diff --git a/app/build.gradle b/app/build.gradle index 01c02c0c0..8e08ece56 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,8 +15,8 @@ android { applicationId 'org.koitharu.kotatsu' minSdkVersion 21 targetSdkVersion 33 - versionCode 551 - versionName '5.2-b1' + versionCode 552 + versionName '5.2' generatedDensities = [] testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -79,7 +79,7 @@ afterEvaluate { } dependencies { //noinspection GradleDependency - implementation('com.github.KotatsuApp:kotatsu-parsers:44e28b40d3') { + implementation('com.github.KotatsuApp:kotatsu-parsers:f732582d55') { exclude group: 'org.json', module: 'json' } diff --git a/app/src/androidTest/java/org/koitharu/kotatsu/core/os/ShortcutsUpdaterTest.kt b/app/src/androidTest/java/org/koitharu/kotatsu/core/os/AppShortcutManagerTest.kt similarity index 94% rename from app/src/androidTest/java/org/koitharu/kotatsu/core/os/ShortcutsUpdaterTest.kt rename to app/src/androidTest/java/org/koitharu/kotatsu/core/os/AppShortcutManagerTest.kt index 6b9de214f..d7fad17d9 100644 --- a/app/src/androidTest/java/org/koitharu/kotatsu/core/os/ShortcutsUpdaterTest.kt +++ b/app/src/androidTest/java/org/koitharu/kotatsu/core/os/AppShortcutManagerTest.kt @@ -23,7 +23,7 @@ import javax.inject.Inject @HiltAndroidTest @RunWith(AndroidJUnit4::class) -class ShortcutsUpdaterTest { +class AppShortcutManagerTest { @get:Rule var hiltRule = HiltAndroidRule(this) @@ -32,7 +32,7 @@ class ShortcutsUpdaterTest { lateinit var historyRepository: HistoryRepository @Inject - lateinit var shortcutsUpdater: ShortcutsUpdater + lateinit var appShortcutManager: AppShortcutManager @Inject lateinit var database: MangaDatabase @@ -72,6 +72,6 @@ class ShortcutsUpdaterTest { private suspend fun awaitUpdate() { val instrumentation = InstrumentationRegistry.getInstrumentation() instrumentation.awaitForIdle() - shortcutsUpdater.await() + appShortcutManager.await() } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/KotatsuApp.kt b/app/src/main/kotlin/org/koitharu/kotatsu/KotatsuApp.kt index 164095e81..ee0de4d61 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/KotatsuApp.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/KotatsuApp.kt @@ -67,6 +67,10 @@ class KotatsuApp : Application(), Configuration.Provider { reportFormat = StringFormat.JSON excludeMatchingSharedPreferencesKeys = listOf( "sources_\\w+", + AppSettings.KEY_APP_PASSWORD, + AppSettings.KEY_PROXY_LOGIN, + AppSettings.KEY_PROXY_ADDRESS, + AppSettings.KEY_PROXY_PASSWORD, ) httpSender { uri = getString(R.string.url_error_report) @@ -83,6 +87,7 @@ class KotatsuApp : Application(), Configuration.Provider { ReportField.PHONE_MODEL, ReportField.STACK_TRACE, ReportField.CRASH_CONFIGURATION, + ReportField.CUSTOM_DATA, ReportField.SHARED_PREFERENCES, ) dialog { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/AppModule.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/AppModule.kt index 25332e92e..c6d273615 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/AppModule.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/AppModule.kt @@ -29,13 +29,14 @@ import org.koitharu.kotatsu.core.cache.MemoryContentCache import org.koitharu.kotatsu.core.cache.StubContentCache import org.koitharu.kotatsu.core.db.MangaDatabase import org.koitharu.kotatsu.core.network.* +import org.koitharu.kotatsu.core.os.AppShortcutManager import org.koitharu.kotatsu.core.os.NetworkState -import org.koitharu.kotatsu.core.os.ShortcutsUpdater import org.koitharu.kotatsu.core.parser.MangaLoaderContextImpl import org.koitharu.kotatsu.core.parser.MangaRepository import org.koitharu.kotatsu.core.parser.favicon.FaviconFetcher import org.koitharu.kotatsu.core.ui.image.CoilImageGetter import org.koitharu.kotatsu.core.ui.util.ActivityRecreationHandle +import org.koitharu.kotatsu.core.util.AcraScreenLogger import org.koitharu.kotatsu.core.util.IncognitoModeIndicator import org.koitharu.kotatsu.core.util.ext.activityManager import org.koitharu.kotatsu.core.util.ext.connectivityManager @@ -125,12 +126,12 @@ interface AppModule { @ElementsIntoSet fun provideDatabaseObservers( widgetUpdater: WidgetUpdater, - shortcutsUpdater: ShortcutsUpdater, + appShortcutManager: AppShortcutManager, backupObserver: BackupObserver, syncController: SyncController, ): Set<@JvmSuppressWildcards InvalidationTracker.Observer> = arraySetOf( widgetUpdater, - shortcutsUpdater, + appShortcutManager, backupObserver, syncController, ) @@ -141,10 +142,12 @@ interface AppModule { appProtectHelper: AppProtectHelper, activityRecreationHandle: ActivityRecreationHandle, incognitoModeIndicator: IncognitoModeIndicator, + acraScreenLogger: AcraScreenLogger, ): Set<@JvmSuppressWildcards Application.ActivityLifecycleCallbacks> = arraySetOf( appProtectHelper, activityRecreationHandle, incognitoModeIndicator, + acraScreenLogger, ) @Provides diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/os/ShortcutsUpdater.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/os/AppShortcutManager.kt similarity index 97% rename from app/src/main/kotlin/org/koitharu/kotatsu/core/os/ShortcutsUpdater.kt rename to app/src/main/kotlin/org/koitharu/kotatsu/core/os/AppShortcutManager.kt index 62d431639..c1db43782 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/os/ShortcutsUpdater.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/os/AppShortcutManager.kt @@ -15,7 +15,6 @@ import androidx.core.graphics.drawable.toBitmap import androidx.room.InvalidationTracker import coil.ImageLoader import coil.request.ImageRequest -import coil.size.Precision import coil.size.Scale import dagger.hilt.android.qualifiers.ApplicationContext import kotlinx.coroutines.Dispatchers @@ -25,6 +24,7 @@ import org.koitharu.kotatsu.R import org.koitharu.kotatsu.core.db.TABLE_HISTORY import org.koitharu.kotatsu.core.parser.MangaDataRepository import org.koitharu.kotatsu.core.prefs.AppSettings +import org.koitharu.kotatsu.core.ui.image.ThumbnailTransformation import org.koitharu.kotatsu.core.util.ext.getDrawableOrThrow import org.koitharu.kotatsu.core.util.ext.printStackTraceDebug import org.koitharu.kotatsu.core.util.ext.processLifecycleScope @@ -36,7 +36,7 @@ import javax.inject.Inject import javax.inject.Singleton @Singleton -class ShortcutsUpdater @Inject constructor( +class AppShortcutManager @Inject constructor( @ApplicationContext private val context: Context, private val coil: ImageLoader, private val historyRepository: HistoryRepository, @@ -128,8 +128,8 @@ class ShortcutsUpdater @Inject constructor( .data(manga.coverUrl) .size(iconSize.width, iconSize.height) .tag(manga.source) - .precision(Precision.EXACT) .scale(Scale.FILL) + .transformations(ThumbnailTransformation()) .build(), ).getDrawableOrThrow().toBitmap() }.fold( 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..9eb35d7f6 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 @@ -14,7 +14,6 @@ import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.view.ActionMode import androidx.appcompat.widget.ActionBarContextView import androidx.appcompat.widget.Toolbar -import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat import androidx.core.graphics.ColorUtils import androidx.core.view.ViewCompat @@ -104,7 +103,8 @@ abstract class BaseActivity : override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { if (BuildConfig.DEBUG && keyCode == KeyEvent.KEYCODE_VOLUME_UP) { - ActivityCompat.recreate(this) + // ActivityCompat.recreate(this) + error("Test") return true } return super.onKeyDown(keyCode, event) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/image/ThumbnailTransformation.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/image/ThumbnailTransformation.kt new file mode 100644 index 000000000..c0ca38662 --- /dev/null +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/image/ThumbnailTransformation.kt @@ -0,0 +1,24 @@ +package org.koitharu.kotatsu.core.ui.image + +import android.graphics.Bitmap +import android.media.ThumbnailUtils +import coil.size.Size +import coil.size.pxOrElse +import coil.transform.Transformation + +class ThumbnailTransformation : Transformation { + + override val cacheKey: String = javaClass.name + + override suspend fun transform(input: Bitmap, size: Size): Bitmap { + return ThumbnailUtils.extractThumbnail( + input, + size.width.pxOrElse { input.width }, + size.height.pxOrElse { input.height }, + ) + } + + override fun equals(other: Any?) = other is ThumbnailTransformation + + override fun hashCode() = javaClass.hashCode() +} diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/util/AcraScreenLogger.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/util/AcraScreenLogger.kt new file mode 100644 index 000000000..5d768b82f --- /dev/null +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/util/AcraScreenLogger.kt @@ -0,0 +1,50 @@ +package org.koitharu.kotatsu.core.util + +import android.app.Activity +import android.content.Context +import android.os.Bundle +import androidx.fragment.app.Fragment +import androidx.fragment.app.FragmentActivity +import androidx.fragment.app.FragmentManager +import androidx.fragment.app.FragmentManager.FragmentLifecycleCallbacks +import org.acra.ACRA +import org.koitharu.kotatsu.core.ui.DefaultActivityLifecycleCallbacks +import java.text.DateFormat +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale +import javax.inject.Inject +import javax.inject.Singleton + +@Singleton +class AcraScreenLogger @Inject constructor() : FragmentLifecycleCallbacks(), DefaultActivityLifecycleCallbacks { + + private val timeFormat = SimpleDateFormat.getTimeInstance(DateFormat.DEFAULT, Locale.ROOT) + + override fun onFragmentAttached(fm: FragmentManager, f: Fragment, context: Context) { + super.onFragmentAttached(fm, f, context) + ACRA.errorReporter.putCustomData(f.key(), "${time()}: ${f.arguments}") + } + + override fun onFragmentDetached(fm: FragmentManager, f: Fragment) { + super.onFragmentDetached(fm, f) + ACRA.errorReporter.removeCustomData(f.key()) + } + + override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) { + super.onActivityCreated(activity, savedInstanceState) + ACRA.errorReporter.putCustomData(activity.key(), "${time()}: ${activity.intent}") + (activity as? FragmentActivity)?.supportFragmentManager?.registerFragmentLifecycleCallbacks(this, true) + } + + override fun onActivityDestroyed(activity: Activity) { + super.onActivityDestroyed(activity) + ACRA.errorReporter.removeCustomData(activity.key()) + } + + private fun Activity.key() = "Activity[${javaClass.simpleName}]" + + private fun Fragment.key() = "Fragment[${javaClass.simpleName}]" + + private fun time() = timeFormat.format(Date()) +} diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Fragment.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Fragment.kt index d755911aa..aaa71435f 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Fragment.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Fragment.kt @@ -52,3 +52,11 @@ suspend fun Fragment.awaitViewLifecycle(): LifecycleOwner { } } } + +fun DialogFragment.showDistinct(fm: FragmentManager, tag: String) { + val existing = fm.findFragmentByTag(tag) as? DialogFragment? + if (existing != null && existing.isVisible && existing.arguments == this.arguments) { + return + } + show(fm, tag) +} 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 1de67398f..323a0d797 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 @@ -30,7 +30,7 @@ import kotlinx.coroutines.flow.filterNotNull import org.koitharu.kotatsu.R import org.koitharu.kotatsu.core.exceptions.resolve.SnackbarErrorObserver import org.koitharu.kotatsu.core.model.parcelable.ParcelableManga -import org.koitharu.kotatsu.core.os.ShortcutsUpdater +import org.koitharu.kotatsu.core.os.AppShortcutManager import org.koitharu.kotatsu.core.parser.MangaIntent import org.koitharu.kotatsu.core.ui.BaseActivity import org.koitharu.kotatsu.core.ui.dialog.RecyclerViewAlertDialog @@ -68,7 +68,7 @@ class DetailsActivity : PopupMenu.OnMenuItemClickListener { @Inject - lateinit var shortcutsUpdater: ShortcutsUpdater + lateinit var appShortcutManager: AppShortcutManager private lateinit var viewBadge: ViewBadge private var buttonTip: WeakReference? = null @@ -147,7 +147,7 @@ class DetailsActivity : activity = this, viewModel = viewModel, snackbarHost = viewBinding.containerChapters, - shortcutsUpdater = shortcutsUpdater, + appShortcutManager = appShortcutManager, ), ) } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsMenuProvider.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsMenuProvider.kt index 4d333c345..a289f55c2 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsMenuProvider.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsMenuProvider.kt @@ -15,7 +15,7 @@ import com.google.android.material.snackbar.Snackbar import kotlinx.coroutines.launch import org.koitharu.kotatsu.R import org.koitharu.kotatsu.browser.BrowserActivity -import org.koitharu.kotatsu.core.os.ShortcutsUpdater +import org.koitharu.kotatsu.core.os.AppShortcutManager import org.koitharu.kotatsu.core.util.ShareHelper import org.koitharu.kotatsu.details.ui.model.MangaBranch import org.koitharu.kotatsu.favourites.ui.categories.select.FavouriteCategoriesSheet @@ -29,7 +29,7 @@ class DetailsMenuProvider( private val activity: FragmentActivity, private val viewModel: DetailsViewModel, private val snackbarHost: View, - private val shortcutsUpdater: ShortcutsUpdater, + private val appShortcutManager: AppShortcutManager, ) : MenuProvider { override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) { @@ -112,7 +112,7 @@ class DetailsMenuProvider( R.id.action_shortcut -> { viewModel.manga.value?.let { activity.lifecycleScope.launch { - if (!shortcutsUpdater.requestPinShortcut(it)) { + if (!appShortcutManager.requestPinShortcut(it)) { Snackbar.make(snackbarHost, R.string.operation_not_supported, Snackbar.LENGTH_SHORT) .show() } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/select/FavouriteCategoriesSheet.kt b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/select/FavouriteCategoriesSheet.kt index 7d5be8b7b..102abab0d 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/select/FavouriteCategoriesSheet.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/categories/select/FavouriteCategoriesSheet.kt @@ -14,6 +14,7 @@ import org.koitharu.kotatsu.core.ui.sheet.BaseAdaptiveSheet import org.koitharu.kotatsu.core.util.ext.getDisplayMessage import org.koitharu.kotatsu.core.util.ext.observe import org.koitharu.kotatsu.core.util.ext.observeEvent +import org.koitharu.kotatsu.core.util.ext.showDistinct import org.koitharu.kotatsu.core.util.ext.withArgs import org.koitharu.kotatsu.databinding.SheetFavoriteCategoriesBinding import org.koitharu.kotatsu.favourites.ui.categories.select.adapter.MangaCategoriesAdapter @@ -81,6 +82,6 @@ class FavouriteCategoriesSheet : ) }, ) - }.show(fm, TAG) + }.showDistinct(fm, TAG) } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/filter/ui/FilterSheetFragment.kt b/app/src/main/kotlin/org/koitharu/kotatsu/filter/ui/FilterSheetFragment.kt index c9734d9c7..7e9ef1405 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/filter/ui/FilterSheetFragment.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/filter/ui/FilterSheetFragment.kt @@ -12,6 +12,7 @@ import org.koitharu.kotatsu.core.ui.sheet.AdaptiveSheetBehavior import org.koitharu.kotatsu.core.ui.sheet.AdaptiveSheetCallback import org.koitharu.kotatsu.core.ui.sheet.BaseAdaptiveSheet import org.koitharu.kotatsu.core.util.ext.observe +import org.koitharu.kotatsu.core.util.ext.showDistinct import org.koitharu.kotatsu.databinding.SheetFilterBinding import org.koitharu.kotatsu.list.ui.model.ListModel @@ -54,6 +55,6 @@ class FilterSheetFragment : private const val TAG = "FilterBottomSheet" - fun show(fm: FragmentManager) = FilterSheetFragment().show(fm, TAG) + fun show(fm: FragmentManager) = FilterSheetFragment().showDistinct(fm, TAG) } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/ListModeBottomSheet.kt b/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/ListModeBottomSheet.kt index 75b18132d..433ddbfb1 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/ListModeBottomSheet.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/ListModeBottomSheet.kt @@ -13,6 +13,7 @@ import org.koitharu.kotatsu.core.prefs.AppSettings import org.koitharu.kotatsu.core.prefs.ListMode import org.koitharu.kotatsu.core.ui.sheet.BaseAdaptiveSheet import org.koitharu.kotatsu.core.util.ext.setValueRounded +import org.koitharu.kotatsu.core.util.ext.showDistinct import org.koitharu.kotatsu.core.util.progress.IntPercentLabelFormatter import org.koitharu.kotatsu.databinding.DialogListModeBinding import javax.inject.Inject @@ -72,6 +73,6 @@ class ListModeBottomSheet : private const val TAG = "ListModeSelectDialog" - fun show(fm: FragmentManager) = ListModeBottomSheet().show(fm, TAG) + fun show(fm: FragmentManager) = ListModeBottomSheet().showDistinct(fm, TAG) } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ChaptersSheet.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ChaptersSheet.kt index 4dcfce2e8..1d30aebb9 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ChaptersSheet.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ChaptersSheet.kt @@ -13,6 +13,7 @@ import org.koitharu.kotatsu.core.ui.list.OnListItemClickListener import org.koitharu.kotatsu.core.ui.sheet.BaseAdaptiveSheet import org.koitharu.kotatsu.core.util.RecyclerViewScrollCallback import org.koitharu.kotatsu.core.util.ext.getParcelableCompat +import org.koitharu.kotatsu.core.util.ext.showDistinct import org.koitharu.kotatsu.core.util.ext.withArgs import org.koitharu.kotatsu.databinding.SheetChaptersBinding import org.koitharu.kotatsu.details.ui.adapter.ChaptersAdapter @@ -87,6 +88,6 @@ class ChaptersSheet : BaseAdaptiveSheet(), OnListItemClick ) = ChaptersSheet().withArgs(2) { putParcelable(ARG_CHAPTERS, ParcelableMangaChapters(chapters)) putLong(ARG_CURRENT_ID, currentId) - }.show(fm, TAG) + }.showDistinct(fm, TAG) } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderViewModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderViewModel.kt index 3a260db4f..0bae31cc5 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderViewModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderViewModel.kt @@ -30,7 +30,7 @@ import kotlinx.coroutines.plus import org.koitharu.kotatsu.R import org.koitharu.kotatsu.bookmarks.domain.Bookmark import org.koitharu.kotatsu.bookmarks.domain.BookmarksRepository -import org.koitharu.kotatsu.core.os.ShortcutsUpdater +import org.koitharu.kotatsu.core.os.AppShortcutManager import org.koitharu.kotatsu.core.parser.MangaDataRepository import org.koitharu.kotatsu.core.parser.MangaIntent import org.koitharu.kotatsu.core.prefs.AppSettings @@ -73,7 +73,7 @@ class ReaderViewModel @Inject constructor( private val pageSaveHelper: PageSaveHelper, private val pageLoader: PageLoader, private val chaptersLoader: ChaptersLoader, - private val shortcutsUpdater: ShortcutsUpdater, + private val appShortcutManager: AppShortcutManager, private val doubleMangaLoadUseCase: DoubleMangaLoadUseCase, private val historyUpdateUseCase: HistoryUpdateUseCase, private val detectReaderModeUseCase: DetectReaderModeUseCase, @@ -155,7 +155,7 @@ class ReaderViewModel @Inject constructor( }.launchIn(viewModelScope + Dispatchers.Default) launchJob(Dispatchers.Default) { val mangaId = mangaFlow.filterNotNull().first().id - shortcutsUpdater.notifyMangaOpened(mangaId) + appShortcutManager.notifyMangaOpened(mangaId) } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/config/ReaderConfigSheet.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/config/ReaderConfigSheet.kt index a29154d6f..109fc58f3 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/config/ReaderConfigSheet.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/config/ReaderConfigSheet.kt @@ -26,6 +26,7 @@ import org.koitharu.kotatsu.core.prefs.observeAsStateFlow import org.koitharu.kotatsu.core.ui.sheet.BaseAdaptiveSheet import org.koitharu.kotatsu.core.util.ScreenOrientationHelper import org.koitharu.kotatsu.core.util.ext.observe +import org.koitharu.kotatsu.core.util.ext.showDistinct import org.koitharu.kotatsu.core.util.ext.viewLifecycleScope import org.koitharu.kotatsu.core.util.ext.withArgs import org.koitharu.kotatsu.databinding.SheetReaderConfigBinding @@ -192,6 +193,6 @@ class ReaderConfigSheet : fun show(fm: FragmentManager, mode: ReaderMode) = ReaderConfigSheet().withArgs(1) { putInt(ARG_MODE, mode.id) - }.show(fm, TAG) + }.showDistinct(fm, TAG) } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/thumbnails/PagesThumbnailsSheet.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/thumbnails/PagesThumbnailsSheet.kt index 2886c1a43..0658e52f0 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/thumbnails/PagesThumbnailsSheet.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/thumbnails/PagesThumbnailsSheet.kt @@ -25,6 +25,7 @@ import org.koitharu.kotatsu.core.util.ext.observe import org.koitharu.kotatsu.core.util.ext.observeEvent import org.koitharu.kotatsu.core.util.ext.plus import org.koitharu.kotatsu.core.util.ext.scaleUpActivityOptionsOf +import org.koitharu.kotatsu.core.util.ext.showDistinct import org.koitharu.kotatsu.core.util.ext.withArgs import org.koitharu.kotatsu.databinding.SheetPagesBinding import org.koitharu.kotatsu.list.ui.MangaListSpanResolver @@ -194,7 +195,7 @@ class PagesThumbnailsSheet : putParcelable(ARG_MANGA, ParcelableManga(manga, true)) putLong(ARG_CHAPTER_ID, chapterId) putInt(ARG_CURRENT_PAGE, currentPage) - }.show(fm, TAG) + }.showDistinct(fm, TAG) } } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/settings/UserDataSettingsFragment.kt b/app/src/main/kotlin/org/koitharu/kotatsu/settings/UserDataSettingsFragment.kt index 2972d126d..d280e2bd0 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/settings/UserDataSettingsFragment.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/settings/UserDataSettingsFragment.kt @@ -21,7 +21,7 @@ import kotlinx.coroutines.runInterruptible import okhttp3.Cache import org.koitharu.kotatsu.R import org.koitharu.kotatsu.core.network.cookies.MutableCookieJar -import org.koitharu.kotatsu.core.os.ShortcutsUpdater +import org.koitharu.kotatsu.core.os.AppShortcutManager import org.koitharu.kotatsu.core.prefs.AppSettings import org.koitharu.kotatsu.core.ui.BasePreferenceFragment import org.koitharu.kotatsu.core.util.FileSize @@ -59,7 +59,7 @@ class UserDataSettingsFragment : BasePreferenceFragment(R.string.data_and_privac lateinit var cache: Cache @Inject - lateinit var shortcutsUpdater: ShortcutsUpdater + lateinit var appShortcutManager: AppShortcutManager private val backupSelectCall = registerForActivityResult( ActivityResultContracts.OpenDocument(), @@ -69,7 +69,7 @@ class UserDataSettingsFragment : BasePreferenceFragment(R.string.data_and_privac override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { addPreferencesFromResource(R.xml.pref_user_data) findPreference(AppSettings.KEY_SHORTCUTS)?.isVisible = - shortcutsUpdater.isDynamicShortcutsAvailable() + appShortcutManager.isDynamicShortcutsAvailable() findPreference(AppSettings.KEY_PROTECT_APP) ?.isChecked = !settings.appPassword.isNullOrEmpty() }