mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 16:21:49 +01:00
Added Webtoon with Padding viewer (#2618)
* Added Webtoon with Padding viewer * Change webtoon padding to be a config option * Removed obselete padded_webtoon * Switch ambiguous padding to vertical padding
This commit is contained in:
parent
275bd44e15
commit
ca10356fd9
@ -47,6 +47,8 @@ object PreferenceKeys {
|
||||
|
||||
const val cropBordersWebtoon = "crop_borders_webtoon"
|
||||
|
||||
const val padPagesVertWebtoon = "pad_pages_vert_webtoon"
|
||||
|
||||
const val readWithTapping = "reader_tap"
|
||||
|
||||
const val readWithLongTap = "reader_long_tap"
|
||||
|
@ -104,6 +104,8 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun cropBordersWebtoon() = rxPrefs.getBoolean(Keys.cropBordersWebtoon, false)
|
||||
|
||||
fun padPagesVertWebtoon() = rxPrefs.getBoolean(Keys.padPagesVertWebtoon, false)
|
||||
|
||||
fun readWithTapping() = rxPrefs.getBoolean(Keys.readWithTapping, true)
|
||||
|
||||
fun readWithLongTap() = rxPrefs.getBoolean(Keys.readWithLongTap, true)
|
||||
|
@ -79,6 +79,7 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia
|
||||
scale_type.bindToPreference(preferences.imageScaleType(), 1)
|
||||
zoom_start.bindToPreference(preferences.zoomStart(), 1)
|
||||
crop_borders.bindToPreference(preferences.cropBorders())
|
||||
pad_pages_vert_webtoon.bindToPreference(preferences.padPagesVertWebtoon())
|
||||
page_transitions.bindToPreference(preferences.pageTransitions())
|
||||
}
|
||||
|
||||
@ -88,6 +89,7 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia
|
||||
private fun initWebtoonPreferences() {
|
||||
webtoon_prefs_group.visible()
|
||||
crop_borders_webtoon.bindToPreference(preferences.cropBordersWebtoon())
|
||||
pad_pages_vert_webtoon.bindToPreference(preferences.padPagesVertWebtoon())
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,6 +31,9 @@ class WebtoonConfig(preferences: PreferencesHelper = Injekt.get()) {
|
||||
var imageCropBorders = false
|
||||
private set
|
||||
|
||||
var padPagesVert = false
|
||||
private set
|
||||
|
||||
var doubleTapAnimDuration = 500
|
||||
private set
|
||||
|
||||
@ -44,6 +47,9 @@ class WebtoonConfig(preferences: PreferencesHelper = Injekt.get()) {
|
||||
preferences.cropBordersWebtoon()
|
||||
.register({ imageCropBorders = it }, { imagePropertyChangedListener?.invoke() })
|
||||
|
||||
preferences.padPagesVertWebtoon()
|
||||
.register({ padPagesVert = it }, { imagePropertyChangedListener?.invoke() })
|
||||
|
||||
preferences.doubleTapAnimSpeed()
|
||||
.register({ doubleTapAnimDuration = it })
|
||||
|
||||
|
@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.reader.viewer.webtoon
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.net.Uri
|
||||
import android.view.Gravity
|
||||
@ -31,6 +32,7 @@ import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
|
||||
import eu.kanade.tachiyomi.ui.reader.viewer.ReaderProgressBar
|
||||
import eu.kanade.tachiyomi.util.system.ImageUtil
|
||||
import eu.kanade.tachiyomi.util.system.dpToPx
|
||||
import eu.kanade.tachiyomi.util.system.pxToDp
|
||||
import eu.kanade.tachiyomi.util.view.gone
|
||||
import eu.kanade.tachiyomi.util.view.visible
|
||||
import rx.Observable
|
||||
@ -112,6 +114,9 @@ class WebtoonPageHolder(
|
||||
|
||||
init {
|
||||
frame.layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT)
|
||||
if (viewer.config.padPagesVert) {
|
||||
frame.setPadding(0, 0, 0, 15.dpToPx)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -120,6 +120,11 @@ class SettingsReaderController : SettingsController() {
|
||||
titleRes = R.string.pref_crop_borders
|
||||
defaultValue = false
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.padPagesVertWebtoon
|
||||
titleRes = R.string.pref_webtoon_padding_vert
|
||||
defaultValue = false
|
||||
}
|
||||
}
|
||||
preferenceCategory {
|
||||
titleRes = R.string.pref_reader_navigation
|
||||
|
@ -249,6 +249,15 @@
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintTop_toBottomOf="@id/webtoon_prefs" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/pad_pages_vert_webtoon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/pref_webtoon_padding_vert"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintTop_toBottomOf="@id/crop_borders_webtoon" />
|
||||
|
||||
<!-- Groups of preferences -->
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
@ -264,7 +273,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="webtoon_prefs,crop_borders_webtoon" />
|
||||
app:constraint_referenced_ids="webtoon_prefs,crop_borders_webtoon,pad_pages_vert_webtoon" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/verticalcenter"
|
||||
|
@ -207,6 +207,7 @@
|
||||
<string name="pref_show_page_number">Show page number</string>
|
||||
<string name="pref_true_color">32-bit color</string>
|
||||
<string name="pref_crop_borders">Crop borders</string>
|
||||
<string name="pref_webtoon_padding_vert">Vertical padding between pages</string>
|
||||
<string name="pref_custom_brightness">Use custom brightness</string>
|
||||
<string name="pref_custom_color_filter">Use custom color filter</string>
|
||||
<string name="pref_color_filter_mode">Color filter blend mode</string>
|
||||
|
Loading…
Reference in New Issue
Block a user