Subtitles reset dialog

This commit is contained in:
KingLucius 2024-07-19 09:21:21 +03:00
parent bac815969a
commit 7dfd726427
3 changed files with 29 additions and 19 deletions

View file

@ -46,6 +46,7 @@ import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
import com.lagradost.cloudstream3.ui.settings.Globals.TV
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
import com.lagradost.cloudstream3.utils.AppContextUtils.isUsingMobileData
import com.lagradost.cloudstream3.utils.AppContextUtils.setDefaultFocus
import com.lagradost.cloudstream3.utils.DataStoreHelper
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showDialog
import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute
@ -59,6 +60,7 @@ import com.lagradost.cloudstream3.utils.UIHelper.toPx
import com.lagradost.cloudstream3.utils.UserPreferenceDelegate
import com.lagradost.cloudstream3.utils.Vector2
import kotlin.math.*
import kotlin.system.exitProcess
const val MINIMUM_SEEK_TIME = 7000L // when swipe seeking
const val MINIMUM_VERTICAL_SWIPE = 2.0f // in percentage
@ -492,10 +494,18 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
player.seekTime(1L)
}
resetBtt.setOnClickListener {
val resetSubsBuilder: AlertDialog.Builder = AlertDialog.Builder(ctx)
resetSubsBuilder.setTitle(R.string.confirm_reset_subs_dialog)
resetSubsBuilder.apply {
setNegativeButton(R.string.no) { _, _ -> }
setPositiveButton(R.string.yes) { _, _ ->
subtitleDelay = 0
dialog.dismissSafe(activity)
player.seekTime(1L)
}
}
resetSubsBuilder.show().setDefaultFocus()
}
cancelBtt.setOnClickListener {
subtitleDelay = beforeOffset
dialog.dismissSafe(activity)

View file

@ -30,28 +30,27 @@
<ImageView
android:id="@+id/subtitle_offset_subtract_more"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:layout_weight="1"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:focusable="true"
android:nextFocusRight="@id/subtitle_offset_subtract"
android:padding="10dp"
android:src="@drawable/ic_baseline_keyboard_arrow_left_24"
app:tint="?attr/white"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/subtitle_offset_subtract"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:layout_weight="1"
android:layout_marginEnd="10dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:focusable="true"
android:nextFocusLeft="@id/subtitle_offset_subtract_more"
android:padding="10dp"
android:src="@drawable/baseline_remove_24"
app:tint="?attr/white"
tools:ignore="ContentDescription" />
@ -67,29 +66,29 @@
<ImageView
android:id="@+id/subtitle_offset_add"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:layout_weight="1"
android:layout_marginStart="10dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:focusable="true"
android:nextFocusRight="@id/subtitle_offset_add_more"
android:padding="10dp"
android:src="@drawable/ic_baseline_add_24"
app:tint="?attr/white"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/subtitle_offset_add_more"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:layout_weight="1"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:focusable="true"
android:nextFocusLeft="@id/subtitle_offset_add"
android:nextFocusDown="@id/apply_btt"
android:padding="10dp"
android:src="@drawable/ic_baseline_keyboard_arrow_right_24"
app:tint="?attr/white"
tools:ignore="ContentDescription" />

View file

@ -677,6 +677,7 @@
<string name="action_mark_as_watched">Mark as watched</string>
<string name="action_remove_from_watched">Remove from watched</string>
<string name="confirm_exit_dialog">Are you sure you want to exit\?</string>
<string name="confirm_reset_subs_dialog">Are you sure you want to reset subtitles delay\?</string>
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="ok">OK</string>