Add Continuous vertical reading mode (#2833)

* Add Continuous Vertical reader mode

* Remove separate webtoon padding option

(cherry picked from commit 3e7d15e51856297210e46e9f5bb0b8394067ce1a)

* Continuas vertical Lowercase v

(cherry picked from commit 515cca7d6704343eb9acb1a38a2bdcda01e7395a)
This commit is contained in:
jobobby04 2020-04-07 22:35:43 -04:00 committed by GitHub
parent b2fba5083b
commit 38ceaf5253
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 7 additions and 22 deletions

View File

@ -49,8 +49,6 @@ 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"

View File

@ -107,8 +107,6 @@ 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)

View File

@ -123,6 +123,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
const val RIGHT_TO_LEFT = 2
const val VERTICAL = 3
const val WEBTOON = 4
const val VERTICAL_PLUS = 5
fun newIntent(context: Context, manga: Manga, chapter: Chapter): Intent {
return Intent(context, ReaderActivity::class.java).apply {
@ -388,6 +389,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
RIGHT_TO_LEFT -> R2LPagerViewer(this)
VERTICAL -> VerticalPagerViewer(this)
WEBTOON -> WebtoonViewer(this)
VERTICAL_PLUS -> WebtoonViewer(this, true)
else -> L2RPagerViewer(this)
}

View File

@ -23,7 +23,6 @@ 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
import kotlinx.android.synthetic.main.reader_settings_sheet.long_tap
import kotlinx.android.synthetic.main.reader_settings_sheet.pad_pages_vert_webtoon
import kotlinx.android.synthetic.main.reader_settings_sheet.page_transitions
import kotlinx.android.synthetic.main.reader_settings_sheet.pager_prefs_group
import kotlinx.android.synthetic.main.reader_settings_sheet.rotation_mode
@ -73,7 +72,7 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia
viewer.onItemSelectedListener = IgnoreFirstSpinnerListener { position ->
activity.presenter.setMangaViewer(position)
if (activity.presenter.getMangaViewer() == ReaderActivity.WEBTOON) {
if (activity.presenter.getMangaViewer() == ReaderActivity.WEBTOON || activity.presenter.getMangaViewer() == ReaderActivity.VERTICAL_PLUS) {
initWebtoonPreferences()
} else {
initPagerPreferences()
@ -104,7 +103,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())
pad_pages_vert_webtoon.bindToPreference(preferences.padPagesVertWebtoon())
page_transitions.bindToPreference(preferences.pageTransitions())
}
@ -116,7 +114,6 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia
webtoon_prefs_group.visible()
crop_borders_webtoon.bindToPreference(preferences.cropBordersWebtoon())
pad_pages_vert_webtoon.bindToPreference(preferences.padPagesVertWebtoon())
}
/**

View File

@ -31,9 +31,6 @@ class WebtoonConfig(preferences: PreferencesHelper = Injekt.get()) {
var imageCropBorders = false
private set
var padPagesVert = false
private set
var doubleTapAnimDuration = 500
private set
@ -50,9 +47,6 @@ 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 })

View File

@ -125,7 +125,7 @@ class WebtoonPageHolder(
private fun refreshLayoutParams() {
frame.layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT).apply {
if (viewer.config.padPagesVert) {
if (viewer.isVerticalPlus) {
bottomMargin = 15.dpToPx
}
}

View File

@ -22,7 +22,7 @@ import timber.log.Timber
/**
* Implementation of a [BaseViewer] to display pages with a [RecyclerView].
*/
class WebtoonViewer(val activity: ReaderActivity) : BaseViewer {
class WebtoonViewer(val activity: ReaderActivity, val isVerticalPlus: Boolean = false) : BaseViewer {
/**
* Recycler view used by this viewer.

View File

@ -146,11 +146,6 @@ 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 {

View File

@ -20,6 +20,7 @@
<item>@string/right_to_left_viewer</item>
<item>@string/vertical_viewer</item>
<item>@string/webtoon_viewer</item>
<item>@string/vertical_plus_viewer</item>
</string-array>
<string-array name="reader_themes">
@ -107,5 +108,4 @@
<item>@string/filter_mode_multiply</item>
<item>@string/filter_mode_screen</item>
</string-array>
</resources>

View File

@ -250,6 +250,7 @@
<string name="right_to_left_viewer">Right to left</string>
<string name="vertical_viewer">Vertical</string>
<string name="webtoon_viewer">Webtoon</string>
<string name="vertical_plus_viewer">Continuous vertical</string>
<string name="pager_viewer">Pager</string>
<string name="pref_image_decoder">Image decoder</string>
<string name="pref_image_scale_type">Scale type</string>