diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 07e82ee9..80f6fd73 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -163,10 +163,10 @@ dependencies {
// Android Core & Lifecycle
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.appcompat:appcompat:1.6.1")
- implementation("androidx.navigation:navigation-ui-ktx:2.7.5")
- implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.6.2")
- implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2")
- implementation("androidx.navigation:navigation-fragment-ktx:2.7.5")
+ implementation("androidx.navigation:navigation-ui-ktx:2.7.6")
+ implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.7.0")
+ implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0")
+ implementation("androidx.navigation:navigation-fragment-ktx:2.7.6")
// Design & UI
implementation("jp.wasabeef:glide-transformations:4.3.0")
@@ -228,8 +228,8 @@ dependencies {
Level 25 or Less. */
// Downloading & Networking
- implementation("androidx.work:work-runtime:2.8.1")
- implementation("androidx.work:work-runtime-ktx:2.8.1")
+ implementation("androidx.work:work-runtime:2.9.0")
+ implementation("androidx.work:work-runtime-ktx:2.9.0")
implementation("com.github.Blatzar:NiceHttp:0.4.5") // HTTP Lib
}
diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt
index 5a490ca0..e8d74752 100644
--- a/app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt
+++ b/app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt
@@ -7,14 +7,13 @@ import android.content.Context
import android.content.pm.ActivityInfo
import android.content.res.ColorStateList
import android.content.res.Configuration
-import android.content.res.Resources
import android.graphics.Color
import android.media.AudioManager
import android.os.Build
import android.os.Bundle
import android.provider.Settings
import android.text.Editable
-import android.util.DisplayMetrics
+import android.text.format.DateUtils
import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.MotionEvent
@@ -31,11 +30,10 @@ import androidx.core.graphics.blue
import androidx.core.graphics.green
import androidx.core.graphics.red
import androidx.core.view.isGone
+import androidx.core.view.isInvisible
import androidx.core.view.isVisible
import androidx.core.widget.doOnTextChanged
import androidx.preference.PreferenceManager
-import com.lagradost.cloudstream3.AcraApplication.Companion.getKey
-import com.lagradost.cloudstream3.AcraApplication.Companion.setKey
import com.lagradost.cloudstream3.CommonActivity.keyEventListener
import com.lagradost.cloudstream3.CommonActivity.playerEventListener
import com.lagradost.cloudstream3.CommonActivity.screenHeight
@@ -48,6 +46,7 @@ import com.lagradost.cloudstream3.ui.player.GeneratorPlayer.Companion.subsProvid
import com.lagradost.cloudstream3.ui.player.source_priority.QualityDataHelper
import com.lagradost.cloudstream3.ui.result.setText
import com.lagradost.cloudstream3.ui.result.txt
+import com.lagradost.cloudstream3.ui.settings.SettingsFragment
import com.lagradost.cloudstream3.utils.AppUtils.isUsingMobileData
import com.lagradost.cloudstream3.utils.DataStoreHelper
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showDialog
@@ -59,10 +58,10 @@ import com.lagradost.cloudstream3.utils.UIHelper.hideSystemUI
import com.lagradost.cloudstream3.utils.UIHelper.popCurrentPage
import com.lagradost.cloudstream3.utils.UIHelper.showSystemUI
import com.lagradost.cloudstream3.utils.UIHelper.toPx
+import com.lagradost.cloudstream3.utils.UserPreferenceDelegate
import com.lagradost.cloudstream3.utils.Vector2
import kotlin.math.*
-
const val MINIMUM_SEEK_TIME = 7000L // when swipe seeking
const val MINIMUM_VERTICAL_SWIPE = 2.0f // in percentage
const val MINIMUM_HORIZONTAL_SWIPE = 2.0f // in percentage
@@ -79,10 +78,9 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
protected open var lockRotation = true
protected open var isFullScreenPlayer = true
protected open var isTv = false
-
protected var playerBinding: PlayerCustomLayoutBinding? = null
-
+ private var durationMode : Boolean by UserPreferenceDelegate("duration_mode", false)
// state of player UI
protected var isShowing = false
protected var isLocked = false
@@ -1332,15 +1330,6 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
} else false
}
- //player_episodes_button?.setOnClickListener {
- // player_episodes_button?.isGone = true
- // player_episode_list?.isVisible = true
- //}
-//
- //player_episode_list?.adapter = PlayerEpisodeAdapter { click ->
-//
- //}
-
try {
context?.let { ctx ->
val settingsManager = PreferenceManager.getDefaultSharedPreferences(ctx)
@@ -1425,12 +1414,21 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
} catch (e: Exception) {
logError(e)
}
+
playerBinding?.apply {
playerPausePlay.setOnClickListener {
autoHide()
player.handleEvent(CSPlayerEvent.PlayPauseToggle)
}
+ exoDuration.setOnClickListener {
+ setRemainingTimeCounter(true)
+ }
+
+ timeLeft.setOnClickListener {
+ setRemainingTimeCounter(false)
+ }
+
skipChapterButton.setOnClickListener {
player.handleEvent(CSPlayerEvent.SkipCurrentChapter)
}
@@ -1515,32 +1513,14 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
return@setOnTouchListener false
}
}
+ // cs3 is peak media center
+ setRemainingTimeCounter(durationMode || SettingsFragment.isTrueTvSettings())
+ playerBinding?.exoPosition?.doOnTextChanged { _, _, _, _ ->
+ updateRemainingTime()
+ }
// init UI
try {
uiReset()
-
- // init chromecast UI
- // removed due to having no use and bugging
- //activity?.let {
- // if (it.isCastApiAvailable()) {
- // try {
- // CastButtonFactory.setUpMediaRouteButton(it, player_media_route_button)
- // val castContext = CastContext.getSharedInstance(it.applicationContext)
- //
- // player_media_route_button?.isGone =
- // castContext.castState == CastState.NO_DEVICES_AVAILABLE
- // castContext.addCastStateListener { state ->
- // player_media_route_button?.isGone =
- // state == CastState.NO_DEVICES_AVAILABLE
- // }
- // } catch (e: Exception) {
- // logError(e)
- // }
- // } else {
- // // if cast is not possible hide UI
- // player_media_route_button?.isGone = true
- // }
- //}
} catch (e: Exception) {
logError(e)
}
@@ -1558,6 +1538,24 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
updateOrientation()
}
+ private fun updateRemainingTime() {
+ val duration = player.getDuration()
+ val position = player.getPosition()
+
+ if (duration != null && duration > 1 && position != null) {
+ val remainingTimeSeconds = (duration - position + 500) / 1000
+ val formattedTime = "-${DateUtils.formatElapsedTime(remainingTimeSeconds)}"
+
+ playerBinding?.timeLeft?.text = formattedTime
+ }
+ }
+
+ private fun setRemainingTimeCounter(showRemaining: Boolean) {
+ durationMode = showRemaining
+ playerBinding?.exoDuration?.isInvisible= showRemaining
+ playerBinding?.timeLeft?.isVisible = showRemaining
+ }
+
private fun dynamicOrientation(): Int {
return if (autoPlayerRotateEnabled) {
if (isVerticalOrientation) {
diff --git a/app/src/main/res/layout/player_custom_layout.xml b/app/src/main/res/layout/player_custom_layout.xml
index 0d73246b..83be8832 100644
--- a/app/src/main/res/layout/player_custom_layout.xml
+++ b/app/src/main/res/layout/player_custom_layout.xml
@@ -518,6 +518,26 @@
app:layout_constraintBaseline_toBaselineOf="@id/exo_position"
app:layout_constraintEnd_toEndOf="parent"
tools:text="23:20" />
+
+
+
+
+
diff --git a/app/src/main/res/layout/trailer_custom_layout.xml b/app/src/main/res/layout/trailer_custom_layout.xml
index 69fbbbd2..59104ca7 100644
--- a/app/src/main/res/layout/trailer_custom_layout.xml
+++ b/app/src/main/res/layout/trailer_custom_layout.xml
@@ -506,6 +506,25 @@
app:layout_constraintEnd_toEndOf="@id/player_fullscreen"
tools:text="23:20" />
+
+