From 2e39be662537e05790b54481f6f85798fc5c1d91 Mon Sep 17 00:00:00 2001 From: len Date: Sat, 3 Dec 2016 16:12:58 +0100 Subject: [PATCH] Image is now the default decoder --- .../data/preference/PreferenceKeys.kt | 3 ++- .../ui/reader/viewer/base/BaseReader.kt | 20 +++++++++---------- .../preference/SwitchPreferenceCategory.kt | 10 ---------- app/src/main/res/values/arrays.xml | 2 +- app/src/main/res/values/keys.xml | 2 +- 5 files changed, 14 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt index 46b07458fe..9e853d1e4e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt @@ -8,6 +8,7 @@ import eu.kanade.tachiyomi.R * in the file "keys.xml". By using this class we can define preferences in one place and get them * referenced here. */ +@Suppress("HasPlatformType") class PreferenceKeys(context: Context) { val theme = context.getString(R.string.pref_theme_key) @@ -94,6 +95,6 @@ class PreferenceKeys(context: Context) { fun syncPassword(syncId: Int) = "pref_mangasync_password_$syncId" - val libraryAsList = context.getString(R.string.pref_display_library_as_list) + val libraryAsList = context.getString(R.string.pref_display_library_as_list) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/base/BaseReader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/base/BaseReader.kt index 84ddde927b..0fb8296ea9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/base/BaseReader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/base/BaseReader.kt @@ -16,9 +16,9 @@ abstract class BaseReader : BaseFragment() { companion object { /** - * Rapid decoder. + * Image decoder. */ - const val RAPID_DECODER = 0 + const val IMAGE_DECODER = 0 /** * Skia decoder. @@ -26,9 +26,9 @@ abstract class BaseReader : BaseFragment() { const val SKIA_DECODER = 1 /** - * Image decoder. + * Rapid decoder. */ - const val IMAGE_DECODER = 2 + const val RAPID_DECODER = 2 } /** @@ -205,17 +205,17 @@ abstract class BaseReader : BaseFragment() { */ fun setDecoderClass(value: Int) { when (value) { - RAPID_DECODER -> { - bitmapDecoderClass = RapidImageDecoder::class.java - regionDecoderClass = RapidImageRegionDecoder::class.java + IMAGE_DECODER -> { + bitmapDecoderClass = IImageDecoder::class.java + regionDecoderClass = IImageRegionDecoder::class.java } SKIA_DECODER -> { bitmapDecoderClass = SkiaImageDecoder::class.java regionDecoderClass = SkiaImageRegionDecoder::class.java } - IMAGE_DECODER -> { - bitmapDecoderClass = IImageDecoder::class.java - regionDecoderClass = IImageRegionDecoder::class.java + RAPID_DECODER -> { + bitmapDecoderClass = RapidImageDecoder::class.java + regionDecoderClass = RapidImageRegionDecoder::class.java } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/SwitchPreferenceCategory.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/SwitchPreferenceCategory.kt index bf54136f16..e4f3d38b6c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/SwitchPreferenceCategory.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/SwitchPreferenceCategory.kt @@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.widget.preference import android.annotation.TargetApi import android.content.Context import android.content.res.TypedArray -import android.os.Build import android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH import android.support.v7.preference.PreferenceViewHolder import android.support.v7.widget.SwitchCompat @@ -11,7 +10,6 @@ import android.util.AttributeSet import android.view.View import android.widget.Checkable import android.widget.CompoundButton -import android.widget.Switch import eu.kanade.tachiyomi.util.getResourceColor import net.xpece.android.support.preference.PreferenceCategory import net.xpece.android.support.preference.R @@ -52,16 +50,12 @@ CompoundButton.OnCheckedChangeListener { if (view is SwitchCompat) { view.setOnCheckedChangeListener(null) - } else if (NATIVE_SWITCH_CAPABLE && view is Switch) { - view.setOnCheckedChangeListener(null) } view.toggle() if (view is SwitchCompat) { view.setOnCheckedChangeListener(this) - } else if (NATIVE_SWITCH_CAPABLE && view is Switch) { - view.setOnCheckedChangeListener(this) } } } @@ -130,8 +124,4 @@ CompoundButton.OnCheckedChangeListener { defaultValue as Boolean) } - companion object { - private val NATIVE_SWITCH_CAPABLE = Build.VERSION.SDK_INT >= ICE_CREAM_SANDWICH - } - } \ No newline at end of file diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 6e644174da..1568c1453a 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -67,9 +67,9 @@ + Image Rapid Skia - Image diff --git a/app/src/main/res/values/keys.xml b/app/src/main/res/values/keys.xml index 31da7fa4ba..6263437115 100644 --- a/app/src/main/res/values/keys.xml +++ b/app/src/main/res/values/keys.xml @@ -36,7 +36,7 @@ color_filter_value pref_red_filter_value pref_reader_theme_key - pref_image_decoder_key + image_decoder reader_volume_keys reader_tap pref_filter_downloaded_key