mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-04 08:08:55 +01:00 
			
		
		
		
	Minor reader cleanup
This commit is contained in:
		@@ -382,11 +382,14 @@ class ReaderActivity : BaseActivity() {
 | 
			
		||||
 | 
			
		||||
        binding.pageNumber.setComposeContent {
 | 
			
		||||
            val state by viewModel.state.collectAsState()
 | 
			
		||||
            val showPageNumber by viewModel.readerPreferences.showPageNumber().collectAsState()
 | 
			
		||||
 | 
			
		||||
            PageIndicatorText(
 | 
			
		||||
                currentPage = state.currentPage,
 | 
			
		||||
                totalPages = state.totalPages,
 | 
			
		||||
            )
 | 
			
		||||
            if (!state.menuVisible && showPageNumber) {
 | 
			
		||||
                PageIndicatorText(
 | 
			
		||||
                    currentPage = state.currentPage,
 | 
			
		||||
                    totalPages = state.totalPages,
 | 
			
		||||
                )
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        binding.dialogRoot.setComposeContent {
 | 
			
		||||
@@ -554,10 +557,6 @@ class ReaderActivity : BaseActivity() {
 | 
			
		||||
                bottomAnimation.applySystemAnimatorScale(this)
 | 
			
		||||
                binding.readerMenuBottom.startAnimation(bottomAnimation)
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (readerPreferences.showPageNumber().get()) {
 | 
			
		||||
                config?.setPageNumberVisibility(false)
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            if (readerPreferences.fullscreen().get()) {
 | 
			
		||||
                windowInsetsController.hide(WindowInsetsCompat.Type.systemBars())
 | 
			
		||||
@@ -580,10 +579,6 @@ class ReaderActivity : BaseActivity() {
 | 
			
		||||
                bottomAnimation.applySystemAnimatorScale(this)
 | 
			
		||||
                binding.readerMenuBottom.startAnimation(bottomAnimation)
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (readerPreferences.showPageNumber().get()) {
 | 
			
		||||
                config?.setPageNumberVisibility(true)
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -636,9 +631,8 @@ class ReaderActivity : BaseActivity() {
 | 
			
		||||
 | 
			
		||||
    private fun showReadingModeToast(mode: Int) {
 | 
			
		||||
        try {
 | 
			
		||||
            val strings = resources.getStringArray(R.array.viewers_selector)
 | 
			
		||||
            readingModeToast?.cancel()
 | 
			
		||||
            readingModeToast = toast(strings[mode])
 | 
			
		||||
            readingModeToast = toast(ReadingModeType.fromPreference(mode).stringRes)
 | 
			
		||||
        } catch (e: ArrayIndexOutOfBoundsException) {
 | 
			
		||||
            logcat(LogPriority.ERROR) { "Unknown reading mode: $mode" }
 | 
			
		||||
        }
 | 
			
		||||
@@ -892,10 +886,6 @@ class ReaderActivity : BaseActivity() {
 | 
			
		||||
                }
 | 
			
		||||
                .launchIn(lifecycleScope)
 | 
			
		||||
 | 
			
		||||
            readerPreferences.showPageNumber().changes()
 | 
			
		||||
                .onEach(::setPageNumberVisibility)
 | 
			
		||||
                .launchIn(lifecycleScope)
 | 
			
		||||
 | 
			
		||||
            readerPreferences.trueColor().changes()
 | 
			
		||||
                .onEach(::setTrueColor)
 | 
			
		||||
                .launchIn(lifecycleScope)
 | 
			
		||||
@@ -945,13 +935,6 @@ class ReaderActivity : BaseActivity() {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /**
 | 
			
		||||
         * Sets the visibility of the bottom page indicator according to [visible].
 | 
			
		||||
         */
 | 
			
		||||
        fun setPageNumberVisibility(visible: Boolean) {
 | 
			
		||||
            binding.pageNumber.isVisible = visible
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /**
 | 
			
		||||
         * Sets the 32-bit color mode according to [enabled].
 | 
			
		||||
         */
 | 
			
		||||
 
 | 
			
		||||
@@ -5,14 +5,14 @@ import androidx.annotation.DrawableRes
 | 
			
		||||
import androidx.annotation.StringRes
 | 
			
		||||
import eu.kanade.tachiyomi.R
 | 
			
		||||
 | 
			
		||||
enum class OrientationType(val prefValue: Int, val flag: Int, @StringRes val stringRes: Int, @DrawableRes val iconRes: Int, val flagValue: Int) {
 | 
			
		||||
    DEFAULT(0, ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED, R.string.label_default, R.drawable.ic_screen_rotation_24dp, 0x00000000),
 | 
			
		||||
    FREE(1, ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED, R.string.rotation_free, R.drawable.ic_screen_rotation_24dp, 0x00000008),
 | 
			
		||||
    PORTRAIT(2, ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT, R.string.rotation_portrait, R.drawable.ic_stay_current_portrait_24dp, 0x00000010),
 | 
			
		||||
    LANDSCAPE(3, ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE, R.string.rotation_landscape, R.drawable.ic_stay_current_landscape_24dp, 0x00000018),
 | 
			
		||||
    LOCKED_PORTRAIT(4, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, R.string.rotation_force_portrait, R.drawable.ic_screen_lock_portrait_24dp, 0x00000020),
 | 
			
		||||
    LOCKED_LANDSCAPE(5, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE, R.string.rotation_force_landscape, R.drawable.ic_screen_lock_landscape_24dp, 0x00000028),
 | 
			
		||||
    REVERSE_PORTRAIT(6, ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT, R.string.rotation_reverse_portrait, R.drawable.ic_stay_current_portrait_24dp, 0x00000030),
 | 
			
		||||
enum class OrientationType(val flag: Int, @StringRes val stringRes: Int, @DrawableRes val iconRes: Int, val flagValue: Int) {
 | 
			
		||||
    DEFAULT(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED, R.string.label_default, R.drawable.ic_screen_rotation_24dp, 0x00000000),
 | 
			
		||||
    FREE(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED, R.string.rotation_free, R.drawable.ic_screen_rotation_24dp, 0x00000008),
 | 
			
		||||
    PORTRAIT(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT, R.string.rotation_portrait, R.drawable.ic_stay_current_portrait_24dp, 0x00000010),
 | 
			
		||||
    LANDSCAPE(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE, R.string.rotation_landscape, R.drawable.ic_stay_current_landscape_24dp, 0x00000018),
 | 
			
		||||
    LOCKED_PORTRAIT(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, R.string.rotation_force_portrait, R.drawable.ic_screen_lock_portrait_24dp, 0x00000020),
 | 
			
		||||
    LOCKED_LANDSCAPE(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE, R.string.rotation_force_landscape, R.drawable.ic_screen_lock_landscape_24dp, 0x00000028),
 | 
			
		||||
    REVERSE_PORTRAIT(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT, R.string.rotation_reverse_portrait, R.drawable.ic_stay_current_portrait_24dp, 0x00000030),
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
    companion object {
 | 
			
		||||
 
 | 
			
		||||
@@ -10,13 +10,13 @@ import eu.kanade.tachiyomi.ui.reader.viewer.pager.R2LPagerViewer
 | 
			
		||||
import eu.kanade.tachiyomi.ui.reader.viewer.pager.VerticalPagerViewer
 | 
			
		||||
import eu.kanade.tachiyomi.ui.reader.viewer.webtoon.WebtoonViewer
 | 
			
		||||
 | 
			
		||||
enum class ReadingModeType(val prefValue: Int, @StringRes val stringRes: Int, @DrawableRes val iconRes: Int, val flagValue: Int) {
 | 
			
		||||
    DEFAULT(0, R.string.label_default, R.drawable.ic_reader_default_24dp, 0x00000000),
 | 
			
		||||
    LEFT_TO_RIGHT(1, R.string.left_to_right_viewer, R.drawable.ic_reader_ltr_24dp, 0x00000001),
 | 
			
		||||
    RIGHT_TO_LEFT(2, R.string.right_to_left_viewer, R.drawable.ic_reader_rtl_24dp, 0x00000002),
 | 
			
		||||
    VERTICAL(3, R.string.vertical_viewer, R.drawable.ic_reader_vertical_24dp, 0x00000003),
 | 
			
		||||
    WEBTOON(4, R.string.webtoon_viewer, R.drawable.ic_reader_webtoon_24dp, 0x00000004),
 | 
			
		||||
    CONTINUOUS_VERTICAL(5, R.string.vertical_plus_viewer, R.drawable.ic_reader_continuous_vertical_24dp, 0x00000005),
 | 
			
		||||
enum class ReadingModeType(@StringRes val stringRes: Int, @DrawableRes val iconRes: Int, val flagValue: Int) {
 | 
			
		||||
    DEFAULT(R.string.label_default, R.drawable.ic_reader_default_24dp, 0x00000000),
 | 
			
		||||
    LEFT_TO_RIGHT(R.string.left_to_right_viewer, R.drawable.ic_reader_ltr_24dp, 0x00000001),
 | 
			
		||||
    RIGHT_TO_LEFT(R.string.right_to_left_viewer, R.drawable.ic_reader_rtl_24dp, 0x00000002),
 | 
			
		||||
    VERTICAL(R.string.vertical_viewer, R.drawable.ic_reader_vertical_24dp, 0x00000003),
 | 
			
		||||
    WEBTOON(R.string.webtoon_viewer, R.drawable.ic_reader_webtoon_24dp, 0x00000004),
 | 
			
		||||
    CONTINUOUS_VERTICAL(R.string.vertical_plus_viewer, R.drawable.ic_reader_continuous_vertical_24dp, 0x00000005),
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
    companion object {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user