diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt index 19e9e6c57..017cc0f5e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt @@ -28,6 +28,7 @@ import kotlinx.android.synthetic.main.reader_settings_sheet.pager_prefs_group import kotlinx.android.synthetic.main.reader_settings_sheet.rotation_mode import kotlinx.android.synthetic.main.reader_settings_sheet.scale_type import kotlinx.android.synthetic.main.reader_settings_sheet.show_page_number +import kotlinx.android.synthetic.main.reader_settings_sheet.tapping_inverted import kotlinx.android.synthetic.main.reader_settings_sheet.true_color import kotlinx.android.synthetic.main.reader_settings_sheet.viewer import kotlinx.android.synthetic.main.reader_settings_sheet.webtoon_prefs_group @@ -57,6 +58,7 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia super.onCreate(savedInstanceState) initGeneralPreferences() + initNavigationPreferences() when (activity.viewer) { is PagerViewer -> initPagerPreferences() @@ -119,6 +121,13 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia webtoon_side_padding.bindToIntPreference(preferences.webtoonSidePadding(), R.array.webtoon_side_padding_values) } + /** + * Init the preferences for navigation. + */ + private fun initNavigationPreferences() { + tapping_inverted.bindToPreference(preferences.readWithTappingInverted()) + } + /** * Binds a checkbox or switch view with a boolean preference. */ @@ -137,6 +146,19 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia setSelection(pref.get() - offset, false) } + /** + * Binds a spinner to an enum preference. + */ + private inline fun > Spinner.bindToPreference(pref: Preference) { + val enumConstants = T::class.java.enumConstants + + onItemSelectedListener = IgnoreFirstSpinnerListener { position -> + enumConstants?.get(position)?.let { pref.set(it) } + } + + enumConstants?.indexOf(pref.get())?.let { setSelection(it, false) } + } + /** * Binds a spinner to an int preference. The position of the spinner item must * correlate with the [intValues] resource item (in arrays.xml), which is a diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt index 8640859e7..b42d6594a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt @@ -15,10 +15,10 @@ import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters import eu.kanade.tachiyomi.ui.reader.viewer.BaseViewer import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.visible -import rx.subscriptions.CompositeSubscription -import timber.log.Timber import kotlin.math.max import kotlin.math.min +import rx.subscriptions.CompositeSubscription +import timber.log.Timber /** * Implementation of a [BaseViewer] to display pages with a [RecyclerView]. diff --git a/app/src/main/res/layout/reader_settings_sheet.xml b/app/src/main/res/layout/reader_settings_sheet.xml index d7170ff69..0a64fadb8 100644 --- a/app/src/main/res/layout/reader_settings_sheet.xml +++ b/app/src/main/res/layout/reader_settings_sheet.xml @@ -188,7 +188,7 @@ android:textColor="?attr/colorAccent" android:textStyle="bold" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/end_general_preferences" /> + app:layout_constraintTop_toBottomOf="@id/end_navigation_preferences" /> + + + + + + + + + + + app:layout_constraintTop_toBottomOf="@id/end_navigation_preferences" /> @string/filter_mode_multiply @string/filter_mode_screen + + + @string/tapping_inverted_none + @string/tapping_inverted_horizontal + @string/tapping_inverted_vertical + @string/tapping_inverted_both +