Add icon for crop border shortcut off state
(cherry picked from commit 4054f2a6a0b627ec87a18519da3e169f41413ca4) # Conflicts: # app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt # app/src/main/res/layout/reader_activity.xml
This commit is contained in:
parent
d3482ef734
commit
fb01b547de
@ -451,7 +451,8 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
|||||||
ReaderSettingsSheet(this).show()
|
ReaderSettingsSheet(this).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*with(binding.actionReaderMode) {
|
// Reading mode
|
||||||
|
/*with(binding.actionReadingMode) {
|
||||||
setTooltip(R.string.viewer)
|
setTooltip(R.string.viewer)
|
||||||
|
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
@ -460,10 +461,13 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
|||||||
presenter.setMangaViewer(newReadingMode.prefValue)
|
presenter.setMangaViewer(newReadingMode.prefValue)
|
||||||
|
|
||||||
menuToggleToast?.cancel()
|
menuToggleToast?.cancel()
|
||||||
|
if (!preferences.showReadingMode()) {
|
||||||
menuToggleToast = toast(newReadingMode.stringRes)
|
menuToggleToast = toast(newReadingMode.stringRes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rotation
|
||||||
with(binding.actionRotation) {
|
with(binding.actionRotation) {
|
||||||
setTooltip(R.string.pref_rotation_type)
|
setTooltip(R.string.pref_rotation_type)
|
||||||
|
|
||||||
@ -479,12 +483,10 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
preferences.rotation().asImmediateFlow { updateRotationShortcut(it) }
|
preferences.rotation().asImmediateFlow { updateRotationShortcut(it) }
|
||||||
.onEach {
|
|
||||||
updateRotationShortcut(it)
|
|
||||||
}
|
|
||||||
.launchIn(lifecycleScope)
|
.launchIn(lifecycleScope)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Crop borders
|
||||||
with(binding.actionCropBorders) {
|
with(binding.actionCropBorders) {
|
||||||
setTooltip(R.string.pref_crop_borders)
|
setTooltip(R.string.pref_crop_borders)
|
||||||
|
|
||||||
@ -504,7 +506,15 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateCropBordersShortcut()
|
||||||
|
listOf(preferences.cropBorders(), preferences.cropBordersWebtoon() /* SY --> */, preferences.cropBordersContinuesVertical()/* SY <-- */)
|
||||||
|
.forEach { pref ->
|
||||||
|
pref.asFlow()
|
||||||
|
.onEach { updateCropBordersShortcut() }
|
||||||
|
.launchIn(lifecycleScope)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Settings sheet
|
||||||
with(binding.actionSettings) {
|
with(binding.actionSettings) {
|
||||||
setTooltip(R.string.action_settings)
|
setTooltip(R.string.action_settings)
|
||||||
|
|
||||||
@ -710,6 +720,30 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
|||||||
binding.actionRotation.setImageResource(orientation.iconRes)
|
binding.actionRotation.setImageResource(orientation.iconRes)
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
private fun updateCropBordersShortcut() {
|
||||||
|
val mangaViewer = presenter.getMangaViewer()
|
||||||
|
val isPagerType = ReadingModeType.isPagerType(mangaViewer)
|
||||||
|
val enabled = if (isPagerType) {
|
||||||
|
preferences.cropBorders().get()
|
||||||
|
} else {
|
||||||
|
// SY -->
|
||||||
|
if (ReadingModeType.fromPreference(mangaViewer) == ReadingModeType.CONTINUOUS_VERTICAL) {
|
||||||
|
preferences.cropBordersContinuesVertical().get()
|
||||||
|
} else {
|
||||||
|
preferences.cropBordersWebtoon().get()
|
||||||
|
}
|
||||||
|
// SY <--
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.actionCropBorders.setImageResource(
|
||||||
|
if (enabled) {
|
||||||
|
R.drawable.ic_crop_24dp
|
||||||
|
} else {
|
||||||
|
R.drawable.ic_crop_off_24dp
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the visibility of the menu according to [visible] and with an optional parameter to
|
* Sets the visibility of the menu according to [visible] and with an optional parameter to
|
||||||
* [animate] the views.
|
* [animate] the views.
|
||||||
@ -830,7 +864,7 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
|||||||
val prevViewer = viewer
|
val prevViewer = viewer
|
||||||
|
|
||||||
/*val viewerMode = ReadingModeType.fromPreference(presenter.getMangaViewer(resolveDefault = false))
|
/*val viewerMode = ReadingModeType.fromPreference(presenter.getMangaViewer(resolveDefault = false))
|
||||||
binding.actionReaderMode.setImageResource(viewerMode.iconRes)*/
|
binding.actionReadingMode.setImageResource(viewerMode.iconRes)*/
|
||||||
|
|
||||||
val newViewer = when (presenter.getMangaViewer()) {
|
val newViewer = when (presenter.getMangaViewer()) {
|
||||||
ReadingModeType.LEFT_TO_RIGHT.prefValue -> L2RPagerViewer(this)
|
ReadingModeType.LEFT_TO_RIGHT.prefValue -> L2RPagerViewer(this)
|
||||||
|
18
app/src/main/res/drawable/ic_crop_off_24dp.xml
Normal file
18
app/src/main/res/drawable/ic_crop_off_24dp.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/black"
|
||||||
|
android:pathData="M7,1l-2,0l0,1.18l2,2l0,-3.18z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/black"
|
||||||
|
android:pathData="M17,7v7.18l0.82,0.82H19V7a2.0059,2.0059 0,0 0,-2 -2H9V6.18L9.82,7Z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/black"
|
||||||
|
android:pathData="M19.0001,19l-2,-2h0L2.1,2.1 0.68,3.51 2.1707,5H1V7H4.1718L5,7.8278V17a2.0059,2.0059 0,0 0,2 2h9.1778L17,19.8218V23h2V21.8207L20.49,23.31 21.9,21.9l-2.9,-2.9ZM7,17V9.8268L14.1768,17Z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/black"
|
||||||
|
android:pathData="M19.82,17l2,2l1.18,0l0,-2l-3.18,0z" />
|
||||||
|
</vector>
|
Loading…
x
Reference in New Issue
Block a user