Configurable reader tap actions

This commit is contained in:
Koitharu
2024-01-27 18:06:40 +02:00
parent 72187e7da0
commit 6f7f3dc5e2
17 changed files with 615 additions and 218 deletions

View File

@@ -0,0 +1,191 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.appbar.MaterialToolbar
android:id="@id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_top"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.33" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_bottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.67" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.33" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.67" />
<TextView
android:id="@+id/textView_top_left"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="?selectableItemBackground"
android:gravity="center"
app:layout_constraintBottom_toTopOf="@id/guideline_top"
app:layout_constraintEnd_toStartOf="@id/guideline_left"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView_top_center"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="?selectableItemBackground"
android:gravity="center"
app:layout_constraintBottom_toTopOf="@id/guideline_top"
app:layout_constraintEnd_toStartOf="@id/guideline_right"
app:layout_constraintStart_toEndOf="@id/guideline_left"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView_top_right"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="?selectableItemBackground"
android:gravity="center"
app:layout_constraintBottom_toTopOf="@id/guideline_top"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/guideline_right"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView_center_left"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="?selectableItemBackground"
android:gravity="center"
app:layout_constraintBottom_toTopOf="@id/textView_bottom_left"
app:layout_constraintEnd_toStartOf="@id/guideline_left"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textView_top_left" />
<TextView
android:id="@+id/textView_center"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="?selectableItemBackground"
android:gravity="center"
app:layout_constraintBottom_toTopOf="@id/textView_bottom_center"
app:layout_constraintEnd_toStartOf="@id/guideline_right"
app:layout_constraintStart_toEndOf="@id/guideline_left"
app:layout_constraintTop_toBottomOf="@id/textView_top_center" />
<TextView
android:id="@+id/textView_center_right"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="?selectableItemBackground"
android:gravity="center"
app:layout_constraintBottom_toTopOf="@id/textView_bottom_right"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/guideline_right"
app:layout_constraintTop_toBottomOf="@id/textView_top_right" />
<TextView
android:id="@+id/textView_bottom_left"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="?selectableItemBackground"
android:gravity="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/guideline_left"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/guideline_bottom" />
<TextView
android:id="@+id/textView_bottom_center"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="?selectableItemBackground"
android:gravity="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/guideline_right"
app:layout_constraintStart_toEndOf="@id/guideline_left"
app:layout_constraintTop_toBottomOf="@id/guideline_bottom" />
<TextView
android:id="@+id/textView_bottom_right"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="?selectableItemBackground"
android:gravity="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/guideline_right"
app:layout_constraintTop_toBottomOf="@id/guideline_bottom" />
<View
android:layout_width="1dp"
android:layout_height="0dp"
android:background="?android:divider"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/guideline_right"
app:layout_constraintStart_toStartOf="@id/guideline_right"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="1dp"
android:layout_height="0dp"
android:background="?android:divider"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/guideline_left"
app:layout_constraintStart_toStartOf="@id/guideline_left"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:background="?android:divider"
app:layout_constraintBottom_toBottomOf="@id/guideline_top"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/guideline_top" />
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:background="?android:divider"
app:layout_constraintBottom_toBottomOf="@id/guideline_bottom"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/guideline_bottom" />
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:background="?android:divider"
app:layout_constraintBottom_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>

View File

@@ -5,10 +5,6 @@
<item>@string/light</item>
<item>@string/dark</item>
</string-array>
<string-array name="reader_switchers" translatable="false">
<item>@string/taps_on_edges</item>
<item>@string/volume_buttons</item>
</string-array>
<string-array name="zoom_modes" translatable="false">
<item>@string/zoom_mode_fit_center</item>
<item>@string/zoom_mode_fit_height</item>
@@ -43,6 +39,7 @@
<string-array name="reader_modes" translatable="false">
<item>@string/standard</item>
<item>@string/right_to_left</item>
<item>@string/vertical</item>
<item>@string/webtoon</item>
</string-array>
<string-array name="scrobbling_statuses" translatable="false">

View File

@@ -21,13 +21,6 @@
<item>1</item>
<item>2</item>
</string-array>
<string-array name="values_reader_switchers" translatable="false">
<item>taps</item>
<item>volume</item>
</string-array>
<string-array name="values_reader_switchers_default" translatable="false">
<item>taps</item>
</string-array>
<string-array name="values_track_sources" translatable="false">
<item>favourites</item>
<item>history</item>

View File

@@ -568,4 +568,17 @@
<string name="vertical">Vertical</string>
<string name="last_read">Last read</string>
<string name="two_pages">Two pages</string>
<string name="show_menu">Show menu</string>
<string name="toggle_ui">Show/hide UI</string>
<string name="prev_chapter">Previous chapter</string>
<string name="next_chapter">Next chapter</string>
<string name="prev_page">Previous page</string>
<string name="next_page">Next page</string>
<string name="reader_actions">Reader actions</string>
<string name="reader_actions_summary">Configure actions for tappable screen areas</string>
<string name="switch_pages_volume_buttons">Enable volume buttons</string>
<string name="switch_pages_volume_buttons_summary">Use volume buttons for switching pages</string>
<string name="tap_action">Tap action</string>
<string name="long_tap_action">Long tap action</string>
<string name="none">None</string>
</resources>

View File

@@ -34,19 +34,18 @@
android:summary="@string/reader_zoom_buttons_summary"
android:title="@string/reader_zoom_buttons" />
<MultiSelectListPreference
android:defaultValue="@array/values_reader_switchers_default"
android:entries="@array/reader_switchers"
android:entryValues="@array/values_reader_switchers"
android:key="reader_switchers"
android:title="@string/switch_pages"
<Preference
android:key="reader_tap_actions"
android:persistent="false"
android:summary="@string/reader_actions_summary"
android:title="@string/reader_actions"
app:allowDividerAbove="true" />
<SwitchPreferenceCompat
android:defaultValue="false"
android:key="reader_taps_ltr"
android:summary="@string/reader_control_ltr_summary"
android:title="@string/reader_control_ltr" />
android:key="reader_volume_buttons"
android:summary="@string/switch_pages_volume_buttons_summary"
android:title="@string/switch_pages_volume_buttons" />
<ListPreference
android:entries="@array/reader_animation"
@@ -58,7 +57,8 @@
android:defaultValue="false"
android:key="enhanced_colors"
android:summary="@string/enhanced_colors_summary"
android:title="@string/enhanced_colors" />
android:title="@string/enhanced_colors"
app:allowDividerAbove="true" />
<SwitchPreferenceCompat
android:defaultValue="false"