Image is now the default decoder

This commit is contained in:
len 2016-12-03 16:12:58 +01:00
parent f514d466a6
commit 2e39be6625
5 changed files with 14 additions and 23 deletions

View file

@ -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 * in the file "keys.xml". By using this class we can define preferences in one place and get them
* referenced here. * referenced here.
*/ */
@Suppress("HasPlatformType")
class PreferenceKeys(context: Context) { class PreferenceKeys(context: Context) {
val theme = context.getString(R.string.pref_theme_key) 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" 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)
} }

View file

@ -16,9 +16,9 @@ abstract class BaseReader : BaseFragment() {
companion object { companion object {
/** /**
* Rapid decoder. * Image decoder.
*/ */
const val RAPID_DECODER = 0 const val IMAGE_DECODER = 0
/** /**
* Skia decoder. * Skia decoder.
@ -26,9 +26,9 @@ abstract class BaseReader : BaseFragment() {
const val SKIA_DECODER = 1 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) { fun setDecoderClass(value: Int) {
when (value) { when (value) {
RAPID_DECODER -> { IMAGE_DECODER -> {
bitmapDecoderClass = RapidImageDecoder::class.java bitmapDecoderClass = IImageDecoder::class.java
regionDecoderClass = RapidImageRegionDecoder::class.java regionDecoderClass = IImageRegionDecoder::class.java
} }
SKIA_DECODER -> { SKIA_DECODER -> {
bitmapDecoderClass = SkiaImageDecoder::class.java bitmapDecoderClass = SkiaImageDecoder::class.java
regionDecoderClass = SkiaImageRegionDecoder::class.java regionDecoderClass = SkiaImageRegionDecoder::class.java
} }
IMAGE_DECODER -> { RAPID_DECODER -> {
bitmapDecoderClass = IImageDecoder::class.java bitmapDecoderClass = RapidImageDecoder::class.java
regionDecoderClass = IImageRegionDecoder::class.java regionDecoderClass = RapidImageRegionDecoder::class.java
} }
} }
} }

View file

@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.widget.preference
import android.annotation.TargetApi import android.annotation.TargetApi
import android.content.Context import android.content.Context
import android.content.res.TypedArray import android.content.res.TypedArray
import android.os.Build
import android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH import android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH
import android.support.v7.preference.PreferenceViewHolder import android.support.v7.preference.PreferenceViewHolder
import android.support.v7.widget.SwitchCompat import android.support.v7.widget.SwitchCompat
@ -11,7 +10,6 @@ import android.util.AttributeSet
import android.view.View import android.view.View
import android.widget.Checkable import android.widget.Checkable
import android.widget.CompoundButton import android.widget.CompoundButton
import android.widget.Switch
import eu.kanade.tachiyomi.util.getResourceColor import eu.kanade.tachiyomi.util.getResourceColor
import net.xpece.android.support.preference.PreferenceCategory import net.xpece.android.support.preference.PreferenceCategory
import net.xpece.android.support.preference.R import net.xpece.android.support.preference.R
@ -52,16 +50,12 @@ CompoundButton.OnCheckedChangeListener {
if (view is SwitchCompat) { if (view is SwitchCompat) {
view.setOnCheckedChangeListener(null) view.setOnCheckedChangeListener(null)
} else if (NATIVE_SWITCH_CAPABLE && view is Switch) {
view.setOnCheckedChangeListener(null)
} }
view.toggle() view.toggle()
if (view is SwitchCompat) { if (view is SwitchCompat) {
view.setOnCheckedChangeListener(this) view.setOnCheckedChangeListener(this)
} else if (NATIVE_SWITCH_CAPABLE && view is Switch) {
view.setOnCheckedChangeListener(this)
} }
} }
} }
@ -130,8 +124,4 @@ CompoundButton.OnCheckedChangeListener {
defaultValue as Boolean) defaultValue as Boolean)
} }
companion object {
private val NATIVE_SWITCH_CAPABLE = Build.VERSION.SDK_INT >= ICE_CREAM_SANDWICH
}
} }

View file

@ -67,9 +67,9 @@
</string-array> </string-array>
<string-array name="image_decoders"> <string-array name="image_decoders">
<item>Image</item>
<item>Rapid</item> <item>Rapid</item>
<item>Skia</item> <item>Skia</item>
<item>Image</item>
</string-array> </string-array>
<string-array name="image_decoders_values"> <string-array name="image_decoders_values">

View file

@ -36,7 +36,7 @@
<string name="pref_color_filter_value_key">color_filter_value</string> <string name="pref_color_filter_value_key">color_filter_value</string>
<string name="pref_red_filter_value_key">pref_red_filter_value</string> <string name="pref_red_filter_value_key">pref_red_filter_value</string>
<string name="pref_reader_theme_key">pref_reader_theme_key</string> <string name="pref_reader_theme_key">pref_reader_theme_key</string>
<string name="pref_image_decoder_key">pref_image_decoder_key</string> <string name="pref_image_decoder_key">image_decoder</string>
<string name="pref_read_with_volume_keys_key">reader_volume_keys</string> <string name="pref_read_with_volume_keys_key">reader_volume_keys</string>
<string name="pref_read_with_tapping_key">reader_tap</string> <string name="pref_read_with_tapping_key">reader_tap</string>
<string name="pref_filter_downloaded_key">pref_filter_downloaded_key</string> <string name="pref_filter_downloaded_key">pref_filter_downloaded_key</string>