Formatting
This commit is contained in:
@@ -31,7 +31,7 @@ class BrowseController :
|
||||
TabbedController {
|
||||
|
||||
constructor(toExtensions: Boolean = false) : super(
|
||||
bundleOf(TO_EXTENSIONS_EXTRA to toExtensions)
|
||||
bundleOf(TO_EXTENSIONS_EXTRA to toExtensions),
|
||||
)
|
||||
|
||||
@Suppress("unused")
|
||||
@@ -114,7 +114,7 @@ class BrowseController :
|
||||
private val tabTitles = listOf(
|
||||
R.string.label_sources,
|
||||
R.string.label_extensions,
|
||||
R.string.label_migration
|
||||
R.string.label_migration,
|
||||
)
|
||||
.map { resources!!.getString(it) }
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ open class ExtensionController :
|
||||
R.id.action_search -> expandActionViewFromInteraction = true
|
||||
R.id.action_settings -> {
|
||||
parentController!!.router.pushController(
|
||||
ExtensionFilterController().withFadeTransaction()
|
||||
ExtensionFilterController().withFadeTransaction(),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -215,7 +215,7 @@ open class ExtensionController :
|
||||
is Extension.Untrusted -> it.extension.name.contains(query, ignoreCase = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
} else {
|
||||
adapter?.updateDataSet(extensions)
|
||||
|
||||
@@ -73,7 +73,7 @@ class ExtensionHolder(view: View, val adapter: ExtensionAdapter) :
|
||||
is Extension.Available -> R.string.ext_install
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
val isIdle = installStep == InstallStep.Idle || installStep == InstallStep.Error
|
||||
|
||||
@@ -69,7 +69,7 @@ open class ExtensionPresenter(
|
||||
val installedSorted = installed.filter { !it.hasUpdate && (showNsfwSources || !it.isNsfw) }
|
||||
.sortedWith(
|
||||
compareBy<Extension.Installed> { !it.isObsolete }
|
||||
.thenBy(String.CASE_INSENSITIVE_ORDER) { it.name }
|
||||
.thenBy(String.CASE_INSENSITIVE_ORDER) { it.name },
|
||||
)
|
||||
|
||||
val untrustedSorted = untrusted.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.name })
|
||||
@@ -163,7 +163,7 @@ open class ExtensionPresenter(
|
||||
if (item != null) {
|
||||
view.downloadUpdate(item)
|
||||
}
|
||||
})
|
||||
},)
|
||||
}
|
||||
|
||||
fun uninstallExtension(pkgName: String) {
|
||||
|
||||
@@ -14,8 +14,8 @@ class ExtensionTrustDialog<T>(bundle: Bundle? = null) : DialogController(bundle)
|
||||
constructor(target: T, signatureHash: String, pkgName: String) : this(
|
||||
bundleOf(
|
||||
SIGNATURE_KEY to signatureHash,
|
||||
PKGNAME_KEY to pkgName
|
||||
)
|
||||
PKGNAME_KEY to pkgName,
|
||||
),
|
||||
) {
|
||||
targetController = target
|
||||
}
|
||||
|
||||
+3
-3
@@ -55,7 +55,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
||||
private var preferenceScreen: PreferenceScreen? = null
|
||||
|
||||
constructor(pkgName: String) : this(
|
||||
bundleOf(PKGNAME_KEY to pkgName)
|
||||
bundleOf(PKGNAME_KEY to pkgName),
|
||||
)
|
||||
|
||||
init {
|
||||
@@ -91,7 +91,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
||||
binding.extensionPrefsRecycler.layoutManager = LinearLayoutManager(context)
|
||||
binding.extensionPrefsRecycler.adapter = ConcatAdapter(
|
||||
ExtensionDetailsHeaderAdapter(presenter),
|
||||
initPreferencesAdapter(context, extension)
|
||||
initPreferencesAdapter(context, extension),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
||||
block()
|
||||
onSettingsClick = View.OnClickListener {
|
||||
router.pushController(
|
||||
SourcePreferencesController(source.id).withFadeTransaction()
|
||||
SourcePreferencesController(source.id).withFadeTransaction(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ class ExtensionDetailsPresenter(
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeFirst({ view, _ ->
|
||||
view.onExtensionUninstalled()
|
||||
})
|
||||
},)
|
||||
}
|
||||
|
||||
fun uninstallExtension() {
|
||||
|
||||
+3
-3
@@ -43,7 +43,7 @@ class SourcePreferencesController(bundle: Bundle? = null) :
|
||||
private var preferenceScreen: PreferenceScreen? = null
|
||||
|
||||
constructor(sourceId: Long) : this(
|
||||
bundleOf(SOURCE_ID to sourceId)
|
||||
bundleOf(SOURCE_ID to sourceId),
|
||||
)
|
||||
|
||||
override fun createBinding(inflater: LayoutInflater): SourcePreferencesControllerBinding {
|
||||
@@ -69,7 +69,7 @@ class SourcePreferencesController(bundle: Bundle? = null) :
|
||||
val themedContext by lazy { getPreferenceThemeContext() }
|
||||
val manager = PreferenceManager(themedContext)
|
||||
val dataStore = SharedPreferencesDataStore(
|
||||
context.getSharedPreferences(source.getPreferenceKey(), Context.MODE_PRIVATE)
|
||||
context.getSharedPreferences(source.getPreferenceKey(), Context.MODE_PRIVATE),
|
||||
)
|
||||
manager.preferenceDataStore = dataStore
|
||||
manager.onDisplayPreferenceDialogListener = this
|
||||
@@ -158,7 +158,7 @@ class SourcePreferencesController(bundle: Bundle? = null) :
|
||||
.newInstance(preference.getKey())
|
||||
else -> throw IllegalArgumentException(
|
||||
"Tried to display dialog for unknown " +
|
||||
"preference type. Did you forget to override onDisplayPreferenceDialog()?"
|
||||
"preference type. Did you forget to override onDisplayPreferenceDialog()?",
|
||||
)
|
||||
}
|
||||
f.targetController = this
|
||||
|
||||
+3
-3
@@ -23,14 +23,14 @@ class MigrationMangaController :
|
||||
constructor(sourceId: Long, sourceName: String?) : super(
|
||||
bundleOf(
|
||||
SOURCE_ID_EXTRA to sourceId,
|
||||
SOURCE_NAME_EXTRA to sourceName
|
||||
)
|
||||
SOURCE_NAME_EXTRA to sourceName,
|
||||
),
|
||||
)
|
||||
|
||||
@Suppress("unused")
|
||||
constructor(bundle: Bundle) : this(
|
||||
bundle.getLong(SOURCE_ID_EXTRA),
|
||||
bundle.getString(SOURCE_NAME_EXTRA)
|
||||
bundle.getString(SOURCE_NAME_EXTRA),
|
||||
)
|
||||
|
||||
private val sourceId: Long = args.getLong(SOURCE_ID_EXTRA)
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ class SearchController(
|
||||
override fun createPresenter(): GlobalSearchPresenter {
|
||||
return SearchPresenter(
|
||||
initialQuery,
|
||||
manga!!
|
||||
manga!!,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class SearchPresenter(
|
||||
replacingMangaRelay.subscribeLatestCache(
|
||||
{ controller, (isReplacingManga, newManga) ->
|
||||
(controller as? SearchController)?.renderIsReplacingManga(isReplacingManga, newManga)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@@ -93,15 +93,15 @@ class SearchPresenter(
|
||||
val flags = preferences.migrateFlags().get()
|
||||
val migrateChapters =
|
||||
MigrationFlags.hasChapters(
|
||||
flags
|
||||
flags,
|
||||
)
|
||||
val migrateCategories =
|
||||
MigrationFlags.hasCategories(
|
||||
flags
|
||||
flags,
|
||||
)
|
||||
val migrateTracks =
|
||||
MigrationFlags.hasTracks(
|
||||
flags
|
||||
flags,
|
||||
)
|
||||
|
||||
db.inTransaction {
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ class SourceSearchController(
|
||||
if (searchQuery != null) {
|
||||
putString(SEARCH_QUERY_KEY, searchQuery)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
private var oldManga: Manga? = args.getSerializable(MANGA_KEY) as Manga?
|
||||
private var newManga: Manga? = null
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ class SelectionHeader : AbstractHeaderItem<SelectionHeader.Holder>() {
|
||||
override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): Holder {
|
||||
return Holder(
|
||||
view,
|
||||
adapter
|
||||
adapter,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ data class SourceItem(val source: Source, val mangaCount: Int, val header: Selec
|
||||
override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): SourceHolder {
|
||||
return SourceHolder(
|
||||
view,
|
||||
adapter as SourceAdapter
|
||||
adapter as SourceAdapter,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ class SourceController :
|
||||
val isPinned = item.header?.code?.equals(SourcePresenter.PINNED_KEY) ?: false
|
||||
|
||||
val items = mutableListOf(
|
||||
activity.getString(if (isPinned) R.string.action_unpin else R.string.action_pin) to { toggleSourcePin(item.source) }
|
||||
activity.getString(if (isPinned) R.string.action_unpin else R.string.action_pin) to { toggleSourcePin(item.source) },
|
||||
)
|
||||
if (item.source !is LocalSource) {
|
||||
items.add(activity.getString(R.string.action_disable) to { disableSource(item.source) })
|
||||
@@ -195,7 +195,7 @@ class SourceController :
|
||||
R.id.action_settings -> {
|
||||
parentController!!.router.pushController(
|
||||
SourceFilterController()
|
||||
.withFadeTransaction()
|
||||
.withFadeTransaction(),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -248,13 +248,13 @@ class SourceController :
|
||||
R.menu.browse_sources,
|
||||
R.id.action_search,
|
||||
R.string.action_global_search_hint,
|
||||
false // GlobalSearch handles the searching here
|
||||
false, // GlobalSearch handles the searching here
|
||||
)
|
||||
}
|
||||
|
||||
override fun onSearchViewQueryTextSubmit(query: String?) {
|
||||
parentController!!.router.pushController(
|
||||
GlobalSearchController(query).withFadeTransaction()
|
||||
GlobalSearchController(query).withFadeTransaction(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ class SourceFilterController : SettingsController() {
|
||||
val orderedLangs = sourcesByLang.keys.sortedWith(
|
||||
compareBy(
|
||||
{ it !in activeLangsCodes },
|
||||
{ LocaleHelper.getSourceDisplayName(it, context) }
|
||||
)
|
||||
{ LocaleHelper.getSourceDisplayName(it, context) },
|
||||
),
|
||||
)
|
||||
|
||||
orderedLangs.forEach { lang ->
|
||||
|
||||
+5
-5
@@ -76,7 +76,7 @@ open class BrowseSourceController(bundle: Bundle) :
|
||||
if (searchQuery != null) {
|
||||
putString(SEARCH_QUERY_KEY, searchQuery)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
@@ -155,7 +155,7 @@ open class BrowseSourceController(bundle: Bundle) :
|
||||
val newFilters = presenter.source.getFilterList()
|
||||
presenter.sourceFilters = newFilters
|
||||
filterSheet?.setFilters(presenter.filterItems)
|
||||
}
|
||||
},
|
||||
)
|
||||
filterSheet?.setFilters(presenter.filterItems)
|
||||
|
||||
@@ -269,7 +269,7 @@ open class BrowseSourceController(bundle: Bundle) :
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
val displayItem = when (preferences.sourceDisplayMode().get()) {
|
||||
@@ -426,13 +426,13 @@ open class BrowseSourceController(bundle: Bundle) :
|
||||
if (adapter.isEmpty) {
|
||||
val actions = if (presenter.source is LocalSource) {
|
||||
listOf(
|
||||
EmptyView.Action(R.string.local_source_help_guide, R.drawable.ic_help_24dp) { openLocalSourceHelpGuide() }
|
||||
EmptyView.Action(R.string.local_source_help_guide, R.drawable.ic_help_24dp) { openLocalSourceHelpGuide() },
|
||||
)
|
||||
} else {
|
||||
listOf(
|
||||
EmptyView.Action(R.string.action_retry, R.drawable.ic_refresh_24dp, retryAction),
|
||||
EmptyView.Action(R.string.action_open_in_web_view, R.drawable.ic_public_24dp) { openInWebView() },
|
||||
EmptyView.Action(R.string.label_help, R.drawable.ic_help_24dp) { activity?.openInBrowser(MoreController.URL_HELP) }
|
||||
EmptyView.Action(R.string.label_help, R.drawable.ic_help_24dp) { activity?.openInBrowser(MoreController.URL_HELP) },
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -157,7 +157,7 @@ open class BrowseSourcePresenter(
|
||||
},
|
||||
{ _, error ->
|
||||
logcat(LogPriority.ERROR, error)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
// Request first page.
|
||||
|
||||
@@ -49,7 +49,7 @@ class SourceFilterSheet(
|
||||
private val binding = SourceFilterSheetBinding.inflate(
|
||||
LayoutInflater.from(context),
|
||||
null,
|
||||
false
|
||||
false,
|
||||
)
|
||||
|
||||
init {
|
||||
|
||||
@@ -39,7 +39,7 @@ class GroupItem(val filter: Filter.Group<*>) : AbstractExpandableHeaderItem<Grou
|
||||
R.drawable.ic_expand_less_24dp
|
||||
} else {
|
||||
R.drawable.ic_expand_more_24dp
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
holder.itemView.setOnClickListener(holder)
|
||||
|
||||
@@ -31,7 +31,7 @@ open class SelectItem(val filter: Filter.Select<*>) : AbstractFlexibleItem<Selec
|
||||
spinner.adapter = ArrayAdapter<Any>(
|
||||
holder.itemView.context,
|
||||
android.R.layout.simple_spinner_item,
|
||||
filter.values
|
||||
filter.values,
|
||||
).apply {
|
||||
setDropDownViewResource(R.layout.common_spinner_item)
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class SortGroup(val filter: Filter.Sort) : AbstractExpandableHeaderItem<SortGrou
|
||||
R.drawable.ic_expand_less_24dp
|
||||
} else {
|
||||
R.drawable.ic_expand_more_24dp
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
holder.itemView.setOnClickListener(holder)
|
||||
|
||||
@@ -40,7 +40,7 @@ open class TriStateItem(val filter: Filter.TriState) : AbstractFlexibleItem<TriS
|
||||
Filter.TriState.STATE_INCLUDE -> TR.drawable.ic_check_box_24dp
|
||||
Filter.TriState.STATE_EXCLUDE -> TR.drawable.ic_check_box_x_24dp
|
||||
else -> throw Exception("Unknown state")
|
||||
}
|
||||
},
|
||||
)?.apply {
|
||||
val color = if (filter.state == Filter.TriState.STATE_INCLUDE) {
|
||||
view.context.getResourceColor(R.attr.colorAccent)
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ open class GlobalSearchController(
|
||||
R.menu.global_search,
|
||||
R.id.action_search,
|
||||
null,
|
||||
false // the onMenuItemActionExpand will handle this
|
||||
false, // the onMenuItemActionExpand will handle this
|
||||
)
|
||||
|
||||
optionsMenuSearchItem = menu.findItem(R.id.action_search)
|
||||
|
||||
+6
-6
@@ -75,7 +75,7 @@ open class GlobalSearchPresenter(
|
||||
// Perform a search with previous or initial state
|
||||
search(
|
||||
savedState?.getString(BrowseSourcePresenter::query.name)
|
||||
?: initialQuery.orEmpty()
|
||||
?: initialQuery.orEmpty(),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ open class GlobalSearchPresenter(
|
||||
.doOnNext { fetchImage(it, source) } // Load manga covers
|
||||
.map { list -> createCatalogueSearchItem(source, list.map { GlobalSearchCardItem(it) }) }
|
||||
},
|
||||
5
|
||||
5,
|
||||
)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
// Update matching source with the obtained results
|
||||
@@ -185,8 +185,8 @@ open class GlobalSearchPresenter(
|
||||
{ it.results.isNullOrEmpty() },
|
||||
// Same as initial sort, i.e. pinned first then alphabetically
|
||||
{ it.source.id.toString() !in pinnedSourceIds },
|
||||
{ "${it.source.name.lowercase()} (${it.source.lang})" }
|
||||
)
|
||||
{ "${it.source.name.lowercase()} (${it.source.lang})" },
|
||||
),
|
||||
)
|
||||
}
|
||||
// Update current state
|
||||
@@ -199,7 +199,7 @@ open class GlobalSearchPresenter(
|
||||
},
|
||||
{ _, error ->
|
||||
logcat(LogPriority.ERROR, error)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ open class GlobalSearchPresenter(
|
||||
},
|
||||
{ error ->
|
||||
logcat(LogPriority.ERROR, error)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourcePresenter
|
||||
class LatestUpdatesController(bundle: Bundle) : BrowseSourceController(bundle) {
|
||||
|
||||
constructor(source: CatalogueSource) : this(
|
||||
bundleOf(SOURCE_ID_KEY to source.id)
|
||||
bundleOf(SOURCE_ID_KEY to source.id),
|
||||
)
|
||||
|
||||
override fun createPresenter(): BrowseSourcePresenter {
|
||||
|
||||
Reference in New Issue
Block a user