forked from recloudstream/cloudstream
Add 1000ms subtitle offset buttons
This commit is contained in:
parent
31054c604f
commit
e54c951bb6
3 changed files with 110 additions and 65 deletions
|
@ -352,7 +352,9 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
||||||
val cancelButton = dialog.findViewById<TextView>(R.id.cancel_btt)!!
|
val cancelButton = dialog.findViewById<TextView>(R.id.cancel_btt)!!
|
||||||
val input = dialog.findViewById<EditText>(R.id.subtitle_offset_input)!!
|
val input = dialog.findViewById<EditText>(R.id.subtitle_offset_input)!!
|
||||||
val sub = dialog.findViewById<ImageView>(R.id.subtitle_offset_subtract)!!
|
val sub = dialog.findViewById<ImageView>(R.id.subtitle_offset_subtract)!!
|
||||||
|
val subMore = dialog.findViewById<ImageView>(R.id.subtitle_offset_subtract_more)!!
|
||||||
val add = dialog.findViewById<ImageView>(R.id.subtitle_offset_add)!!
|
val add = dialog.findViewById<ImageView>(R.id.subtitle_offset_add)!!
|
||||||
|
val addMore = dialog.findViewById<ImageView>(R.id.subtitle_offset_add_more)!!
|
||||||
val subTitle = dialog.findViewById<TextView>(R.id.subtitle_offset_sub_title)!!
|
val subTitle = dialog.findViewById<TextView>(R.id.subtitle_offset_sub_title)!!
|
||||||
|
|
||||||
input.doOnTextChanged { text, _, _, _ ->
|
input.doOnTextChanged { text, _, _, _ ->
|
||||||
|
@ -381,6 +383,7 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
||||||
input.text = Editable.Factory.getInstance()?.newEditable(beforeOffset.toString())
|
input.text = Editable.Factory.getInstance()?.newEditable(beforeOffset.toString())
|
||||||
|
|
||||||
val buttonChange = 100L
|
val buttonChange = 100L
|
||||||
|
val buttonChangeMore = 1000L
|
||||||
|
|
||||||
fun changeBy(by: Long) {
|
fun changeBy(by: Long) {
|
||||||
val current = (input.text?.toString()?.toLongOrNull() ?: 0) + by
|
val current = (input.text?.toString()?.toLongOrNull() ?: 0) + by
|
||||||
|
@ -390,10 +393,15 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
||||||
add.setOnClickListener {
|
add.setOnClickListener {
|
||||||
changeBy(buttonChange)
|
changeBy(buttonChange)
|
||||||
}
|
}
|
||||||
|
addMore.setOnClickListener {
|
||||||
|
changeBy(buttonChangeMore)
|
||||||
|
}
|
||||||
sub.setOnClickListener {
|
sub.setOnClickListener {
|
||||||
changeBy(-buttonChange)
|
changeBy(-buttonChange)
|
||||||
}
|
}
|
||||||
|
subMore.setOnClickListener {
|
||||||
|
changeBy(-buttonChangeMore)
|
||||||
|
}
|
||||||
|
|
||||||
dialog.setOnDismissListener {
|
dialog.setOnDismissListener {
|
||||||
if (isFullScreenPlayer)
|
if (isFullScreenPlayer)
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<vector android:autoMirrored="true" android:height="24dp"
|
||||||
|
android:tint="?attr/white" android:viewportHeight="24"
|
||||||
|
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M15.41,16.59L10.83,12l4.58,-4.59L14,6l-6,6 6,6 1.41,-1.41z"/>
|
||||||
|
</vector>
|
|
@ -1,86 +1,118 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="300dp"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_height="match_parent"
|
android:layout_width="300dp"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/WatchHeaderText"
|
style="@style/WatchHeaderText"
|
||||||
android:layout_margin="0dp"
|
android:layout_width="wrap_content"
|
||||||
android:paddingTop="10dp"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/subtitle_offset_title"
|
android:layout_gravity="center"
|
||||||
android:layout_gravity="center"
|
android:layout_margin="0dp"
|
||||||
android:layout_width="wrap_content"
|
android:paddingTop="10dp"
|
||||||
android:layout_height="wrap_content" />
|
android:text="@string/subtitle_offset_title" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/subtitle_offset_sub_title"
|
android:id="@+id/subtitle_offset_sub_title"
|
||||||
android:layout_gravity="center"
|
android:layout_width="wrap_content"
|
||||||
tools:text="@string/subtitle_offset_extra_hint_none_format"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="?attr/grayTextColor"
|
android:layout_gravity="center"
|
||||||
android:layout_width="wrap_content"
|
android:textColor="?attr/grayTextColor"
|
||||||
android:layout_height="wrap_content" />
|
tools:text="@string/subtitle_offset_extra_hint_none_format" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="horizontal"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/subtitle_offset_subtract"
|
android:id="@+id/subtitle_offset_subtract_more"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:layout_width="wrap_content"
|
||||||
android:padding="10dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_gravity="center"
|
||||||
android:layout_gravity="center"
|
android:layout_weight="1"
|
||||||
android:src="@drawable/baseline_remove_24"
|
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||||
android:layout_width="wrap_content"
|
android:nextFocusRight="@id/subtitle_offset_subtract"
|
||||||
android:layout_height="match_parent"
|
android:padding="10dp"
|
||||||
app:tint="?attr/white"
|
android:src="@drawable/ic_baseline_keyboard_arrow_left_24"
|
||||||
tools:ignore="ContentDescription" />
|
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_gravity="center"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||||
|
android:nextFocusLeft="@id/subtitle_offset_subtract_more"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:src="@drawable/baseline_remove_24"
|
||||||
|
app:tint="?attr/white"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:layout_weight="20"
|
android:id="@+id/subtitle_offset_input"
|
||||||
android:id="@+id/subtitle_offset_input"
|
android:layout_width="0dp"
|
||||||
android:inputType="numberSigned"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="0dp"
|
android:layout_weight="20"
|
||||||
android:layout_height="wrap_content"
|
android:hint="@string/subtitle_offset_hint"
|
||||||
android:hint="@string/subtitle_offset_hint"
|
android:inputType="numberSigned"
|
||||||
tools:ignore="LabelFor" />
|
tools:ignore="LabelFor" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/subtitle_offset_add"
|
android:id="@+id/subtitle_offset_add"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:layout_width="wrap_content"
|
||||||
android:padding="10dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_gravity="center"
|
||||||
android:layout_gravity="center"
|
android:layout_weight="1"
|
||||||
android:src="@drawable/ic_baseline_add_24"
|
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||||
android:layout_width="wrap_content"
|
android:nextFocusRight="@id/subtitle_offset_add_more"
|
||||||
android:layout_height="match_parent"
|
android:padding="10dp"
|
||||||
app:tint="?attr/white"
|
android:src="@drawable/ic_baseline_add_24"
|
||||||
tools:ignore="ContentDescription" />
|
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_gravity="center"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||||
|
android:nextFocusLeft="@id/subtitle_offset_add"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:src="@drawable/ic_baseline_keyboard_arrow_right_24"
|
||||||
|
app:tint="?attr/white"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="horizontal"
|
android:layout_width="match_parent"
|
||||||
android:layout_gravity="bottom"
|
android:layout_height="60dp"
|
||||||
android:gravity="bottom|end"
|
android:layout_gravity="bottom"
|
||||||
android:layout_width="match_parent"
|
android:gravity="bottom|end"
|
||||||
android:layout_height="60dp">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
style="@style/WhiteButton"
|
android:id="@+id/apply_btt"
|
||||||
android:layout_gravity="center_vertical|end"
|
style="@style/WhiteButton"
|
||||||
android:visibility="visible"
|
android:layout_width="wrap_content"
|
||||||
android:text="@string/sort_apply"
|
android:layout_gravity="center_vertical|end"
|
||||||
android:id="@+id/apply_btt"
|
android:text="@string/sort_apply"
|
||||||
android:layout_width="wrap_content">
|
android:visibility="visible">
|
||||||
|
|
||||||
<requestFocus />
|
<requestFocus />
|
||||||
</com.google.android.material.button.MaterialButton>
|
</com.google.android.material.button.MaterialButton>
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
style="@style/BlackButton"
|
android:id="@+id/cancel_btt"
|
||||||
android:layout_gravity="center_vertical|end"
|
style="@style/BlackButton"
|
||||||
android:text="@string/sort_cancel"
|
android:layout_width="wrap_content"
|
||||||
android:id="@+id/cancel_btt"
|
android:layout_gravity="center_vertical|end"
|
||||||
android:layout_width="wrap_content" />
|
android:text="@string/sort_cancel" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
Loading…
Reference in a new issue