Skip to content

Commit

Permalink
Add system time display when video is paused
Browse files Browse the repository at this point in the history
Fixes #1401

Add current time display when video is paused.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/recloudstream/cloudstream/issues/1401?shareId=XXXX-XXXX-XXXX-XXXX).
  • Loading branch information
Laiirton committed Nov 3, 2024
1 parent 08b4802 commit 4649413
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import android.view.WindowManager
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.ProgressBar
import android.widget.TextView
import android.widget.Toast
import androidx.annotation.LayoutRes
import androidx.annotation.StringRes
Expand Down Expand Up @@ -89,6 +90,7 @@ abstract class AbstractPlayerFragment(
var playerView: PlayerView? = null
var piphide: FrameLayout? = null
var subtitleHolder: FrameLayout? = null
var currentTimeTextView: TextView? = null // P7d6f

@LayoutRes
protected open var layout: Int = R.layout.fragment_player
Expand Down Expand Up @@ -191,6 +193,15 @@ abstract class AbstractPlayerFragment(
}
}

if (isPausedRightNow) {
val currentTime = System.currentTimeMillis()
val formattedTime = java.text.SimpleDateFormat("HH:mm", java.util.Locale.getDefault()).format(currentTime)
currentTimeTextView?.text = formattedTime
currentTimeTextView?.isVisible = true
} else {
currentTimeTextView?.isVisible = false
}

canEnterPipMode = isPlayingRightNow && hasPipModeSupport
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
activity?.let { act ->
Expand Down Expand Up @@ -662,6 +673,7 @@ abstract class AbstractPlayerFragment(
playerView = root.findViewById(R.id.player_view)
piphide = root.findViewById(R.id.piphide)
subtitleHolder = root.findViewById(R.id.subtitle_holder)
currentTimeTextView = root.findViewById(R.id.current_time_text_view) // P72d6
return root
}
}
}

0 comments on commit 4649413

Please sign in to comment.