This file contains hidden or 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
class PackageTableModel( | |
private val packages: MutableList<String> | |
) : AbstractTableModel() { | |
override fun getRowCount(): Int { | |
return packages.size | |
} | |
override fun getColumnCount(): Int { | |
return 1 //only 1 column | |
} |
This file contains hidden or 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 | |
private fun VideoPlayer(modifier: Modifier = Modifier) { | |
val context = LocalContext.current | |
val exoPlayer = remember { | |
ExoPlayer.Builder(context) | |
.apply { | |
setSeekBackIncrementMs(PLAYER_SEEK_BACK_INCREMENT) | |
setSeekForwardIncrementMs(PLAYER_SEEK_FORWARD_INCREMENT) |
This file contains hidden or 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
var totalDuration by remember { mutableStateOf(0L) } | |
var currentTime by remember { mutableStateOf(0L) } | |
var bufferedPercentage by remember { mutableStateOf(0) } | |
Box(modifier = Modifier) { | |
DisposableEffect(key1 = Unit) { | |
val listener = | |
object : Player.Listener { |
This file contains hidden or 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 PlayerControls( | |
modifier: Modifier = Modifier, | |
isVisible: () -> Boolean, | |
/* other params */ | |
) { | |
val visible = remember(isVisible()) { isVisible() } | |
AnimatedVisibility( |
This file contains hidden or 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 BottomControls( | |
modifier: Modifier = Modifier, | |
totalDuration: () -> Long, | |
currentTime: () -> Long, | |
bufferPercentage: () -> Int, | |
onSeekChanged: (timeMs: Float) -> Unit | |
) { | |
val duration = remember(totalDuration()) { totalDuration() } |
This file contains hidden or 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 BottomControls(modifier: Modifier = Modifier) { | |
Column(modifier = modifier.padding(bottom = 32.dp)) { | |
// seek bar | |
Slider( | |
modifier = Modifier.fillMaxWidth(), | |
value = 1f, | |
onValueChange = { value: Float -> }, | |
valueRange = 0f..1f, |
This file contains hidden or 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 CenterControls( | |
modifier: Modifier = Modifier, | |
isPlaying: () -> Boolean, | |
onReplayClick: () -> Unit, | |
onPauseToggle: () -> Unit, | |
onForwardClick: () -> Unit | |
) { | |
val isVideoPlaying = remember(isPlaying()) { isPlaying() } |
This file contains hidden or 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 PlayerControls(modifier: Modifier = Modifier) { | |
//black overlay across the video player | |
Box(modifier = modifier.background(Color.Black.copy(alpha = 0.6f))) { | |
Row( | |
modifier = Modifier.align(Alignment.Center).fillMaxWidth(), | |
horizontalArrangement = Arrangement.SpaceEvenly | |
) { | |
//replay button | |
IconButton(modifier = Modifier.size(40.dp), onClick = {}) { |
This file contains hidden or 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(modifier: Modifier = Modifier) { | |
val context = LocalContext.current | |
val exoPlayer = remember { | |
ExoPlayer.Builder(context).build().apply { | |
setMediaItem( | |
MediaItem.fromUri( | |
"https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4" |
This file contains hidden or 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
// Update notifications | |
EditorNotifications.getInstance(project).updateAllNotifications() | |
// Restart the analysis | |
PsiManager.getInstance(project).apply { | |
dropPsiCaches() | |
dropResolveCaches() | |
} | |
DaemonCodeAnalyzer.getInstance(project).restart() |
NewerOlder