From 350f1521a6bf09c38a8b4fa030a016d3cf6dc4e9 Mon Sep 17 00:00:00 2001 From: Koitharu Date: Thu, 3 Oct 2024 13:08:00 +0300 Subject: [PATCH] Fix warnings and cleanup --- app/build.gradle | 2 +- .../kotatsu/bookmarks/domain/Bookmark.kt | 3 - .../kotatsu/browser/BrowserActivity.kt | 94 +++++++++---------- .../org/koitharu/kotatsu/core/AppModule.kt | 1 - .../exceptions/CloudFlareBlockedException.kt | 1 - .../exceptions/NoDataReceivedException.kt | 2 +- .../core/parser/ParserMangaRepository.kt | 4 - .../external/ExternalMangaRepository.kt | 2 +- .../kotatsu/core/ui/ReorderableListAdapter.kt | 10 +- .../kotatsu/core/util/ext/Collections.kt | 2 +- .../koitharu/kotatsu/core/util/ext/Flow.kt | 1 - .../details/ui/adapter/ChaptersAdapter.kt | 2 +- .../download/ui/worker/DownloadWorker.kt | 1 - .../kotatsu/list/ui/MangaListViewModel.kt | 1 - .../kotatsu/list/ui/model/ErrorFooter.kt | 2 - .../local/data/output/LocalMangaOutput.kt | 1 - .../main/ui/protect/ProtectViewModel.kt | 1 - .../kotatsu/reader/ui/ReaderManager.kt | 2 +- .../kotatsu/reader/ui/ReaderViewModel.kt | 1 - .../reader/ui/pager/BaseReaderFragment.kt | 1 - .../selector/ScrobblingSelectorViewModel.kt | 1 - .../settings/DownloadsSettingsFragment.kt | 1 - .../kotatsu/settings/backup/AppBackupAgent.kt | 1 - .../settings/backup/RestoreViewModel.kt | 4 - .../kotatsu/stats/data/StatsEntity.kt | 1 - .../kotatsu/stats/data/StatsRepository.kt | 4 - .../kotatsu/stats/domain/StatsRecord.kt | 8 -- .../kotatsu/stats/ui/StatsViewModel.kt | 2 +- .../stats/ui/sheet/MangaStatsViewModel.kt | 3 - .../kotatsu/stats/ui/views/PieChartView.kt | 3 +- .../kotatsu/sync/data/SyncSettings.kt | 9 +- .../tracker/ui/debug/TrackerDebugViewModel.kt | 2 +- app/src/main/res/color/ripple_toolbar.xml | 5 - app/src/main/res/drawable/bg_card_bottom.xml | 29 ------ app/src/main/res/drawable/bg_card_full.xml | 25 ----- app/src/main/res/drawable/bg_card_none.xml | 23 ----- app/src/main/res/drawable/bg_card_top.xml | 29 ------ app/src/main/res/drawable/ic_discord.xml | 11 --- app/src/main/res/drawable/ic_github.xml | 11 --- app/src/main/res/drawable/ic_list_sheet.xml | 12 --- app/src/main/res/drawable/ic_telegram.xml | 10 -- app/src/main/res/layout/dialog_onboard.xml | 30 ------ app/src/main/res/layout/item_catalog_page.xml | 19 ---- .../layout/item_source_config_checkable.xml | 58 ------------ .../main/res/layout/item_source_locale.xml | 47 ---------- .../res/layout/preference_about_links.xml | 43 --------- 46 files changed, 67 insertions(+), 458 deletions(-) delete mode 100644 app/src/main/res/color/ripple_toolbar.xml delete mode 100644 app/src/main/res/drawable/bg_card_bottom.xml delete mode 100644 app/src/main/res/drawable/bg_card_full.xml delete mode 100644 app/src/main/res/drawable/bg_card_none.xml delete mode 100644 app/src/main/res/drawable/bg_card_top.xml delete mode 100644 app/src/main/res/drawable/ic_discord.xml delete mode 100644 app/src/main/res/drawable/ic_github.xml delete mode 100644 app/src/main/res/drawable/ic_list_sheet.xml delete mode 100644 app/src/main/res/drawable/ic_telegram.xml delete mode 100644 app/src/main/res/layout/dialog_onboard.xml delete mode 100644 app/src/main/res/layout/item_catalog_page.xml delete mode 100644 app/src/main/res/layout/item_source_config_checkable.xml delete mode 100644 app/src/main/res/layout/item_source_locale.xml delete mode 100644 app/src/main/res/layout/preference_about_links.xml diff --git a/app/build.gradle b/app/build.gradle index 7bad9b52c..66c8e1af5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -94,7 +94,7 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.7.0' implementation 'androidx.core:core-ktx:1.13.1' implementation 'androidx.activity:activity-ktx:1.9.2' - implementation 'androidx.fragment:fragment-ktx:1.8.3' + implementation 'androidx.fragment:fragment-ktx:1.8.4' implementation 'androidx.transition:transition-ktx:1.5.1' implementation 'androidx.collection:collection-ktx:1.4.4' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.6' diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/bookmarks/domain/Bookmark.kt b/app/src/main/kotlin/org/koitharu/kotatsu/bookmarks/domain/Bookmark.kt index ad092b746..acc4c74f6 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/bookmarks/domain/Bookmark.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/bookmarks/domain/Bookmark.kt @@ -17,9 +17,6 @@ data class Bookmark( val percent: Float, ) : ListModel { - val directImageUrl: String? - get() = if (isImageUrlDirect()) imageUrl else null - val imageLoadData: Any get() = if (isImageUrlDirect()) imageUrl else toMangaPage() diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/browser/BrowserActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/browser/BrowserActivity.kt index d236b74d6..159550134 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/browser/BrowserActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/browser/BrowserActivity.kt @@ -12,7 +12,6 @@ import androidx.core.graphics.Insets import androidx.core.view.isVisible import androidx.core.view.updatePadding import dagger.hilt.android.AndroidEntryPoint -import okhttp3.internal.userAgent import org.koitharu.kotatsu.R import org.koitharu.kotatsu.core.model.MangaSource import org.koitharu.kotatsu.core.network.CommonHeaders @@ -22,49 +21,50 @@ import org.koitharu.kotatsu.core.ui.BaseActivity import org.koitharu.kotatsu.core.util.ext.configureForParser import org.koitharu.kotatsu.core.util.ext.toUriOrNull import org.koitharu.kotatsu.databinding.ActivityBrowserBinding +import org.koitharu.kotatsu.parsers.model.MangaSource import javax.inject.Inject import com.google.android.material.R as materialR @AndroidEntryPoint class BrowserActivity : BaseActivity(), BrowserCallback { - private lateinit var onBackPressedCallback: WebViewBackPressedCallback + private lateinit var onBackPressedCallback: WebViewBackPressedCallback - @Inject - lateinit var mangaRepositoryFactory: MangaRepository.Factory + @Inject + lateinit var mangaRepositoryFactory: MangaRepository.Factory - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - if (!setContentViewWebViewSafe { ActivityBrowserBinding.inflate(layoutInflater) }) { - return - } - supportActionBar?.run { - setDisplayHomeAsUpEnabled(true) - setHomeAsUpIndicator(materialR.drawable.abc_ic_clear_material) - } - val mangaSource = MangaSource(intent?.getStringExtra(EXTRA_SOURCE)) - val repository = mangaRepositoryFactory.create(mangaSource) as? ParserMangaRepository - val userAgent = repository?.getRequestHeaders()?.get(CommonHeaders.USER_AGENT) - viewBinding.webView.configureForParser(userAgent) - CookieManager.getInstance().setAcceptThirdPartyCookies(viewBinding.webView, true) - viewBinding.webView.webViewClient = BrowserClient(this) - viewBinding.webView.webChromeClient = ProgressChromeClient(viewBinding.progressBar) - onBackPressedCallback = WebViewBackPressedCallback(viewBinding.webView) - onBackPressedDispatcher.addCallback(onBackPressedCallback) - if (savedInstanceState != null) { - return - } - val url = intent?.dataString - if (url.isNullOrEmpty()) { - finishAfterTransition() - } else { - onTitleChanged( - intent?.getStringExtra(EXTRA_TITLE) ?: getString(R.string.loading_), - url, - ) - viewBinding.webView.loadUrl(url) - } - } + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + if (!setContentViewWebViewSafe { ActivityBrowserBinding.inflate(layoutInflater) }) { + return + } + supportActionBar?.run { + setDisplayHomeAsUpEnabled(true) + setHomeAsUpIndicator(materialR.drawable.abc_ic_clear_material) + } + val mangaSource = MangaSource(intent?.getStringExtra(EXTRA_SOURCE)) + val repository = mangaRepositoryFactory.create(mangaSource) as? ParserMangaRepository + val userAgent = repository?.getRequestHeaders()?.get(CommonHeaders.USER_AGENT) + viewBinding.webView.configureForParser(userAgent) + CookieManager.getInstance().setAcceptThirdPartyCookies(viewBinding.webView, true) + viewBinding.webView.webViewClient = BrowserClient(this) + viewBinding.webView.webChromeClient = ProgressChromeClient(viewBinding.progressBar) + onBackPressedCallback = WebViewBackPressedCallback(viewBinding.webView) + onBackPressedDispatcher.addCallback(onBackPressedCallback) + if (savedInstanceState != null) { + return + } + val url = intent?.dataString + if (url.isNullOrEmpty()) { + finishAfterTransition() + } else { + onTitleChanged( + intent?.getStringExtra(EXTRA_TITLE) ?: getString(R.string.loading_), + url, + ) + viewBinding.webView.loadUrl(url) + } + } override fun onCreateOptionsMenu(menu: Menu): Boolean { super.onCreateOptionsMenu(menu) @@ -136,17 +136,17 @@ class BrowserActivity : BaseActivity(), BrowserCallback bottom = insets.bottom, ) } - - companion object { - private const val EXTRA_TITLE = "title" - private const val EXTRA_SOURCE = "source" + companion object { - fun newIntent(context: Context, url: String, source: MangaSource?, title: String?): Intent { - return Intent(context, BrowserActivity::class.java) - .setData(Uri.parse(url)) - .putExtra(EXTRA_TITLE, title) - .putExtra(EXTRA_SOURCE, source?.name) - } - } + private const val EXTRA_TITLE = "title" + private const val EXTRA_SOURCE = "source" + + fun newIntent(context: Context, url: String, source: MangaSource?, title: String?): Intent { + return Intent(context, BrowserActivity::class.java) + .setData(Uri.parse(url)) + .putExtra(EXTRA_TITLE, title) + .putExtra(EXTRA_SOURCE, source?.name) + } + } } 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 f1abcfdb2..cf47f00b2 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/AppModule.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/AppModule.kt @@ -1,7 +1,6 @@ package org.koitharu.kotatsu.core import android.app.Application -import android.content.ContentResolver import android.content.Context import android.provider.SearchRecentSuggestions import android.text.Html diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/exceptions/CloudFlareBlockedException.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/exceptions/CloudFlareBlockedException.kt index 244dba9f1..4860e4880 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/exceptions/CloudFlareBlockedException.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/exceptions/CloudFlareBlockedException.kt @@ -1,6 +1,5 @@ package org.koitharu.kotatsu.core.exceptions -import okhttp3.Headers import okio.IOException import org.koitharu.kotatsu.parsers.model.MangaSource diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/exceptions/NoDataReceivedException.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/exceptions/NoDataReceivedException.kt index f8de32a1e..3594ce18b 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/exceptions/NoDataReceivedException.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/exceptions/NoDataReceivedException.kt @@ -3,5 +3,5 @@ package org.koitharu.kotatsu.core.exceptions import okio.IOException class NoDataReceivedException( - private val url: String, + url: String, ) : IOException("No data has been received from $url") diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/ParserMangaRepository.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/ParserMangaRepository.kt index 82a614891..12f4cfcee 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/ParserMangaRepository.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/ParserMangaRepository.kt @@ -8,7 +8,6 @@ import org.koitharu.kotatsu.core.prefs.SourceSettings import org.koitharu.kotatsu.parsers.MangaParser import org.koitharu.kotatsu.parsers.MangaParserAuthProvider import org.koitharu.kotatsu.parsers.config.ConfigKey -import org.koitharu.kotatsu.parsers.model.ContentRating import org.koitharu.kotatsu.parsers.model.Favicons import org.koitharu.kotatsu.parsers.model.Manga import org.koitharu.kotatsu.parsers.model.MangaChapter @@ -17,13 +16,10 @@ import org.koitharu.kotatsu.parsers.model.MangaListFilterCapabilities import org.koitharu.kotatsu.parsers.model.MangaListFilterOptions import org.koitharu.kotatsu.parsers.model.MangaPage import org.koitharu.kotatsu.parsers.model.MangaParserSource -import org.koitharu.kotatsu.parsers.model.MangaState -import org.koitharu.kotatsu.parsers.model.MangaTag import org.koitharu.kotatsu.parsers.model.SortOrder import org.koitharu.kotatsu.parsers.util.SuspendLazy import org.koitharu.kotatsu.parsers.util.domain import org.koitharu.kotatsu.parsers.util.runCatchingCancellable -import java.util.Locale class ParserMangaRepository( private val parser: MangaParser, diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/external/ExternalMangaRepository.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/external/ExternalMangaRepository.kt index 2f4e9db24..05083c982 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/external/ExternalMangaRepository.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/parser/external/ExternalMangaRepository.kt @@ -17,7 +17,7 @@ import org.koitharu.kotatsu.parsers.util.SuspendLazy import java.util.EnumSet class ExternalMangaRepository( - private val contentResolver: ContentResolver, + contentResolver: ContentResolver, override val source: ExternalMangaSource, cache: MemoryContentCache, ) : CachingMangaRepository(cache) { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/ReorderableListAdapter.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/ReorderableListAdapter.kt index c34cb8382..738309af5 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/ReorderableListAdapter.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/ReorderableListAdapter.kt @@ -28,10 +28,12 @@ open class ReorderableListAdapter : ListDelegationAdapter listListeners.forEach { it.onCurrentListChanged(oldList, newList) } } - @Deprecated("Use emit() to dispatch list updates", level = DeprecationLevel.ERROR) - override fun setItems(items: List?) { - super.setItems(items) - } + @Deprecated( + message = "Use emit() to dispatch list updates", + level = DeprecationLevel.ERROR, + replaceWith = ReplaceWith("emit(items)"), + ) + override fun setItems(items: List?) = super.setItems(items) fun reorderItems(oldPos: Int, newPos: Int) { Collections.swap(items ?: return, oldPos, newPos) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Collections.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Collections.kt index 8af44c883..a7455af10 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Collections.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Collections.kt @@ -92,7 +92,7 @@ fun LongSet.toLongArray(): LongArray { return result } -fun LongSet.toSet(): Set = toCollection(ArraySet(size)) +fun LongSet.toSet(): Set = toCollection(ArraySet(size)) fun > LongSet.toCollection(out: R): R = out.also { result -> forEach(result::add) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Flow.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Flow.kt index a8db54adc..b5d922e70 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Flow.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Flow.kt @@ -17,7 +17,6 @@ import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.transform import kotlinx.coroutines.flow.transformLatest import kotlinx.coroutines.flow.transformWhile -import org.koitharu.kotatsu.R import org.koitharu.kotatsu.parsers.util.SuspendLazy import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicInteger diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/adapter/ChaptersAdapter.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/adapter/ChaptersAdapter.kt index 5035401c2..ae83503c1 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/adapter/ChaptersAdapter.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/adapter/ChaptersAdapter.kt @@ -12,7 +12,7 @@ import org.koitharu.kotatsu.list.ui.model.ListHeader import org.koitharu.kotatsu.list.ui.model.ListModel class ChaptersAdapter( - private val onItemClickListener: OnListItemClickListener, + onItemClickListener: OnListItemClickListener, ) : BaseListAdapter(), FastScroller.SectionIndexer { private var hasVolumes = false diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/download/ui/worker/DownloadWorker.kt b/app/src/main/kotlin/org/koitharu/kotatsu/download/ui/worker/DownloadWorker.kt index 0f985027b..651be3654 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/download/ui/worker/DownloadWorker.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/download/ui/worker/DownloadWorker.kt @@ -71,7 +71,6 @@ import org.koitharu.kotatsu.local.data.LocalMangaRepository import org.koitharu.kotatsu.local.data.LocalStorageChanges import org.koitharu.kotatsu.local.data.PagesCache import org.koitharu.kotatsu.local.data.TempFileFilter -import org.koitharu.kotatsu.local.data.index.LocalMangaIndex import org.koitharu.kotatsu.local.data.input.LocalMangaInput import org.koitharu.kotatsu.local.data.output.LocalMangaOutput import org.koitharu.kotatsu.local.domain.MangaLock diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/MangaListViewModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/MangaListViewModel.kt index 5278dbf56..0090b8e10 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/MangaListViewModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/MangaListViewModel.kt @@ -22,7 +22,6 @@ import org.koitharu.kotatsu.download.ui.worker.DownloadWorker import org.koitharu.kotatsu.list.domain.ListFilterOption import org.koitharu.kotatsu.list.ui.model.ListModel import org.koitharu.kotatsu.parsers.model.Manga -import org.koitharu.kotatsu.parsers.model.MangaTag abstract class MangaListViewModel( private val settings: AppSettings, diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/model/ErrorFooter.kt b/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/model/ErrorFooter.kt index 55e414919..119ed411a 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/model/ErrorFooter.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/model/ErrorFooter.kt @@ -1,7 +1,5 @@ package org.koitharu.kotatsu.list.ui.model -import androidx.annotation.DrawableRes - data class ErrorFooter( val exception: Throwable, ) : ListModel { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/local/data/output/LocalMangaOutput.kt b/app/src/main/kotlin/org/koitharu/kotatsu/local/data/output/LocalMangaOutput.kt index b94c04ddf..c150ac6a4 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/local/data/output/LocalMangaOutput.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/local/data/output/LocalMangaOutput.kt @@ -4,7 +4,6 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock import kotlinx.coroutines.withContext -import okhttp3.internal.format import okio.Closeable import org.koitharu.kotatsu.core.prefs.DownloadFormat import org.koitharu.kotatsu.core.util.ext.printStackTraceDebug diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/main/ui/protect/ProtectViewModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/main/ui/protect/ProtectViewModel.kt index b9a407a4e..77af614f5 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/main/ui/protect/ProtectViewModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/main/ui/protect/ProtectViewModel.kt @@ -8,7 +8,6 @@ import org.koitharu.kotatsu.core.prefs.AppSettings import org.koitharu.kotatsu.core.ui.BaseViewModel import org.koitharu.kotatsu.core.util.ext.MutableEventFlow import org.koitharu.kotatsu.core.util.ext.call -import org.koitharu.kotatsu.parsers.util.isNumeric import org.koitharu.kotatsu.parsers.util.md5 import javax.inject.Inject diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderManager.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderManager.kt index bb045deb8..53069dd1b 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderManager.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderManager.kt @@ -19,7 +19,7 @@ import java.util.EnumMap class ReaderManager( private val fragmentManager: FragmentManager, private val container: FragmentContainerView, - private val settings: AppSettings, + settings: AppSettings, ) { private val modeMap = EnumMap>>(ReaderMode::class.java) 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 a0341f7ba..852fba563 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 @@ -13,7 +13,6 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job import kotlinx.coroutines.cancelAndJoin import kotlinx.coroutines.ensureActive -import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.SharingStarted diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/pager/BaseReaderFragment.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/pager/BaseReaderFragment.kt index 04fa68a81..c4ac87358 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/pager/BaseReaderFragment.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/pager/BaseReaderFragment.kt @@ -7,7 +7,6 @@ import androidx.viewbinding.ViewBinding import org.koitharu.kotatsu.core.prefs.ReaderAnimation import org.koitharu.kotatsu.core.ui.BaseFragment import org.koitharu.kotatsu.core.ui.widgets.ZoomControl -import org.koitharu.kotatsu.core.util.ext.getParcelableCompat import org.koitharu.kotatsu.core.util.ext.isAnimationsEnabled import org.koitharu.kotatsu.core.util.ext.observe import org.koitharu.kotatsu.reader.ui.ReaderState diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/selector/ScrobblingSelectorViewModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/selector/ScrobblingSelectorViewModel.kt index 217cee55a..0542c61d2 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/selector/ScrobblingSelectorViewModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/selector/ScrobblingSelectorViewModel.kt @@ -20,7 +20,6 @@ import org.koitharu.kotatsu.core.parser.MangaIntent import org.koitharu.kotatsu.core.ui.BaseViewModel import org.koitharu.kotatsu.core.util.ext.MutableEventFlow import org.koitharu.kotatsu.core.util.ext.call -import org.koitharu.kotatsu.core.util.ext.ifZero import org.koitharu.kotatsu.core.util.ext.printStackTraceDebug import org.koitharu.kotatsu.core.util.ext.require import org.koitharu.kotatsu.core.util.ext.requireValue diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/settings/DownloadsSettingsFragment.kt b/app/src/main/kotlin/org/koitharu/kotatsu/settings/DownloadsSettingsFragment.kt index 1a2922728..ffcb1e10f 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/settings/DownloadsSettingsFragment.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/settings/DownloadsSettingsFragment.kt @@ -17,7 +17,6 @@ import kotlinx.coroutines.withContext import org.koitharu.kotatsu.R import org.koitharu.kotatsu.core.prefs.AppSettings import org.koitharu.kotatsu.core.prefs.DownloadFormat -import org.koitharu.kotatsu.core.prefs.ReaderAnimation import org.koitharu.kotatsu.core.ui.BasePreferenceFragment import org.koitharu.kotatsu.core.util.ext.printStackTraceDebug import org.koitharu.kotatsu.core.util.ext.resolveFile diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/settings/backup/AppBackupAgent.kt b/app/src/main/kotlin/org/koitharu/kotatsu/settings/backup/AppBackupAgent.kt index 919728c4d..cc076775e 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/settings/backup/AppBackupAgent.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/settings/backup/AppBackupAgent.kt @@ -15,7 +15,6 @@ import org.koitharu.kotatsu.core.backup.BackupZipOutput import org.koitharu.kotatsu.core.db.MangaDatabase import org.koitharu.kotatsu.core.exceptions.BadBackupFormatException import org.koitharu.kotatsu.core.prefs.AppSettings -import org.koitharu.kotatsu.core.util.ext.printStackTraceDebug import java.io.File import java.io.FileDescriptor import java.io.FileInputStream diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/settings/backup/RestoreViewModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/settings/backup/RestoreViewModel.kt index 9acb88717..bef9212ad 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/settings/backup/RestoreViewModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/settings/backup/RestoreViewModel.kt @@ -1,8 +1,6 @@ package org.koitharu.kotatsu.settings.backup -import android.content.ContentResolver import android.content.Context -import android.net.Uri import androidx.lifecycle.SavedStateHandle import dagger.hilt.android.lifecycle.HiltViewModel import dagger.hilt.android.qualifiers.ApplicationContext @@ -13,8 +11,6 @@ import org.koitharu.kotatsu.core.backup.BackupEntry import org.koitharu.kotatsu.core.backup.BackupRepository import org.koitharu.kotatsu.core.backup.BackupZipInput import org.koitharu.kotatsu.core.backup.CompositeResult -import org.koitharu.kotatsu.core.exceptions.BadBackupFormatException -import org.koitharu.kotatsu.core.exceptions.UnsupportedFileException import org.koitharu.kotatsu.core.ui.BaseViewModel import org.koitharu.kotatsu.core.util.ext.MutableEventFlow import org.koitharu.kotatsu.core.util.ext.call diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/stats/data/StatsEntity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/stats/data/StatsEntity.kt index 0889b3f53..9ebef64a7 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/stats/data/StatsEntity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/stats/data/StatsEntity.kt @@ -3,7 +3,6 @@ package org.koitharu.kotatsu.stats.data import androidx.room.ColumnInfo import androidx.room.Entity import androidx.room.ForeignKey -import org.koitharu.kotatsu.core.db.entity.MangaEntity import org.koitharu.kotatsu.history.data.HistoryEntity @Entity( diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/stats/data/StatsRepository.kt b/app/src/main/kotlin/org/koitharu/kotatsu/stats/data/StatsRepository.kt index 7facb67e0..9b621e1b0 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/stats/data/StatsRepository.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/stats/data/StatsRepository.kt @@ -1,10 +1,7 @@ package org.koitharu.kotatsu.stats.data -import androidx.collection.LongIntMap -import androidx.collection.MutableLongIntMap import androidx.room.withTransaction import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.flowOf @@ -13,7 +10,6 @@ import org.koitharu.kotatsu.core.db.MangaDatabase import org.koitharu.kotatsu.core.db.entity.toManga import org.koitharu.kotatsu.core.prefs.AppSettings import org.koitharu.kotatsu.core.prefs.observeAsFlow -import org.koitharu.kotatsu.core.util.ext.combine import org.koitharu.kotatsu.stats.domain.StatsPeriod import org.koitharu.kotatsu.stats.domain.StatsRecord import java.util.NavigableMap diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/stats/domain/StatsRecord.kt b/app/src/main/kotlin/org/koitharu/kotatsu/stats/domain/StatsRecord.kt index 190f8efe1..7e4c9e739 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/stats/domain/StatsRecord.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/stats/domain/StatsRecord.kt @@ -1,17 +1,9 @@ package org.koitharu.kotatsu.stats.domain -import android.content.Context -import androidx.annotation.ColorInt -import androidx.core.content.ContextCompat -import androidx.core.graphics.ColorUtils -import com.google.android.material.R -import com.google.android.material.color.MaterialColors -import org.koitharu.kotatsu.core.util.ext.getThemeColor import org.koitharu.kotatsu.details.data.ReadingTime import org.koitharu.kotatsu.list.ui.model.ListModel import org.koitharu.kotatsu.parsers.model.Manga import java.util.concurrent.TimeUnit -import kotlin.math.absoluteValue data class StatsRecord( val manga: Manga?, diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/stats/ui/StatsViewModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/stats/ui/StatsViewModel.kt index 40b07d252..f6a309b22 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/stats/ui/StatsViewModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/stats/ui/StatsViewModel.kt @@ -21,7 +21,7 @@ import javax.inject.Inject @HiltViewModel class StatsViewModel @Inject constructor( private val repository: StatsRepository, - private val favouritesRepository: FavouritesRepository, + favouritesRepository: FavouritesRepository, ) : BaseViewModel() { val period = MutableStateFlow(StatsPeriod.WEEK) 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 f81b4a6bd..9fc1f782b 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,10 +1,8 @@ package org.koitharu.kotatsu.stats.ui.sheet import androidx.collection.IntList -import androidx.collection.LongIntMap import androidx.collection.MutableIntList import androidx.collection.emptyIntList -import androidx.collection.emptyLongIntMap import androidx.lifecycle.SavedStateHandle import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.Dispatchers @@ -15,7 +13,6 @@ import org.koitharu.kotatsu.core.ui.model.DateTimeAgo import org.koitharu.kotatsu.core.util.ext.calculateTimeAgo import org.koitharu.kotatsu.core.util.ext.require import org.koitharu.kotatsu.stats.data.StatsRepository -import org.koitharu.kotatsu.stats.domain.StatsRecord import java.time.Instant import java.util.concurrent.TimeUnit import javax.inject.Inject diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/stats/ui/views/PieChartView.kt b/app/src/main/kotlin/org/koitharu/kotatsu/stats/ui/views/PieChartView.kt index 6f2cc29cb..178e25f18 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/stats/ui/views/PieChartView.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/stats/ui/views/PieChartView.kt @@ -13,6 +13,7 @@ import androidx.core.graphics.ColorUtils import org.koitharu.kotatsu.core.util.ext.getThemeColor import org.koitharu.kotatsu.core.util.ext.resolveDp import org.koitharu.kotatsu.parsers.util.replaceWith +import kotlin.math.atan2 import kotlin.math.sqrt class PieChartView @JvmOverloads constructor( @@ -130,7 +131,7 @@ class PieChartView @JvmOverloads constructor( if (distance < chartBounds.height() / 4f || distance > chartBounds.centerX()) { return -1 } - var touchAngle = Math.toDegrees(Math.atan2(dy, dx)).toFloat() + var touchAngle = Math.toDegrees(atan2(dy, dx)).toFloat() if (touchAngle < 0) { touchAngle += 360 } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/sync/data/SyncSettings.kt b/app/src/main/kotlin/org/koitharu/kotatsu/sync/data/SyncSettings.kt index e686e1349..9a0651b44 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/sync/data/SyncSettings.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/sync/data/SyncSettings.kt @@ -4,7 +4,6 @@ import android.accounts.Account import android.accounts.AccountManager import android.content.Context import androidx.annotation.WorkerThread -import dagger.Reusable import dagger.hilt.android.qualifiers.ApplicationContext import org.koitharu.kotatsu.R import org.koitharu.kotatsu.core.util.ext.ifNullOrEmpty @@ -30,11 +29,11 @@ class SyncSettings( @set:WorkerThread var syncURL: String get() = account?.let { - val sync_url = accountManager.getUserData(it, KEY_SYNC_URL) - if ( !sync_url.startsWith("http://") && !sync_url.startsWith("https://") ) { - return "http://$sync_url" + val result = accountManager.getUserData(it, KEY_SYNC_URL) + if (!result.startsWith("http://") && !result.startsWith("https://")) { + return "http://$result" } - return sync_url + return result }.ifNullOrEmpty { defaultSyncUrl } set(value) { account?.let { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/tracker/ui/debug/TrackerDebugViewModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/tracker/ui/debug/TrackerDebugViewModel.kt index cf591c685..b9b8866ec 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/tracker/ui/debug/TrackerDebugViewModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/tracker/ui/debug/TrackerDebugViewModel.kt @@ -16,7 +16,7 @@ import javax.inject.Inject @HiltViewModel class TrackerDebugViewModel @Inject constructor( - private val db: MangaDatabase + db: MangaDatabase ) : BaseViewModel() { val content = db.getTracksDao().observeAll() diff --git a/app/src/main/res/color/ripple_toolbar.xml b/app/src/main/res/color/ripple_toolbar.xml deleted file mode 100644 index 979d0f94a..000000000 --- a/app/src/main/res/color/ripple_toolbar.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/app/src/main/res/drawable/bg_card_bottom.xml b/app/src/main/res/drawable/bg_card_bottom.xml deleted file mode 100644 index f693f7c2a..000000000 --- a/app/src/main/res/drawable/bg_card_bottom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/bg_card_full.xml b/app/src/main/res/drawable/bg_card_full.xml deleted file mode 100644 index 316531284..000000000 --- a/app/src/main/res/drawable/bg_card_full.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/bg_card_none.xml b/app/src/main/res/drawable/bg_card_none.xml deleted file mode 100644 index 2e6a50b46..000000000 --- a/app/src/main/res/drawable/bg_card_none.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/bg_card_top.xml b/app/src/main/res/drawable/bg_card_top.xml deleted file mode 100644 index 145b73611..000000000 --- a/app/src/main/res/drawable/bg_card_top.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/ic_discord.xml b/app/src/main/res/drawable/ic_discord.xml deleted file mode 100644 index 73fde1989..000000000 --- a/app/src/main/res/drawable/ic_discord.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_github.xml b/app/src/main/res/drawable/ic_github.xml deleted file mode 100644 index 55a2da656..000000000 --- a/app/src/main/res/drawable/ic_github.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_list_sheet.xml b/app/src/main/res/drawable/ic_list_sheet.xml deleted file mode 100644 index 2a7ccb3a9..000000000 --- a/app/src/main/res/drawable/ic_list_sheet.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_telegram.xml b/app/src/main/res/drawable/ic_telegram.xml deleted file mode 100644 index c18d3a442..000000000 --- a/app/src/main/res/drawable/ic_telegram.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/app/src/main/res/layout/dialog_onboard.xml b/app/src/main/res/layout/dialog_onboard.xml deleted file mode 100644 index 2ca236818..000000000 --- a/app/src/main/res/layout/dialog_onboard.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - diff --git a/app/src/main/res/layout/item_catalog_page.xml b/app/src/main/res/layout/item_catalog_page.xml deleted file mode 100644 index d43cdb9db..000000000 --- a/app/src/main/res/layout/item_catalog_page.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - diff --git a/app/src/main/res/layout/item_source_config_checkable.xml b/app/src/main/res/layout/item_source_config_checkable.xml deleted file mode 100644 index 9bb6ae9ad..000000000 --- a/app/src/main/res/layout/item_source_config_checkable.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/item_source_locale.xml b/app/src/main/res/layout/item_source_locale.xml deleted file mode 100644 index 71c333a98..000000000 --- a/app/src/main/res/layout/item_source_locale.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/preference_about_links.xml b/app/src/main/res/layout/preference_about_links.xml deleted file mode 100644 index b5c0ad8ee..000000000 --- a/app/src/main/res/layout/preference_about_links.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - -