mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-14 03:55:06 +01:00
Unify crop borders settings
This commit is contained in:
parent
763da19c9d
commit
1920568057
@ -51,8 +51,6 @@ object PreferenceKeys {
|
||||
|
||||
const val cropBorders = "crop_borders"
|
||||
|
||||
const val cropBordersWebtoon = "crop_borders_webtoon"
|
||||
|
||||
const val readWithTapping = "reader_tap"
|
||||
|
||||
const val readWithTappingInverted = "reader_tapping_inverted"
|
||||
|
@ -115,8 +115,6 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun cropBorders() = flowPrefs.getBoolean(Keys.cropBorders, false)
|
||||
|
||||
fun cropBordersWebtoon() = flowPrefs.getBoolean(Keys.cropBordersWebtoon, false)
|
||||
|
||||
fun webtoonSidePadding() = flowPrefs.getInt(Keys.webtoonSidePadding, 0)
|
||||
|
||||
fun readWithTapping() = flowPrefs.getBoolean(Keys.readWithTapping, true)
|
||||
|
@ -19,7 +19,6 @@ import eu.kanade.tachiyomi.widget.IgnoreFirstSpinnerListener
|
||||
import kotlinx.android.synthetic.main.reader_settings_sheet.always_show_chapter_transition
|
||||
import kotlinx.android.synthetic.main.reader_settings_sheet.background_color
|
||||
import kotlinx.android.synthetic.main.reader_settings_sheet.crop_borders
|
||||
import kotlinx.android.synthetic.main.reader_settings_sheet.crop_borders_webtoon
|
||||
import kotlinx.android.synthetic.main.reader_settings_sheet.cutout_short
|
||||
import kotlinx.android.synthetic.main.reader_settings_sheet.fullscreen
|
||||
import kotlinx.android.synthetic.main.reader_settings_sheet.keepscreen
|
||||
@ -92,6 +91,7 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia
|
||||
keepscreen.bindToPreference(preferences.keepScreenOn())
|
||||
long_tap.bindToPreference(preferences.readWithLongTap())
|
||||
always_show_chapter_transition.bindToPreference(preferences.alwaysShowChapterTransition())
|
||||
crop_borders.bindToPreference(preferences.cropBorders())
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
true_color.visible()
|
||||
@ -108,7 +108,6 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia
|
||||
|
||||
scale_type.bindToPreference(preferences.imageScaleType(), 1)
|
||||
zoom_start.bindToPreference(preferences.zoomStart(), 1)
|
||||
crop_borders.bindToPreference(preferences.cropBorders())
|
||||
page_transitions.bindToPreference(preferences.pageTransitions())
|
||||
}
|
||||
|
||||
@ -119,7 +118,6 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia
|
||||
pager_prefs_group.invisible()
|
||||
webtoon_prefs_group.visible()
|
||||
|
||||
crop_borders_webtoon.bindToPreference(preferences.cropBordersWebtoon())
|
||||
webtoon_side_padding.bindToIntPreference(preferences.webtoonSidePadding(), R.array.webtoon_side_padding_values)
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@ abstract class ViewerConfig(preferences: PreferencesHelper) {
|
||||
var volumeKeysEnabled = false
|
||||
var volumeKeysInverted = false
|
||||
var trueColor = false
|
||||
var imageCropBorders = false
|
||||
var alwaysShowChapterTransition = true
|
||||
|
||||
init {
|
||||
@ -50,6 +51,9 @@ abstract class ViewerConfig(preferences: PreferencesHelper) {
|
||||
preferences.trueColor()
|
||||
.register({ trueColor = it }, { imagePropertyChangedListener?.invoke() })
|
||||
|
||||
preferences.cropBorders()
|
||||
.register({ imageCropBorders = it }, { imagePropertyChangedListener?.invoke() })
|
||||
|
||||
preferences.alwaysShowChapterTransition()
|
||||
.register({ alwaysShowChapterTransition = it })
|
||||
}
|
||||
|
@ -20,9 +20,6 @@ class PagerConfig(private val viewer: PagerViewer, preferences: PreferencesHelpe
|
||||
var imageZoomType = ZoomType.Left
|
||||
private set
|
||||
|
||||
var imageCropBorders = false
|
||||
private set
|
||||
|
||||
init {
|
||||
preferences.pageTransitions()
|
||||
.register({ usePageTransitions = it })
|
||||
@ -32,9 +29,6 @@ class PagerConfig(private val viewer: PagerViewer, preferences: PreferencesHelpe
|
||||
|
||||
preferences.zoomStart()
|
||||
.register({ zoomTypeFromPreference(it) }, { imagePropertyChangedListener?.invoke() })
|
||||
|
||||
preferences.cropBorders()
|
||||
.register({ imageCropBorders = it }, { imagePropertyChangedListener?.invoke() })
|
||||
}
|
||||
|
||||
private fun zoomTypeFromPreference(value: Int) {
|
||||
|
@ -10,16 +10,10 @@ import uy.kohesive.injekt.api.get
|
||||
*/
|
||||
class WebtoonConfig(preferences: PreferencesHelper = Injekt.get()) : ViewerConfig(preferences) {
|
||||
|
||||
var imageCropBorders = false
|
||||
private set
|
||||
|
||||
var sidePadding = 0
|
||||
private set
|
||||
|
||||
init {
|
||||
preferences.cropBordersWebtoon()
|
||||
.register({ imageCropBorders = it }, { imagePropertyChangedListener?.invoke() })
|
||||
|
||||
preferences.webtoonSidePadding()
|
||||
.register({ sidePadding = it }, { imagePropertyChangedListener?.invoke() })
|
||||
}
|
||||
|
@ -101,6 +101,11 @@ class SettingsReaderController : SettingsController() {
|
||||
defaultValue = false
|
||||
}
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.cropBorders
|
||||
titleRes = R.string.pref_crop_borders
|
||||
defaultValue = false
|
||||
}
|
||||
}
|
||||
|
||||
preferenceCategory {
|
||||
@ -154,22 +159,11 @@ class SettingsReaderController : SettingsController() {
|
||||
titleRes = R.string.pref_page_transitions
|
||||
defaultValue = true
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.cropBorders
|
||||
titleRes = R.string.pref_crop_borders
|
||||
defaultValue = false
|
||||
}
|
||||
}
|
||||
|
||||
preferenceCategory {
|
||||
titleRes = R.string.webtoon_viewer
|
||||
|
||||
switchPreference {
|
||||
key = Keys.cropBordersWebtoon
|
||||
titleRes = R.string.pref_crop_borders
|
||||
defaultValue = false
|
||||
}
|
||||
|
||||
intListPreference {
|
||||
key = Keys.webtoonSidePadding
|
||||
titleRes = R.string.pref_webtoon_side_padding
|
||||
|
@ -171,11 +171,19 @@
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintTop_toBottomOf="@id/true_color" />
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/crop_borders"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/pref_crop_borders"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintTop_toBottomOf="@id/always_show_chapter_transition" />
|
||||
|
||||
<android.widget.Space
|
||||
android:id="@+id/end_general_preferences"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/always_show_chapter_transition" />
|
||||
app:layout_constraintBottom_toBottomOf="@id/crop_borders" />
|
||||
|
||||
<!-- Pager preferences -->
|
||||
|
||||
@ -228,22 +236,14 @@
|
||||
app:layout_constraintStart_toEndOf="@id/verticalcenter"
|
||||
app:layout_constraintTop_toBottomOf="@id/scale_type" />
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/crop_borders"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/pref_crop_borders"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintTop_toBottomOf="@id/zoom_start" />
|
||||
|
||||
<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/crop_borders" />
|
||||
app:layout_constraintTop_toBottomOf="@id/zoom_start" />
|
||||
|
||||
<android.widget.Space
|
||||
android:id="@+id/end_paged_preferences"
|
||||
@ -295,22 +295,13 @@
|
||||
android:id="@+id/webtoon_prefs"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:text="@string/webtoon_viewer"
|
||||
android:textColor="?attr/colorAccent"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/end_navigation_preferences" />
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/crop_borders_webtoon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/pref_crop_borders"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintTop_toBottomOf="@id/webtoon_prefs" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/webtoon_side_padding_text"
|
||||
android:layout_width="0dp"
|
||||
@ -328,7 +319,7 @@
|
||||
android:entries="@array/webtoon_side_padding"
|
||||
app:layout_constraintLeft_toRightOf="@id/verticalcenter"
|
||||
app:layout_constraintRight_toRightOf="@id/spinner_end"
|
||||
app:layout_constraintTop_toBottomOf="@id/crop_borders_webtoon" />
|
||||
app:layout_constraintTop_toBottomOf="@id/webtoon_prefs" />
|
||||
|
||||
<!-- Groups of preferences -->
|
||||
|
||||
@ -337,7 +328,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="pager_prefs,scale_type_text,scale_type,zoom_start_text,zoom_start,crop_borders,page_transitions"
|
||||
app:constraint_referenced_ids="pager_prefs,scale_type_text,scale_type,zoom_start_text,zoom_start,page_transitions"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
@ -345,7 +336,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="webtoon_prefs,crop_borders_webtoon,webtoon_side_padding_text,webtoon_side_padding" />
|
||||
app:constraint_referenced_ids="webtoon_prefs,webtoon_side_padding_text,webtoon_side_padding" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/verticalcenter"
|
||||
|
Loading…
Reference in New Issue
Block a user