This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun <T: Comparable<T>> SlideInOutLayout( | |
targetState: T, | |
modifier: Modifier = Modifier, | |
animationSpec: FiniteAnimationSpec<Float> = tween(), | |
content: @Composable (T) -> Unit | |
) { | |
val items = remember { mutableStateListOf<CrossSlideAnimationItem<T>>() } | |
val transitionState = remember { MutableTransitionState(targetState) } | |
val targetChanged = (targetState != transitionState.targetState) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun VideoPlayer() { | |
// This is the official way to access current context from Composable functions | |
val context = ContextAmbient.current | |
// Do not recreate the player everytime this Composable commits | |
val exoPlayer = remember { | |
SimpleExoPlayer.Builder(context).build().apply { | |
val dataSourceFactory: DataSource.Factory = DefaultDataSourceFactory(context, | |
Util.getUserAgent(context, context.packageName)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun VideoPlayer(sourceUrl: String) { | |
// This is the official way to access current context from Composable functions | |
val context = LocalContext.current | |
// Do not recreate the player everytime this Composable commits | |
val exoPlayer = remember { | |
SimpleExoPlayer.Builder(context).build() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun VideoPlayer() { | |
// This is the official way to access current context from Composable functions | |
val context = LocalContext.current | |
// Do not recreate the player everytime this Composable commits | |
val exoPlayer = remember(context) { | |
SimpleExoPlayer.Builder(context).build().apply { | |
val dataSourceFactory: DataSource.Factory = DefaultDataSourceFactory(context, | |
Util.getUserAgent(context, context.packageName)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This interface marks the class for use of `Rizalt` library. | |
*/ | |
interface Rizalt<P: Parcelable> | |
/** | |
* Creates a unique request key for given Fragment class. Key can be left empty | |
* to create a default instance. | |
*/ | |
fun <T, P: Parcelable> KClass<T>.getRequestKeyNameFor(key: String): String where T: Fragment, T: Rizalt<P> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> Task :app:compileDebugKotlin FAILED | |
w: ATTENTION! | |
This build uses unsafe internal compiler arguments: | |
-XXLanguage:+NonParenthesizedAnnotationsOnFunctionalTypes | |
This mode is not recommended for production use, | |
as no stability/compatibility guarantees are given on | |
compiler or generated code. Use it at your own risk! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val _isPlaying = MutableStateFlow(true) | |
val isPlaying: StateFlow<Boolean> = _isPlaying | |
private val _playbackState = MutableStateFlow(ExoPlayer.STATE_IDLE) | |
val playbackState: StateFlow<Int> = _playbackState | |
private val exoPlayer by lazy { | |
SimpleExoPlayer.Builder(context).build().apply { | |
addListener(object: Player.EventListener { | |
override fun onPlayerStateChanged(playWhenReady: Boolean, playbackState: Int) { |