show chapter and streams ui element only when they are usefull

This commit is contained in:
Christian Schabesberger 2024-09-04 11:03:24 +02:00
parent 45043f1739
commit 38ea5560b6
1 changed files with 19 additions and 14 deletions

View File

@ -21,6 +21,7 @@
package net.newpipe.newplayer.ui.videoplayer package net.newpipe.newplayer.ui.videoplayer
import android.app.Activity import android.app.Activity
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.PaddingValues
@ -94,21 +95,25 @@ fun TopUI(
"1x", fontWeight = FontWeight.Bold, modifier = Modifier.padding(0.dp) "1x", fontWeight = FontWeight.Bold, modifier = Modifier.padding(0.dp)
) )
} }
IconButton( AnimatedVisibility(visible = uiState.chapters.isNotEmpty()) {
onClick = { viewModel.openStreamSelection(selectChapter = true, embeddedUiConfig) }, IconButton(
) { onClick = { viewModel.openStreamSelection(selectChapter = true, embeddedUiConfig) },
Icon( ) {
imageVector = Icons.AutoMirrored.Filled.MenuBook, Icon(
contentDescription = stringResource(R.string.widget_description_chapter_selection) imageVector = Icons.AutoMirrored.Filled.MenuBook,
) contentDescription = stringResource(R.string.widget_description_chapter_selection)
)
}
} }
IconButton( androidx.compose.animation.AnimatedVisibility(visible = 1 < uiState.playList.size) {
onClick = { viewModel.openStreamSelection(selectChapter = false, embeddedUiConfig) }, IconButton(
) { onClick = { viewModel.openStreamSelection(selectChapter = false, embeddedUiConfig) },
Icon( ) {
imageVector = Icons.AutoMirrored.Filled.List, Icon(
contentDescription = stringResource(R.string.widget_descriptoin_playlist_item_selection) imageVector = Icons.AutoMirrored.Filled.List,
) contentDescription = stringResource(R.string.widget_descriptoin_playlist_item_selection)
)
}
} }
DropDownMenu() DropDownMenu()
} }