mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-30 22:07:57 +01:00 
			
		
		
		
	Add 32-bit color mode to reader settings (#1941)
* add ARGB_8888 mode to reader settings * Only show option on Oreo or later. Only show option in settings screen.
This commit is contained in:
		| @@ -15,6 +15,8 @@ object PreferenceKeys { | ||||
|  | ||||
|     const val showPageNumber = "pref_show_page_number_key" | ||||
|  | ||||
|     const val trueColor = "pref_true_color_key" | ||||
|  | ||||
|     const val fullscreen = "fullscreen" | ||||
|  | ||||
|     const val keepScreenOn = "pref_keep_screen_on_key" | ||||
|   | ||||
| @@ -43,6 +43,8 @@ class PreferencesHelper(val context: Context) { | ||||
|  | ||||
|     fun showPageNumber() = rxPrefs.getBoolean(Keys.showPageNumber, true) | ||||
|  | ||||
|     fun trueColor() = rxPrefs.getBoolean(Keys.trueColor, false) | ||||
|  | ||||
|     fun fullscreen() = rxPrefs.getBoolean(Keys.fullscreen, true) | ||||
|  | ||||
|     fun keepScreenOn() = rxPrefs.getBoolean(Keys.keepScreenOn, true) | ||||
|   | ||||
| @@ -6,6 +6,7 @@ import android.content.Context | ||||
| import android.content.Intent | ||||
| import android.content.pm.ActivityInfo | ||||
| import android.content.res.Configuration | ||||
| import android.graphics.Bitmap | ||||
| import android.graphics.Color | ||||
| import android.os.Build | ||||
| import android.os.Bundle | ||||
| @@ -13,6 +14,7 @@ import android.view.* | ||||
| import android.view.animation.Animation | ||||
| import android.view.animation.AnimationUtils | ||||
| import android.widget.SeekBar | ||||
| import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView | ||||
| import eu.kanade.tachiyomi.R | ||||
| import eu.kanade.tachiyomi.data.database.models.Chapter | ||||
| import eu.kanade.tachiyomi.data.database.models.Manga | ||||
| @@ -558,6 +560,9 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() { | ||||
|             subscriptions += preferences.showPageNumber().asObservable() | ||||
|                 .subscribe { setPageNumberVisibility(it) } | ||||
|  | ||||
|             subscriptions += preferences.trueColor().asObservable() | ||||
|                 .subscribe { setTrueColor(it) } | ||||
|  | ||||
|             subscriptions += preferences.fullscreen().asObservable() | ||||
|                 .subscribe { setFullscreen(it) } | ||||
|  | ||||
| @@ -614,6 +619,16 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() { | ||||
|             page_number.visibility = if (visible) View.VISIBLE else View.INVISIBLE | ||||
|         } | ||||
|  | ||||
|         /** | ||||
|          * Sets the 32-bit color mode according to [enabled]. | ||||
|          */ | ||||
|         private fun setTrueColor(enabled: Boolean) { | ||||
|             if (enabled) | ||||
|                 SubsamplingScaleImageView.setPreferredBitmapConfig(Bitmap.Config.ARGB_8888) | ||||
|             else | ||||
|                 SubsamplingScaleImageView.setPreferredBitmapConfig(Bitmap.Config.RGB_565) | ||||
|         } | ||||
|  | ||||
|         /** | ||||
|          * Sets the fullscreen reading mode (immersive) according to [enabled]. | ||||
|          */ | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| package eu.kanade.tachiyomi.ui.setting | ||||
|  | ||||
| import android.os.Build | ||||
| import android.support.v7.preference.PreferenceScreen | ||||
| import eu.kanade.tachiyomi.R | ||||
| import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys | ||||
| @@ -77,6 +78,13 @@ class SettingsReaderController : SettingsController() { | ||||
|             titleRes = R.string.pref_show_page_number | ||||
|             defaultValue = true | ||||
|         } | ||||
|         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | ||||
|             switchPreference { | ||||
|                 key = Keys.trueColor | ||||
|                 titleRes = R.string.pref_true_color | ||||
|                 defaultValue = false | ||||
|             } | ||||
|         } | ||||
|         preferenceCategory { | ||||
|             titleRes = R.string.pager_viewer | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user