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,6 +95,7 @@ fun TopUI(
"1x", fontWeight = FontWeight.Bold, modifier = Modifier.padding(0.dp) "1x", fontWeight = FontWeight.Bold, modifier = Modifier.padding(0.dp)
) )
} }
AnimatedVisibility(visible = uiState.chapters.isNotEmpty()) {
IconButton( IconButton(
onClick = { viewModel.openStreamSelection(selectChapter = true, embeddedUiConfig) }, onClick = { viewModel.openStreamSelection(selectChapter = true, embeddedUiConfig) },
) { ) {
@ -102,6 +104,8 @@ fun TopUI(
contentDescription = stringResource(R.string.widget_description_chapter_selection) contentDescription = stringResource(R.string.widget_description_chapter_selection)
) )
} }
}
androidx.compose.animation.AnimatedVisibility(visible = 1 < uiState.playList.size) {
IconButton( IconButton(
onClick = { viewModel.openStreamSelection(selectChapter = false, embeddedUiConfig) }, onClick = { viewModel.openStreamSelection(selectChapter = false, embeddedUiConfig) },
) { ) {
@ -110,6 +114,7 @@ fun TopUI(
contentDescription = stringResource(R.string.widget_descriptoin_playlist_item_selection) contentDescription = stringResource(R.string.widget_descriptoin_playlist_item_selection)
) )
} }
}
DropDownMenu() DropDownMenu()
} }
} }