mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
chore: Update SSIV and Image Decoder
This commit is contained in:
parent
32a34b7cf4
commit
c3faccacd2
10 changed files with 59 additions and 24 deletions
|
@ -15,4 +15,6 @@ class BasePreferences(private val preferenceStore: PreferenceStore) {
|
||||||
PRIVATE(R.string.ext_installer_private, false),
|
PRIVATE(R.string.ext_installer_private, false),
|
||||||
LEGACY(R.string.ext_installer_legacy, true), // Technically useless, but just in case it being missing crashes the app
|
LEGACY(R.string.ext_installer_legacy, true), // Technically useless, but just in case it being missing crashes the app
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun displayProfile() = preferenceStore.getString("pref_display_profile_key", "")
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ class TachiyomiImageDecoder(private val resources: ImageSource, private val opti
|
||||||
|
|
||||||
check(decoder != null && decoder.width > 0 && decoder.height > 0) { "Failed to initialize decoder." }
|
check(decoder != null && decoder.width > 0 && decoder.height > 0) { "Failed to initialize decoder." }
|
||||||
|
|
||||||
val bitmap = decoder.decode(rgb565 = options.allowRgb565)
|
val bitmap = decoder.decode()
|
||||||
decoder.recycle()
|
decoder.recycle()
|
||||||
|
|
||||||
check(bitmap != null) { "Failed to decode image." }
|
check(bitmap != null) { "Failed to decode image." }
|
||||||
|
|
|
@ -24,8 +24,6 @@ object PreferenceKeys {
|
||||||
|
|
||||||
const val showPageNumber = "pref_show_page_number_key"
|
const val showPageNumber = "pref_show_page_number_key"
|
||||||
|
|
||||||
const val trueColor = "pref_true_color_key"
|
|
||||||
|
|
||||||
const val fullscreen = "fullscreen"
|
const val fullscreen = "fullscreen"
|
||||||
|
|
||||||
const val keepScreenOn = "pref_keep_screen_on_key"
|
const val keepScreenOn = "pref_keep_screen_on_key"
|
||||||
|
|
|
@ -109,8 +109,6 @@ class PreferencesHelper(val context: Context, val preferenceStore: PreferenceSto
|
||||||
|
|
||||||
fun showPageNumber() = preferenceStore.getBoolean(Keys.showPageNumber, true)
|
fun showPageNumber() = preferenceStore.getBoolean(Keys.showPageNumber, true)
|
||||||
|
|
||||||
fun trueColor() = preferenceStore.getBoolean(Keys.trueColor, false)
|
|
||||||
|
|
||||||
fun fullscreen() = preferenceStore.getBoolean(Keys.fullscreen, true)
|
fun fullscreen() = preferenceStore.getBoolean(Keys.fullscreen, true)
|
||||||
|
|
||||||
fun keepScreenOn() = preferenceStore.getBoolean(Keys.keepScreenOn, true)
|
fun keepScreenOn() = preferenceStore.getBoolean(Keys.keepScreenOn, true)
|
||||||
|
|
|
@ -74,6 +74,8 @@ import com.google.android.material.snackbar.Snackbar
|
||||||
import com.google.android.material.transition.platform.MaterialContainerTransformSharedElementCallback
|
import com.google.android.material.transition.platform.MaterialContainerTransformSharedElementCallback
|
||||||
import com.google.common.primitives.Floats.max
|
import com.google.common.primitives.Floats.max
|
||||||
import com.google.common.primitives.Ints.max
|
import com.google.common.primitives.Ints.max
|
||||||
|
import dev.yokai.domain.base.BasePreferences
|
||||||
|
import dev.yokai.domain.ui.settings.ReaderPreferences
|
||||||
import dev.yokai.presentation.extension.repo.ExtensionRepoController
|
import dev.yokai.presentation.extension.repo.ExtensionRepoController
|
||||||
import eu.kanade.tachiyomi.BuildConfig
|
import eu.kanade.tachiyomi.BuildConfig
|
||||||
import eu.kanade.tachiyomi.Migrations
|
import eu.kanade.tachiyomi.Migrations
|
||||||
|
@ -206,6 +208,18 @@ open class MainActivity : BaseActivity<MainActivityBinding>() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ideally we want this to be inside the controller itself, but Conductor doesn't support the new ActivityResult API
|
||||||
|
// Should be fine once we moved completely to Compose..... someday....
|
||||||
|
// REF: https://github.com/bluelinelabs/Conductor/issues/612
|
||||||
|
private fun requestColourProfile(context: Context, basePreferences: BasePreferences) =
|
||||||
|
registerForActivityResult(ActivityResultContracts.OpenDocument()) { uri ->
|
||||||
|
uri?.let {
|
||||||
|
val flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
|
||||||
|
context.contentResolver.takePersistableUriPermission(uri, flags)
|
||||||
|
basePreferences.displayProfile().set(uri.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun setUndoSnackBar(snackBar: Snackbar?, extraViewToCheck: View? = null) {
|
fun setUndoSnackBar(snackBar: Snackbar?, extraViewToCheck: View? = null) {
|
||||||
this.snackBar = snackBar
|
this.snackBar = snackBar
|
||||||
canDismissSnackBar = false
|
canDismissSnackBar = false
|
||||||
|
@ -995,6 +1009,11 @@ open class MainActivity : BaseActivity<MainActivityBinding>() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun showColourProfilePicker(context: Context, basePreferences: BasePreferences) {
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return
|
||||||
|
requestColourProfile(context, basePreferences).launch(arrayOf("*/*"))
|
||||||
|
}
|
||||||
|
|
||||||
override fun onNewIntent(intent: Intent) {
|
override fun onNewIntent(intent: Intent) {
|
||||||
if (!handleIntentAction(intent)) {
|
if (!handleIntentAction(intent)) {
|
||||||
super.onNewIntent(intent)
|
super.onNewIntent(intent)
|
||||||
|
|
|
@ -41,6 +41,7 @@ import androidx.activity.viewModels
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.graphics.ColorUtils
|
import androidx.core.graphics.ColorUtils
|
||||||
|
import androidx.core.net.toUri
|
||||||
import androidx.core.text.buildSpannedString
|
import androidx.core.text.buildSpannedString
|
||||||
import androidx.core.text.inSpans
|
import androidx.core.text.inSpans
|
||||||
import androidx.core.transition.addListener
|
import androidx.core.transition.addListener
|
||||||
|
@ -71,6 +72,8 @@ import com.google.android.material.slider.Slider
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import com.google.android.material.transition.platform.MaterialContainerTransform
|
import com.google.android.material.transition.platform.MaterialContainerTransform
|
||||||
import com.google.android.material.transition.platform.MaterialContainerTransformSharedElementCallback
|
import com.google.android.material.transition.platform.MaterialContainerTransformSharedElementCallback
|
||||||
|
import com.hippo.unifile.UniFile
|
||||||
|
import dev.yokai.domain.base.BasePreferences
|
||||||
import dev.yokai.domain.ui.settings.ReaderPreferences
|
import dev.yokai.domain.ui.settings.ReaderPreferences
|
||||||
import dev.yokai.domain.ui.settings.ReaderPreferences.LandscapeCutoutBehaviour
|
import dev.yokai.domain.ui.settings.ReaderPreferences.LandscapeCutoutBehaviour
|
||||||
import eu.kanade.tachiyomi.BuildConfig
|
import eu.kanade.tachiyomi.BuildConfig
|
||||||
|
@ -155,6 +158,7 @@ import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
import java.io.ByteArrayOutputStream
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.text.DecimalFormatSymbols
|
import java.text.DecimalFormatSymbols
|
||||||
|
@ -239,6 +243,7 @@ class ReaderActivity : BaseActivity<ReaderActivityBinding>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private val readerPreferences: ReaderPreferences by injectLazy()
|
private val readerPreferences: ReaderPreferences by injectLazy()
|
||||||
|
private val basePreferences: BasePreferences by injectLazy()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
|
@ -1954,7 +1959,7 @@ class ReaderActivity : BaseActivity<ReaderActivityBinding>() {
|
||||||
.onEach { setCutoutMode() }
|
.onEach { setCutoutMode() }
|
||||||
.launchIn(scope)
|
.launchIn(scope)
|
||||||
|
|
||||||
preferences.trueColor().changesIn(scope) { setTrueColor(it) }
|
basePreferences.displayProfile().changesIn(scope) { setDisplayProfile(it) }
|
||||||
|
|
||||||
preferences.fullscreen().changesIn(scope) { setFullscreen(it) }
|
preferences.fullscreen().changesIn(scope) { setFullscreen(it) }
|
||||||
|
|
||||||
|
@ -2001,13 +2006,19 @@ class ReaderActivity : BaseActivity<ReaderActivityBinding>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the 32-bit color mode according to [enabled].
|
* Sets the display profile to [path].
|
||||||
*/
|
*/
|
||||||
private fun setTrueColor(enabled: Boolean) {
|
private fun setDisplayProfile(path: String) {
|
||||||
if (enabled) {
|
val file = UniFile.fromUri(baseContext, path.toUri())
|
||||||
SubsamplingScaleImageView.setPreferredBitmapConfig(Bitmap.Config.ARGB_8888)
|
if (file != null && file.exists()) {
|
||||||
} else {
|
val inputStream = file.openInputStream()
|
||||||
SubsamplingScaleImageView.setPreferredBitmapConfig(Bitmap.Config.RGB_565)
|
val outputStream = ByteArrayOutputStream()
|
||||||
|
inputStream.use { input ->
|
||||||
|
outputStream.use { output ->
|
||||||
|
input.copyTo(output)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SubsamplingScaleImageView.setDisplayProfile(outputStream.toByteArray())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.preference.PreferenceScreen
|
import androidx.preference.PreferenceScreen
|
||||||
import com.google.firebase.crashlytics.ktx.crashlytics
|
import com.google.firebase.crashlytics.ktx.crashlytics
|
||||||
import com.google.firebase.ktx.Firebase
|
import com.google.firebase.ktx.Firebase
|
||||||
import dev.yokai.domain.base.BasePreferences
|
|
||||||
import dev.yokai.domain.base.BasePreferences.ExtensionInstaller
|
import dev.yokai.domain.base.BasePreferences.ExtensionInstaller
|
||||||
import dev.yokai.domain.extension.TrustExtension
|
import dev.yokai.domain.extension.TrustExtension
|
||||||
import eu.kanade.tachiyomi.BuildConfig
|
import eu.kanade.tachiyomi.BuildConfig
|
||||||
|
@ -41,6 +40,7 @@ import eu.kanade.tachiyomi.network.PREF_DOH_GOOGLE
|
||||||
import eu.kanade.tachiyomi.network.PREF_DOH_QUAD101
|
import eu.kanade.tachiyomi.network.PREF_DOH_QUAD101
|
||||||
import eu.kanade.tachiyomi.network.PREF_DOH_QUAD9
|
import eu.kanade.tachiyomi.network.PREF_DOH_QUAD9
|
||||||
import eu.kanade.tachiyomi.source.SourceManager
|
import eu.kanade.tachiyomi.source.SourceManager
|
||||||
|
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||||
import eu.kanade.tachiyomi.ui.setting.database.ClearDatabaseController
|
import eu.kanade.tachiyomi.ui.setting.database.ClearDatabaseController
|
||||||
import eu.kanade.tachiyomi.ui.setting.debug.DebugController
|
import eu.kanade.tachiyomi.ui.setting.debug.DebugController
|
||||||
import eu.kanade.tachiyomi.util.CrashLogUtil
|
import eu.kanade.tachiyomi.util.CrashLogUtil
|
||||||
|
@ -398,6 +398,20 @@ class SettingsAdvancedController : SettingsController() {
|
||||||
onClick { LibraryUpdateJob.startNow(context, target = Target.TRACKING) }
|
onClick { LibraryUpdateJob.startNow(context, target = Target.TRACKING) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
preferenceCategory {
|
||||||
|
titleRes = R.string.reader
|
||||||
|
|
||||||
|
preference {
|
||||||
|
key = "pref_display_profile"
|
||||||
|
titleRes = R.string.pref_display_profile
|
||||||
|
onClick {
|
||||||
|
(activity as? MainActivity)?.showColourProfilePicker(context, basePreferences)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun cleanupDownloads(removeRead: Boolean, removeNonFavorite: Boolean) {
|
private fun cleanupDownloads(removeRead: Boolean, removeNonFavorite: Boolean) {
|
||||||
|
|
|
@ -58,14 +58,6 @@ class SettingsReaderController : SettingsController() {
|
||||||
titleRes = R.string.animate_page_transitions
|
titleRes = R.string.animate_page_transitions
|
||||||
defaultValue = true
|
defaultValue = true
|
||||||
}
|
}
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
switchPreference {
|
|
||||||
key = Keys.trueColor
|
|
||||||
titleRes = R.string.true_32bit_color
|
|
||||||
summaryRes = R.string.reduces_banding_impacts_performance
|
|
||||||
defaultValue = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
intListPreference(activity) {
|
intListPreference(activity) {
|
||||||
key = Keys.preloadSize
|
key = Keys.preloadSize
|
||||||
titleRes = R.string.page_preload_amount
|
titleRes = R.string.page_preload_amount
|
||||||
|
|
|
@ -522,6 +522,7 @@
|
||||||
<item quantity="one">Skipping %d chapter, either the source is missing it or it has been filtered out</item>
|
<item quantity="one">Skipping %d chapter, either the source is missing it or it has been filtered out</item>
|
||||||
<item quantity="other">Skipping %d chapters, either the source is missing them or they have been filtered out</item>
|
<item quantity="other">Skipping %d chapters, either the source is missing them or they have been filtered out</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
|
<string name="pref_display_profile">Custom display profile</string>
|
||||||
|
|
||||||
<!-- Manga details -->
|
<!-- Manga details -->
|
||||||
<string name="about_this_">About this %1$s</string>
|
<string name="about_this_">About this %1$s</string>
|
||||||
|
|
|
@ -29,7 +29,7 @@ flexible-adapter = { module = "com.github.arkon.FlexibleAdapter:flexible-adapter
|
||||||
google-services = { module = "com.google.gms:google-services", version = "4.3.15" }
|
google-services = { module = "com.google.gms:google-services", version = "4.3.15" }
|
||||||
gradle = { module = "com.android.tools.build:gradle", version = "8.1.4" }
|
gradle = { module = "com.android.tools.build:gradle", version = "8.1.4" }
|
||||||
guava = { module = "com.google.guava:guava", version = "31.1-android" }
|
guava = { module = "com.google.guava:guava", version = "31.1-android" }
|
||||||
image-decoder = { module = "com.github.tachiyomiorg:image-decoder", version = "fbd6601290" }
|
image-decoder = { module = "com.github.tachiyomiorg:image-decoder", version = "e08e9be535" }
|
||||||
injekt-core = { module = "com.github.inorichi.injekt:injekt-core", version = "65b0440" }
|
injekt-core = { module = "com.github.inorichi.injekt:injekt-core", version = "65b0440" }
|
||||||
material = { module = "com.google.android.material:material", version = "1.11.0" }
|
material = { module = "com.google.android.material:material", version = "1.11.0" }
|
||||||
material-design-dimens = { module = "com.dmitrymalkovich.android:material-design-dimens", version = "1.4" }
|
material-design-dimens = { module = "com.dmitrymalkovich.android:material-design-dimens", version = "1.4" }
|
||||||
|
@ -56,7 +56,7 @@ rxjava = { module = "io.reactivex:rxjava", version = "1.3.8" }
|
||||||
rxandroid = { module = "io.reactivex:rxandroid", version = "1.2.1" }
|
rxandroid = { module = "io.reactivex:rxandroid", version = "1.2.1" }
|
||||||
slice = { module = "com.github.mthli:Slice", version = "v1.2" }
|
slice = { module = "com.github.mthli:Slice", version = "v1.2" }
|
||||||
sqlite-android = { module = "com.github.requery:sqlite-android", version = "3.39.2" }
|
sqlite-android = { module = "com.github.requery:sqlite-android", version = "3.39.2" }
|
||||||
subsamplingscaleimageview = { module = "com.github.null2264:subsampling-scale-image-view", version = "e3cffd59c5" }
|
subsamplingscaleimageview = { module = "com.github.null2264:subsampling-scale-image-view", version = "338caedb5f" }
|
||||||
shizuku-api = { module = "dev.rikka.shizuku:api", version.ref = "shizuku" }
|
shizuku-api = { module = "dev.rikka.shizuku:api", version.ref = "shizuku" }
|
||||||
shizuku-provider = { module = "dev.rikka.shizuku:provider", version.ref = "shizuku" }
|
shizuku-provider = { module = "dev.rikka.shizuku:provider", version.ref = "shizuku" }
|
||||||
taptargetview = { module = "com.getkeepsafe.taptargetview:taptargetview", version = "1.13.3" }
|
taptargetview = { module = "com.getkeepsafe.taptargetview:taptargetview", version = "1.13.3" }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue