Skip to content

Commit

Permalink
Clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
tevincent committed Oct 8, 2024
1 parent d9d1707 commit 8ffdd3a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ class PreviewSliderFragment : Fragment(), FileInfoActionsView.OnItemClickListene

@OptIn(UnstableApi::class)
override fun onPageSelected(position: Int) {
val selectedFragmentId = previewSliderAdapter.getItemId(position)
val selectedFragment = childFragmentManager.findFragmentByTag("f$selectedFragmentId")
val selectedFragment = childFragmentManager.findFragmentByTag("f$previewSliderAdapter.getItemId(position)")

selectedFragment?.trackScreen()

// Implementation of onFragmentUnselected to handle resume of media to the same position
// Implementation of onFragmentUnselected to handle resume of media to the same position, only
// for PreviewVideoFragment.
childFragmentManager.fragments.filter {
it is PreviewVideoFragment && it != selectedFragment
}.forEach { unselectedFragment ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ open class PreviewVideoFragment : PreviewFragment() {
private var mediaPosition = 0L

private val playerListener = object : Player.Listener {

override fun onIsPlayingChanged(isPlaying: Boolean) {
val flagKeepScreenOn = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
if (isPlaying) {
Expand Down

0 comments on commit 8ffdd3a

Please sign in to comment.