Skip to content
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(ui): tap video duration to toggle remaining time counter #878

Merged
merged 13 commits into from
Jan 21, 2024

Conversation

IndusAryan
Copy link
Contributor

@IndusAryan IndusAryan commented Jan 13, 2024

@fire-light42 shifted to views

@IndusAryan IndusAryan marked this pull request as draft January 15, 2024 18:41
@fire-light42
Copy link
Collaborator

Why is this draft? do you want a review?

@IndusAryan
Copy link
Contributor Author

@fire-light42 i thought you will ask some minor changes, anyway it can be merged, undrafting it now

@IndusAryan IndusAryan marked this pull request as ready for review January 16, 2024 18:25
@fire-light42
Copy link
Collaborator

The code looked fine, HOWEVER when testing it I found that it was unsynced af making it feel shitty and it does not save the setting between runs.

The first issue can be solved by binding the update to the text change of the position set by exo, this also removes the need to a looper

exoPosition.doOnTextChanged { _, _, _, _ ->
    updateRemainingTime()
}

and dont forget

val remainingTimeSeconds = (duration - position + 500) / 1000 // this is due to rounding

The second issue can be solved with a PreferenceDelegate
eg var resizeMode : Int by UserPreferenceDelegate("resize_mode", 0) with a bool instead

Copy link
Collaborator

@fire-light42 fire-light42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

@IndusAryan
Copy link
Contributor Author

IndusAryan commented Jan 20, 2024

so i made and tested these desired changes , now it is going with sync properly and i also replaced the comment // cs is ott itself to cs3 is media center itself so that it dont provoke any unwanted heat or issue.
Thanks for telling about preference delegates, i had no idea about them or their existence, now the remaining time counter is default in all video if user clicks it .

can you tell me about this method, what does _ _ _ do, do they ignore parameters that are not present.

playerBinding?.exoPosition?.doOnTextChanged { _, _, _, _ ->
            updateRemainingTime()
        }```
        

@IndusAryan
Copy link
Contributor Author

IndusAryan commented Jan 20, 2024

because i experimented first with, and turned update function to
char sequence , int , int -> unit ...... return updatingtime // this was flagged as recursive call by ide

playerBinding?.exoPosition?.doOnTextChanged (
            updateRemainingTime())

but it crashed

} catch (e: Exception) {
logError(e)
}

if (SettingsFragment.isTrueTvSettings()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setRemainingTimeWatcher(SettingsFragment.isTrueTvSettings() || durationMode)

}

timeLeft.setOnClickListener {
stopUpdatingRemainingTime()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setRemainingTimeWatcher(false)

@fire-light42 fire-light42 merged commit 3dcf707 into recloudstream:master Jan 21, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants