From c874d73c04b3a26c99881a0b8f7e7c4f6746bcdb Mon Sep 17 00:00:00 2001 From: Koitharu Date: Wed, 9 Aug 2023 16:17:59 +0300 Subject: [PATCH] Fix warnings and enable locales-config auto-generating --- app/build.gradle | 8 +- .../core/util/LoggingAdapterDataObserver.kt | 37 -------- app/src/main/AndroidManifest.xml | 1 - .../kotatsu/browser/BrowserActivity.kt | 1 - .../browser/cloudflare/CloudFlareActivity.kt | 2 - .../koitharu/kotatsu/core/ui/BaseActivity.kt | 1 - .../core/ui/dialog/AppBottomSheetDialog.kt | 29 ------- .../decor/AbstractDividerItemDecoration.kt | 87 ------------------- .../koitharu/kotatsu/core/util/ext/Android.kt | 14 ++- .../kotatsu/core/util/ext/Collections.kt | 13 --- .../koitharu/kotatsu/core/util/ext/Theme.kt | 2 - .../details/ui/adapter/BranchesAdapter.kt | 16 ---- .../filter/ui/model/FilterHeaderModel.kt | 1 - .../kotatsu/local/data/LocalStorageManager.kt | 1 - .../local/data/output/LocalMangaUtil.kt | 1 - .../koitharu/kotatsu/local/ui/ImportWorker.kt | 6 +- .../kotatsu/reader/ui/PageSaveHelper.kt | 2 +- .../reader/ui/thumbnails/MangaPageFetcher.kt | 24 ++--- .../settings/AppearanceSettingsFragment.kt | 2 +- .../sources/auth/SourceAuthActivity.kt | 1 - .../storage/MangaDirectorySelectViewModel.kt | 1 - .../directories/MangaDirectoriesViewModel.kt | 1 - .../tracker/ui/updates/UpdatesViewModel.kt | 2 - .../main/res/layout/item_download_option.xml | 1 - app/src/main/res/layout/view_tip.xml | 1 - app/src/main/res/resources.properties | 1 + app/src/main/res/xml/locales.xml | 36 -------- 27 files changed, 35 insertions(+), 257 deletions(-) delete mode 100644 app/src/debug/java/org/koitharu/kotatsu/core/util/LoggingAdapterDataObserver.kt delete mode 100644 app/src/main/kotlin/org/koitharu/kotatsu/core/ui/dialog/AppBottomSheetDialog.kt delete mode 100644 app/src/main/kotlin/org/koitharu/kotatsu/core/ui/list/decor/AbstractDividerItemDecoration.kt delete mode 100644 app/src/main/kotlin/org/koitharu/kotatsu/details/ui/adapter/BranchesAdapter.kt create mode 100644 app/src/main/res/resources.properties delete mode 100644 app/src/main/res/xml/locales.xml diff --git a/app/build.gradle b/app/build.gradle index 5dd7c3232..f2910d34d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,24 +9,24 @@ plugins { android { compileSdk = 33 - compileSdkExtension = 4 +// compileSdkExtension = 4 buildToolsVersion = '34.0.0' namespace = 'org.koitharu.kotatsu' defaultConfig { applicationId 'org.koitharu.kotatsu' minSdkVersion 21 - //TODO: update as soon as sources becomes available - //noinspection OldTargetApi targetSdkVersion 33 versionCode 567 versionName '5.3.10' generatedDensities = [] testInstrumentationRunner "org.koitharu.kotatsu.HiltTestRunner" - ksp { arg("room.schemaLocation", "$projectDir/schemas") } + androidResources { + generateLocaleConfig true + } } buildTypes { debug { diff --git a/app/src/debug/java/org/koitharu/kotatsu/core/util/LoggingAdapterDataObserver.kt b/app/src/debug/java/org/koitharu/kotatsu/core/util/LoggingAdapterDataObserver.kt deleted file mode 100644 index 2d47a63b3..000000000 --- a/app/src/debug/java/org/koitharu/kotatsu/core/util/LoggingAdapterDataObserver.kt +++ /dev/null @@ -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()") - } -} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index fb16c29d8..bc598d4b7 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -46,7 +46,6 @@ android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:largeHeap="true" - android:localeConfig="@xml/locales" android:networkSecurityConfig="@xml/network_security_config" android:requestLegacyExternalStorage="true" android:roundIcon="@mipmap/ic_launcher_round" diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/browser/BrowserActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/browser/BrowserActivity.kt index 832c4679f..af49d1dcd 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/browser/BrowserActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/browser/BrowserActivity.kt @@ -13,7 +13,6 @@ import androidx.core.graphics.Insets import androidx.core.view.isVisible import androidx.core.view.updatePadding import org.koitharu.kotatsu.R -import org.koitharu.kotatsu.core.network.CommonHeadersInterceptor import org.koitharu.kotatsu.core.ui.BaseActivity import org.koitharu.kotatsu.core.util.ext.catchingWebViewUnavailability import org.koitharu.kotatsu.databinding.ActivityBrowserBinding diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/browser/cloudflare/CloudFlareActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/browser/cloudflare/CloudFlareActivity.kt index 8dba17b23..22b44c4d6 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/browser/cloudflare/CloudFlareActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/browser/cloudflare/CloudFlareActivity.kt @@ -5,7 +5,6 @@ import android.content.Intent import android.os.Bundle import android.view.MenuItem import android.webkit.CookieManager -import android.webkit.WebSettings import androidx.activity.result.contract.ActivityResultContract import androidx.core.graphics.Insets import androidx.core.net.toUri @@ -18,7 +17,6 @@ import okhttp3.HttpUrl.Companion.toHttpUrlOrNull import org.koitharu.kotatsu.R import org.koitharu.kotatsu.browser.WebViewBackPressedCallback 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.ui.BaseActivity import org.koitharu.kotatsu.core.util.TaggedActivityResult diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/BaseActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/BaseActivity.kt index be9a10694..91968b0ad 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/BaseActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/BaseActivity.kt @@ -97,7 +97,6 @@ abstract class BaseActivity : } override fun onOptionsItemSelected(item: MenuItem) = if (item.itemId == android.R.id.home) { - @Suppress("DEPRECATION") onBackPressed() true } else super.onOptionsItemSelected(item) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/dialog/AppBottomSheetDialog.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/dialog/AppBottomSheetDialog.kt deleted file mode 100644 index f76e27d11..000000000 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/dialog/AppBottomSheetDialog.kt +++ /dev/null @@ -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 - } - } - } -} diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/list/decor/AbstractDividerItemDecoration.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/list/decor/AbstractDividerItemDecoration.kt deleted file mode 100644 index ca4bbec76..000000000 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/list/decor/AbstractDividerItemDecoration.kt +++ /dev/null @@ -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 -} diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Android.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Android.kt index 5087a013e..0bb946be3 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Android.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Android.kt @@ -1,9 +1,11 @@ package org.koitharu.kotatsu.core.util.ext +import android.annotation.SuppressLint import android.app.Activity import android.app.ActivityManager import android.app.ActivityManager.MemoryInfo import android.app.ActivityOptions +import android.app.LocaleConfig import android.content.Context import android.content.Context.ACTIVITY_SERVICE import android.content.Context.POWER_SERVICE @@ -12,7 +14,6 @@ import android.content.OperationApplicationException import android.content.SharedPreferences import android.content.SyncResult import android.content.pm.ResolveInfo -import android.content.res.Resources import android.database.SQLException import android.graphics.Color import android.net.Uri @@ -172,10 +173,17 @@ fun scaleUpActivityOptionsOf(view: View): Bundle? = if (view.context.isAnimation 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(",") 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) { if (xpp.eventType == XmlPullParser.START_TAG) { if (xpp.name == "locale") { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Collections.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Collections.kt index 1e66f3b14..92edc2773 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Collections.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Collections.kt @@ -5,15 +5,6 @@ import androidx.collection.ArraySet import java.util.Collections import java.util.EnumSet -@Deprecated("TODO: remove") -fun MutableList.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 MutableSet(size: Int, init: (index: Int) -> T): MutableSet { val set = ArraySet(size) repeat(size) { index -> set.add(init(index)) } @@ -41,10 +32,6 @@ fun Map.findKeyByValue(value: V): K? { return null } -inline fun Collection.filterToSet(predicate: (T) -> Boolean): Set { - return filterTo(ArraySet(size), predicate) -} - fun Sequence.toListSorted(comparator: Comparator): List { return toMutableList().apply { sortWith(comparator) } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Theme.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Theme.kt index 23ae5e3c9..e5b713d8f 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Theme.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Theme.kt @@ -9,8 +9,6 @@ import androidx.annotation.ColorInt import androidx.annotation.FloatRange import androidx.annotation.Px 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.graphics.ColorUtils diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/adapter/BranchesAdapter.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/adapter/BranchesAdapter.kt deleted file mode 100644 index add2a583f..000000000 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/adapter/BranchesAdapter.kt +++ /dev/null @@ -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, - listener: OnListItemClickListener, -) : ListDelegationAdapter>() { - - init { - delegatesManager.addDelegate(branchAD(listener)) - items = list - } -} diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/filter/ui/model/FilterHeaderModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/filter/ui/model/FilterHeaderModel.kt index c981c9782..7e376dd55 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/filter/ui/model/FilterHeaderModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/filter/ui/model/FilterHeaderModel.kt @@ -1,7 +1,6 @@ package org.koitharu.kotatsu.filter.ui.model import org.koitharu.kotatsu.core.ui.widgets.ChipsView -import org.koitharu.kotatsu.list.ui.model.ListModel import org.koitharu.kotatsu.parsers.model.SortOrder class FilterHeaderModel( diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/local/data/LocalStorageManager.kt b/app/src/main/kotlin/org/koitharu/kotatsu/local/data/LocalStorageManager.kt index 37170b478..be4fe6e69 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/local/data/LocalStorageManager.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/local/data/LocalStorageManager.kt @@ -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.getStorageName import org.koitharu.kotatsu.core.util.ext.resolveFile -import org.koitharu.kotatsu.core.util.ext.toFileOrNull import org.koitharu.kotatsu.parsers.util.mapToSet import java.io.File import javax.inject.Inject diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/local/data/output/LocalMangaUtil.kt b/app/src/main/kotlin/org/koitharu/kotatsu/local/data/output/LocalMangaUtil.kt index 8c9da3c62..baa354cfa 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/local/data/output/LocalMangaUtil.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/local/data/output/LocalMangaUtil.kt @@ -4,7 +4,6 @@ import androidx.core.net.toFile import androidx.core.net.toUri import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runInterruptible -import org.koitharu.kotatsu.local.data.MangaIndex import org.koitharu.kotatsu.parsers.model.Manga import org.koitharu.kotatsu.parsers.model.MangaSource diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/local/ui/ImportWorker.kt b/app/src/main/kotlin/org/koitharu/kotatsu/local/ui/ImportWorker.kt index 083abb1c9..5a4d600c3 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/local/ui/ImportWorker.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/local/ui/ImportWorker.kt @@ -46,8 +46,10 @@ class ImportWorker @AssistedInject constructor( val result = runCatchingCancellable { importer.import(uri).manga } - val notification = buildNotification(result) - notificationManager.notify(uri.hashCode(), notification) + if (notificationManager.areNotificationsEnabled()) { + val notification = buildNotification(result) + notificationManager.notify(uri.hashCode(), notification) + } return Result.success() } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/PageSaveHelper.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/PageSaveHelper.kt index b312c9b12..0b75aedaf 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/PageSaveHelper.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/PageSaveHelper.kt @@ -44,7 +44,7 @@ class PageSaveHelper @Inject constructor( val pageFile = pageLoader.loadPage(page, force = false) val proposedName = getProposedFileName(pageUrl, pageFile) val destination = withContext(Dispatchers.Main) { - suspendCancellableCoroutine { cont -> + suspendCancellableCoroutine { cont -> continuation = cont saveLauncher.launch(proposedName) }.also { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/thumbnails/MangaPageFetcher.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/thumbnails/MangaPageFetcher.kt index 393f6398d..812df6484 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/thumbnails/MangaPageFetcher.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/thumbnails/MangaPageFetcher.kt @@ -57,17 +57,19 @@ class MangaPageFetcher( private suspend fun loadPage(pageUrl: String): SourceResult { val uri = pageUrl.toUri() return if (CbzFilter.isUriSupported(uri)) { - val zip = runInterruptible(Dispatchers.IO) { ZipFile(uri.schemeSpecificPart) } - val entry = runInterruptible(Dispatchers.IO) { zip.getEntry(uri.fragment) } - return SourceResult( - source = ImageSource( - source = zip.getInputStream(entry).source().withExtraCloseable(zip).buffer(), - context = context, - metadata = MangaPageMetadata(page), - ), - mimeType = null, - dataSource = DataSource.DISK, - ) + runInterruptible(Dispatchers.IO) { + val zip = ZipFile(uri.schemeSpecificPart) + val entry = zip.getEntry(uri.fragment) + SourceResult( + source = ImageSource( + source = zip.getInputStream(entry).source().withExtraCloseable(zip).buffer(), + context = context, + metadata = MangaPageMetadata(page), + ), + mimeType = null, + dataSource = DataSource.DISK, + ) + } } else { val request = PageLoader.createPageRequest(page, pageUrl) imageProxyInterceptor.interceptPageRequest(request, okHttpClient).use { response -> diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/settings/AppearanceSettingsFragment.kt b/app/src/main/kotlin/org/koitharu/kotatsu/settings/AppearanceSettingsFragment.kt index c227eff25..039293ce6 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/settings/AppearanceSettingsFragment.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/settings/AppearanceSettingsFragment.kt @@ -102,7 +102,7 @@ class AppearanceSettingsFragment : } private fun initLocalePicker(preference: ListPreference) { - val locales = resources.getLocalesConfig() + val locales = preference.context.getLocalesConfig() .toList() .sortedWith(LocaleComparator(preference.context)) preference.entries = Array(locales.size + 1) { i -> diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/settings/sources/auth/SourceAuthActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/settings/sources/auth/SourceAuthActivity.kt index 150e71faa..4239c03fb 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/settings/sources/auth/SourceAuthActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/settings/sources/auth/SourceAuthActivity.kt @@ -18,7 +18,6 @@ import org.koitharu.kotatsu.browser.BrowserCallback import org.koitharu.kotatsu.browser.BrowserClient import org.koitharu.kotatsu.browser.ProgressChromeClient 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.RemoteMangaRepository import org.koitharu.kotatsu.core.ui.BaseActivity diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/settings/storage/MangaDirectorySelectViewModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/settings/storage/MangaDirectorySelectViewModel.kt index 2b1a679de..7985c9bda 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/settings/storage/MangaDirectorySelectViewModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/settings/storage/MangaDirectorySelectViewModel.kt @@ -4,7 +4,6 @@ import android.net.Uri import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableStateFlow -import okio.FileNotFoundException import org.koitharu.kotatsu.R import org.koitharu.kotatsu.core.prefs.AppSettings import org.koitharu.kotatsu.core.ui.BaseViewModel diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/settings/storage/directories/MangaDirectoriesViewModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/settings/storage/directories/MangaDirectoriesViewModel.kt index 6d1b22853..bad65b98f 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/settings/storage/directories/MangaDirectoriesViewModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/settings/storage/directories/MangaDirectoriesViewModel.kt @@ -6,7 +6,6 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job import kotlinx.coroutines.cancelAndJoin import kotlinx.coroutines.flow.MutableStateFlow -import okio.FileNotFoundException import org.koitharu.kotatsu.core.prefs.AppSettings import org.koitharu.kotatsu.core.ui.BaseViewModel import org.koitharu.kotatsu.local.data.LocalStorageManager diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/tracker/ui/updates/UpdatesViewModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/tracker/ui/updates/UpdatesViewModel.kt index ec066dba7..6c14436df 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/tracker/ui/updates/UpdatesViewModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/tracker/ui/updates/UpdatesViewModel.kt @@ -13,7 +13,6 @@ import org.koitharu.kotatsu.R import org.koitharu.kotatsu.core.prefs.AppSettings import org.koitharu.kotatsu.core.util.ext.onFirst 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.ui.MangaListViewModel import org.koitharu.kotatsu.list.ui.model.EmptyState @@ -27,7 +26,6 @@ import javax.inject.Inject class UpdatesViewModel @Inject constructor( private val repository: TrackingRepository, private val settings: AppSettings, - private val historyRepository: HistoryRepository, private val extraProvider: ListExtraProvider, downloadScheduler: DownloadWorker.Scheduler, ) : MangaListViewModel(settings, downloadScheduler) { diff --git a/app/src/main/res/layout/item_download_option.xml b/app/src/main/res/layout/item_download_option.xml index 195b02ace..b40694d2b 100644 --- a/app/src/main/res/layout/item_download_option.xml +++ b/app/src/main/res/layout/item_download_option.xml @@ -2,7 +2,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -