-
-
Notifications
You must be signed in to change notification settings - Fork 177
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
feat: sleep mode #518
base: main
Are you sure you want to change the base?
feat: sleep mode #518
Conversation
|
||
private fun disableSleepMode() { | ||
binding.playerView.player?.playWhenReady = true | ||
window.addFlags (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) |
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.
Lint issue here, just remove the space after addFlag
.
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.
Thank you!
"Sleep Mode will be enabled in $hours $hourText and $minutes $minuteText" | ||
hours > 0 -> | ||
"Sleep Mode will be enabled in $hours $hourText" | ||
else -> | ||
"Sleep Mode will be enabled in $minutes $minuteText" |
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.
Moving this to a string resource will be better for Translations.
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.
Moving this to a string resource will be better for Translations.
I think I moved everything to a string resource, but I had to use @SuppressLint("StringFormatMatches") for that function because I couldn't figure out what the thing wanted from me. It works fine tho.
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.
@AstroTheAstronaut StringFormatMatches
lint is probably because you used %1$s
while you are passing a number value which expects %1$d
in some places like hours
, minutes
, etc.
Added sleep mode. Requires a lot of testing. Probably a lot of bugs. Works most of the time, though
Co-authored-by: Yash Garg <[email protected]>
c87403c
to
5b2a869
Compare
Poking this feature, hope this can get in soon. Looking forward to it! |
I realize that this PR has been open for over a year, but for now some reason I I was just thinking about it. I wouldn't like to propose/request that this feature (and the UI elements for it) be named "Sleep Timer" (instead of Sleep Mode). In my experience, that is usually what this type of feature is called on TVs and related apps. |
This PR adds a Sleep Mode to Findroid. (Fixes a request on Discord)
At the moment, if the user falls asleep while watching a show, the screen will remain on for the remainder of the show/movie, maybe even more, depending if it's a show or a movie (if it is a show, the rest of the episodes in the series will play). This isn't ideal as it consumes battery needlessly.
This PR implements a timer that, when it's finished, shows a new screen that explains that Sleep Mode has been enabled and that the screen will turn off on its own to prevent unnecessary battery consumption.
This feature can be disabled in the app's settings if people don't want to have this option (Not sure if this should be removed)
Screenshots:
Setting in the Player section
Button next to the lock button to show the Sleep Mode button
Sleep Mode timer dialog
Sleep Mode screen with unlock button
To do:
UPDATE: Tested it with MPV and it works just fine also.