-
-
Notifications
You must be signed in to change notification settings - Fork 928
Add photo player presentation delay to settings as user preference #5722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hraabis
wants to merge
9
commits into
jellyfin:master
Choose a base branch
from
hraabis:feature/photo-player-slideshow-speed
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7ccbe16
Add photo player presentation delay to settings as user preference. I…
hraabis d14a9c2
Merge branch 'master' into feature/photo-player-slideshow-speed
hraabis 6cb779a
Add focusKeys to new Photo Player settings.
hraabis 2f6f43a
Update UserPreferences.kt photoPlayerPresentationDelay to use var
hraabis 45e3c09
Fix magic number warning in SettingsPlaybackPhotoPlayerScreen.kt. Add…
hraabis 2ae6e75
Merge branch 'master' into feature/photo-player-slideshow-speed
hraabis 82e2552
Merge branch 'master' into feature/photo-player-slideshow-speed
hraabis 7b64e8e
Add button to Photo Player Controls to open Playback photo player set…
hraabis 81f320f
Fix syntax
hraabis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
80 changes: 80 additions & 0 deletions
80
...a/org/jellyfin/androidtv/ui/settings/screen/playback/SettingsPlaybackPhotoPlayerScreen.kt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| package org.jellyfin.androidtv.ui.settings.screen.playback | ||
|
|
||
| import androidx.compose.foundation.interaction.MutableInteractionSource | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.Row | ||
| import androidx.compose.foundation.layout.Spacer | ||
| import androidx.compose.foundation.layout.height | ||
| import androidx.compose.foundation.layout.sizeIn | ||
| import androidx.compose.foundation.layout.width | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.getValue | ||
| import androidx.compose.runtime.remember | ||
| import androidx.compose.runtime.setValue | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.res.stringResource | ||
| import androidx.compose.ui.unit.dp | ||
| import org.jellyfin.androidtv.R | ||
| import org.jellyfin.androidtv.preference.UserPreferences | ||
| import org.jellyfin.androidtv.ui.base.Text | ||
| import org.jellyfin.androidtv.ui.base.form.RangeControl | ||
| import org.jellyfin.androidtv.ui.base.list.ListControl | ||
| import org.jellyfin.androidtv.ui.base.list.ListSection | ||
| import org.jellyfin.androidtv.ui.navigation.focus.focusKey | ||
| import org.jellyfin.androidtv.ui.settings.compat.rememberPreference | ||
| import org.jellyfin.androidtv.ui.settings.composable.SettingsColumn | ||
| import org.jellyfin.design.Tokens | ||
| import org.koin.compose.koinInject | ||
|
|
||
| @Composable | ||
| fun SettingsPlaybackPhotoPlayerScreen() { | ||
| val userPreferences = koinInject<UserPreferences>() | ||
|
|
||
| SettingsColumn { | ||
| item { | ||
| ListSection( | ||
| overlineContent = { Text(stringResource(R.string.pref_playback).uppercase()) }, | ||
| headingContent = { Text(stringResource(R.string.photo_player)) }, | ||
| ) | ||
| } | ||
|
|
||
| item { | ||
| var photoPlayerPresentationDelay by rememberPreference(userPreferences, UserPreferences.photoPlayerPresentationDelay) | ||
| val interactionSource = remember { MutableInteractionSource() } | ||
|
|
||
| ListControl( | ||
| headingContent = { Text(stringResource(R.string.photo_display_duration)) }, | ||
| captionContent = { Text(stringResource(R.string.photo_display_duration_description)) }, | ||
| interactionSource = interactionSource, | ||
| modifier = Modifier.focusKey("photo_display_duration") | ||
| ) { | ||
| Row( | ||
| verticalAlignment = Alignment.CenterVertically, | ||
| ) { | ||
| RangeControl( | ||
| modifier = Modifier | ||
| .height(4.dp) | ||
| .weight(1f), | ||
| interactionSource = interactionSource, | ||
| // 4 - 120 seconds with 2 second increment | ||
| min = 4_000f, | ||
| max = 120_000f, | ||
| stepForward = 2_000f, | ||
| value = photoPlayerPresentationDelay.toFloat(), | ||
| onValueChange = { photoPlayerPresentationDelay = it.toLong() } | ||
| ) | ||
|
|
||
| Spacer(Modifier.width(Tokens.Space.spaceSm)) | ||
|
|
||
| Box( | ||
| modifier = Modifier.sizeIn(minWidth = 32.dp), | ||
| contentAlignment = Alignment.CenterEnd | ||
| ) { | ||
| Text("${photoPlayerPresentationDelay / 1000}s") | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same implementation of formatting value as seconds is found in SettingsPlaybackAdvancedScreen.kt and SettingsPlaybackNextUpScreen.kt. Should all be updated or this one ignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New timeUtils function to convert millis to seconds added to remove usage of magic number for displaying seconds.