Skip to content

Commit

Permalink
Update KDoc for pillarbox-cast
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 committed Oct 29, 2024
1 parent c87ef7b commit c33327e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ import com.google.android.gms.cast.framework.CastContext
import com.google.common.util.concurrent.MoreExecutors

/**
* Get the shared instance of [CastContext] if available, or initialize a new one.
* Call this method inside your [Activity][android.app.Activity] or [Application][android.app.Application].
* The sooner, the better.
* Retrieves the shared instance of [CastContext].
*
* This function attempts to retrieve the existing shared instance of [CastContext]. If it doesn't exist, it initializes a new instance and returns
* it.
*
* Call this method inside your [Activity][android.app.Activity] or [Application][android.app.Application] for early initialization. The earlier this
* is called, the better the user experience.
*
* @return The shared instance of [CastContext].
*/
fun Context.getCastContext(): CastContext {
return CastContext.getSharedInstance() ?: CastContext.getSharedInstance(this, MoreExecutors.directExecutor()).result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/
package ch.srgssr.pillarbox.cast.widget

import android.app.Activity
import android.app.Application
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.viewinterop.AndroidView
Expand All @@ -12,7 +14,13 @@ import com.google.android.gms.cast.framework.CastButtonFactory
import com.google.android.gms.cast.framework.CastContext

/**
* Make sure to instantiate a [CastContext] before using it.
* A composable function that displays a Cast button. This button allows users to discover and connect to Cast-enabled devices.
*
* You must instantiate a [CastContext] before using this composable. This is typically done in your [Activity] or [Application] class.
*
* @param modifier The [Modifier] to be applied to the Cast button.
*
* @see [Context.getCastContext()][ch.srgssr.pillarbox.cast.getCastContext]
*/
@Composable
fun CastButton(
Expand Down

0 comments on commit c33327e

Please sign in to comment.