mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 00:01:54 +01:00
Make page transitions setting apply to webtoon viewer as well
This commit is contained in:
parent
1920568057
commit
b363b9fc1a
@ -92,6 +92,7 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia
|
|||||||
long_tap.bindToPreference(preferences.readWithLongTap())
|
long_tap.bindToPreference(preferences.readWithLongTap())
|
||||||
always_show_chapter_transition.bindToPreference(preferences.alwaysShowChapterTransition())
|
always_show_chapter_transition.bindToPreference(preferences.alwaysShowChapterTransition())
|
||||||
crop_borders.bindToPreference(preferences.cropBorders())
|
crop_borders.bindToPreference(preferences.cropBorders())
|
||||||
|
page_transitions.bindToPreference(preferences.pageTransitions())
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
true_color.visible()
|
true_color.visible()
|
||||||
@ -108,7 +109,6 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia
|
|||||||
|
|
||||||
scale_type.bindToPreference(preferences.imageScaleType(), 1)
|
scale_type.bindToPreference(preferences.imageScaleType(), 1)
|
||||||
zoom_start.bindToPreference(preferences.zoomStart(), 1)
|
zoom_start.bindToPreference(preferences.zoomStart(), 1)
|
||||||
page_transitions.bindToPreference(preferences.pageTransitions())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,8 +20,9 @@ abstract class ViewerConfig(preferences: PreferencesHelper) {
|
|||||||
var imagePropertyChangedListener: (() -> Unit)? = null
|
var imagePropertyChangedListener: (() -> Unit)? = null
|
||||||
|
|
||||||
var tappingEnabled = true
|
var tappingEnabled = true
|
||||||
var longTapEnabled = true
|
|
||||||
var tappingInverted = TappingInvertMode.NONE
|
var tappingInverted = TappingInvertMode.NONE
|
||||||
|
var longTapEnabled = true
|
||||||
|
var usePageTransitions = false
|
||||||
var doubleTapAnimDuration = 500
|
var doubleTapAnimDuration = 500
|
||||||
var volumeKeysEnabled = false
|
var volumeKeysEnabled = false
|
||||||
var volumeKeysInverted = false
|
var volumeKeysInverted = false
|
||||||
@ -39,6 +40,9 @@ abstract class ViewerConfig(preferences: PreferencesHelper) {
|
|||||||
preferences.readWithLongTap()
|
preferences.readWithLongTap()
|
||||||
.register({ longTapEnabled = it })
|
.register({ longTapEnabled = it })
|
||||||
|
|
||||||
|
preferences.pageTransitions()
|
||||||
|
.register({ usePageTransitions = it })
|
||||||
|
|
||||||
preferences.doubleTapAnimSpeed()
|
preferences.doubleTapAnimSpeed()
|
||||||
.register({ doubleTapAnimDuration = it })
|
.register({ doubleTapAnimDuration = it })
|
||||||
|
|
||||||
|
@ -11,9 +11,6 @@ import uy.kohesive.injekt.api.get
|
|||||||
class PagerConfig(private val viewer: PagerViewer, preferences: PreferencesHelper = Injekt.get()) :
|
class PagerConfig(private val viewer: PagerViewer, preferences: PreferencesHelper = Injekt.get()) :
|
||||||
ViewerConfig(preferences) {
|
ViewerConfig(preferences) {
|
||||||
|
|
||||||
var usePageTransitions = false
|
|
||||||
private set
|
|
||||||
|
|
||||||
var imageScaleType = 1
|
var imageScaleType = 1
|
||||||
private set
|
private set
|
||||||
|
|
||||||
@ -21,9 +18,6 @@ class PagerConfig(private val viewer: PagerViewer, preferences: PreferencesHelpe
|
|||||||
private set
|
private set
|
||||||
|
|
||||||
init {
|
init {
|
||||||
preferences.pageTransitions()
|
|
||||||
.register({ usePageTransitions = it })
|
|
||||||
|
|
||||||
preferences.imageScaleType()
|
preferences.imageScaleType()
|
||||||
.register({ imageScaleType = it }, { imagePropertyChangedListener?.invoke() })
|
.register({ imageScaleType = it }, { imagePropertyChangedListener?.invoke() })
|
||||||
|
|
||||||
|
@ -236,14 +236,22 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
|
|||||||
* Scrolls up by [scrollDistance].
|
* Scrolls up by [scrollDistance].
|
||||||
*/
|
*/
|
||||||
private fun scrollUp() {
|
private fun scrollUp() {
|
||||||
recycler.smoothScrollBy(0, -scrollDistance)
|
if (config.usePageTransitions) {
|
||||||
|
recycler.smoothScrollBy(0, -scrollDistance)
|
||||||
|
} else {
|
||||||
|
recycler.scrollBy(0, -scrollDistance)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scrolls down by [scrollDistance].
|
* Scrolls down by [scrollDistance].
|
||||||
*/
|
*/
|
||||||
private fun scrollDown() {
|
private fun scrollDown() {
|
||||||
recycler.smoothScrollBy(0, scrollDistance)
|
if (config.usePageTransitions) {
|
||||||
|
recycler.smoothScrollBy(0, scrollDistance)
|
||||||
|
} else {
|
||||||
|
recycler.scrollBy(0, scrollDistance)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,6 +106,11 @@ class SettingsReaderController : SettingsController() {
|
|||||||
titleRes = R.string.pref_crop_borders
|
titleRes = R.string.pref_crop_borders
|
||||||
defaultValue = false
|
defaultValue = false
|
||||||
}
|
}
|
||||||
|
switchPreference {
|
||||||
|
key = Keys.enableTransitions
|
||||||
|
titleRes = R.string.pref_page_transitions
|
||||||
|
defaultValue = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
preferenceCategory {
|
preferenceCategory {
|
||||||
@ -154,11 +159,6 @@ class SettingsReaderController : SettingsController() {
|
|||||||
defaultValue = "1"
|
defaultValue = "1"
|
||||||
summary = "%s"
|
summary = "%s"
|
||||||
}
|
}
|
||||||
switchPreference {
|
|
||||||
key = Keys.enableTransitions
|
|
||||||
titleRes = R.string.pref_page_transitions
|
|
||||||
defaultValue = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
preferenceCategory {
|
preferenceCategory {
|
||||||
|
@ -179,11 +179,19 @@
|
|||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
app:layout_constraintTop_toBottomOf="@id/always_show_chapter_transition" />
|
app:layout_constraintTop_toBottomOf="@id/always_show_chapter_transition" />
|
||||||
|
|
||||||
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
|
android:id="@+id/page_transitions"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/pref_page_transitions"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/crop_borders" />
|
||||||
|
|
||||||
<android.widget.Space
|
<android.widget.Space
|
||||||
android:id="@+id/end_general_preferences"
|
android:id="@+id/end_general_preferences"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/crop_borders" />
|
app:layout_constraintBottom_toBottomOf="@id/page_transitions" />
|
||||||
|
|
||||||
<!-- Pager preferences -->
|
<!-- Pager preferences -->
|
||||||
|
|
||||||
@ -236,20 +244,11 @@
|
|||||||
app:layout_constraintStart_toEndOf="@id/verticalcenter"
|
app:layout_constraintStart_toEndOf="@id/verticalcenter"
|
||||||
app:layout_constraintTop_toBottomOf="@id/scale_type" />
|
app:layout_constraintTop_toBottomOf="@id/scale_type" />
|
||||||
|
|
||||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
|
||||||
android:id="@+id/page_transitions"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:text="@string/pref_page_transitions"
|
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/zoom_start" />
|
|
||||||
|
|
||||||
<android.widget.Space
|
<android.widget.Space
|
||||||
android:id="@+id/end_paged_preferences"
|
android:id="@+id/end_paged_preferences"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/page_transitions"
|
app:layout_constraintBottom_toBottomOf="@+id/zoom_start"
|
||||||
tools:layout_editor_absoluteX="24dp" />
|
tools:layout_editor_absoluteX="24dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -328,7 +327,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:constraint_referenced_ids="pager_prefs,scale_type_text,scale_type,zoom_start_text,zoom_start,page_transitions"
|
app:constraint_referenced_ids="pager_prefs,scale_type_text,scale_type,zoom_start_text,zoom_start"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Group
|
<androidx.constraintlayout.widget.Group
|
||||||
|
Loading…
Reference in New Issue
Block a user