Fix warnings and enable locales-config auto-generating
This commit is contained in:
@@ -9,24 +9,24 @@ plugins {
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdk = 33
|
compileSdk = 33
|
||||||
compileSdkExtension = 4
|
// compileSdkExtension = 4
|
||||||
buildToolsVersion = '34.0.0'
|
buildToolsVersion = '34.0.0'
|
||||||
namespace = 'org.koitharu.kotatsu'
|
namespace = 'org.koitharu.kotatsu'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId 'org.koitharu.kotatsu'
|
applicationId 'org.koitharu.kotatsu'
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
//TODO: update as soon as sources becomes available
|
|
||||||
//noinspection OldTargetApi
|
|
||||||
targetSdkVersion 33
|
targetSdkVersion 33
|
||||||
versionCode 567
|
versionCode 567
|
||||||
versionName '5.3.10'
|
versionName '5.3.10'
|
||||||
generatedDensities = []
|
generatedDensities = []
|
||||||
testInstrumentationRunner "org.koitharu.kotatsu.HiltTestRunner"
|
testInstrumentationRunner "org.koitharu.kotatsu.HiltTestRunner"
|
||||||
|
|
||||||
ksp {
|
ksp {
|
||||||
arg("room.schemaLocation", "$projectDir/schemas")
|
arg("room.schemaLocation", "$projectDir/schemas")
|
||||||
}
|
}
|
||||||
|
androidResources {
|
||||||
|
generateLocaleConfig true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
debug {
|
debug {
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
package org.koitharu.kotatsu.core.util
|
|
||||||
|
|
||||||
import android.util.Log
|
|
||||||
import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver
|
|
||||||
|
|
||||||
class LoggingAdapterDataObserver(
|
|
||||||
private val tag: String,
|
|
||||||
) : AdapterDataObserver() {
|
|
||||||
|
|
||||||
override fun onChanged() {
|
|
||||||
Log.d(tag, "onChanged()")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onItemRangeChanged(positionStart: Int, itemCount: Int) {
|
|
||||||
Log.d(tag, "onItemRangeChanged(positionStart=$positionStart, itemCount=$itemCount)")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onItemRangeChanged(positionStart: Int, itemCount: Int, payload: Any?) {
|
|
||||||
Log.d(tag, "onItemRangeChanged(positionStart=$positionStart, itemCount=$itemCount, payload=$payload)")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onItemRangeInserted(positionStart: Int, itemCount: Int) {
|
|
||||||
Log.d(tag, "onItemRangeInserted(positionStart=$positionStart, itemCount=$itemCount)")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onItemRangeRemoved(positionStart: Int, itemCount: Int) {
|
|
||||||
Log.d(tag, "onItemRangeRemoved(positionStart=$positionStart, itemCount=$itemCount)")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onItemRangeMoved(fromPosition: Int, toPosition: Int, itemCount: Int) {
|
|
||||||
Log.d(tag, "onItemRangeMoved(fromPosition=$fromPosition, toPosition=$toPosition, itemCount=$itemCount)")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStateRestorationPolicyChanged() {
|
|
||||||
Log.d(tag, "onStateRestorationPolicyChanged()")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -46,7 +46,6 @@
|
|||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:largeHeap="true"
|
android:largeHeap="true"
|
||||||
android:localeConfig="@xml/locales"
|
|
||||||
android:networkSecurityConfig="@xml/network_security_config"
|
android:networkSecurityConfig="@xml/network_security_config"
|
||||||
android:requestLegacyExternalStorage="true"
|
android:requestLegacyExternalStorage="true"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import androidx.core.graphics.Insets
|
|||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.core.view.updatePadding
|
import androidx.core.view.updatePadding
|
||||||
import org.koitharu.kotatsu.R
|
import org.koitharu.kotatsu.R
|
||||||
import org.koitharu.kotatsu.core.network.CommonHeadersInterceptor
|
|
||||||
import org.koitharu.kotatsu.core.ui.BaseActivity
|
import org.koitharu.kotatsu.core.ui.BaseActivity
|
||||||
import org.koitharu.kotatsu.core.util.ext.catchingWebViewUnavailability
|
import org.koitharu.kotatsu.core.util.ext.catchingWebViewUnavailability
|
||||||
import org.koitharu.kotatsu.databinding.ActivityBrowserBinding
|
import org.koitharu.kotatsu.databinding.ActivityBrowserBinding
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import android.content.Intent
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.webkit.CookieManager
|
import android.webkit.CookieManager
|
||||||
import android.webkit.WebSettings
|
|
||||||
import androidx.activity.result.contract.ActivityResultContract
|
import androidx.activity.result.contract.ActivityResultContract
|
||||||
import androidx.core.graphics.Insets
|
import androidx.core.graphics.Insets
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
@@ -18,7 +17,6 @@ import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
|||||||
import org.koitharu.kotatsu.R
|
import org.koitharu.kotatsu.R
|
||||||
import org.koitharu.kotatsu.browser.WebViewBackPressedCallback
|
import org.koitharu.kotatsu.browser.WebViewBackPressedCallback
|
||||||
import org.koitharu.kotatsu.core.network.CommonHeaders
|
import org.koitharu.kotatsu.core.network.CommonHeaders
|
||||||
import org.koitharu.kotatsu.core.network.CommonHeadersInterceptor
|
|
||||||
import org.koitharu.kotatsu.core.network.cookies.MutableCookieJar
|
import org.koitharu.kotatsu.core.network.cookies.MutableCookieJar
|
||||||
import org.koitharu.kotatsu.core.ui.BaseActivity
|
import org.koitharu.kotatsu.core.ui.BaseActivity
|
||||||
import org.koitharu.kotatsu.core.util.TaggedActivityResult
|
import org.koitharu.kotatsu.core.util.TaggedActivityResult
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ abstract class BaseActivity<B : ViewBinding> :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem) = if (item.itemId == android.R.id.home) {
|
override fun onOptionsItemSelected(item: MenuItem) = if (item.itemId == android.R.id.home) {
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
onBackPressed()
|
onBackPressed()
|
||||||
true
|
true
|
||||||
} else super.onOptionsItemSelected(item)
|
} else super.onOptionsItemSelected(item)
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
package org.koitharu.kotatsu.core.ui.dialog
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.graphics.Color
|
|
||||||
import android.view.View
|
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
|
||||||
|
|
||||||
class AppBottomSheetDialog(context: Context, theme: Int) : BottomSheetDialog(context, theme) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* https://github.com/material-components/material-components-android/issues/2582
|
|
||||||
*/
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
override fun onAttachedToWindow() {
|
|
||||||
val window = window
|
|
||||||
val initialSystemUiVisibility = window?.decorView?.systemUiVisibility ?: 0
|
|
||||||
super.onAttachedToWindow()
|
|
||||||
if (window != null) {
|
|
||||||
// If the navigation bar is translucent at all, the BottomSheet should be edge to edge
|
|
||||||
val drawEdgeToEdge = edgeToEdgeEnabled && Color.alpha(window.navigationBarColor) < 0xFF
|
|
||||||
if (drawEdgeToEdge) {
|
|
||||||
// Copied from super.onAttachedToWindow:
|
|
||||||
val edgeToEdgeFlags = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
|
||||||
// Fix super-class's window flag bug by respecting the initial system UI visibility:
|
|
||||||
window.decorView.systemUiVisibility = edgeToEdgeFlags or initialSystemUiVisibility
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
package org.koitharu.kotatsu.core.ui.list.decor
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Context
|
|
||||||
import android.graphics.Canvas
|
|
||||||
import android.graphics.Paint
|
|
||||||
import android.graphics.Rect
|
|
||||||
import android.view.View
|
|
||||||
import androidx.core.content.res.getColorOrThrow
|
|
||||||
import androidx.core.view.children
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import com.google.android.material.R as materialR
|
|
||||||
|
|
||||||
@SuppressLint("PrivateResource")
|
|
||||||
abstract class AbstractDividerItemDecoration(context: Context) : RecyclerView.ItemDecoration() {
|
|
||||||
|
|
||||||
private val bounds = Rect()
|
|
||||||
private val thickness: Int
|
|
||||||
private val paint = Paint(Paint.ANTI_ALIAS_FLAG)
|
|
||||||
|
|
||||||
init {
|
|
||||||
paint.style = Paint.Style.FILL
|
|
||||||
val ta = context.obtainStyledAttributes(
|
|
||||||
null,
|
|
||||||
materialR.styleable.MaterialDivider,
|
|
||||||
materialR.attr.materialDividerStyle,
|
|
||||||
materialR.style.Widget_Material3_MaterialDivider,
|
|
||||||
)
|
|
||||||
paint.color = ta.getColorOrThrow(materialR.styleable.MaterialDivider_dividerColor)
|
|
||||||
thickness = ta.getDimensionPixelSize(
|
|
||||||
materialR.styleable.MaterialDivider_dividerThickness,
|
|
||||||
context.resources.getDimensionPixelSize(materialR.dimen.material_divider_thickness),
|
|
||||||
)
|
|
||||||
ta.recycle()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
override fun getItemOffsets(
|
|
||||||
outRect: Rect,
|
|
||||||
view: View,
|
|
||||||
parent: RecyclerView,
|
|
||||||
state: RecyclerView.State,
|
|
||||||
) {
|
|
||||||
outRect.set(0, thickness, 0, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO implement for horizontal lists on demand
|
|
||||||
override fun onDraw(canvas: Canvas, parent: RecyclerView, s: RecyclerView.State) {
|
|
||||||
if (parent.layoutManager == null || thickness == 0) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
canvas.save()
|
|
||||||
val left: Float
|
|
||||||
val right: Float
|
|
||||||
if (parent.clipToPadding) {
|
|
||||||
left = parent.paddingLeft.toFloat()
|
|
||||||
right = (parent.width - parent.paddingRight).toFloat()
|
|
||||||
canvas.clipRect(
|
|
||||||
left,
|
|
||||||
parent.paddingTop.toFloat(),
|
|
||||||
right,
|
|
||||||
(parent.height - parent.paddingBottom).toFloat(),
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
left = 0f
|
|
||||||
right = parent.width.toFloat()
|
|
||||||
}
|
|
||||||
|
|
||||||
var previous: RecyclerView.ViewHolder? = null
|
|
||||||
for (child in parent.children) {
|
|
||||||
val holder = parent.getChildViewHolder(child)
|
|
||||||
if (previous != null && shouldDrawDivider(previous, holder)) {
|
|
||||||
parent.getDecoratedBoundsWithMargins(child, bounds)
|
|
||||||
val top: Float = bounds.top + child.translationY
|
|
||||||
val bottom: Float = top + thickness
|
|
||||||
canvas.drawRect(left, top, right, bottom, paint)
|
|
||||||
}
|
|
||||||
previous = holder
|
|
||||||
}
|
|
||||||
canvas.restore()
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract fun shouldDrawDivider(
|
|
||||||
above: RecyclerView.ViewHolder,
|
|
||||||
below: RecyclerView.ViewHolder,
|
|
||||||
): Boolean
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
package org.koitharu.kotatsu.core.util.ext
|
package org.koitharu.kotatsu.core.util.ext
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.app.ActivityManager
|
import android.app.ActivityManager
|
||||||
import android.app.ActivityManager.MemoryInfo
|
import android.app.ActivityManager.MemoryInfo
|
||||||
import android.app.ActivityOptions
|
import android.app.ActivityOptions
|
||||||
|
import android.app.LocaleConfig
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Context.ACTIVITY_SERVICE
|
import android.content.Context.ACTIVITY_SERVICE
|
||||||
import android.content.Context.POWER_SERVICE
|
import android.content.Context.POWER_SERVICE
|
||||||
@@ -12,7 +14,6 @@ import android.content.OperationApplicationException
|
|||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.content.SyncResult
|
import android.content.SyncResult
|
||||||
import android.content.pm.ResolveInfo
|
import android.content.pm.ResolveInfo
|
||||||
import android.content.res.Resources
|
|
||||||
import android.database.SQLException
|
import android.database.SQLException
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
@@ -172,10 +173,17 @@ fun scaleUpActivityOptionsOf(view: View): Bundle? = if (view.context.isAnimation
|
|||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Resources.getLocalesConfig(): LocaleListCompat {
|
@SuppressLint("DiscouragedApi")
|
||||||
|
fun Context.getLocalesConfig(): LocaleListCompat {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
|
LocaleConfig(this).supportedLocales?.let {
|
||||||
|
return LocaleListCompat.wrap(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
val tagsList = StringJoiner(",")
|
val tagsList = StringJoiner(",")
|
||||||
try {
|
try {
|
||||||
val xpp: XmlPullParser = getXml(R.xml.locales)
|
val resId = resources.getIdentifier("_generated_res_locale_config", "xml", packageName)
|
||||||
|
val xpp: XmlPullParser = resources.getXml(resId)
|
||||||
while (xpp.eventType != XmlPullParser.END_DOCUMENT) {
|
while (xpp.eventType != XmlPullParser.END_DOCUMENT) {
|
||||||
if (xpp.eventType == XmlPullParser.START_TAG) {
|
if (xpp.eventType == XmlPullParser.START_TAG) {
|
||||||
if (xpp.name == "locale") {
|
if (xpp.name == "locale") {
|
||||||
|
|||||||
@@ -5,15 +5,6 @@ import androidx.collection.ArraySet
|
|||||||
import java.util.Collections
|
import java.util.Collections
|
||||||
import java.util.EnumSet
|
import java.util.EnumSet
|
||||||
|
|
||||||
@Deprecated("TODO: remove")
|
|
||||||
fun <T> MutableList<T>.move(sourceIndex: Int, targetIndex: Int) {
|
|
||||||
if (sourceIndex <= targetIndex) {
|
|
||||||
Collections.rotate(subList(sourceIndex, targetIndex + 1), -1)
|
|
||||||
} else {
|
|
||||||
Collections.rotate(subList(targetIndex, sourceIndex + 1), 1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline fun <T> MutableSet(size: Int, init: (index: Int) -> T): MutableSet<T> {
|
inline fun <T> MutableSet(size: Int, init: (index: Int) -> T): MutableSet<T> {
|
||||||
val set = ArraySet<T>(size)
|
val set = ArraySet<T>(size)
|
||||||
repeat(size) { index -> set.add(init(index)) }
|
repeat(size) { index -> set.add(init(index)) }
|
||||||
@@ -41,10 +32,6 @@ fun <K, V> Map<K, V>.findKeyByValue(value: V): K? {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun <T> Collection<T>.filterToSet(predicate: (T) -> Boolean): Set<T> {
|
|
||||||
return filterTo(ArraySet(size), predicate)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun <T> Sequence<T>.toListSorted(comparator: Comparator<T>): List<T> {
|
fun <T> Sequence<T>.toListSorted(comparator: Comparator<T>): List<T> {
|
||||||
return toMutableList().apply { sortWith(comparator) }
|
return toMutableList().apply { sortWith(comparator) }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import androidx.annotation.ColorInt
|
|||||||
import androidx.annotation.FloatRange
|
import androidx.annotation.FloatRange
|
||||||
import androidx.annotation.Px
|
import androidx.annotation.Px
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.content.res.ResourcesCompat
|
|
||||||
import androidx.core.content.res.TypedArrayUtils
|
|
||||||
import androidx.core.content.res.use
|
import androidx.core.content.res.use
|
||||||
import androidx.core.graphics.ColorUtils
|
import androidx.core.graphics.ColorUtils
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
package org.koitharu.kotatsu.details.ui.adapter
|
|
||||||
|
|
||||||
import com.hannesdorfmann.adapterdelegates4.ListDelegationAdapter
|
|
||||||
import org.koitharu.kotatsu.core.ui.list.OnListItemClickListener
|
|
||||||
import org.koitharu.kotatsu.details.ui.model.MangaBranch
|
|
||||||
|
|
||||||
class BranchesAdapter(
|
|
||||||
list: List<MangaBranch>,
|
|
||||||
listener: OnListItemClickListener<MangaBranch>,
|
|
||||||
) : ListDelegationAdapter<List<MangaBranch>>() {
|
|
||||||
|
|
||||||
init {
|
|
||||||
delegatesManager.addDelegate(branchAD(listener))
|
|
||||||
items = list
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package org.koitharu.kotatsu.filter.ui.model
|
package org.koitharu.kotatsu.filter.ui.model
|
||||||
|
|
||||||
import org.koitharu.kotatsu.core.ui.widgets.ChipsView
|
import org.koitharu.kotatsu.core.ui.widgets.ChipsView
|
||||||
import org.koitharu.kotatsu.list.ui.model.ListModel
|
|
||||||
import org.koitharu.kotatsu.parsers.model.SortOrder
|
import org.koitharu.kotatsu.parsers.model.SortOrder
|
||||||
|
|
||||||
class FilterHeaderModel(
|
class FilterHeaderModel(
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import org.koitharu.kotatsu.core.prefs.AppSettings
|
|||||||
import org.koitharu.kotatsu.core.util.ext.computeSize
|
import org.koitharu.kotatsu.core.util.ext.computeSize
|
||||||
import org.koitharu.kotatsu.core.util.ext.getStorageName
|
import org.koitharu.kotatsu.core.util.ext.getStorageName
|
||||||
import org.koitharu.kotatsu.core.util.ext.resolveFile
|
import org.koitharu.kotatsu.core.util.ext.resolveFile
|
||||||
import org.koitharu.kotatsu.core.util.ext.toFileOrNull
|
|
||||||
import org.koitharu.kotatsu.parsers.util.mapToSet
|
import org.koitharu.kotatsu.parsers.util.mapToSet
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import androidx.core.net.toFile
|
|||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.runInterruptible
|
import kotlinx.coroutines.runInterruptible
|
||||||
import org.koitharu.kotatsu.local.data.MangaIndex
|
|
||||||
import org.koitharu.kotatsu.parsers.model.Manga
|
import org.koitharu.kotatsu.parsers.model.Manga
|
||||||
import org.koitharu.kotatsu.parsers.model.MangaSource
|
import org.koitharu.kotatsu.parsers.model.MangaSource
|
||||||
|
|
||||||
|
|||||||
@@ -46,8 +46,10 @@ class ImportWorker @AssistedInject constructor(
|
|||||||
val result = runCatchingCancellable {
|
val result = runCatchingCancellable {
|
||||||
importer.import(uri).manga
|
importer.import(uri).manga
|
||||||
}
|
}
|
||||||
val notification = buildNotification(result)
|
if (notificationManager.areNotificationsEnabled()) {
|
||||||
notificationManager.notify(uri.hashCode(), notification)
|
val notification = buildNotification(result)
|
||||||
|
notificationManager.notify(uri.hashCode(), notification)
|
||||||
|
}
|
||||||
return Result.success()
|
return Result.success()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class PageSaveHelper @Inject constructor(
|
|||||||
val pageFile = pageLoader.loadPage(page, force = false)
|
val pageFile = pageLoader.loadPage(page, force = false)
|
||||||
val proposedName = getProposedFileName(pageUrl, pageFile)
|
val proposedName = getProposedFileName(pageUrl, pageFile)
|
||||||
val destination = withContext(Dispatchers.Main) {
|
val destination = withContext(Dispatchers.Main) {
|
||||||
suspendCancellableCoroutine<Uri> { cont ->
|
suspendCancellableCoroutine { cont ->
|
||||||
continuation = cont
|
continuation = cont
|
||||||
saveLauncher.launch(proposedName)
|
saveLauncher.launch(proposedName)
|
||||||
}.also {
|
}.also {
|
||||||
|
|||||||
@@ -57,17 +57,19 @@ class MangaPageFetcher(
|
|||||||
private suspend fun loadPage(pageUrl: String): SourceResult {
|
private suspend fun loadPage(pageUrl: String): SourceResult {
|
||||||
val uri = pageUrl.toUri()
|
val uri = pageUrl.toUri()
|
||||||
return if (CbzFilter.isUriSupported(uri)) {
|
return if (CbzFilter.isUriSupported(uri)) {
|
||||||
val zip = runInterruptible(Dispatchers.IO) { ZipFile(uri.schemeSpecificPart) }
|
runInterruptible(Dispatchers.IO) {
|
||||||
val entry = runInterruptible(Dispatchers.IO) { zip.getEntry(uri.fragment) }
|
val zip = ZipFile(uri.schemeSpecificPart)
|
||||||
return SourceResult(
|
val entry = zip.getEntry(uri.fragment)
|
||||||
source = ImageSource(
|
SourceResult(
|
||||||
source = zip.getInputStream(entry).source().withExtraCloseable(zip).buffer(),
|
source = ImageSource(
|
||||||
context = context,
|
source = zip.getInputStream(entry).source().withExtraCloseable(zip).buffer(),
|
||||||
metadata = MangaPageMetadata(page),
|
context = context,
|
||||||
),
|
metadata = MangaPageMetadata(page),
|
||||||
mimeType = null,
|
),
|
||||||
dataSource = DataSource.DISK,
|
mimeType = null,
|
||||||
)
|
dataSource = DataSource.DISK,
|
||||||
|
)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
val request = PageLoader.createPageRequest(page, pageUrl)
|
val request = PageLoader.createPageRequest(page, pageUrl)
|
||||||
imageProxyInterceptor.interceptPageRequest(request, okHttpClient).use { response ->
|
imageProxyInterceptor.interceptPageRequest(request, okHttpClient).use { response ->
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ class AppearanceSettingsFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun initLocalePicker(preference: ListPreference) {
|
private fun initLocalePicker(preference: ListPreference) {
|
||||||
val locales = resources.getLocalesConfig()
|
val locales = preference.context.getLocalesConfig()
|
||||||
.toList()
|
.toList()
|
||||||
.sortedWith(LocaleComparator(preference.context))
|
.sortedWith(LocaleComparator(preference.context))
|
||||||
preference.entries = Array(locales.size + 1) { i ->
|
preference.entries = Array(locales.size + 1) { i ->
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import org.koitharu.kotatsu.browser.BrowserCallback
|
|||||||
import org.koitharu.kotatsu.browser.BrowserClient
|
import org.koitharu.kotatsu.browser.BrowserClient
|
||||||
import org.koitharu.kotatsu.browser.ProgressChromeClient
|
import org.koitharu.kotatsu.browser.ProgressChromeClient
|
||||||
import org.koitharu.kotatsu.browser.WebViewBackPressedCallback
|
import org.koitharu.kotatsu.browser.WebViewBackPressedCallback
|
||||||
import org.koitharu.kotatsu.core.network.CommonHeadersInterceptor
|
|
||||||
import org.koitharu.kotatsu.core.parser.MangaRepository
|
import org.koitharu.kotatsu.core.parser.MangaRepository
|
||||||
import org.koitharu.kotatsu.core.parser.RemoteMangaRepository
|
import org.koitharu.kotatsu.core.parser.RemoteMangaRepository
|
||||||
import org.koitharu.kotatsu.core.ui.BaseActivity
|
import org.koitharu.kotatsu.core.ui.BaseActivity
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import android.net.Uri
|
|||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import okio.FileNotFoundException
|
|
||||||
import org.koitharu.kotatsu.R
|
import org.koitharu.kotatsu.R
|
||||||
import org.koitharu.kotatsu.core.prefs.AppSettings
|
import org.koitharu.kotatsu.core.prefs.AppSettings
|
||||||
import org.koitharu.kotatsu.core.ui.BaseViewModel
|
import org.koitharu.kotatsu.core.ui.BaseViewModel
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import kotlinx.coroutines.Dispatchers
|
|||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.cancelAndJoin
|
import kotlinx.coroutines.cancelAndJoin
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import okio.FileNotFoundException
|
|
||||||
import org.koitharu.kotatsu.core.prefs.AppSettings
|
import org.koitharu.kotatsu.core.prefs.AppSettings
|
||||||
import org.koitharu.kotatsu.core.ui.BaseViewModel
|
import org.koitharu.kotatsu.core.ui.BaseViewModel
|
||||||
import org.koitharu.kotatsu.local.data.LocalStorageManager
|
import org.koitharu.kotatsu.local.data.LocalStorageManager
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import org.koitharu.kotatsu.R
|
|||||||
import org.koitharu.kotatsu.core.prefs.AppSettings
|
import org.koitharu.kotatsu.core.prefs.AppSettings
|
||||||
import org.koitharu.kotatsu.core.util.ext.onFirst
|
import org.koitharu.kotatsu.core.util.ext.onFirst
|
||||||
import org.koitharu.kotatsu.download.ui.worker.DownloadWorker
|
import org.koitharu.kotatsu.download.ui.worker.DownloadWorker
|
||||||
import org.koitharu.kotatsu.history.data.HistoryRepository
|
|
||||||
import org.koitharu.kotatsu.list.domain.ListExtraProvider
|
import org.koitharu.kotatsu.list.domain.ListExtraProvider
|
||||||
import org.koitharu.kotatsu.list.ui.MangaListViewModel
|
import org.koitharu.kotatsu.list.ui.MangaListViewModel
|
||||||
import org.koitharu.kotatsu.list.ui.model.EmptyState
|
import org.koitharu.kotatsu.list.ui.model.EmptyState
|
||||||
@@ -27,7 +26,6 @@ import javax.inject.Inject
|
|||||||
class UpdatesViewModel @Inject constructor(
|
class UpdatesViewModel @Inject constructor(
|
||||||
private val repository: TrackingRepository,
|
private val repository: TrackingRepository,
|
||||||
private val settings: AppSettings,
|
private val settings: AppSettings,
|
||||||
private val historyRepository: HistoryRepository,
|
|
||||||
private val extraProvider: ListExtraProvider,
|
private val extraProvider: ListExtraProvider,
|
||||||
downloadScheduler: DownloadWorker.Scheduler,
|
downloadScheduler: DownloadWorker.Scheduler,
|
||||||
) : MangaListViewModel(settings, downloadScheduler) {
|
) : MangaListViewModel(settings, downloadScheduler) {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
<org.koitharu.kotatsu.core.ui.widgets.TwoLinesItemView
|
<org.koitharu.kotatsu.core.ui.widgets.TwoLinesItemView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/button_file"
|
android:id="@+id/button_file"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<merge
|
<merge
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:padding="@dimen/margin_normal"
|
android:padding="@dimen/margin_normal"
|
||||||
tools:background="@drawable/bg_appwidget_card"
|
tools:background="@drawable/bg_appwidget_card"
|
||||||
|
|||||||
1
app/src/main/res/resources.properties
Normal file
1
app/src/main/res/resources.properties
Normal file
@@ -0,0 +1 @@
|
|||||||
|
unqualifiedResLocale=en-US
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<locale-config
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<locale android:name="en" />
|
|
||||||
<locale android:name="ar" />
|
|
||||||
<locale android:name="be" />
|
|
||||||
<locale android:name="bn" />
|
|
||||||
<locale android:name="de" />
|
|
||||||
<locale android:name="el" />
|
|
||||||
<locale android:name="es" />
|
|
||||||
<locale android:name="fa" />
|
|
||||||
<locale android:name="fi" />
|
|
||||||
<locale android:name="fr" />
|
|
||||||
<locale android:name="in" />
|
|
||||||
<locale android:name="it" />
|
|
||||||
<locale android:name="ja" />
|
|
||||||
<locale android:name="nb-NO" />
|
|
||||||
<locale android:name="pl" />
|
|
||||||
<locale android:name="pt" />
|
|
||||||
<locale android:name="pt-BR" />
|
|
||||||
<locale android:name="ru" />
|
|
||||||
<locale android:name="si" />
|
|
||||||
<locale android:name="sr" />
|
|
||||||
<locale android:name="sv" />
|
|
||||||
<locale android:name="tr" />
|
|
||||||
<locale android:name="uk" />
|
|
||||||
<locale android:name="zh-CN" />
|
|
||||||
<locale android:name="zh-TW" />
|
|
||||||
<locale android:name="fil" />
|
|
||||||
<locale android:name="hi" />
|
|
||||||
<locale android:name="kk" />
|
|
||||||
<locale android:name="ko" />
|
|
||||||
<locale android:name="ne" />
|
|
||||||
<locale android:name="nn" />
|
|
||||||
<locale android:name="vi" />
|
|
||||||
</locale-config>
|
|
||||||
Reference in New Issue
Block a user