Update linter

This commit is contained in:
arkon
2022-04-08 15:30:30 -04:00
parent 37100f0937
commit f0eb42e72d
192 changed files with 318 additions and 437 deletions

View File

@@ -25,7 +25,7 @@ class OneWayFadeChangeHandler : FadeChangeHandler {
from: View?,
to: View?,
isPush: Boolean,
toAddedToContainer: Boolean
toAddedToContainer: Boolean,
): Animator {
val animator = AnimatorSet()
if (to != null) {

View File

@@ -21,8 +21,7 @@ import reactivecircus.flowbinding.appcompat.queryTextEvents
/**
* Implementation of the NucleusController that has a built-in ViewSearch
*/
abstract class SearchableNucleusController<VB : ViewBinding, P : BasePresenter<*>>
(bundle: Bundle? = null) : NucleusController<VB, P>(bundle) {
abstract class SearchableNucleusController<VB : ViewBinding, P : BasePresenter<*>>(bundle: Bundle? = null) : NucleusController<VB, P>(bundle) {
enum class SearchViewState { LOADING, LOADED, COLLAPSING, FOCUSED }
@@ -45,7 +44,7 @@ abstract class SearchableNucleusController<VB : ViewBinding, P : BasePresenter<*
menuId: Int,
searchItemId: Int,
@StringRes queryHint: Int? = null,
restoreCurrentQuery: Boolean = true
restoreCurrentQuery: Boolean = true,
) {
// Inflate menu
inflater.inflate(menuId, menu)

View File

@@ -16,7 +16,7 @@ import eu.kanade.tachiyomi.R
data class ExtensionGroupItem(
val name: String,
val size: Int,
val showSize: Boolean = false
val showSize: Boolean = false,
) : AbstractHeaderItem<ExtensionGroupHolder>() {
var actionLabel: String? = null
@@ -43,7 +43,7 @@ data class ExtensionGroupItem(
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: ExtensionGroupHolder,
position: Int,
payloads: List<Any?>?
payloads: List<Any?>?,
) {
holder.bind(this)
}

View File

@@ -19,7 +19,7 @@ import eu.kanade.tachiyomi.source.CatalogueSource
data class ExtensionItem(
val extension: Extension,
val header: ExtensionGroupItem? = null,
val installStep: InstallStep = InstallStep.Idle
val installStep: InstallStep = InstallStep.Idle,
) :
AbstractSectionableItem<ExtensionHolder, ExtensionGroupItem>(header) {
@@ -44,7 +44,7 @@ data class ExtensionItem(
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: ExtensionHolder,
position: Int,
payloads: List<Any?>?
payloads: List<Any?>?,
) {
if (payloads == null || payloads.isEmpty()) {
holder.bind(this)

View File

@@ -26,7 +26,7 @@ private typealias ExtensionTuple =
*/
open class ExtensionPresenter(
private val extensionManager: ExtensionManager = Injekt.get(),
private val preferences: PreferencesHelper = Injekt.get()
private val preferences: PreferencesHelper = Injekt.get(),
) : BasePresenter<ExtensionController>() {
private var extensions = emptyList<ExtensionItem>()
@@ -64,7 +64,7 @@ open class ExtensionPresenter(
val items = mutableListOf<ExtensionItem>()
val updatesSorted = installed.filter { it.hasUpdate && (showNsfwSources || !it.isNsfw) }
.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, { it.name }))
.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.name })
val installedSorted = installed.filter { !it.hasUpdate && (showNsfwSources || !it.isNsfw) }
.sortedWith(
@@ -72,7 +72,7 @@ open class ExtensionPresenter(
.thenBy(String.CASE_INSENSITIVE_ORDER) { it.name }
)
val untrustedSorted = untrusted.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, { it.name }))
val untrustedSorted = untrusted.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.name })
val availableSorted = available
// Filter out already installed extensions and disabled languages
@@ -82,7 +82,7 @@ open class ExtensionPresenter(
avail.lang in activeLangs &&
(showNsfwSources || !avail.isNsfw)
}
.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, { it.name }))
.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.name })
if (updatesSorted.isNotEmpty()) {
val header = ExtensionGroupItem(context.getString(R.string.ext_updates_pending), updatesSorted.size, true)

View File

@@ -7,7 +7,7 @@ import uy.kohesive.injekt.api.get
class SourcePreferencesPresenter(
val sourceId: Long,
sourceManager: SourceManager = Injekt.get()
sourceManager: SourceManager = Injekt.get(),
) : BasePresenter<SourcePreferencesController>() {
val source = sourceManager.get(sourceId)

View File

@@ -8,7 +8,7 @@ import eu.kanade.tachiyomi.databinding.SourceListItemBinding
class MigrationMangaHolder(
view: View,
private val adapter: MigrationMangaAdapter
private val adapter: MigrationMangaAdapter,
) : FlexibleViewHolder(view, adapter) {
private val binding = SourceListItemBinding.bind(view)

View File

@@ -22,7 +22,7 @@ class MigrationMangaItem(val manga: Manga) : AbstractFlexibleItem<MigrationManga
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: MigrationMangaHolder,
position: Int,
payloads: List<Any?>?
payloads: List<Any?>?,
) {
holder.bind(this)
}

View File

@@ -10,7 +10,7 @@ import uy.kohesive.injekt.api.get
class MigrationMangaPresenter(
private val sourceId: Long,
private val db: DatabaseHelper = Injekt.get()
private val db: DatabaseHelper = Injekt.get(),
) : BasePresenter<MigrationMangaController>() {
override fun onCreate(savedState: Bundle?) {

View File

@@ -19,7 +19,7 @@ import eu.kanade.tachiyomi.ui.manga.MangaController
import uy.kohesive.injekt.injectLazy
class SearchController(
private var manga: Manga? = null
private var manga: Manga? = null,
) : GlobalSearchController(manga?.title) {
private var newManga: Manga? = null
@@ -121,7 +121,7 @@ class SearchController(
}
(targetController as? SearchController)?.migrateManga(manga, newManga)
}
.setNegativeButton(R.string.copy) { _, _, ->
.setNegativeButton(R.string.copy) { _, _ ->
if (callingController != null) {
if (callingController.javaClass == SourceSearchController::class.java) {
router.popController(callingController)

View File

@@ -27,7 +27,7 @@ import java.util.Date
class SearchPresenter(
initialQuery: String? = "",
private val manga: Manga
private val manga: Manga,
) : GlobalSearchPresenter(initialQuery) {
private val replacingMangaRelay = BehaviorRelay.create<Pair<Boolean, Manga?>>()
@@ -88,7 +88,7 @@ class SearchPresenter(
sourceChapters: List<SChapter>,
prevManga: Manga,
manga: Manga,
replace: Boolean
replace: Boolean,
) {
val flags = preferences.migrateFlags().get()
val migrateChapters =

View File

@@ -8,7 +8,7 @@ import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourceController
import eu.kanade.tachiyomi.ui.browse.source.browse.SourceItem
class SourceSearchController(
bundle: Bundle
bundle: Bundle,
) : BrowseSourceController(bundle) {
constructor(manga: Manga? = null, source: CatalogueSource, searchQuery: String? = null) : this(

View File

@@ -20,7 +20,7 @@ import java.util.Locale
class MigrationSourcesPresenter(
private val sourceManager: SourceManager = Injekt.get(),
private val db: DatabaseHelper = Injekt.get()
private val db: DatabaseHelper = Injekt.get(),
) : BasePresenter<MigrationSourcesController>() {
private val preferences: PreferencesHelper by injectLazy()

View File

@@ -38,7 +38,7 @@ class SelectionHeader : AbstractHeaderItem<SelectionHeader.Holder>() {
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: Holder,
position: Int,
payloads: List<Any?>?
payloads: List<Any?>?,
) {
// Intentionally empty
}

View File

@@ -41,7 +41,7 @@ data class SourceItem(val source: Source, val mangaCount: Int, val header: Selec
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: SourceHolder,
position: Int,
payloads: List<Any?>?
payloads: List<Any?>?,
) {
holder.bind(this)
}

View File

@@ -35,7 +35,7 @@ data class LangItem(val code: String) : AbstractHeaderItem<LangHolder>() {
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: LangHolder,
position: Int,
payloads: MutableList<Any>
payloads: MutableList<Any>,
) {
holder.bind(this)
}

View File

@@ -17,7 +17,7 @@ import eu.kanade.tachiyomi.source.CatalogueSource
data class SourceItem(
val source: CatalogueSource,
val header: LangItem? = null,
val isPinned: Boolean = false
val isPinned: Boolean = false,
) :
AbstractSectionableItem<SourceHolder, LangItem>(header) {
@@ -33,7 +33,7 @@ data class SourceItem(
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: SourceHolder,
position: Int,
payloads: MutableList<Any>
payloads: MutableList<Any>,
) {
holder.bind(this)
}

View File

@@ -21,7 +21,7 @@ import java.util.TreeMap
*/
class SourcePresenter(
val sourceManager: SourceManager = Injekt.get(),
private val preferences: PreferencesHelper = Injekt.get()
private val preferences: PreferencesHelper = Injekt.get(),
) : BasePresenter<SourceController>() {
var sources = getEnabledSources()

View File

@@ -62,7 +62,7 @@ open class BrowseSourcePresenter(
private val sourceManager: SourceManager = Injekt.get(),
private val db: DatabaseHelper = Injekt.get(),
private val prefs: PreferencesHelper = Injekt.get(),
private val coverCache: CoverCache = Injekt.get()
private val coverCache: CoverCache = Injekt.get(),
) : BasePresenter<BrowseSourceController>() {
/**

View File

@@ -18,7 +18,7 @@ import eu.kanade.tachiyomi.util.view.loadAutoPause
*/
class SourceComfortableGridHolder(
override val binding: SourceComfortableGridItemBinding,
adapter: FlexibleAdapter<*>
adapter: FlexibleAdapter<*>,
) : SourceHolder<SourceComfortableGridItemBinding>(binding.root, adapter) {
/**

View File

@@ -18,7 +18,7 @@ import eu.kanade.tachiyomi.util.view.loadAutoPause
*/
class SourceCompactGridHolder(
override val binding: SourceCompactGridItemBinding,
adapter: FlexibleAdapter<*>
adapter: FlexibleAdapter<*>,
) : SourceHolder<SourceCompactGridItemBinding>(binding.root, adapter) {
/**

View File

@@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.widget.sheet.BaseBottomSheetDialog
class SourceFilterSheet(
activity: Activity,
private val onFilterClicked: () -> Unit,
private val onResetClicked: () -> Unit
private val onResetClicked: () -> Unit,
) : BaseBottomSheetDialog(activity) {
private var filterNavView: FilterNavigationView = FilterNavigationView(activity)
@@ -36,7 +36,7 @@ class SourceFilterSheet(
class FilterNavigationView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null
attrs: AttributeSet? = null,
) :
SimpleNavigationView(context, attrs) {

View File

@@ -25,7 +25,7 @@ class SourceItem(val manga: Manga, private val displayMode: Preference<DisplayMo
override fun createViewHolder(
view: View,
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
): SourceHolder<*> {
return when (displayMode.get()) {
DisplayModeSetting.COMPACT_GRID, DisplayModeSetting.COVER_ONLY_GRID -> {
@@ -44,7 +44,7 @@ class SourceItem(val manga: Manga, private val displayMode: Preference<DisplayMo
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: SourceHolder<*>,
position: Int,
payloads: List<Any?>?
payloads: List<Any?>?,
) {
holder.onSetValues(manga)
}

View File

@@ -22,7 +22,7 @@ class GlobalSearchCardItem(val manga: Manga) : AbstractFlexibleItem<GlobalSearch
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: GlobalSearchCardHolder,
position: Int,
payloads: List<Any?>?
payloads: List<Any?>?,
) {
holder.bind(manga)
}

View File

@@ -28,7 +28,7 @@ import uy.kohesive.injekt.injectLazy
*/
open class GlobalSearchController(
protected val initialQuery: String? = null,
protected val extensionFilter: String? = null
protected val extensionFilter: String? = null,
) : SearchableNucleusController<GlobalSearchControllerBinding, GlobalSearchPresenter>(),
GlobalSearchCardAdapter.OnMangaClickListener,
GlobalSearchAdapter.OnTitleClickListener {

View File

@@ -43,7 +43,7 @@ class GlobalSearchItem(val source: CatalogueSource, val results: List<GlobalSear
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: GlobalSearchHolder,
position: Int,
payloads: List<Any?>?
payloads: List<Any?>?,
) {
holder.bind(this)
}

View File

@@ -39,7 +39,7 @@ open class GlobalSearchPresenter(
val initialExtensionFilter: String? = null,
val sourceManager: SourceManager = Injekt.get(),
val db: DatabaseHelper = Injekt.get(),
val preferences: PreferencesHelper = Injekt.get()
val preferences: PreferencesHelper = Injekt.get(),
) : BasePresenter<GlobalSearchController>() {
/**

View File

@@ -47,7 +47,7 @@ class CategoryItem(val category: Category) : AbstractFlexibleItem<CategoryHolder
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: CategoryHolder,
position: Int,
payloads: List<Any?>?
payloads: List<Any?>?,
) {
holder.bind(category)
}

View File

@@ -13,7 +13,7 @@ import uy.kohesive.injekt.api.get
* Presenter of [CategoryController]. Used to manage the categories of the library.
*/
class CategoryPresenter(
private val db: DatabaseHelper = Injekt.get()
private val db: DatabaseHelper = Injekt.get(),
) : BasePresenter<CategoryController>() {
/**

View File

@@ -197,7 +197,9 @@ class DownloadController :
onUpdateDownloadedPages(download)
}
Download.State.ERROR -> unsubscribeProgress(download)
else -> { /* unused */ }
else -> {
/* unused */
}
}
}

View File

@@ -10,7 +10,7 @@ import eu.kanade.tachiyomi.R
data class DownloadHeaderItem(
val id: Long,
val name: String,
val size: Int
val size: Int,
) : AbstractExpandableHeaderItem<DownloadHeaderHolder, DownloadItem>() {
override fun getLayoutRes(): Int {
@@ -19,7 +19,7 @@ data class DownloadHeaderItem(
override fun createViewHolder(
view: View,
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
): DownloadHeaderHolder {
return DownloadHeaderHolder(view, adapter)
}
@@ -28,7 +28,7 @@ data class DownloadHeaderItem(
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: DownloadHeaderHolder,
position: Int,
payloads: List<Any?>?
payloads: List<Any?>?,
) {
holder.bind(this)
}

View File

@@ -10,7 +10,7 @@ import eu.kanade.tachiyomi.data.download.model.Download
class DownloadItem(
val download: Download,
header: DownloadHeaderItem
header: DownloadHeaderItem,
) : AbstractSectionableItem<DownloadHolder, DownloadHeaderItem>(header) {
override fun getLayoutRes(): Int {
@@ -25,7 +25,7 @@ class DownloadItem(
*/
override fun createViewHolder(
view: View,
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
): DownloadHolder {
return DownloadHolder(view, adapter as DownloadAdapter)
}
@@ -42,7 +42,7 @@ class DownloadItem(
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: DownloadHolder,
position: Int,
payloads: MutableList<Any>
payloads: MutableList<Any>,
) {
holder.bind(download)
}

View File

@@ -25,7 +25,7 @@ class ChangeMangaCategoriesDialog<T>(bundle: Bundle? = null) :
target: T,
mangas: List<Manga>,
categories: List<Category>,
preselected: Array<Int>
preselected: Array<Int>,
) : this() {
this.mangas = mangas
this.categories = categories

View File

@@ -24,7 +24,7 @@ class DeleteLibraryMangasDialog<T>(bundle: Bundle? = null) :
val items = when (canDeleteChapters) {
true -> listOf(
R.string.manga_from_library,
R.string.downloaded_chapters,
R.string.downloaded_chapters
)
false -> listOf(R.string.manga_from_library)
}

View File

@@ -21,7 +21,7 @@ import uy.kohesive.injekt.api.get
*/
class LibraryAdapter(
private val controller: LibraryController,
private val preferences: PreferencesHelper = Injekt.get()
private val preferences: PreferencesHelper = Injekt.get(),
) : RecyclerViewPagerAdapter() {
/**

View File

@@ -19,7 +19,7 @@ import eu.kanade.tachiyomi.util.view.loadAutoPause
*/
class LibraryComfortableGridHolder(
override val binding: SourceComfortableGridItemBinding,
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
) : LibraryHolder<SourceComfortableGridItemBinding>(binding.root, adapter) {
/**

View File

@@ -18,7 +18,7 @@ import eu.kanade.tachiyomi.util.view.loadAutoPause
class LibraryCompactGridHolder(
override val binding: SourceCompactGridItemBinding,
adapter: FlexibleAdapter<*>,
private val coverOnly: Boolean
private val coverOnly: Boolean,
) : LibraryHolder<SourceCompactGridItemBinding>(binding.root, adapter) {
/**

View File

@@ -51,7 +51,7 @@ import java.util.concurrent.TimeUnit
class LibraryController(
bundle: Bundle? = null,
private val preferences: PreferencesHelper = Injekt.get()
private val preferences: PreferencesHelper = Injekt.get(),
) : SearchableNucleusController<LibraryControllerBinding, LibraryPresenter>(bundle),
RootController,
TabbedController,
@@ -282,7 +282,7 @@ class LibraryController(
EmptyView.Action(R.string.getting_started_guide, R.drawable.ic_help_24dp) {
activity?.openInBrowser("https://tachiyomi.org/help/guides/getting-started")
}
),
)
)
(activity as? MainActivity)?.ready = true
}

View File

@@ -14,7 +14,7 @@ import eu.davidea.viewholders.FlexibleViewHolder
abstract class LibraryHolder<VB : ViewBinding>(
view: View,
adapter: FlexibleAdapter<*>
adapter: FlexibleAdapter<*>,
) : FlexibleViewHolder(view, adapter) {
abstract val binding: VB

View File

@@ -19,7 +19,7 @@ import uy.kohesive.injekt.api.get
class LibraryItem(
val manga: LibraryManga,
private val shouldSetFromCategory: Preference<Boolean>,
private val defaultLibraryDisplayMode: Preference<DisplayModeSetting>
private val defaultLibraryDisplayMode: Preference<DisplayModeSetting>,
) :
AbstractFlexibleItem<LibraryHolder<*>>(), IFilterable<String> {
@@ -68,7 +68,7 @@ class LibraryItem(
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: LibraryHolder<*>,
position: Int,
payloads: List<Any?>?
payloads: List<Any?>?,
) {
holder.onSetValues(this)
}

View File

@@ -18,7 +18,7 @@ import eu.kanade.tachiyomi.databinding.SourceListItemBinding
*/
class LibraryListHolder(
private val view: View,
private val adapter: FlexibleAdapter<*>
private val adapter: FlexibleAdapter<*>,
) : LibraryHolder<SourceListItemBinding>(view, adapter) {
override val binding = SourceListItemBinding.bind(view)

View File

@@ -53,7 +53,7 @@ class LibraryPresenter(
private val coverCache: CoverCache = Injekt.get(),
private val sourceManager: SourceManager = Injekt.get(),
private val downloadManager: DownloadManager = Injekt.get(),
private val trackManager: TrackManager = Injekt.get()
private val trackManager: TrackManager = Injekt.get(),
) : BasePresenter<LibraryController>() {
private val context = preferences.context

View File

@@ -23,7 +23,7 @@ import uy.kohesive.injekt.injectLazy
class LibrarySettingsSheet(
router: Router,
private val trackManager: TrackManager = Injekt.get(),
onGroupClickListener: (ExtendedNavigationView.Group) -> Unit
onGroupClickListener: (ExtendedNavigationView.Group) -> Unit,
) : TabbedBottomSheetDialog(router.activity!!) {
val filters: Filter

View File

@@ -204,7 +204,7 @@ class MainActivity : BaseActivity() {
from: Controller?,
isPush: Boolean,
container: ViewGroup,
handler: ControllerChangeHandler
handler: ControllerChangeHandler,
) {
syncActivityViewWithController(to, from, isPush)
}
@@ -214,7 +214,7 @@ class MainActivity : BaseActivity() {
from: Controller?,
isPush: Boolean,
container: ViewGroup,
handler: ControllerChangeHandler
handler: ControllerChangeHandler,
) {
}
}

View File

@@ -425,7 +425,7 @@ class MangaController :
when (item.itemId) {
R.id.action_share -> shareManga()
R.id.download_next, R.id.download_next_5, R.id.download_next_10,
R.id.download_custom, R.id.download_unread, R.id.download_all
R.id.download_custom, R.id.download_unread, R.id.download_all,
-> downloadChapters(item.itemId)
R.id.action_edit_categories -> onCategoriesClick()
@@ -532,7 +532,7 @@ class MangaController :
if (duplicateManga != null) {
showAddDuplicateDialog(
manga,
duplicateManga,
duplicateManga
)
} else {
addToLibrary(manga)
@@ -545,11 +545,11 @@ class MangaController :
val source = sourceManager.getOrStub(libraryManga.source)
MaterialAlertDialogBuilder(it).apply {
setMessage(activity?.getString(R.string.confirm_manga_add_duplicate, source.name))
setPositiveButton(activity?.getString(R.string.action_add)) { _, _, ->
setPositiveButton(activity?.getString(R.string.action_add)) { _, _ ->
addToLibrary(newManga)
}
setNegativeButton(activity?.getString(R.string.action_cancel)) { _, _, -> }
setNeutralButton(activity?.getString(R.string.action_show_manga)) { _, _, ->
setNegativeButton(activity?.getString(R.string.action_cancel)) { _, _ -> }
setNeutralButton(activity?.getString(R.string.action_show_manga)) { _, _ ->
router.pushController(MangaController(libraryManga).withFadeTransaction())
}
setCancelable(true)
@@ -703,7 +703,7 @@ class MangaController :
previousController.search(query)
}
is UpdatesController,
is HistoryController -> {
is HistoryController, -> {
// Manually navigate to LibraryController
router.handleBack()
(router.activity as MainActivity).setSelectedNavItem(R.id.nav_library)
@@ -960,7 +960,7 @@ class MangaController :
intent.apply {
putExtra(ReaderActivity.EXTRA_IS_TRANSITION, true)
},
activityOptions.toBundle(),
activityOptions.toBundle()
)
} else {
startActivity(intent)

View File

@@ -66,7 +66,7 @@ class MangaPresenter(
private val db: DatabaseHelper = Injekt.get(),
private val trackManager: TrackManager = Injekt.get(),
private val downloadManager: DownloadManager = Injekt.get(),
private val coverCache: CoverCache = Injekt.get()
private val coverCache: CoverCache = Injekt.get(),
) : BasePresenter<MangaController>() {
/**

View File

@@ -15,7 +15,7 @@ import java.util.Date
class ChapterHolder(
view: View,
private val adapter: ChaptersAdapter
private val adapter: ChaptersAdapter,
) : BaseChapterHolder(view, adapter) {
private val binding = ChaptersItemBinding.bind(view)

View File

@@ -26,7 +26,7 @@ class ChapterItem(chapter: Chapter, val manga: Manga) :
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: ChapterHolder,
position: Int,
payloads: List<Any?>?
payloads: List<Any?>?,
) {
holder.bind(this, manga)
}

View File

@@ -13,7 +13,7 @@ import java.text.DecimalFormatSymbols
class ChaptersAdapter(
controller: MangaController,
context: Context
context: Context,
) : BaseChaptersAdapter<ChapterItem>(controller) {
private val preferences: PreferencesHelper by injectLazy()

View File

@@ -17,7 +17,7 @@ import eu.kanade.tachiyomi.widget.sheet.TabbedBottomSheetDialog
class ChaptersSettingsSheet(
private val router: Router,
private val presenter: MangaPresenter,
private val onGroupClickListener: (ExtendedNavigationView.Group) -> Unit
private val onGroupClickListener: (ExtendedNavigationView.Group) -> Unit,
) : TabbedBottomSheetDialog(router.activity!!) {
val filters = Filter(router.activity!!)

View File

@@ -14,7 +14,7 @@ import kotlinx.coroutines.flow.onEach
import reactivecircus.flowbinding.android.view.clicks
class MangaChaptersHeaderAdapter(
private val controller: MangaController
private val controller: MangaController,
) :
RecyclerView.Adapter<MangaChaptersHeaderAdapter.HeaderViewHolder>() {

View File

@@ -8,7 +8,7 @@ import eu.kanade.tachiyomi.util.view.popupMenu
open class BaseChapterHolder(
view: View,
private val adapter: BaseChaptersAdapter<*>
private val adapter: BaseChaptersAdapter<*>,
) : FlexibleViewHolder(view, adapter) {
fun onDownloadClick(view: View, position: Int) {

View File

@@ -8,7 +8,7 @@ import eu.kanade.tachiyomi.source.model.Page
abstract class BaseChapterItem<T : BaseChapterHolder, H : AbstractHeaderItem<*>>(
val chapter: Chapter,
header: H? = null
header: H? = null,
) :
AbstractSectionableItem<T, H?>(header),
Chapter by chapter {

View File

@@ -8,7 +8,7 @@ import eu.kanade.tachiyomi.databinding.TrackSearchItemBinding
class TrackSearchAdapter(
private val currentTrackUrl: String?,
private val onSelectionChanged: (TrackSearch?) -> Unit
private val onSelectionChanged: (TrackSearch?) -> Unit,
) : RecyclerView.Adapter<TrackSearchHolder>() {
var selectedItemPosition = -1
set(value) {

View File

@@ -45,7 +45,7 @@ class TrackSearchDialog : DialogController {
constructor(
target: MangaController,
_service: TrackService,
_currentTrackUrl: String?
_currentTrackUrl: String?,
) : super(bundleOf(KEY_SERVICE to _service.id, KEY_CURRENT_URL to _currentTrackUrl)) {
targetController = target
service = _service

View File

@@ -10,7 +10,7 @@ import java.util.Locale
class TrackSearchHolder(
private val binding: TrackSearchItemBinding,
private val adapter: TrackSearchAdapter
private val adapter: TrackSearchAdapter,
) : RecyclerView.ViewHolder(binding.root) {
fun bind(track: TrackSearch, position: Int) {
binding.root.isChecked = position == adapter.selectedItemPosition

View File

@@ -31,7 +31,7 @@ class TrackSheet(
val controller: MangaController,
val manga: Manga,
val fragmentManager: FragmentManager,
private val sourceManager: SourceManager = Injekt.get()
private val sourceManager: SourceManager = Injekt.get(),
) : BaseBottomSheetDialog(controller.activity!!),
TrackAdapter.OnClickListener,
SetTrackStatusDialog.Listener,

View File

@@ -22,7 +22,7 @@ class LicensesItem(val library: Library) : AbstractFlexibleItem<LicensesHolder>(
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: LicensesHolder,
position: Int,
payloads: List<Any?>?
payloads: List<Any?>?,
) {
holder.bind(library)
}

View File

@@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.widget.OutlineSpan
*/
class PageIndicatorTextView(
context: Context,
attrs: AttributeSet? = null
attrs: AttributeSet? = null,
) : AppCompatTextView(context, attrs) {
init {

View File

@@ -431,7 +431,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
setOnClickListener {
popupMenu(
items = ReadingModeType.values().map { it.flagValue to it.stringRes },
selectedItemId = presenter.getMangaReadingMode(resolveDefault = false),
selectedItemId = presenter.getMangaReadingMode(resolveDefault = false)
) {
val newReadingMode = ReadingModeType.fromPreference(itemId)
@@ -485,7 +485,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
popupMenu(
items = OrientationType.values().map { it.flagValue to it.stringRes },
selectedItemId = presenter.manga?.orientationType
?: preferences.defaultOrientationType(),
?: preferences.defaultOrientationType()
) {
val newOrientation = OrientationType.fromPreference(itemId)

View File

@@ -10,7 +10,7 @@ import androidx.core.graphics.toXfermode
class ReaderColorFilterView(
context: Context,
attrs: AttributeSet? = null
attrs: AttributeSet? = null,
) : View(context, attrs) {
private val colorFilterPaint: Paint = Paint()

View File

@@ -14,7 +14,7 @@ import eu.kanade.tachiyomi.widget.sheet.BaseBottomSheetDialog
*/
class ReaderPageSheet(
private val activity: ReaderActivity,
private val page: ReaderPage
private val page: ReaderPage,
) : BaseBottomSheetDialog(activity) {
private lateinit var binding: ReaderPageSheetBinding

View File

@@ -273,7 +273,7 @@ class ReaderPresenter(
*/
private fun getLoadObservable(
loader: ChapterLoader,
chapter: ReaderChapter
chapter: ReaderChapter,
): Observable<ViewerChapters> {
return loader.loadChapter(chapter)
.andThen(

View File

@@ -9,7 +9,7 @@ import com.google.android.material.slider.Slider
*/
class ReaderSlider @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null
attrs: AttributeSet? = null,
) : Slider(context, attrs) {
init {

View File

@@ -21,7 +21,7 @@ class ChapterLoader(
private val context: Context,
private val downloadManager: DownloadManager,
private val manga: Manga,
private val source: Source
private val source: Source,
) {
/**

View File

@@ -20,7 +20,7 @@ class DownloadPageLoader(
private val chapter: ReaderChapter,
private val manga: Manga,
private val source: Source,
private val downloadManager: DownloadManager
private val downloadManager: DownloadManager,
) : PageLoader() {
// Needed to open input streams

View File

@@ -26,7 +26,7 @@ import kotlin.math.min
class HttpPageLoader(
private val chapter: ReaderChapter,
private val source: HttpSource,
private val chapterCache: ChapterCache = Injekt.get()
private val chapterCache: ChapterCache = Injekt.get(),
) : PageLoader() {
/**
@@ -169,7 +169,7 @@ class HttpPageLoader(
*/
private class PriorityPage(
val page: ReaderPage,
val priority: Int
val priority: Int,
) : Comparable<PriorityPage> {
companion object {
private val idGenerator = AtomicInteger()

View File

@@ -7,12 +7,12 @@ sealed class ChapterTransition {
class Prev(
override val from: ReaderChapter,
override val to: ReaderChapter?
override val to: ReaderChapter?,
) : ChapterTransition()
class Next(
override val from: ReaderChapter,
override val to: ReaderChapter?
override val to: ReaderChapter?,
) : ChapterTransition()
override fun equals(other: Any?): Boolean {

View File

@@ -7,7 +7,7 @@ open class ReaderPage(
index: Int,
url: String = "",
imageUrl: String? = null,
var stream: (() -> InputStream)? = null
var stream: (() -> InputStream)? = null,
) : Page(index, url, imageUrl, null) {
open lateinit var chapter: ReaderChapter

View File

@@ -3,7 +3,7 @@ package eu.kanade.tachiyomi.ui.reader.model
data class ViewerChapters(
val currChapter: ReaderChapter,
val prevChapter: ReaderChapter?,
val nextChapter: ReaderChapter?
val nextChapter: ReaderChapter?,
) {
fun ref() {

View File

@@ -64,12 +64,12 @@ class ReaderSettingsSheet(
override fun getTabViews() = listOf(
readingModeSettings,
generalSettings,
colorFilterSettings,
colorFilterSettings
)
override fun getTabTitles() = listOf(
R.string.pref_category_reading_mode,
R.string.pref_category_general,
R.string.custom_filter,
R.string.custom_filter
)
}

View File

@@ -14,7 +14,7 @@ import kotlin.math.abs
*/
open class GestureDetectorWithLongTap(
context: Context,
listener: Listener
listener: Listener,
) : GestureDetector(context, listener) {
private val handler = Handler(Looper.getMainLooper())

View File

@@ -14,7 +14,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.pager.PagerViewer
class ReaderButton @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = R.attr.materialButtonStyle
defStyleAttr: Int = R.attr.materialButtonStyle,
) : MaterialButton(context, attrs, defStyleAttr) {
var viewer: PagerViewer? = null

View File

@@ -47,7 +47,7 @@ open class ReaderPageImageView @JvmOverloads constructor(
attrs: AttributeSet? = null,
@AttrRes defStyleAttrs: Int = 0,
@StyleRes defStyleRes: Int = 0,
private val isWebtoon: Boolean = false
private val isWebtoon: Boolean = false,
) : FrameLayout(context, attrs, defStyleAttrs, defStyleRes) {
private var pageView: View? = null
@@ -254,7 +254,7 @@ open class ReaderPageImageView @JvmOverloads constructor(
private fun setNonAnimatedImage(
image: Any,
config: Config
config: Config,
) = (pageView as? SubsamplingScaleImageView)?.apply {
setDoubleTapZoomDuration(config.zoomDuration.getSystemScaledDuration())
setMinimumScaleType(config.minimumScaleType)
@@ -326,7 +326,7 @@ open class ReaderPageImageView @JvmOverloads constructor(
private fun setAnimatedImage(
image: Any,
config: Config
config: Config,
) = (pageView as? AppCompatImageView)?.apply {
if (this is PhotoView) {
setZoomTransitionDuration(config.zoomDuration.getSystemScaledDuration())

View File

@@ -19,7 +19,7 @@ import com.google.android.material.progressindicator.CircularProgressIndicator
class ReaderProgressIndicator @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
defStyleAttr: Int = 0,
) : FrameLayout(context, attrs, defStyleAttr) {
private val indicator: CircularProgressIndicator

View File

@@ -82,7 +82,7 @@ abstract class ViewerConfig(preferences: PreferencesHelper, private val scope: C
fun <T> Preference<T>.register(
valueAssignment: (T) -> Unit,
onChanged: (T) -> Unit = {}
onChanged: (T) -> Unit = {},
) {
asFlow()
.onEach { valueAssignment(it) }

View File

@@ -19,7 +19,7 @@ abstract class ViewerNavigation {
data class Region(
val rectF: RectF,
val type: NavigationRegion
val type: NavigationRegion,
) {
fun invert(invertMode: PreferenceValues.TappingInvertMode): Region {
if (invertMode == PreferenceValues.TappingInvertMode.NONE) return this

View File

@@ -27,6 +27,6 @@ class EdgeNavigation : ViewerNavigation() {
Region(
rectF = RectF(0.66f, 0f, 1f, 1f),
type = NavigationRegion.NEXT
),
)
)
}

View File

@@ -23,6 +23,6 @@ class RightAndLeftNavigation : ViewerNavigation() {
Region(
rectF = RectF(0.66f, 0f, 1f, 1f),
type = NavigationRegion.RIGHT
),
)
)
}

View File

@@ -14,7 +14,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.GestureDetectorWithLongTap
*/
open class Pager(
context: Context,
isHorizontal: Boolean = true
isHorizontal: Boolean = true,
) : DirectionalViewPager(context, isHorizontal) {
/**

View File

@@ -21,7 +21,7 @@ import uy.kohesive.injekt.api.get
class PagerConfig(
private val viewer: PagerViewer,
scope: CoroutineScope,
preferences: PreferencesHelper = Injekt.get()
preferences: PreferencesHelper = Injekt.get(),
) : ViewerConfig(preferences, scope) {
var theme = preferences.readerTheme().get()

View File

@@ -30,7 +30,7 @@ import java.util.concurrent.TimeUnit
class PagerPageHolder(
readerThemedContext: Context,
val viewer: PagerViewer,
val page: ReaderPage
val page: ReaderPage,
) : ReaderPageImageView(readerThemedContext), ViewPagerAdapter.PositionableView {
/**
@@ -227,7 +227,7 @@ class PagerPageHolder(
minimumScaleType = viewer.config.imageScaleType,
cropBorders = viewer.config.imageCropBorders,
zoomStartPosition = viewer.config.imageZoomType,
landscapeZoom = viewer.config.landscapeZoom,
landscapeZoom = viewer.config.landscapeZoom
)
)
if (!isAnimated) {

View File

@@ -27,7 +27,7 @@ import rx.android.schedulers.AndroidSchedulers
class PagerTransitionHolder(
readerThemedContext: Context,
val viewer: PagerViewer,
val transition: ChapterTransition
val transition: ChapterTransition,
) : LinearLayout(readerThemedContext), ViewPagerAdapter.PositionableView {
/**

View File

@@ -171,7 +171,7 @@ class PagerViewerAdapter(private val viewer: PagerViewer) : ViewPagerAdapter() {
val placeAtIndex = when (viewer) {
is L2RPagerViewer,
is VerticalPagerViewer -> currentIndex + 1
is VerticalPagerViewer, -> currentIndex + 1
else -> currentIndex
}

View File

@@ -149,7 +149,7 @@ class WebtoonAdapter(val viewer: WebtoonViewer) : RecyclerView.Adapter<RecyclerV
*/
private class Callback(
private val oldItems: List<Any>,
private val newItems: List<Any>
private val newItems: List<Any>,
) : DiffUtil.Callback() {
/**

View File

@@ -8,7 +8,7 @@ import rx.Subscription
abstract class WebtoonBaseHolder(
view: View,
protected val viewer: WebtoonViewer
protected val viewer: WebtoonViewer,
) : RecyclerView.ViewHolder(view) {
/**

View File

@@ -20,7 +20,7 @@ import uy.kohesive.injekt.api.get
*/
class WebtoonConfig(
scope: CoroutineScope,
preferences: PreferencesHelper = Injekt.get()
preferences: PreferencesHelper = Injekt.get(),
) : ViewerConfig(preferences, scope) {
var themeChangedListener: (() -> Unit)? = null

View File

@@ -71,7 +71,7 @@ class WebtoonFrame(context: Context) : FrameLayout(context) {
e1: MotionEvent?,
e2: MotionEvent?,
velocityX: Float,
velocityY: Float
velocityY: Float,
): Boolean {
return recycler?.zoomFling(velocityX.toInt(), velocityY.toInt()) ?: false
}

View File

@@ -35,7 +35,7 @@ import java.util.concurrent.TimeUnit
*/
class WebtoonPageHolder(
private val frame: ReaderPageImageView,
viewer: WebtoonViewer
viewer: WebtoonViewer,
) : WebtoonBaseHolder(frame, viewer) {
/**

View File

@@ -20,7 +20,7 @@ import kotlin.math.abs
open class WebtoonRecyclerView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyle: Int = 0
defStyle: Int = 0,
) : RecyclerView(context, attrs, defStyle) {
private var isZooming = false
@@ -94,7 +94,7 @@ open class WebtoonRecyclerView @JvmOverloads constructor(
fromX: Float,
toX: Float,
fromY: Float,
toY: Float
toY: Float,
) {
isZooming = true
val animatorSet = AnimatorSet()

View File

@@ -11,7 +11,7 @@ import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
*/
class WebtoonSubsamplingImageView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null
attrs: AttributeSet? = null,
) : SubsamplingScaleImageView(context, attrs) {
override fun onTouchEvent(event: MotionEvent): Boolean {

View File

@@ -22,7 +22,7 @@ import rx.android.schedulers.AndroidSchedulers
*/
class WebtoonTransitionHolder(
val layout: LinearLayout,
viewer: WebtoonViewer
viewer: WebtoonViewer,
) : WebtoonBaseHolder(layout, viewer) {
/**

View File

@@ -320,11 +320,13 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
KeyEvent.KEYCODE_DPAD_LEFT,
KeyEvent.KEYCODE_DPAD_UP,
KeyEvent.KEYCODE_PAGE_UP -> if (isUp) scrollUp()
KeyEvent.KEYCODE_PAGE_UP,
-> if (isUp) scrollUp()
KeyEvent.KEYCODE_DPAD_RIGHT,
KeyEvent.KEYCODE_DPAD_DOWN,
KeyEvent.KEYCODE_PAGE_DOWN -> if (isUp) scrollDown()
KeyEvent.KEYCODE_PAGE_DOWN,
-> if (isUp) scrollDown()
else -> return false
}
return true

View File

@@ -21,7 +21,7 @@ import java.util.Date
*/
class HistoryHolder(
view: View,
val adapter: HistoryAdapter
val adapter: HistoryAdapter,
) : FlexibleViewHolder(view, adapter) {
private val binding = HistoryItemBinding.bind(view)

View File

@@ -24,7 +24,7 @@ class HistoryItem(val mch: MangaChapterHistory, header: DateSectionItem) :
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: HistoryHolder,
position: Int,
payloads: List<Any?>?
payloads: List<Any?>?,
) {
holder.bind(mch)
}

View File

@@ -9,7 +9,7 @@ import eu.kanade.tachiyomi.util.system.getResourceColor
class UpdatesAdapter(
val controller: UpdatesController,
context: Context,
val items: List<IFlexible<*>>?
val items: List<IFlexible<*>>?,
) : BaseChaptersAdapter<IFlexible<*>>(controller, items) {
var readColor = context.getResourceColor(R.attr.colorOnSurface, 0.38f)

View File

@@ -25,7 +25,7 @@ class UpdatesItem(chapter: Chapter, val manga: Manga, header: DateSectionItem) :
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
holder: UpdatesHolder,
position: Int,
payloads: List<Any?>?
payloads: List<Any?>?,
) {
holder.bind(this)
}

View File

@@ -26,7 +26,7 @@ class UnlockActivity : BaseActivity() {
override fun onAuthenticationError(
activity: FragmentActivity?,
errorCode: Int,
errString: CharSequence
errString: CharSequence,
) {
super.onAuthenticationError(activity, errorCode, errString)
logcat(LogPriority.ERROR) { errString.toString() }
@@ -35,7 +35,7 @@ class UnlockActivity : BaseActivity() {
override fun onAuthenticationSucceeded(
activity: FragmentActivity?,
result: BiometricPrompt.AuthenticationResult
result: BiometricPrompt.AuthenticationResult,
) {
super.onAuthenticationSucceeded(activity, result)
SecureActivityDelegate.locked = false

View File

@@ -169,14 +169,14 @@ class SettingsAdvancedController : SettingsController() {
"Cloudflare",
"Google",
"AdGuard",
"Quad9",
"Quad9"
)
entryValues = arrayOf(
"-1",
PREF_DOH_CLOUDFLARE.toString(),
PREF_DOH_GOOGLE.toString(),
PREF_DOH_ADGUARD.toString(),
PREF_DOH_QUAD9.toString(),
PREF_DOH_QUAD9.toString()
)
defaultValue = "-1"
summary = "%s"

View File

@@ -103,7 +103,7 @@ class SettingsAppearanceController : SettingsController() {
entriesRes = arrayOf(
R.string.alignment_top,
R.string.alignment_center,
R.string.alignment_bottom,
R.string.alignment_bottom
)
entryValues = arrayOf("0", "1", "2")
summary = "%s"

Some files were not shown because too many files have changed in this diff Show More