mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 06:17:57 +01:00 
			
		
		
		
	Add option to always use SSIV for image decoding
This commit is contained in:
		| @@ -18,6 +18,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co | |||||||
| - Fixed "currentTab was used multiple times" | - Fixed "currentTab was used multiple times" | ||||||
| - Fixed a rare crash when invoking "Mark previous as read" action | - Fixed a rare crash when invoking "Mark previous as read" action | ||||||
| - Fixed long strip images not loading in some old devices | - Fixed long strip images not loading in some old devices | ||||||
|  |   - Added option to always use SSIV for image decoding | ||||||
|  |  | ||||||
| ### Improved | ### Improved | ||||||
| - Bangumi search now shows the score and summary of a search result ([@MajorTanya](https://github.com/MajorTanya)) ([#1396](https://github.com/mihonapp/mihon/pull/1396)) | - Bangumi search now shows the score and summary of a search result ([@MajorTanya](https://github.com/MajorTanya)) ([#1396](https://github.com/mihonapp/mihon/pull/1396)) | ||||||
|   | |||||||
| @@ -30,4 +30,6 @@ class BasePreferences( | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     fun displayProfile() = preferenceStore.getString("pref_display_profile_key", "") |     fun displayProfile() = preferenceStore.getString("pref_display_profile_key", "") | ||||||
|  |  | ||||||
|  |     fun alwaysUseSSIVToDecode() = preferenceStore.getBoolean("pref_always_use_ssiv_to_decode", false) | ||||||
| } | } | ||||||
|   | |||||||
| @@ -341,6 +341,10 @@ object SettingsAdvancedScreen : SearchableSettings { | |||||||
|                         chooseColorProfile.launch(arrayOf("*/*")) |                         chooseColorProfile.launch(arrayOf("*/*")) | ||||||
|                     }, |                     }, | ||||||
|                 ), |                 ), | ||||||
|  |                 Preference.PreferenceItem.SwitchPreference( | ||||||
|  |                     pref = basePreferences.alwaysUseSSIVToDecode(), | ||||||
|  |                     title = stringResource(MR.strings.pref_always_use_ssiv_to_decode), | ||||||
|  |                 ), | ||||||
|             ), |             ), | ||||||
|         ) |         ) | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -33,6 +33,7 @@ import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.EASE_IN_OUT | |||||||
| import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.EASE_OUT_QUAD | import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.EASE_OUT_QUAD | ||||||
| import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.SCALE_TYPE_CENTER_INSIDE | import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.SCALE_TYPE_CENTER_INSIDE | ||||||
| import com.github.chrisbanes.photoview.PhotoView | import com.github.chrisbanes.photoview.PhotoView | ||||||
|  | import eu.kanade.domain.base.BasePreferences | ||||||
| import eu.kanade.tachiyomi.data.coil.cropBorders | import eu.kanade.tachiyomi.data.coil.cropBorders | ||||||
| import eu.kanade.tachiyomi.data.coil.customDecoder | import eu.kanade.tachiyomi.data.coil.customDecoder | ||||||
| import eu.kanade.tachiyomi.ui.reader.viewer.webtoon.WebtoonSubsamplingImageView | import eu.kanade.tachiyomi.ui.reader.viewer.webtoon.WebtoonSubsamplingImageView | ||||||
| @@ -41,6 +42,8 @@ import eu.kanade.tachiyomi.util.system.animatorDurationScale | |||||||
| import eu.kanade.tachiyomi.util.view.isVisibleOnScreen | import eu.kanade.tachiyomi.util.view.isVisibleOnScreen | ||||||
| import okio.BufferedSource | import okio.BufferedSource | ||||||
| import tachiyomi.core.common.util.system.ImageUtil | import tachiyomi.core.common.util.system.ImageUtil | ||||||
|  | import uy.kohesive.injekt.Injekt | ||||||
|  | import uy.kohesive.injekt.api.get | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * A wrapper view for showing page image. |  * A wrapper view for showing page image. | ||||||
| @@ -58,6 +61,8 @@ open class ReaderPageImageView @JvmOverloads constructor( | |||||||
|     private val isWebtoon: Boolean = false, |     private val isWebtoon: Boolean = false, | ||||||
| ) : FrameLayout(context, attrs, defStyleAttrs, defStyleRes) { | ) : FrameLayout(context, attrs, defStyleAttrs, defStyleRes) { | ||||||
|  |  | ||||||
|  |     private val alwaysUseSSIVToDecode by lazy { Injekt.get<BasePreferences>().alwaysUseSSIVToDecode().get() } | ||||||
|  |  | ||||||
|     private var pageView: View? = null |     private var pageView: View? = null | ||||||
|  |  | ||||||
|     private var config: Config? = null |     private var config: Config? = null | ||||||
| @@ -295,7 +300,7 @@ open class ReaderPageImageView @JvmOverloads constructor( | |||||||
|                 isVisible = true |                 isVisible = true | ||||||
|             } |             } | ||||||
|             is BufferedSource -> { |             is BufferedSource -> { | ||||||
|                 if (!isWebtoon || !ImageUtil.canUseCoilToDecode(data)) { |                 if (alwaysUseSSIVToDecode || !isWebtoon || !ImageUtil.canUseCoilToDecode(data)) { | ||||||
|                     setImage(ImageSource.inputStream(data.inputStream())) |                     setImage(ImageSource.inputStream(data.inputStream())) | ||||||
|                     isVisible = true |                     isVisible = true | ||||||
|                 } else { |                 } else { | ||||||
|   | |||||||
| @@ -392,6 +392,7 @@ | |||||||
|     <string name="pref_show_reading_mode">Show reading mode</string> |     <string name="pref_show_reading_mode">Show reading mode</string> | ||||||
|     <string name="pref_show_reading_mode_summary">Briefly show current mode when reader is opened</string> |     <string name="pref_show_reading_mode_summary">Briefly show current mode when reader is opened</string> | ||||||
|     <string name="pref_display_profile">Custom display profile</string> |     <string name="pref_display_profile">Custom display profile</string> | ||||||
|  |     <string name="pref_always_use_ssiv_to_decode">Always use SSIV to decode long strip images</string> | ||||||
|     <string name="pref_crop_borders">Crop borders</string> |     <string name="pref_crop_borders">Crop borders</string> | ||||||
|     <string name="pref_custom_brightness">Custom brightness</string> |     <string name="pref_custom_brightness">Custom brightness</string> | ||||||
|     <string name="pref_grayscale">Grayscale</string> |     <string name="pref_grayscale">Grayscale</string> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user