diff --git a/app/build.gradle b/app/build.gradle index 326beccdd..f41881156 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -70,6 +70,7 @@ android { '-opt-in=kotlin.ExperimentalStdlibApi', '-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi', '-opt-in=kotlinx.coroutines.ExperimentalForInheritanceCoroutinesApi', + '-opt-in=kotlinx.coroutines.InternalForInheritanceCoroutinesApi', '-opt-in=kotlinx.coroutines.FlowPreview', '-opt-in=kotlin.contracts.ExperimentalContracts', '-opt-in=coil3.annotation.ExperimentalCoilApi', diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/ErrorReporterReceiver.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/ErrorReporterReceiver.kt index 27e42a2a5..770248c7b 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/ErrorReporterReceiver.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/ErrorReporterReceiver.kt @@ -4,9 +4,9 @@ import android.app.PendingIntent import android.content.BroadcastReceiver import android.content.Context import android.content.Intent -import android.net.Uri import android.os.BadParcelableException import androidx.core.app.PendingIntentCompat +import androidx.core.net.toUri import org.koitharu.kotatsu.BuildConfig import org.koitharu.kotatsu.core.nav.AppRouter import org.koitharu.kotatsu.core.util.ext.getSerializableExtraCompat @@ -27,7 +27,7 @@ class ErrorReporterReceiver : BroadcastReceiver() { fun getPendingIntent(context: Context, e: Throwable): PendingIntent? = try { val intent = Intent(context, ErrorReporterReceiver::class.java) intent.setAction(ACTION_REPORT) - intent.setData(Uri.parse("err://${e.hashCode()}")) + intent.setData("err://${e.hashCode()}".toUri()) intent.putExtra(AppRouter.KEY_ERROR, e) PendingIntentCompat.getBroadcast(context, 0, intent, 0, false) } catch (e: BadParcelableException) { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/model/MangaSource.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/model/MangaSource.kt index 2216af06e..c63423806 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/model/MangaSource.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/model/MangaSource.kt @@ -1,13 +1,9 @@ package org.koitharu.kotatsu.core.model import android.content.Context -import android.graphics.Color import android.os.Build import android.text.SpannableStringBuilder -import android.text.style.ForegroundColorSpan import android.text.style.ImageSpan -import android.text.style.RelativeSizeSpan -import android.text.style.SuperscriptSpan import android.widget.TextView import androidx.annotation.DrawableRes import androidx.annotation.StringRes @@ -16,7 +12,6 @@ import androidx.core.text.inSpans import org.koitharu.kotatsu.R import org.koitharu.kotatsu.core.parser.external.ExternalMangaSource import org.koitharu.kotatsu.core.util.ext.getDisplayName -import org.koitharu.kotatsu.core.util.ext.getThemeColor import org.koitharu.kotatsu.core.util.ext.toLocale import org.koitharu.kotatsu.core.util.ext.toLocaleOrNull import org.koitharu.kotatsu.parsers.model.ContentType @@ -24,7 +19,6 @@ import org.koitharu.kotatsu.parsers.model.MangaParserSource import org.koitharu.kotatsu.parsers.model.MangaSource import org.koitharu.kotatsu.parsers.util.splitTwoParts import java.util.Locale -import androidx.appcompat.R as appcompatR data object LocalMangaSource : MangaSource { override val name = "LOCAL" @@ -102,14 +96,6 @@ fun MangaSource.getTitle(context: Context): String = when (val source = unwrap() else -> context.getString(R.string.unknown) } -fun SpannableStringBuilder.appendNsfwLabel(context: Context) = inSpans( - ForegroundColorSpan(context.getThemeColor(appcompatR.attr.colorError, Color.RED)), - RelativeSizeSpan(0.74f), - SuperscriptSpan(), -) { - append(context.getString(R.string.nsfw)) -} - fun SpannableStringBuilder.appendIcon(textView: TextView, @DrawableRes resId: Int): SpannableStringBuilder { val icon = ContextCompat.getDrawable(textView.context, resId) ?: return this icon.setTintList(textView.textColors) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/nav/AppRouter.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/nav/AppRouter.kt index 4374f5c39..af1d470f4 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/nav/AppRouter.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/nav/AppRouter.kt @@ -675,7 +675,7 @@ class AppRouter private constructor( companion object { fun from(view: View): AppRouter? = runCatching { - AppRouter(view.findFragment()) + AppRouter(view.findFragment()) }.getOrElse { (view.context.findActivity() as? FragmentActivity)?.let(::AppRouter) } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/os/RomCompat.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/os/RomCompat.kt index ec519c179..b51e2bad3 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/os/RomCompat.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/os/RomCompat.kt @@ -7,7 +7,7 @@ import java.io.InputStreamReader object RomCompat { - val isMiui = suspendLazy(Dispatchers.IO) { + val isMiui = suspendLazy(Dispatchers.IO) { getProp("ro.miui.ui.version.name").isNotEmpty() } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/BitmapWrapper.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/BitmapWrapper.kt index 09d2d6ec8..5c8d4fdf1 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/BitmapWrapper.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/BitmapWrapper.kt @@ -1,6 +1,7 @@ package org.koitharu.kotatsu.core.parser import android.graphics.Canvas +import androidx.core.graphics.createBitmap import org.koitharu.kotatsu.parsers.bitmap.Bitmap import org.koitharu.kotatsu.parsers.bitmap.Rect import java.io.OutputStream @@ -35,7 +36,7 @@ class BitmapWrapper private constructor( companion object { fun create(width: Int, height: Int) = BitmapWrapper( - AndroidBitmap.createBitmap(width, height, AndroidBitmap.Config.ARGB_8888), + createBitmap(width, height, AndroidBitmap.Config.ARGB_8888), ) fun create(bitmap: AndroidBitmap) = BitmapWrapper( diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/favicon/FaviconFetcher.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/favicon/FaviconFetcher.kt index a47b03050..870435239 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/favicon/FaviconFetcher.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/favicon/FaviconFetcher.kt @@ -2,11 +2,11 @@ package org.koitharu.kotatsu.core.parser.favicon import android.graphics.Color import android.graphics.drawable.AdaptiveIconDrawable -import android.graphics.drawable.ColorDrawable import android.graphics.drawable.Drawable import android.graphics.drawable.LayerDrawable import android.net.Uri import android.os.Build +import coil3.ColorImage import coil3.ImageLoader import coil3.asImage import coil3.decode.DataSource @@ -45,7 +45,7 @@ class FaviconFetcher( is ParserMangaRepository -> fetchParserFavicon(repo) is ExternalMangaRepository -> fetchPluginIcon(repo) is EmptyMangaRepository -> ImageFetchResult( - image = ColorDrawable(Color.WHITE).asImage(), + image = ColorImage(Color.WHITE), isSampled = false, dataSource = DataSource.MEMORY, ) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/FragmentContainerActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/FragmentContainerActivity.kt index 6f9d6a543..38235c63f 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/FragmentContainerActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/FragmentContainerActivity.kt @@ -30,7 +30,7 @@ abstract class FragmentContainerActivity(private val fragmentClass: Class - val observer = ContinuationLifecycleObserver(this, cont, state) - addObserverFromAnyThread(observer) - cont.invokeOnCancellation { - removeObserverFromAnyThread(observer) - } - } -} - -private class ContinuationLifecycleObserver( - private val lifecycle: Lifecycle, - private val continuation: CancellableContinuation, - private val targetState: Lifecycle.State, -) : LifecycleEventObserver { - - override fun onStateChanged(source: LifecycleOwner, event: Lifecycle.Event) { - if (event == Lifecycle.Event.upTo(targetState)) { - lifecycle.removeObserver(this) - continuation.resume(Unit) - } else if (event == Lifecycle.Event.ON_DESTROY) { - lifecycle.removeObserver(this) - continuation.resumeWithException(LifecycleDestroyedException()) - } - } -} - -private fun Lifecycle.addObserverFromAnyThread(observer: LifecycleObserver) { - val dispatcher = Dispatchers.Main.immediate - if (dispatcher.isDispatchNeeded(EmptyCoroutineContext)) { - dispatcher.dispatch(EmptyCoroutineContext) { addObserver(observer) } - } else { - addObserver(observer) - } -} - -private fun Lifecycle.removeObserverFromAnyThread(observer: LifecycleObserver) { - val dispatcher = Dispatchers.Main.immediate - if (dispatcher.isDispatchNeeded(EmptyCoroutineContext)) { - dispatcher.dispatch(EmptyCoroutineContext) { removeObserver(observer) } - } else { - removeObserver(observer) - } -} - fun Deferred.getCompletionResultOrNull(): Result? = if (isCompleted) { getCompletionExceptionOrNull()?.let { error -> Result.failure(error) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Date.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Date.kt index 4f4b0a66d..551d2067b 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Date.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Date.kt @@ -35,7 +35,6 @@ fun calculateTimeAgo(instant: Instant, showMonths: Boolean = false): DateTimeAgo } } -@Suppress("KotlinConstantConditions") fun Long.toInstantOrNull() = if (this == 0L) null else Instant.ofEpochMilli(this) fun Resources.formatDurationShort(millis: Long): String? { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/TextView.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/TextView.kt index 89cbd8faa..76b4b202d 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/TextView.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/TextView.kt @@ -2,17 +2,17 @@ package org.koitharu.kotatsu.core.util.ext import android.graphics.Typeface import android.graphics.drawable.Drawable -import android.view.View import android.widget.TextView import androidx.annotation.AttrRes import androidx.annotation.StringRes import androidx.annotation.StyleRes import androidx.core.content.res.use import androidx.core.view.isGone +import androidx.core.view.isVisible import androidx.core.widget.TextViewCompat var TextView.textAndVisible: CharSequence? - get() = text?.takeIf { visibility == View.VISIBLE } + get() = text?.takeIf { isVisible } set(value) { text = value isGone = value.isNullOrEmpty() diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/zip/ZipOutput.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/zip/ZipOutput.kt index 66cd93c3e..139de832e 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/zip/ZipOutput.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/zip/ZipOutput.kt @@ -158,7 +158,7 @@ class ZipOutput( private fun Closeable.closeSafe() { try { - cachedOutput?.close() + close() } catch (e: NullPointerException) { // Don't throw the "Deflater has been closed" exception e.printStackTraceDebug() diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/domain/DetailsInteractor.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/domain/DetailsInteractor.kt index 68e0b99af..f48a668df 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/domain/DetailsInteractor.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/domain/DetailsInteractor.kt @@ -5,7 +5,6 @@ import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.distinctUntilChangedBy import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.flowOf -import kotlinx.coroutines.flow.map import org.koitharu.kotatsu.core.model.FavouriteCategory import org.koitharu.kotatsu.core.prefs.AppSettings import org.koitharu.kotatsu.core.prefs.observeAsFlow @@ -31,11 +30,6 @@ class DetailsInteractor @Inject constructor( private val scrobblers: Set<@JvmSuppressWildcards Scrobbler>, ) { - fun observeIsFavourite(mangaId: Long): Flow { - return favouritesRepository.observeCategoriesIds(mangaId) - .map { it.isNotEmpty() } - } - fun observeFavourite(mangaId: Long): Flow> { return favouritesRepository.observeCategories(mangaId) } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt index b11668888..b92ec6a66 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt @@ -126,7 +126,7 @@ class DetailsActivity : super.onCreate(savedInstanceState) setContentView(ActivityDetailsBinding.inflate(layoutInflater)) infoBinding = LayoutDetailsTableBinding.bind(viewBinding.root) - setDisplayHomeAsUp(true, false) + setDisplayHomeAsUp(isEnabled = true, showUpAsClose = false) supportActionBar?.setDisplayShowTitleEnabled(false) viewBinding.chipFavorite.setOnClickListener(this) infoBinding.textViewLocal.setOnClickListener(this) @@ -377,7 +377,7 @@ class DetailsActivity : if (adapter != null) { adapter.items = scrobblings } else { - adapter = ScrollingInfoAdapter(this, coil, router) + adapter = ScrollingInfoAdapter(router) adapter.items = scrobblings viewBinding.recyclerViewScrobbling.adapter = adapter viewBinding.recyclerViewScrobbling.addItemDecoration(ScrobblingItemDecoration()) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/pages/PageThumbnailAdapter.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/pages/PageThumbnailAdapter.kt index cca53c9bc..0cd045abb 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/pages/PageThumbnailAdapter.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/pages/PageThumbnailAdapter.kt @@ -1,8 +1,6 @@ package org.koitharu.kotatsu.details.ui.pager.pages import android.content.Context -import androidx.lifecycle.LifecycleOwner -import coil3.ImageLoader import org.koitharu.kotatsu.core.ui.BaseListAdapter import org.koitharu.kotatsu.core.ui.list.OnListItemClickListener import org.koitharu.kotatsu.core.ui.list.fastscroll.FastScroller @@ -11,8 +9,6 @@ import org.koitharu.kotatsu.list.ui.adapter.listHeaderAD import org.koitharu.kotatsu.list.ui.model.ListModel class PageThumbnailAdapter( - coil: ImageLoader, - lifecycleOwner: LifecycleOwner, clickListener: OnListItemClickListener, ) : BaseListAdapter(), FastScroller.SectionIndexer { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/pages/PagesFragment.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/pages/PagesFragment.kt index ead43b6dc..17d498034 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/pages/PagesFragment.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/pages/PagesFragment.kt @@ -15,7 +15,6 @@ import androidx.core.view.isVisible import androidx.fragment.app.viewModels import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.RecyclerView -import coil3.ImageLoader import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.combine @@ -59,9 +58,6 @@ class PagesFragment : RecyclerViewOwner, ListSelectionController.Callback { - @Inject - lateinit var coil: ImageLoader - @Inject lateinit var settings: AppSettings @@ -113,8 +109,6 @@ class PagesFragment : callback = this, ) thumbnailsAdapter = PageThumbnailAdapter( - coil = coil, - lifecycleOwner = viewLifecycleOwner, clickListener = this@PagesFragment, ) viewModel.gridScale.observe(viewLifecycleOwner, ::onGridScaleChanged) // before rv initialization diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/scrobbling/ScrobblingInfoSheet.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/scrobbling/ScrobblingInfoSheet.kt index 676d29dde..ef497c3a7 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/scrobbling/ScrobblingInfoSheet.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/scrobbling/ScrobblingInfoSheet.kt @@ -13,7 +13,6 @@ import androidx.core.text.method.LinkMovementMethodCompat import androidx.core.view.WindowInsetsCompat import androidx.core.view.updatePadding import androidx.fragment.app.activityViewModels -import coil3.ImageLoader import com.google.android.material.snackbar.Snackbar import dagger.hilt.android.AndroidEntryPoint import org.koitharu.kotatsu.R @@ -29,7 +28,6 @@ import org.koitharu.kotatsu.databinding.SheetScrobblingBinding import org.koitharu.kotatsu.details.ui.DetailsViewModel import org.koitharu.kotatsu.scrobbling.common.domain.model.ScrobblingInfo import org.koitharu.kotatsu.scrobbling.common.domain.model.ScrobblingStatus -import javax.inject.Inject @AndroidEntryPoint class ScrobblingInfoSheet : @@ -42,9 +40,6 @@ class ScrobblingInfoSheet : private val viewModel by activityViewModels() private var scrobblerIndex: Int = -1 - @Inject - lateinit var coil: ImageLoader - private var menu: PopupMenu? = null override fun onCreate(savedInstanceState: Bundle?) { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/scrobbling/ScrollingInfoAdapter.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/scrobbling/ScrollingInfoAdapter.kt index 6829d668c..d732ae3be 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/scrobbling/ScrollingInfoAdapter.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/scrobbling/ScrollingInfoAdapter.kt @@ -1,14 +1,10 @@ package org.koitharu.kotatsu.details.ui.scrobbling -import androidx.lifecycle.LifecycleOwner -import coil3.ImageLoader import org.koitharu.kotatsu.core.nav.AppRouter import org.koitharu.kotatsu.core.ui.BaseListAdapter import org.koitharu.kotatsu.list.ui.model.ListModel class ScrollingInfoAdapter( - lifecycleOwner: LifecycleOwner, - coil: ImageLoader, router: AppRouter, ) : BaseListAdapter() { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/download/ui/list/DownloadItemModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/download/ui/list/DownloadItemModel.kt index a0843d55e..69bb664b0 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/download/ui/list/DownloadItemModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/download/ui/list/DownloadItemModel.kt @@ -7,7 +7,6 @@ import androidx.core.text.bold import androidx.core.text.buildSpannedString import androidx.core.text.color import androidx.work.WorkInfo -import coil3.memory.MemoryCache import kotlinx.coroutines.flow.StateFlow import org.koitharu.kotatsu.core.util.ext.getThemeColor import org.koitharu.kotatsu.download.ui.list.chapters.DownloadChapter @@ -35,8 +34,6 @@ data class DownloadItemModel( val chapters: StateFlow?>, ) : ListModel, Comparable { - val coverCacheKey = MemoryCache.Key(manga?.coverUrl.orEmpty(), mapOf("dl" to "1")) - val percent: Float get() = if (max > 0) progress / max.toFloat() else 0f diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/download/ui/list/DownloadsActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/download/ui/list/DownloadsActivity.kt index 856b2566b..7822a3406 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/download/ui/list/DownloadsActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/download/ui/list/DownloadsActivity.kt @@ -43,7 +43,7 @@ class DownloadsActivity : BaseActivity(), override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(ActivityDownloadsBinding.inflate(layoutInflater)) - setDisplayHomeAsUp(true, false) + setDisplayHomeAsUp(isEnabled = true, showUpAsClose = false) val downloadsAdapter = DownloadsAdapter(this, this) val decoration = TypedListSpacingDecoration(this, false) selectionController = ListSelectionController( @@ -80,7 +80,7 @@ class DownloadsActivity : BaseActivity(), right = bars.right, top = bars.top, ) - return return WindowInsetsCompat.Builder(insets) + return WindowInsetsCompat.Builder(insets) .setInsets(WindowInsetsCompat.Type.systemBars(), Insets.NONE) .build() } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/download/ui/worker/PausingReceiver.kt b/app/src/main/kotlin/org/koitharu/kotatsu/download/ui/worker/PausingReceiver.kt index ce216ad3a..ca43f2394 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/download/ui/worker/PausingReceiver.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/download/ui/worker/PausingReceiver.kt @@ -4,9 +4,9 @@ import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.content.IntentFilter -import android.net.Uri import android.os.PatternMatcher import androidx.core.app.PendingIntentCompat +import androidx.core.net.toUri import org.koitharu.kotatsu.core.util.ext.toUUIDOrNull import java.util.UUID @@ -81,7 +81,7 @@ class PausingReceiver( ) private fun createIntent(context: Context, id: UUID, action: String) = Intent(action) - .setData(Uri.parse("$SCHEME://$id")) + .setData("$SCHEME://$id".toUri()) .setPackage(context.packageName) .putExtra(EXTRA_UUID, id.toString()) } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/FavouritesActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/FavouritesActivity.kt index 694c082ff..deab7279c 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/FavouritesActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/FavouritesActivity.kt @@ -1,7 +1,6 @@ package org.koitharu.kotatsu.favourites.ui import android.os.Bundle -import dagger.hilt.android.AndroidEntryPoint import org.koitharu.kotatsu.core.nav.AppRouter import org.koitharu.kotatsu.core.ui.FragmentContainerActivity import org.koitharu.kotatsu.favourites.ui.list.FavouritesListFragment diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/FavouriteCategoriesActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/FavouriteCategoriesActivity.kt index 46079afdf..0c358d15b 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/FavouriteCategoriesActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/FavouriteCategoriesActivity.kt @@ -49,7 +49,7 @@ class FavouriteCategoriesActivity : override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(ActivityCategoriesBinding.inflate(layoutInflater)) - setDisplayHomeAsUp(true, false) + setDisplayHomeAsUp(isEnabled = true, showUpAsClose = false) adapter = CategoriesAdapter(this, this) selectionController = ListSelectionController( appCompatDelegate = delegate, diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/edit/FavouritesCategoryEditActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/edit/FavouritesCategoryEditActivity.kt index 83fbe7363..6e9bd9296 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/edit/FavouritesCategoryEditActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/edit/FavouritesCategoryEditActivity.kt @@ -40,7 +40,7 @@ class FavouritesCategoryEditActivity : override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(ActivityCategoryEditBinding.inflate(layoutInflater)) - setDisplayHomeAsUp(true, true) + setDisplayHomeAsUp(isEnabled = true, showUpAsClose = true) initSortSpinner() viewBinding.buttonDone.setOnClickListener(this) viewBinding.editName.addTextChangedListener(this) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/select/FavoriteDialog.kt b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/select/FavoriteDialog.kt index 076213a94..5d8a94d12 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/select/FavoriteDialog.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/select/FavoriteDialog.kt @@ -18,12 +18,12 @@ import org.koitharu.kotatsu.core.util.ext.getDisplayMessage import org.koitharu.kotatsu.core.util.ext.joinToStringWithLimit import org.koitharu.kotatsu.core.util.ext.observe import org.koitharu.kotatsu.core.util.ext.observeEvent -import org.koitharu.kotatsu.databinding.SheetFavoriteCategoriesBinding +import org.koitharu.kotatsu.databinding.DialogFavoriteBinding import org.koitharu.kotatsu.favourites.ui.categories.select.adapter.MangaCategoriesAdapter import org.koitharu.kotatsu.favourites.ui.categories.select.model.MangaCategoryItem @AndroidEntryPoint -class FavoriteDialog : AlertDialogFragment(), +class FavoriteDialog : AlertDialogFragment(), OnListItemClickListener, DialogInterface.OnClickListener { private val viewModel by viewModels() @@ -31,7 +31,7 @@ class FavoriteDialog : AlertDialogFragment(), override fun onCreateViewBinding( inflater: LayoutInflater, container: ViewGroup?, - ) = SheetFavoriteCategoriesBinding.inflate(inflater, container, false) + ) = DialogFavoriteBinding.inflate(inflater, container, false) override fun onBuildDialog(builder: MaterialAlertDialogBuilder): MaterialAlertDialogBuilder { return super.onBuildDialog(builder) @@ -40,7 +40,7 @@ class FavoriteDialog : AlertDialogFragment(), } override fun onViewBindingCreated( - binding: SheetFavoriteCategoriesBinding, + binding: DialogFavoriteBinding, savedInstanceState: Bundle?, ) { super.onViewBindingCreated(binding, savedInstanceState) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/history/data/HistoryRepository.kt b/app/src/main/kotlin/org/koitharu/kotatsu/history/data/HistoryRepository.kt index 80e5e21cb..1ba9c4b0d 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/history/data/HistoryRepository.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/history/data/HistoryRepository.kt @@ -66,10 +66,6 @@ class HistoryRepository @Inject constructor( return entities.toMangaList() } - suspend fun getCount(): Int { - return db.getHistoryDao().getCount() - } - suspend fun getLastOrNull(): Manga? { val entity = db.getHistoryDao().findAll(0, 1).firstOrNull() ?: return null return entity.toManga() @@ -116,12 +112,6 @@ class HistoryRepository @Inject constructor( } } - fun observeHasItems(): Flow { - return db.getHistoryDao().observeCount() - .map { it > 0 } - .distinctUntilChanged() - } - suspend fun addOrUpdate(manga: Manga, chapterId: Long, page: Int, scroll: Int, percent: Float, force: Boolean) { if (!force && shouldSkip(manga)) { return @@ -158,7 +148,7 @@ class HistoryRepository @Inject constructor( return ReadingProgress( percent = fixedPercent, totalChapters = entity.chaptersCount, - mode = mode + mode = mode, ).takeIf { it.isValid() } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/image/ui/CoverStackView.kt b/app/src/main/kotlin/org/koitharu/kotatsu/image/ui/CoverStackView.kt index 61912bbe7..99e9c2291 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/image/ui/CoverStackView.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/image/ui/CoverStackView.kt @@ -9,6 +9,7 @@ import androidx.annotation.Px import androidx.core.content.withStyledAttributes import androidx.core.graphics.ColorUtils import androidx.core.view.children +import androidx.core.view.isGone import androidx.core.view.isVisible import androidx.core.view.updateLayoutParams import androidx.core.widget.ImageViewCompat @@ -33,10 +34,12 @@ class CoverStackView @JvmOverloads constructor( binding.imageViewCover2, binding.imageViewCover3, ) - private var hideEmptyView: Boolean = true + private var hideEmptyView: Boolean = false init { context.withStyledAttributes(attrs, R.styleable.CoverStackView, defStyleAttr) { + hideEmptyView = getBoolean(R.styleable.CoverStackView_hideEmptyViews, hideEmptyView) + children.forEach { it.isGone = hideEmptyView } val coverSize = getDimension(R.styleable.CoverStackView_coverSize, 0f) if (coverSize > 0f) { setCoverSize(coverSize) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/preview/PreviewFragment.kt b/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/preview/PreviewFragment.kt index 8ef4a8063..5ebc837cb 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/preview/PreviewFragment.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/preview/PreviewFragment.kt @@ -9,7 +9,6 @@ import androidx.core.text.method.LinkMovementMethodCompat import androidx.core.view.WindowInsetsCompat import androidx.core.view.isVisible import androidx.fragment.app.viewModels -import coil3.ImageLoader import com.google.android.material.chip.Chip import dagger.hilt.android.AndroidEntryPoint import org.koitharu.kotatsu.R @@ -24,14 +23,10 @@ import org.koitharu.kotatsu.parsers.model.Manga import org.koitharu.kotatsu.parsers.model.MangaTag import org.koitharu.kotatsu.parsers.util.ifNullOrEmpty import org.koitharu.kotatsu.search.ui.MangaListActivity -import javax.inject.Inject @AndroidEntryPoint class PreviewFragment : BaseFragment(), View.OnClickListener, ChipsView.OnChipClickListener { - @Inject - lateinit var coil: ImageLoader - private val viewModel: PreviewViewModel by viewModels() override fun onCreateViewBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentPreviewBinding { @@ -64,9 +59,9 @@ class PreviewFragment : BaseFragment(), View.OnClickList R.id.button_open -> router.openDetails(manga) R.id.button_read -> router.openReader(manga) - R.id.textView_author -> router.openSearch( + R.id.textView_author -> router.showAuthorDialog( + author = manga.authors.firstOrNull() ?: return, source = manga.source, - query = manga.author ?: return, ) R.id.imageView_cover -> router.openImage( @@ -93,8 +88,8 @@ class PreviewFragment : BaseFragment(), View.OnClickList // Main loadCover(manga) textViewTitle.text = manga.title - textViewSubtitle.textAndVisible = manga.altTitle - textViewAuthor.textAndVisible = manga.author + textViewSubtitle.textAndVisible = manga.altTitles.firstOrNull() + textViewAuthor.textAndVisible = manga.authors.firstOrNull() if (manga.hasRating) { ratingBar.rating = manga.rating * ratingBar.numStars ratingBar.isVisible = true @@ -110,8 +105,8 @@ class PreviewFragment : BaseFragment(), View.OnClickList buttonRead.setText( when { footer == null -> R.string.loading_ - footer.isIncognito == true -> R.string.incognito - footer.isInProgress() == true -> R.string._continue + footer.isIncognito -> R.string.incognito + footer.isInProgress() -> R.string._continue else -> R.string.read }, ) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/main/ui/owners/NoModalBottomSheetOwner.kt b/app/src/main/kotlin/org/koitharu/kotatsu/main/ui/owners/NoModalBottomSheetOwner.kt deleted file mode 100644 index 3920088d4..000000000 --- a/app/src/main/kotlin/org/koitharu/kotatsu/main/ui/owners/NoModalBottomSheetOwner.kt +++ /dev/null @@ -1,6 +0,0 @@ -package org.koitharu.kotatsu.main.ui.owners - -interface NoModalBottomSheetOwner { - - fun getBottomSheetCollapsedHeight(): Int -} diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/main/ui/welcome/WelcomeViewModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/main/ui/welcome/WelcomeViewModel.kt index 7bbc1b3bb..5db4833b4 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/main/ui/welcome/WelcomeViewModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/main/ui/welcome/WelcomeViewModel.kt @@ -3,7 +3,6 @@ package org.koitharu.kotatsu.main.ui.welcome import android.content.Context import androidx.core.os.ConfigurationCompat import dagger.hilt.android.lifecycle.HiltViewModel -import dagger.hilt.android.qualifiers.ApplicationContext import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job import kotlinx.coroutines.flow.MutableStateFlow diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/domain/DetectReaderModeUseCase.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/domain/DetectReaderModeUseCase.kt index da6db5fee..cf307f0bb 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/domain/DetectReaderModeUseCase.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/domain/DetectReaderModeUseCase.kt @@ -1,9 +1,9 @@ package org.koitharu.kotatsu.reader.domain import android.graphics.BitmapFactory -import android.net.Uri import android.util.Size import androidx.core.net.toFile +import androidx.core.net.toUri import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runInterruptible import okhttp3.OkHttpClient @@ -62,7 +62,7 @@ class DetectReaderModeUseCase @Inject constructor( val pageIndex = (pages.size * 0.3).roundToInt() val page = requireNotNull(pages.getOrNull(pageIndex)) { "No pages" } val url = repository.getPageUrl(page) - val uri = Uri.parse(url) + val uri = url.toUri() val size = when { uri.isZipUri() -> runInterruptible(Dispatchers.IO) { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/domain/PageLoader.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/domain/PageLoader.kt index 8c37c8316..ba7dd3d24 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/domain/PageLoader.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/domain/PageLoader.kt @@ -3,7 +3,6 @@ package org.koitharu.kotatsu.reader.domain import android.content.Context import android.graphics.Rect import android.net.Uri -import android.util.Log import androidx.annotation.AnyThread import androidx.annotation.CheckResult import androidx.collection.LongSparseArray 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 cf0e6aa2e..9619ea814 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 @@ -11,7 +11,6 @@ import androidx.documentfile.provider.DocumentFile import dagger.assisted.Assisted import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject -import dagger.hilt.android.qualifiers.ApplicationContext import kotlinx.coroutines.CancellableContinuation import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runInterruptible diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/colorfilter/ColorFilterConfigViewModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/colorfilter/ColorFilterConfigViewModel.kt index dec4a3d13..42172cae9 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/colorfilter/ColorFilterConfigViewModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/colorfilter/ColorFilterConfigViewModel.kt @@ -33,9 +33,6 @@ class ColorFilterConfigViewModel @Inject constructor( val isChanged: Boolean get() = colorFilter.value != initialColorFilter - val is32BitColorsEnabled: Boolean - get() = settings.is32BitColorsEnabled - init { launchLoadingJob { initialColorFilter = mangaDataRepository.getColorFilter(manga.id) ?: settings.readerColorFilter diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/pager/OnBoundsScrollListener.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/pager/OnBoundsScrollListener.kt deleted file mode 100644 index a275908fb..000000000 --- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/pager/OnBoundsScrollListener.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.koitharu.kotatsu.reader.ui.pager - -interface OnBoundsScrollListener { - - fun onScrolledToStart() - - fun onScrolledToEnd() -} \ No newline at end of file diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/pager/reversed/ReversedPageHolder.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/pager/reversed/ReversedPageHolder.kt index df6da9e21..dc8f1dc2c 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/pager/reversed/ReversedPageHolder.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/pager/reversed/ReversedPageHolder.kt @@ -1,21 +1,13 @@ package org.koitharu.kotatsu.reader.ui.pager.reversed import android.graphics.PointF -import android.os.Build import android.view.Gravity -import android.view.RoundedCorner -import android.view.ViewGroup -import android.view.WindowInsets import android.widget.FrameLayout -import androidx.annotation.RequiresApi -import androidx.core.view.updateLayoutParams import androidx.lifecycle.LifecycleOwner import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView -import org.koitharu.kotatsu.R import org.koitharu.kotatsu.core.exceptions.resolve.ExceptionResolver import org.koitharu.kotatsu.core.model.ZoomMode import org.koitharu.kotatsu.core.os.NetworkState -import org.koitharu.kotatsu.core.util.ext.isRtl import org.koitharu.kotatsu.databinding.ItemPageBinding import org.koitharu.kotatsu.reader.domain.PageLoader import org.koitharu.kotatsu.reader.ui.config.ReaderSettings diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/pager/webtoon/WebtoonRecyclerView.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/pager/webtoon/WebtoonRecyclerView.kt index fb2f09f56..04eb2fd90 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/pager/webtoon/WebtoonRecyclerView.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/pager/webtoon/WebtoonRecyclerView.kt @@ -5,6 +5,8 @@ import android.util.AttributeSet import android.view.View import androidx.core.view.ViewCompat.TYPE_TOUCH import androidx.core.view.forEach +import androidx.core.view.isEmpty +import androidx.core.view.isNotEmpty import androidx.core.view.iterator import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView @@ -33,7 +35,7 @@ class WebtoonRecyclerView @JvmOverloads constructor( override fun startNestedScroll(axes: Int) = startNestedScroll(axes, TYPE_TOUCH) - override fun startNestedScroll(axes: Int, type: Int): Boolean = childCount != 0 + override fun startNestedScroll(axes: Int, type: Int): Boolean = isNotEmpty() override fun dispatchNestedPreScroll( dx: Int, @@ -59,7 +61,7 @@ class WebtoonRecyclerView @JvmOverloads constructor( } private fun consumeVerticalScroll(dy: Int): Int { - if (childCount == 0) { + if (isEmpty()) { return 0 } when { @@ -123,7 +125,7 @@ class WebtoonRecyclerView @JvmOverloads constructor( } } - fun updateChildrenScroll() { + fun updateChildrenScroll() { if (isFixingScroll) { return } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/ScrobblerAuthHelper.kt b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/ScrobblerAuthHelper.kt index 330a8edbf..860b24033 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/ScrobblerAuthHelper.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/ScrobblerAuthHelper.kt @@ -3,7 +3,7 @@ package org.koitharu.kotatsu.scrobbling.common.ui import android.annotation.SuppressLint import android.content.Context import android.content.Intent -import android.net.Uri +import androidx.core.net.toUri import org.koitharu.kotatsu.scrobbling.common.domain.ScrobblerRepositoryMap import org.koitharu.kotatsu.scrobbling.common.domain.model.ScrobblerService import org.koitharu.kotatsu.scrobbling.common.domain.model.ScrobblerUser @@ -31,7 +31,7 @@ class ScrobblerAuthHelper @Inject constructor( } else { val repository = repositoriesMap[scrobbler] val intent = Intent(Intent.ACTION_VIEW) - intent.data = Uri.parse(repository.oauthUrl) + intent.data = repository.oauthUrl.toUri() context.startActivity(intent) } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/config/ScrobblerConfigActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/config/ScrobblerConfigActivity.kt index 0702f38f7..1e267903e 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/config/ScrobblerConfigActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/config/ScrobblerConfigActivity.kt @@ -6,7 +6,6 @@ import android.view.View import androidx.activity.viewModels import androidx.core.view.WindowInsetsCompat import androidx.core.view.updatePadding -import coil3.ImageLoader import com.google.android.material.dialog.MaterialAlertDialogBuilder import dagger.hilt.android.AndroidEntryPoint import org.koitharu.kotatsu.R @@ -24,25 +23,21 @@ import org.koitharu.kotatsu.list.ui.adapter.TypedListSpacingDecoration import org.koitharu.kotatsu.scrobbling.common.domain.model.ScrobblerUser import org.koitharu.kotatsu.scrobbling.common.domain.model.ScrobblingInfo import org.koitharu.kotatsu.scrobbling.common.ui.config.adapter.ScrobblingMangaAdapter -import javax.inject.Inject import androidx.appcompat.R as appcompatR @AndroidEntryPoint class ScrobblerConfigActivity : BaseActivity(), OnListItemClickListener, View.OnClickListener { - @Inject - lateinit var coil: ImageLoader - private val viewModel: ScrobblerConfigViewModel by viewModels() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(ActivityScrobblerConfigBinding.inflate(layoutInflater)) setTitle(viewModel.titleResId) - setDisplayHomeAsUp(true, false) + setDisplayHomeAsUp(isEnabled = true, showUpAsClose = false) - val listAdapter = ScrobblingMangaAdapter(this, coil, this) + val listAdapter = ScrobblingMangaAdapter(this) with(viewBinding.recyclerView) { adapter = listAdapter setHasFixedSize(true) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/config/adapter/ScrobblingMangaAdapter.kt b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/config/adapter/ScrobblingMangaAdapter.kt index 48acb4bd8..e98ee5e9c 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/config/adapter/ScrobblingMangaAdapter.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/config/adapter/ScrobblingMangaAdapter.kt @@ -1,7 +1,5 @@ package org.koitharu.kotatsu.scrobbling.common.ui.config.adapter -import androidx.lifecycle.LifecycleOwner -import coil3.ImageLoader import org.koitharu.kotatsu.core.ui.BaseListAdapter import org.koitharu.kotatsu.core.ui.list.OnListItemClickListener import org.koitharu.kotatsu.list.ui.adapter.ListItemType @@ -11,8 +9,6 @@ import org.koitharu.kotatsu.scrobbling.common.domain.model.ScrobblingInfo class ScrobblingMangaAdapter( clickListener: OnListItemClickListener, - coil: ImageLoader, - lifecycleOwner: LifecycleOwner, ) : BaseListAdapter() { init { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/selector/ScrobblingSelectorSheet.kt b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/selector/ScrobblingSelectorSheet.kt index 7118e9504..b47002d7f 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/selector/ScrobblingSelectorSheet.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/selector/ScrobblingSelectorSheet.kt @@ -12,7 +12,6 @@ import androidx.core.view.updatePadding import androidx.fragment.app.viewModels import androidx.recyclerview.widget.AsyncListDiffer import androidx.recyclerview.widget.RecyclerView.NO_ID -import coil3.ImageLoader import com.google.android.material.tabs.TabLayout import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.launch @@ -40,7 +39,6 @@ import org.koitharu.kotatsu.list.ui.model.LoadingFooter import org.koitharu.kotatsu.scrobbling.common.domain.model.ScrobblerManga import org.koitharu.kotatsu.scrobbling.common.ui.selector.adapter.ScrobblerMangaSelectionDecoration import org.koitharu.kotatsu.scrobbling.common.ui.selector.adapter.ScrobblerSelectorAdapter -import javax.inject.Inject @AndroidEntryPoint class ScrobblingSelectorSheet : @@ -54,9 +52,6 @@ class ScrobblingSelectorSheet : ListStateHolderListener, AsyncListDiffer.ListListener { - @Inject - lateinit var coil: ImageLoader - private var collapsibleActionViewCallback: CollapseActionViewCallback? = null private var paginationScrollListener: PaginationScrollListener? = null private val viewModel by viewModels() @@ -68,7 +63,7 @@ class ScrobblingSelectorSheet : override fun onViewBindingCreated(binding: SheetScrobblingSelectorBinding, savedInstanceState: Bundle?) { super.onViewBindingCreated(binding, savedInstanceState) disableFitToContents() - val listAdapter = ScrobblerSelectorAdapter(viewLifecycleOwner, coil, this, this) + val listAdapter = ScrobblerSelectorAdapter(this, this) listAdapter.addListListener(this) val decoration = ScrobblerMangaSelectionDecoration(binding.root.context) with(binding.recyclerView) { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/selector/adapter/ScrobblerSelectorAdapter.kt b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/selector/adapter/ScrobblerSelectorAdapter.kt index a4a5b29c9..bcef595ed 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/selector/adapter/ScrobblerSelectorAdapter.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/selector/adapter/ScrobblerSelectorAdapter.kt @@ -1,7 +1,5 @@ package org.koitharu.kotatsu.scrobbling.common.ui.selector.adapter -import androidx.lifecycle.LifecycleOwner -import coil3.ImageLoader import org.koitharu.kotatsu.core.ui.BaseListAdapter import org.koitharu.kotatsu.core.ui.list.OnListItemClickListener import org.koitharu.kotatsu.list.ui.adapter.ListItemType @@ -12,8 +10,6 @@ import org.koitharu.kotatsu.list.ui.model.ListModel import org.koitharu.kotatsu.scrobbling.common.domain.model.ScrobblerManga class ScrobblerSelectorAdapter( - lifecycleOwner: LifecycleOwner, - coil: ImageLoader, clickListener: OnListItemClickListener, stateHolderListener: ListStateHolderListener, ) : BaseListAdapter() { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/MangaListActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/MangaListActivity.kt index 00c100ca0..9fedf6774 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/MangaListActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/MangaListActivity.kt @@ -76,7 +76,7 @@ class MangaListActivity : val filter = intent.getParcelableExtraCompat(AppRouter.KEY_FILTER)?.filter val sortOrder = intent.getSerializableExtraCompat(AppRouter.KEY_SORT_ORDER) source = MangaSource(intent.getStringExtra(AppRouter.KEY_SOURCE)) - setDisplayHomeAsUp(true, false) + setDisplayHomeAsUp(isEnabled = true, showUpAsClose = false) if (viewBinding.containerFilterHeader != null) { viewBinding.appbar.addOnOffsetChangedListener(this) } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/MangaSuggestionsProvider.kt b/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/MangaSuggestionsProvider.kt index c708db286..571fda4d6 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/MangaSuggestionsProvider.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/MangaSuggestionsProvider.kt @@ -6,6 +6,7 @@ import android.content.Context import android.content.SearchRecentSuggestionsProvider import android.net.Uri import android.provider.SearchRecentSuggestions +import androidx.core.net.toUri import org.koitharu.kotatsu.BuildConfig class MangaSuggestionsProvider : SearchRecentSuggestionsProvider() { @@ -29,6 +30,6 @@ class MangaSuggestionsProvider : SearchRecentSuggestionsProvider() { .appendPath(SearchManager.SUGGEST_URI_PATH_QUERY) .build() - val URI: Uri = Uri.parse("content://$AUTHORITY/suggestions") + val URI: Uri = "content://$AUTHORITY/suggestions".toUri() } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/multi/SearchActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/multi/SearchActivity.kt index a196f7332..0d690b50f 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/multi/SearchActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/multi/SearchActivity.kt @@ -9,7 +9,6 @@ import androidx.activity.viewModels import androidx.appcompat.view.ActionMode import androidx.core.view.WindowInsetsCompat import androidx.core.view.updatePadding -import coil3.ImageLoader import dagger.hilt.android.AndroidEntryPoint import org.koitharu.kotatsu.R import org.koitharu.kotatsu.core.exceptions.resolve.SnackbarErrorObserver @@ -44,9 +43,6 @@ class SearchActivity : MangaListListener, ListSelectionController.Callback { - @Inject - lateinit var coil: ImageLoader - @Inject lateinit var settings: AppSettings @@ -85,8 +81,6 @@ class SearchActivity : callback = this, ) val adapter = SearchAdapter( - lifecycleOwner = this, - coil = coil, listener = this, itemClickListener = itemClickListener, sizeResolver = sizeResolver, @@ -96,7 +90,7 @@ class SearchActivity : viewBinding.recyclerView.setHasFixedSize(true) viewBinding.recyclerView.addItemDecoration(TypedListSpacingDecoration(this, true)) - setDisplayHomeAsUp(true, false) + setDisplayHomeAsUp(isEnabled = true, showUpAsClose = false) supportActionBar?.setSubtitle(R.string.search_results) addMenuProvider(SearchKindMenuProvider(this, viewModel.query, viewModel.kind)) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/multi/adapter/SearchAdapter.kt b/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/multi/adapter/SearchAdapter.kt index da8031745..49e66e017 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/multi/adapter/SearchAdapter.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/multi/adapter/SearchAdapter.kt @@ -1,9 +1,7 @@ package org.koitharu.kotatsu.search.ui.multi.adapter import android.content.Context -import androidx.lifecycle.LifecycleOwner import androidx.recyclerview.widget.RecyclerView.RecycledViewPool -import coil3.ImageLoader import org.koitharu.kotatsu.core.ui.BaseListAdapter import org.koitharu.kotatsu.core.ui.list.OnListItemClickListener import org.koitharu.kotatsu.core.ui.list.fastscroll.FastScroller @@ -20,8 +18,6 @@ import org.koitharu.kotatsu.list.ui.size.ItemSizeResolver import org.koitharu.kotatsu.search.ui.multi.SearchResultsListModel class SearchAdapter( - lifecycleOwner: LifecycleOwner, - coil: ImageLoader, listener: MangaListListener, itemClickListener: OnListItemClickListener, sizeResolver: ItemSizeResolver, diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/multi/adapter/SearchResultsAD.kt b/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/multi/adapter/SearchResultsAD.kt index a6a698552..c82ae0d77 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/multi/adapter/SearchResultsAD.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/multi/adapter/SearchResultsAD.kt @@ -1,5 +1,6 @@ package org.koitharu.kotatsu.search.ui.multi.adapter +import android.annotation.SuppressLint import androidx.core.view.isGone import androidx.core.view.isVisible import androidx.recyclerview.widget.RecyclerView.RecycledViewPool @@ -20,6 +21,7 @@ import org.koitharu.kotatsu.list.ui.size.ItemSizeResolver import org.koitharu.kotatsu.parsers.model.Manga import org.koitharu.kotatsu.search.ui.multi.SearchResultsListModel +@SuppressLint("NotifyDataSetChanged") fun searchResultsAD( sharedPool: RecycledViewPool, sizeResolver: ItemSizeResolver, diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/suggestion/SearchSuggestionFragment.kt b/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/suggestion/SearchSuggestionFragment.kt index 08bc21bdf..973ffd5bc 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/suggestion/SearchSuggestionFragment.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/suggestion/SearchSuggestionFragment.kt @@ -7,7 +7,6 @@ import android.view.ViewGroup import androidx.core.view.WindowInsetsCompat import androidx.fragment.app.activityViewModels import androidx.recyclerview.widget.ItemTouchHelper -import coil3.ImageLoader import dagger.hilt.android.AndroidEntryPoint import org.koitharu.kotatsu.core.os.VoiceInputContract import org.koitharu.kotatsu.core.ui.BaseFragment @@ -16,16 +15,12 @@ import org.koitharu.kotatsu.core.util.ext.consumeAllSystemBarsInsets import org.koitharu.kotatsu.core.util.ext.observe import org.koitharu.kotatsu.databinding.FragmentSearchSuggestionBinding import org.koitharu.kotatsu.search.ui.suggestion.adapter.SearchSuggestionAdapter -import javax.inject.Inject @AndroidEntryPoint class SearchSuggestionFragment : BaseFragment(), SearchSuggestionItemCallback.SuggestionItemListener { - @Inject - lateinit var coil: ImageLoader - private val viewModel by activityViewModels() private val voiceInputLauncher = registerForActivityResult(VoiceInputContract()) { result -> if (result != null) { @@ -41,8 +36,6 @@ class SearchSuggestionFragment : override fun onViewBindingCreated(binding: FragmentSearchSuggestionBinding, savedInstanceState: Bundle?) { super.onViewBindingCreated(binding, savedInstanceState) val adapter = SearchSuggestionAdapter( - coil = coil, - lifecycleOwner = viewLifecycleOwner, listener = requireActivity() as SearchSuggestionListener, ) addMenuProvider(SearchSuggestionMenuProvider(binding.root.context, voiceInputLauncher, viewModel)) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/suggestion/adapter/SearchSuggestionAdapter.kt b/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/suggestion/adapter/SearchSuggestionAdapter.kt index 5ffc5e4d6..695be2ad2 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/suggestion/adapter/SearchSuggestionAdapter.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/suggestion/adapter/SearchSuggestionAdapter.kt @@ -1,7 +1,5 @@ package org.koitharu.kotatsu.search.ui.suggestion.adapter -import androidx.lifecycle.LifecycleOwner -import coil3.ImageLoader import org.koitharu.kotatsu.core.ui.BaseListAdapter import org.koitharu.kotatsu.search.ui.suggestion.SearchSuggestionListener import org.koitharu.kotatsu.search.ui.suggestion.model.SearchSuggestionItem @@ -9,8 +7,6 @@ import org.koitharu.kotatsu.search.ui.suggestion.model.SearchSuggestionItem const val SEARCH_SUGGESTION_ITEM_TYPE_QUERY = 0 class SearchSuggestionAdapter( - coil: ImageLoader, - lifecycleOwner: LifecycleOwner, listener: SearchSuggestionListener, ) : BaseListAdapter() { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/settings/NetworkSettingsFragment.kt b/app/src/main/kotlin/org/koitharu/kotatsu/settings/NetworkSettingsFragment.kt index 4f9827d57..cdb349ca9 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/settings/NetworkSettingsFragment.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/settings/NetworkSettingsFragment.kt @@ -6,25 +6,18 @@ import android.view.View import androidx.preference.ListPreference import androidx.preference.Preference import com.google.android.material.snackbar.Snackbar -import dagger.hilt.android.AndroidEntryPoint import org.koitharu.kotatsu.R -import org.koitharu.kotatsu.core.cache.MemoryContentCache import org.koitharu.kotatsu.core.network.DoHProvider import org.koitharu.kotatsu.core.prefs.AppSettings import org.koitharu.kotatsu.core.ui.BasePreferenceFragment import org.koitharu.kotatsu.core.util.ext.setDefaultValueCompat import org.koitharu.kotatsu.parsers.util.names import java.net.Proxy -import javax.inject.Inject -@AndroidEntryPoint class NetworkSettingsFragment : BasePreferenceFragment(R.string.network), SharedPreferences.OnSharedPreferenceChangeListener { - @Inject - lateinit var contentCache: MemoryContentCache - override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { addPreferencesFromResource(R.xml.pref_network) findPreference(AppSettings.KEY_DOH)?.run { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/settings/override/OverrideConfigActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/settings/override/OverrideConfigActivity.kt index e162dd9aa..667823721 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/settings/override/OverrideConfigActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/settings/override/OverrideConfigActivity.kt @@ -8,7 +8,6 @@ import androidx.activity.result.contract.ActivityResultContracts.PickVisualMedia import androidx.activity.viewModels import androidx.core.view.WindowInsetsCompat import androidx.core.view.isVisible -import coil3.ImageLoader import com.google.android.material.snackbar.Snackbar import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.flow.filterNotNull @@ -24,7 +23,6 @@ import org.koitharu.kotatsu.core.util.ext.tryLaunch import org.koitharu.kotatsu.databinding.ActivityOverrideEditBinding import org.koitharu.kotatsu.parsers.model.Manga import org.koitharu.kotatsu.parsers.util.ifNullOrEmpty -import javax.inject.Inject import androidx.appcompat.R as appcompatR import com.google.android.material.R as materialR @@ -42,9 +40,6 @@ class OverrideConfigActivity : BaseActivity(), View } } - @Inject - lateinit var coil: ImageLoader - override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(ActivityOverrideEditBinding.inflate(layoutInflater)) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/settings/reader/ReaderTapGridConfigActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/settings/reader/ReaderTapGridConfigActivity.kt index e0adfb4a6..5844fa4bd 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/settings/reader/ReaderTapGridConfigActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/settings/reader/ReaderTapGridConfigActivity.kt @@ -40,7 +40,7 @@ class ReaderTapGridConfigActivity : BaseActivity() { init { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/settings/sources/manage/SourcesListProducer.kt b/app/src/main/kotlin/org/koitharu/kotatsu/settings/sources/manage/SourcesListProducer.kt index 2901f6bc1..d7bcc5e0c 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/settings/sources/manage/SourcesListProducer.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/settings/sources/manage/SourcesListProducer.kt @@ -3,7 +3,6 @@ package org.koitharu.kotatsu.settings.sources.manage import android.content.Context import androidx.room.InvalidationTracker import dagger.hilt.android.ViewModelLifecycle -import dagger.hilt.android.qualifiers.ApplicationContext import dagger.hilt.android.scopes.ViewModelScoped import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.cancelAndJoin diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/settings/sources/manage/SourcesManageFragment.kt b/app/src/main/kotlin/org/koitharu/kotatsu/settings/sources/manage/SourcesManageFragment.kt index 8bc1f6eae..74cb7505b 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/settings/sources/manage/SourcesManageFragment.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/settings/sources/manage/SourcesManageFragment.kt @@ -13,7 +13,6 @@ import androidx.core.view.WindowInsetsCompat import androidx.fragment.app.viewModels import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.RecyclerView -import coil3.ImageLoader import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.launch import org.koitharu.kotatsu.R @@ -49,9 +48,6 @@ class SourcesManageFragment : SourceConfigListener, RecyclerViewOwner { - @Inject - lateinit var coil: ImageLoader - @Inject lateinit var settings: AppSettings @@ -75,7 +71,7 @@ class SourcesManageFragment : savedInstanceState: Bundle?, ) { super.onViewBindingCreated(binding, savedInstanceState) - sourcesAdapter = SourceConfigAdapter(this, coil, viewLifecycleOwner) + sourcesAdapter = SourceConfigAdapter(this) with(binding.recyclerView) { setHasFixedSize(true) adapter = sourcesAdapter diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/settings/storage/directories/MangaDirectoriesActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/settings/storage/directories/MangaDirectoriesActivity.kt index b30e10954..514c3238d 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/settings/storage/directories/MangaDirectoriesActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/settings/storage/directories/MangaDirectoriesActivity.kt @@ -62,7 +62,7 @@ class MangaDirectoriesActivity : BaseActivity() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(ActivityMangaDirectoriesBinding.inflate(layoutInflater)) - setDisplayHomeAsUp(true, false) + setDisplayHomeAsUp(isEnabled = true, showUpAsClose = false) val adapter = AsyncListDifferDelegationAdapter(DirectoryDiffCallback(), directoryConfigAD(this)) viewBinding.recyclerView.adapter = adapter viewBinding.fabAdd.setOnClickListener(this) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/settings/utils/ActivityListPreference.kt b/app/src/main/kotlin/org/koitharu/kotatsu/settings/utils/ActivityListPreference.kt index 43e38d720..b1e86a62f 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/settings/utils/ActivityListPreference.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/settings/utils/ActivityListPreference.kt @@ -7,6 +7,7 @@ import android.util.AttributeSet import androidx.preference.ListPreference import org.koitharu.kotatsu.core.util.ext.printStackTraceDebug +@Suppress("unused") class ActivityListPreference : ListPreference { var activityIntent: Intent? = null diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/settings/utils/ThemeChooserPreference.kt b/app/src/main/kotlin/org/koitharu/kotatsu/settings/utils/ThemeChooserPreference.kt index 5a92f92db..d6cfee114 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/settings/utils/ThemeChooserPreference.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/settings/utils/ThemeChooserPreference.kt @@ -11,6 +11,7 @@ import android.view.View import android.view.ViewTreeObserver import android.widget.HorizontalScrollView import androidx.appcompat.view.ContextThemeWrapper +import androidx.core.view.isEmpty import androidx.core.view.isVisible import androidx.core.view.updatePaddingRelative import androidx.customview.view.AbsSavedState @@ -55,7 +56,7 @@ class ThemeChooserPreference @JvmOverloads constructor( val context = ContextThemeWrapper(context, theme.styleResId) val item = ItemColorSchemeBinding.inflate(LayoutInflater.from(context), binding.linear, false) - if (binding.linear.childCount == 0) { + if (binding.linear.isEmpty()) { item.root.updatePaddingRelative(start = 0) } val isSelected = theme == currentValue diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/stats/ui/StatsActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/stats/ui/StatsActivity.kt index 0646274a7..f0684ad35 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/stats/ui/StatsActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/stats/ui/StatsActivity.kt @@ -16,7 +16,6 @@ import androidx.core.view.isVisible import androidx.core.view.updateLayoutParams import androidx.core.view.updatePaddingRelative import androidx.recyclerview.widget.AsyncListDiffer -import coil3.ImageLoader import com.google.android.material.chip.Chip import com.google.android.material.chip.ChipDrawable import dagger.hilt.android.AndroidEntryPoint @@ -42,7 +41,6 @@ import org.koitharu.kotatsu.parsers.model.Manga import org.koitharu.kotatsu.stats.domain.StatsPeriod import org.koitharu.kotatsu.stats.domain.StatsRecord import org.koitharu.kotatsu.stats.ui.views.PieChartView -import javax.inject.Inject @AndroidEntryPoint class StatsActivity : BaseActivity(), @@ -53,15 +51,12 @@ class StatsActivity : BaseActivity(), View.OnClickListener, CompoundButton.OnCheckedChangeListener { - @Inject - lateinit var coil: ImageLoader - private val viewModel: StatsViewModel by viewModels() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(ActivityStatsBinding.inflate(layoutInflater)) - setDisplayHomeAsUp(true, false) + setDisplayHomeAsUp(isEnabled = true, showUpAsClose = false) val adapter = BaseListAdapter() .addDelegate(ListItemType.FEED, statsAD(this)) .addListListener(this) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/stats/ui/sheet/MangaStatsViewModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/stats/ui/sheet/MangaStatsViewModel.kt index 7d0133608..fa5a70d25 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/stats/ui/sheet/MangaStatsViewModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/stats/ui/sheet/MangaStatsViewModel.kt @@ -1,6 +1,5 @@ package org.koitharu.kotatsu.stats.ui.sheet -import androidx.collection.IntList import androidx.collection.MutableIntList import androidx.collection.emptyIntList import androidx.lifecycle.SavedStateHandle @@ -26,7 +25,7 @@ class MangaStatsViewModel @Inject constructor( val manga = savedStateHandle.require(AppRouter.KEY_MANGA).manga - val stats = MutableStateFlow(emptyIntList()) + val stats = MutableStateFlow(emptyIntList()) val startDate = MutableStateFlow(null) val totalPagesRead = MutableStateFlow(0) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/sync/domain/SyncHelper.kt b/app/src/main/kotlin/org/koitharu/kotatsu/sync/domain/SyncHelper.kt index 6b7ebdd50..5a2d8da75 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/sync/domain/SyncHelper.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/sync/domain/SyncHelper.kt @@ -9,10 +9,10 @@ import android.content.OperationApplicationException import android.content.SyncResult import android.content.SyncStats import android.database.Cursor -import android.net.Uri import android.util.Log import androidx.annotation.WorkerThread import androidx.core.content.contentValuesOf +import androidx.core.net.toUri import dagger.assisted.Assisted import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject @@ -288,7 +288,7 @@ class SyncHelper @AssistedInject constructor( ?: throw OperationApplicationException("Query failed: $uri") } - private fun uri(authority: String, table: String) = Uri.parse("content://$authority/$table") + private fun uri(authority: String, table: String) = "content://$authority/$table".toUri() private fun JSONObject.removeJSONObject(name: String) = remove(name) as JSONObject diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/tracker/ui/debug/TrackerDebugActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/tracker/ui/debug/TrackerDebugActivity.kt index 126f51f70..ea20f608d 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/tracker/ui/debug/TrackerDebugActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/tracker/ui/debug/TrackerDebugActivity.kt @@ -5,7 +5,6 @@ import android.view.View import androidx.activity.viewModels import androidx.core.view.WindowInsetsCompat import androidx.core.view.updatePadding -import coil3.ImageLoader import dagger.hilt.android.AndroidEntryPoint import org.koitharu.kotatsu.core.nav.router import org.koitharu.kotatsu.core.ui.BaseActivity @@ -17,20 +16,16 @@ import org.koitharu.kotatsu.core.util.ext.systemBarsInsets import org.koitharu.kotatsu.databinding.ActivityTrackerDebugBinding import org.koitharu.kotatsu.list.ui.adapter.ListItemType import org.koitharu.kotatsu.list.ui.adapter.TypedListSpacingDecoration -import javax.inject.Inject @AndroidEntryPoint class TrackerDebugActivity : BaseActivity(), OnListItemClickListener { - @Inject - lateinit var coil: ImageLoader - private val viewModel by viewModels() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(ActivityTrackerDebugBinding.inflate(layoutInflater)) - setDisplayHomeAsUp(true, false) + setDisplayHomeAsUp(isEnabled = true, showUpAsClose = false) val tracksAdapter = BaseListAdapter() .addDelegate(ListItemType.FEED, trackDebugAD(this)) with(viewBinding.recyclerView) { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/widget/recent/RecentWidgetConfigActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/widget/recent/RecentWidgetConfigActivity.kt index f5a42535f..209984510 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/widget/recent/RecentWidgetConfigActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/widget/recent/RecentWidgetConfigActivity.kt @@ -23,7 +23,7 @@ class RecentWidgetConfigActivity : override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(ActivityAppwidgetRecentBinding.inflate(layoutInflater)) - setDisplayHomeAsUp(true, true) + setDisplayHomeAsUp(isEnabled = true, showUpAsClose = true) viewBinding.buttonDone.setOnClickListener(this) val appWidgetId = intent?.getIntExtra( AppWidgetManager.EXTRA_APPWIDGET_ID, diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/widget/recent/RecentWidgetProvider.kt b/app/src/main/kotlin/org/koitharu/kotatsu/widget/recent/RecentWidgetProvider.kt index 380eb1cca..004e71778 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/widget/recent/RecentWidgetProvider.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/widget/recent/RecentWidgetProvider.kt @@ -5,9 +5,9 @@ import android.appwidget.AppWidgetManager import android.content.Context import android.content.Intent import android.graphics.Color -import android.net.Uri import android.widget.RemoteViews import androidx.core.app.PendingIntentCompat +import androidx.core.net.toUri import org.koitharu.kotatsu.R import org.koitharu.kotatsu.core.nav.ReaderIntent import org.koitharu.kotatsu.core.prefs.AppWidgetConfig @@ -34,7 +34,7 @@ class RecentWidgetProvider : BaseAppWidgetProvider() { } val adapter = Intent(context, RecentWidgetService::class.java) adapter.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, config.widgetId) - adapter.data = Uri.parse(adapter.toUri(Intent.URI_INTENT_SCHEME)) + adapter.data = adapter.toUri(Intent.URI_INTENT_SCHEME).toUri() views.setRemoteAdapter(R.id.stackView, adapter) val intent = Intent(context, ReaderActivity::class.java) intent.action = ReaderIntent.ACTION_MANGA_READ diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/widget/shelf/ShelfWidgetConfigActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/widget/shelf/ShelfWidgetConfigActivity.kt index 4c2ee770e..720655ec2 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/widget/shelf/ShelfWidgetConfigActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/widget/shelf/ShelfWidgetConfigActivity.kt @@ -35,7 +35,7 @@ class ShelfWidgetConfigActivity : override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(ActivityAppwidgetShelfBinding.inflate(layoutInflater)) - setDisplayHomeAsUp(true, true) + setDisplayHomeAsUp(isEnabled = true, showUpAsClose = true) adapter = CategorySelectAdapter(this) viewBinding.recyclerView.adapter = adapter viewBinding.buttonDone.setOnClickListener(this) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/widget/shelf/ShelfWidgetProvider.kt b/app/src/main/kotlin/org/koitharu/kotatsu/widget/shelf/ShelfWidgetProvider.kt index f56e11e0d..e052e7f49 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/widget/shelf/ShelfWidgetProvider.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/widget/shelf/ShelfWidgetProvider.kt @@ -5,9 +5,9 @@ import android.appwidget.AppWidgetManager import android.content.Context import android.content.Intent import android.graphics.Color -import android.net.Uri import android.widget.RemoteViews import androidx.core.app.PendingIntentCompat +import androidx.core.net.toUri import org.koitharu.kotatsu.R import org.koitharu.kotatsu.core.nav.ReaderIntent import org.koitharu.kotatsu.core.prefs.AppWidgetConfig @@ -34,7 +34,7 @@ class ShelfWidgetProvider : BaseAppWidgetProvider() { } val adapter = Intent(context, ShelfWidgetService::class.java) adapter.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, config.widgetId) - adapter.data = Uri.parse(adapter.toUri(Intent.URI_INTENT_SCHEME)) + adapter.data = adapter.toUri(Intent.URI_INTENT_SCHEME).toUri() views.setRemoteAdapter(R.id.gridView, adapter) val intent = Intent(context, ReaderActivity::class.java) intent.action = ReaderIntent.ACTION_MANGA_READ diff --git a/app/src/main/res/color/bottom_menu_active_indicator.xml b/app/src/main/res/color/bottom_menu_active_indicator.xml deleted file mode 100644 index 3dd89e625..000000000 --- a/app/src/main/res/color/bottom_menu_active_indicator.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/app/src/main/res/color/bottom_menu_active_item.xml b/app/src/main/res/color/bottom_menu_active_item.xml deleted file mode 100644 index a56980d3c..000000000 --- a/app/src/main/res/color/bottom_menu_active_item.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/app/src/main/res/drawable/ic_error_placeholder.xml b/app/src/main/res/drawable/ic_error_placeholder.xml deleted file mode 100644 index 5900c0e9e..000000000 --- a/app/src/main/res/drawable/ic_error_placeholder.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_list_end.xml b/app/src/main/res/drawable/ic_list_end.xml deleted file mode 100644 index 2e7f20ad1..000000000 --- a/app/src/main/res/drawable/ic_list_end.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_list_next.xml b/app/src/main/res/drawable/ic_list_next.xml deleted file mode 100644 index eb82e2891..000000000 --- a/app/src/main/res/drawable/ic_list_next.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_list_start.xml b/app/src/main/res/drawable/ic_list_start.xml deleted file mode 100644 index ca31a1d05..000000000 --- a/app/src/main/res/drawable/ic_list_start.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/app/src/main/res/layout/activity_categories.xml b/app/src/main/res/layout/activity_categories.xml index d124ddb81..c7946e672 100644 --- a/app/src/main/res/layout/activity_categories.xml +++ b/app/src/main/res/layout/activity_categories.xml @@ -64,7 +64,7 @@ app:fabSize="normal" app:layout_anchor="@id/recyclerView" app:layout_anchorGravity="bottom|end" - app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior" + app:layout_behavior="com.google.android.material.behavior.HideViewOnScrollBehavior" app:layout_dodgeInsetEdges="bottom" /> diff --git a/app/src/main/res/layout/sheet_favorite_categories.xml b/app/src/main/res/layout/dialog_favorite.xml similarity index 98% rename from app/src/main/res/layout/sheet_favorite_categories.xml rename to app/src/main/res/layout/dialog_favorite.xml index ec773818b..f1101a988 100644 --- a/app/src/main/res/layout/sheet_favorite_categories.xml +++ b/app/src/main/res/layout/dialog_favorite.xml @@ -13,6 +13,7 @@ android:layout_height="@dimen/category_covers_height" android:layout_marginStart="@dimen/screen_padding" app:coverSize="3.4dp" + app:hideEmptyViews="true" app:layout_constraintDimensionRatio="13:18" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/layout/fragment_list.xml b/app/src/main/res/layout/fragment_list.xml index 04f03261c..9c66fbd51 100644 --- a/app/src/main/res/layout/fragment_list.xml +++ b/app/src/main/res/layout/fragment_list.xml @@ -1,7 +1,6 @@ diff --git a/app/src/main/res/menu/opt_stats.xml b/app/src/main/res/menu/opt_stats.xml index 4072c40b4..442858386 100644 --- a/app/src/main/res/menu/opt_stats.xml +++ b/app/src/main/res/menu/opt_stats.xml @@ -1,8 +1,7 @@ + xmlns:app="http://schemas.android.com/apk/res-auto"> + diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f2a09e7ad..f94645e5a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -17,7 +17,7 @@ diskLruCache = "1.5" fragment = "1.8.6" gradle = "8.9.1" guava = "33.4.8-android" -dagger = "2.56.1" +dagger = "2.56.2" hilt = "1.2.0" json = "20250107" junit = "4.13.2" @@ -27,22 +27,22 @@ ksp = "2.1.20-2.0.0" leakcanary = "3.0-alpha-8" lifecycle = "2.8.7" markwon = "4.6.2" -material = "1.13.0-alpha12" +material = "1.13.0-alpha13" moshi = "1.15.2" okhttp = "4.12.0" okio = "3.11.0" parsers = "e874837efb" preference = "1.2.1" recyclerview = "1.4.0" -room = "2.7.0" +room = "2.7.1" ssiv = "9a67b6a7c9" swiperefreshlayout = "1.1.0" testRules = "1.6.1" testRunner = "1.6.2" -transition = "1.5.1" +transition = "1.6.0" viewpager2 = "1.1.0" webkit = "1.13.0" -workRuntime = "2.10.0" +workRuntime = "2.10.1" workinspector = "1.2" [libraries]