mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-17 06:27:29 +01:00
Run linter
This commit is contained in:
@@ -6,12 +6,12 @@ import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate
|
||||
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values
|
||||
|
||||
abstract class BaseActivity : AppCompatActivity() {
|
||||
|
||||
@@ -54,5 +54,4 @@ abstract class BaseActivity : AppCompatActivity() {
|
||||
|
||||
SecureActivityDelegate.onResume(this)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,5 +24,4 @@ abstract class BaseRxActivity<P : BasePresenter<*>> : NucleusAppCompatActivity<P
|
||||
|
||||
SecureActivityDelegate.onResume(this)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -123,5 +123,4 @@ abstract class BaseController(bundle: Bundle? = null) : RestoreViewOnCreateContr
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ abstract class DialogController : RestoreViewOnCreateController {
|
||||
dialog!!.onRestoreInstanceState(dialogState)
|
||||
}
|
||||
}
|
||||
return View(activity) //stub view
|
||||
return View(activity) // stub view
|
||||
}
|
||||
|
||||
override fun onSaveViewState(view: View, outState: Bundle) {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package eu.kanade.tachiyomi.ui.base.controller
|
||||
|
||||
interface NoToolbarElevationController
|
||||
interface NoToolbarElevationController
|
||||
|
||||
@@ -42,7 +42,6 @@ abstract class RxController(bundle: Bundle? = null) : BaseController(bundle) {
|
||||
untilDestroySubscriptions.unsubscribe()
|
||||
}
|
||||
|
||||
|
||||
fun <T> Observable<T>.subscribeUntilDetach(): Subscription {
|
||||
|
||||
return subscribe().also { untilDetachSubscriptions.add(it) }
|
||||
@@ -53,15 +52,19 @@ abstract class RxController(bundle: Bundle? = null) : BaseController(bundle) {
|
||||
return subscribe(onNext).also { untilDetachSubscriptions.add(it) }
|
||||
}
|
||||
|
||||
fun <T> Observable<T>.subscribeUntilDetach(onNext: (T) -> Unit,
|
||||
onError: (Throwable) -> Unit): Subscription {
|
||||
fun <T> Observable<T>.subscribeUntilDetach(
|
||||
onNext: (T) -> Unit,
|
||||
onError: (Throwable) -> Unit
|
||||
): Subscription {
|
||||
|
||||
return subscribe(onNext, onError).also { untilDetachSubscriptions.add(it) }
|
||||
}
|
||||
|
||||
fun <T> Observable<T>.subscribeUntilDetach(onNext: (T) -> Unit,
|
||||
onError: (Throwable) -> Unit,
|
||||
onCompleted: () -> Unit): Subscription {
|
||||
fun <T> Observable<T>.subscribeUntilDetach(
|
||||
onNext: (T) -> Unit,
|
||||
onError: (Throwable) -> Unit,
|
||||
onCompleted: () -> Unit
|
||||
): Subscription {
|
||||
|
||||
return subscribe(onNext, onError, onCompleted).also { untilDetachSubscriptions.add(it) }
|
||||
}
|
||||
@@ -76,17 +79,20 @@ abstract class RxController(bundle: Bundle? = null) : BaseController(bundle) {
|
||||
return subscribe(onNext).also { untilDestroySubscriptions.add(it) }
|
||||
}
|
||||
|
||||
fun <T> Observable<T>.subscribeUntilDestroy(onNext: (T) -> Unit,
|
||||
onError: (Throwable) -> Unit): Subscription {
|
||||
fun <T> Observable<T>.subscribeUntilDestroy(
|
||||
onNext: (T) -> Unit,
|
||||
onError: (Throwable) -> Unit
|
||||
): Subscription {
|
||||
|
||||
return subscribe(onNext, onError).also { untilDestroySubscriptions.add(it) }
|
||||
}
|
||||
|
||||
fun <T> Observable<T>.subscribeUntilDestroy(onNext: (T) -> Unit,
|
||||
onError: (Throwable) -> Unit,
|
||||
onCompleted: () -> Unit): Subscription {
|
||||
fun <T> Observable<T>.subscribeUntilDestroy(
|
||||
onNext: (T) -> Unit,
|
||||
onError: (Throwable) -> Unit,
|
||||
onCompleted: () -> Unit
|
||||
): Subscription {
|
||||
|
||||
return subscribe(onNext, onError, onCompleted).also { untilDestroySubscriptions.add(it) }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,11 +5,13 @@ import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||
import eu.davidea.viewholders.FlexibleViewHolder
|
||||
import kotlinx.android.extensions.LayoutContainer
|
||||
|
||||
abstract class BaseFlexibleViewHolder(view: View,
|
||||
adapter: FlexibleAdapter<*>,
|
||||
stickyHeader: Boolean = false) :
|
||||
abstract class BaseFlexibleViewHolder(
|
||||
view: View,
|
||||
adapter: FlexibleAdapter<*>,
|
||||
stickyHeader: Boolean = false
|
||||
) :
|
||||
FlexibleViewHolder(view, adapter, stickyHeader), LayoutContainer {
|
||||
|
||||
override val containerView: View?
|
||||
get() = itemView
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,8 +41,13 @@ interface SlicedHolder {
|
||||
}
|
||||
}
|
||||
|
||||
private fun applySlice(radius: Float, topRect: Boolean, bottomRect: Boolean,
|
||||
topShadow: Boolean, bottomShadow: Boolean) {
|
||||
private fun applySlice(
|
||||
radius: Float,
|
||||
topRect: Boolean,
|
||||
bottomRect: Boolean,
|
||||
topShadow: Boolean,
|
||||
bottomShadow: Boolean
|
||||
) {
|
||||
val margin = margin
|
||||
|
||||
slice.setRadius(radius)
|
||||
@@ -62,5 +67,4 @@ interface SlicedHolder {
|
||||
|
||||
val margin
|
||||
get() = 8.dpToPx
|
||||
|
||||
}
|
||||
|
||||
@@ -66,5 +66,4 @@ open class BasePresenter<V> : RxPresenter<V>() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,5 +43,4 @@ class NucleusConductorDelegate<P : Presenter<*>>(private val factory: PresenterF
|
||||
fun onDestroy() {
|
||||
presenter?.destroy()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,5 +29,4 @@ class NucleusConductorLifecycleListener(private val delegate: NucleusConductorDe
|
||||
companion object {
|
||||
private const val PRESENTER_STATE_KEY = "presenter_state"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,4 +45,3 @@ class CatalogueAdapter(val controller: CatalogueController) :
|
||||
fun onLatestClick(position: Int)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@ import eu.kanade.tachiyomi.source.CatalogueSource
|
||||
import eu.kanade.tachiyomi.source.LocalSource
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
||||
import java.util.TreeMap
|
||||
import java.util.concurrent.TimeUnit
|
||||
import rx.Observable
|
||||
import rx.Subscription
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.util.TreeMap
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
* Presenter of [CatalogueController]
|
||||
@@ -23,8 +23,8 @@ import java.util.concurrent.TimeUnit
|
||||
* @param preferences application preferences.
|
||||
*/
|
||||
class CataloguePresenter(
|
||||
val sourceManager: SourceManager = Injekt.get(),
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
val sourceManager: SourceManager = Injekt.get(),
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
) : BasePresenter<CatalogueController>() {
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,11 +32,11 @@ data class LangItem(val code: String) : AbstractHeaderItem<LangHolder>() {
|
||||
* Binds this item to the given view holder.
|
||||
*/
|
||||
override fun bindViewHolder(
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: LangHolder,
|
||||
position: Int,
|
||||
payloads: MutableList<Any>) {
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: LangHolder,
|
||||
position: Int,
|
||||
payloads: MutableList<Any>
|
||||
) {
|
||||
holder.bind(this)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,9 +36,12 @@ class SourceDividerItemDecoration(context: Context) : RecyclerView.ItemDecoratio
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView,
|
||||
state: RecyclerView.State) {
|
||||
override fun getItemOffsets(
|
||||
outRect: Rect,
|
||||
view: View,
|
||||
parent: RecyclerView,
|
||||
state: RecyclerView.State
|
||||
) {
|
||||
outRect.set(0, 0, 0, divider.intrinsicHeight)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,11 +35,11 @@ data class SourceItem(val source: CatalogueSource, val header: LangItem? = null)
|
||||
* Binds this item to the given view holder.
|
||||
*/
|
||||
override fun bindViewHolder(
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: SourceHolder,
|
||||
position: Int,
|
||||
payloads: MutableList<Any>) {
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: SourceHolder,
|
||||
position: Int,
|
||||
payloads: MutableList<Any>
|
||||
) {
|
||||
holder.bind(this)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import eu.kanade.tachiyomi.util.view.inflate
|
||||
import eu.kanade.tachiyomi.util.view.snack
|
||||
import eu.kanade.tachiyomi.util.view.visible
|
||||
import eu.kanade.tachiyomi.widget.AutofitRecyclerView
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlinx.android.synthetic.main.catalogue_controller.catalogue_view
|
||||
import kotlinx.android.synthetic.main.catalogue_controller.progress
|
||||
import kotlinx.android.synthetic.main.main_activity.drawer
|
||||
@@ -44,7 +45,6 @@ import rx.Subscription
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
import timber.log.Timber
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
* Controller to manage the catalogues available in the app.
|
||||
@@ -525,7 +525,6 @@ open class BrowseCatalogueController(bundle: Bundle) :
|
||||
}
|
||||
activity.toast(activity.getString(R.string.manga_added_library))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -542,5 +541,4 @@ open class BrowseCatalogueController(bundle: Bundle) :
|
||||
protected companion object {
|
||||
const val SOURCE_ID_KEY = "sourceId"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,11 +29,11 @@ import uy.kohesive.injekt.api.get
|
||||
* Presenter of [BrowseCatalogueController].
|
||||
*/
|
||||
open class BrowseCataloguePresenter(
|
||||
sourceId: Long,
|
||||
sourceManager: SourceManager = Injekt.get(),
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
private val prefs: PreferencesHelper = Injekt.get(),
|
||||
private val coverCache: CoverCache = Injekt.get()
|
||||
sourceId: Long,
|
||||
sourceManager: SourceManager = Injekt.get(),
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
private val prefs: PreferencesHelper = Injekt.get(),
|
||||
private val coverCache: CoverCache = Injekt.get()
|
||||
) : BasePresenter<BrowseCatalogueController>() {
|
||||
|
||||
/**
|
||||
@@ -372,5 +372,4 @@ open class BrowseCataloguePresenter(
|
||||
changeMangaFavorite(manga)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ abstract class CatalogueHolder(view: View, adapter: FlexibleAdapter<*>) :
|
||||
*/
|
||||
abstract fun onSetValues(manga: Manga)
|
||||
|
||||
|
||||
/**
|
||||
* Updates the image for this holder. Useful to update the image when the manga is initialized
|
||||
* and the url is now known.
|
||||
|
||||
@@ -27,8 +27,8 @@ class CatalogueItem(val manga: Manga, private val catalogueAsList: Preference<Bo
|
||||
}
|
||||
|
||||
override fun createViewHolder(
|
||||
view: View,
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>
|
||||
view: View,
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>
|
||||
): CatalogueHolder {
|
||||
val parent = adapter.recyclerView
|
||||
return if (parent is AutofitRecyclerView) {
|
||||
@@ -45,10 +45,10 @@ class CatalogueItem(val manga: Manga, private val catalogueAsList: Preference<Bo
|
||||
}
|
||||
|
||||
override fun bindViewHolder(
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: CatalogueHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: CatalogueHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
) {
|
||||
holder.onSetValues(manga)
|
||||
}
|
||||
@@ -64,5 +64,4 @@ class CatalogueItem(val manga: Manga, private val catalogueAsList: Preference<Bo
|
||||
override fun hashCode(): Int {
|
||||
return manga.id!!.hashCode()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,5 +49,4 @@ class CatalogueListHolder(private val view: View, adapter: FlexibleAdapter<*>) :
|
||||
.into(thumbnail)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,9 +12,8 @@ import kotlinx.android.synthetic.main.catalogue_drawer_content.view.reset_btn
|
||||
import kotlinx.android.synthetic.main.catalogue_drawer_content.view.search_btn
|
||||
import kotlinx.android.synthetic.main.catalogue_drawer_content.view.title
|
||||
|
||||
|
||||
class CatalogueNavigationView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null)
|
||||
: SimpleNavigationView(context, attrs) {
|
||||
class CatalogueNavigationView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
||||
SimpleNavigationView(context, attrs) {
|
||||
|
||||
val adapter: FlexibleAdapter<IFlexible<*>> = FlexibleAdapter<IFlexible<*>>(null)
|
||||
.setDisplayHeadersAtStartUp(true)
|
||||
@@ -38,5 +37,4 @@ class CatalogueNavigationView @JvmOverloads constructor(context: Context, attrs:
|
||||
fun setFilters(items: List<IFlexible<*>>) {
|
||||
adapter.updateDataSet(items)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,5 +28,4 @@ open class CataloguePager(val source: CatalogueSource, val query: String, val fi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package eu.kanade.tachiyomi.ui.catalogue.browse
|
||||
|
||||
class NoResultsException : Exception()
|
||||
class NoResultsException : Exception()
|
||||
|
||||
@@ -27,5 +27,4 @@ abstract class Pager(var currentPage: Int = 1) {
|
||||
hasNextPage = mangasPage.hasNextPage && mangasPage.mangas.isNotEmpty()
|
||||
results.call(Pair(page, mangasPage.mangas))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import eu.davidea.flexibleadapter.items.IFlexible
|
||||
import eu.davidea.viewholders.FlexibleViewHolder
|
||||
import eu.kanade.tachiyomi.R
|
||||
|
||||
|
||||
class ProgressItem : AbstractFlexibleItem<ProgressItem.Holder>() {
|
||||
|
||||
private var loadMore = true
|
||||
@@ -47,5 +46,4 @@ class ProgressItem : AbstractFlexibleItem<ProgressItem.Holder>() {
|
||||
val progressBar: ProgressBar = view.findViewById(R.id.progress_bar)
|
||||
val progressMessage: TextView = view.findViewById(R.id.progress_message)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -71,5 +71,4 @@ class SortItem(val name: String, val group: SortGroup) : AbstractSectionableItem
|
||||
class Holder(view: View, adapter: FlexibleAdapter<*>) : FlexibleViewHolder(view, adapter) {
|
||||
val text: CheckedTextView = itemView.findViewById(R.id.nav_view_item)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@ import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
|
||||
import eu.davidea.flexibleadapter.items.IFlexible
|
||||
import eu.davidea.viewholders.FlexibleViewHolder
|
||||
import eu.kanade.tachiyomi.R as TR
|
||||
import eu.kanade.tachiyomi.source.model.Filter
|
||||
import eu.kanade.tachiyomi.util.system.dpToPx
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
import eu.kanade.tachiyomi.R as TR
|
||||
|
||||
open class TriStateItem(val filter: Filter.TriState) : AbstractFlexibleItem<TriStateItem.Holder>() {
|
||||
|
||||
@@ -72,5 +72,4 @@ open class TriStateItem(val filter: Filter.TriState) : AbstractFlexibleItem<TriS
|
||||
text.compoundDrawablePadding = 20.dpToPx
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,5 +24,4 @@ class CatalogueSearchCardAdapter(controller: CatalogueSearchController) :
|
||||
fun onMangaClick(manga: Manga)
|
||||
fun onMangaLongClick(manga: Manga)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ import kotlinx.android.synthetic.main.catalogue_global_search_controller_card_it
|
||||
import kotlinx.android.synthetic.main.catalogue_global_search_controller_card_item.progress
|
||||
import kotlinx.android.synthetic.main.catalogue_global_search_controller_card_item.tvTitle
|
||||
|
||||
class CatalogueSearchCardHolder(view: View, adapter: CatalogueSearchCardAdapter)
|
||||
: BaseFlexibleViewHolder(view, adapter) {
|
||||
class CatalogueSearchCardHolder(view: View, adapter: CatalogueSearchCardAdapter) :
|
||||
BaseFlexibleViewHolder(view, adapter) {
|
||||
|
||||
init {
|
||||
// Call onMangaClickListener when item is pressed.
|
||||
@@ -50,5 +50,4 @@ class CatalogueSearchCardHolder(view: View, adapter: CatalogueSearchCardAdapter)
|
||||
.into(StateImageViewTarget(itemImage, progress))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,8 +18,12 @@ class CatalogueSearchCardItem(val manga: Manga) : AbstractFlexibleItem<Catalogue
|
||||
return CatalogueSearchCardHolder(view, adapter as CatalogueSearchCardAdapter)
|
||||
}
|
||||
|
||||
override fun bindViewHolder(adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>, holder: CatalogueSearchCardHolder,
|
||||
position: Int, payloads: List<Any?>?) {
|
||||
override fun bindViewHolder(
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: CatalogueSearchCardHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
) {
|
||||
holder.bind(manga)
|
||||
}
|
||||
|
||||
@@ -33,5 +37,4 @@ class CatalogueSearchCardItem(val manga: Manga) : AbstractFlexibleItem<Catalogue
|
||||
override fun hashCode(): Int {
|
||||
return manga.id?.toInt() ?: 0
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ import kotlinx.android.synthetic.main.catalogue_global_search_controller.recycle
|
||||
* [CatalogueSearchCardAdapter.OnMangaClickListener] called when manga is clicked in global search
|
||||
*/
|
||||
open class CatalogueSearchController(
|
||||
protected val initialQuery: String? = null,
|
||||
protected val extensionFilter: String? = null
|
||||
protected val initialQuery: String? = null,
|
||||
protected val extensionFilter: String? = null
|
||||
) : NucleusController<CatalogueSearchPresenter>(),
|
||||
CatalogueSearchCardAdapter.OnMangaClickListener {
|
||||
|
||||
@@ -186,5 +186,4 @@ open class CatalogueSearchController(
|
||||
fun onMangaInitialized(source: CatalogueSource, manga: Manga) {
|
||||
getHolder(source)?.setImage(manga)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -103,5 +103,4 @@ class CatalogueSearchHolder(view: View, val adapter: CatalogueSearchAdapter) :
|
||||
title.gone()
|
||||
source_card.gone()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ import eu.kanade.tachiyomi.source.CatalogueSource
|
||||
* @param results the search results.
|
||||
* @param highlighted whether this search item should be highlighted/marked in the catalogue search view.
|
||||
*/
|
||||
class CatalogueSearchItem(val source: CatalogueSource, val results: List<CatalogueSearchCardItem>?, val highlighted: Boolean = false)
|
||||
: AbstractFlexibleItem<CatalogueSearchHolder>() {
|
||||
class CatalogueSearchItem(val source: CatalogueSource, val results: List<CatalogueSearchCardItem>?, val highlighted: Boolean = false) :
|
||||
AbstractFlexibleItem<CatalogueSearchHolder>() {
|
||||
|
||||
/**
|
||||
* Set view.
|
||||
@@ -39,8 +39,12 @@ class CatalogueSearchItem(val source: CatalogueSource, val results: List<Catalog
|
||||
/**
|
||||
* Bind item to view.
|
||||
*/
|
||||
override fun bindViewHolder(adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>, holder: CatalogueSearchHolder,
|
||||
position: Int, payloads: List<Any?>?) {
|
||||
override fun bindViewHolder(
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: CatalogueSearchHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
) {
|
||||
holder.bind(this)
|
||||
}
|
||||
|
||||
@@ -64,5 +68,4 @@ class CatalogueSearchItem(val source: CatalogueSource, val results: List<Catalog
|
||||
override fun hashCode(): Int {
|
||||
return source.id.toInt()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,11 +34,11 @@ import uy.kohesive.injekt.injectLazy
|
||||
* @param preferencesHelper manages the preference calls.
|
||||
*/
|
||||
open class CatalogueSearchPresenter(
|
||||
val initialQuery: String? = "",
|
||||
val initialExtensionFilter: String? = null,
|
||||
val sourceManager: SourceManager = Injekt.get(),
|
||||
val db: DatabaseHelper = Injekt.get(),
|
||||
val preferencesHelper: PreferencesHelper = Injekt.get()
|
||||
val initialQuery: String? = "",
|
||||
val initialExtensionFilter: String? = null,
|
||||
val sourceManager: SourceManager = Injekt.get(),
|
||||
val db: DatabaseHelper = Injekt.get(),
|
||||
val preferencesHelper: PreferencesHelper = Injekt.get()
|
||||
) : BasePresenter<CatalogueSearchController>() {
|
||||
|
||||
/**
|
||||
@@ -204,7 +204,6 @@ open class CatalogueSearchPresenter(
|
||||
.map { Pair(it, source) }
|
||||
.concatMap { getMangaDetailsObservable(it.first, it.second) }
|
||||
.map { Pair(source as CatalogueSource, it) }
|
||||
|
||||
}
|
||||
.onBackpressureBuffer()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
|
||||
@@ -33,7 +33,5 @@ class LatestUpdatesController(bundle: Bundle) : BrowseCatalogueController(bundle
|
||||
}
|
||||
|
||||
override fun cleanupSecondaryDrawer(drawer: DrawerLayout) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,5 +18,4 @@ class LatestUpdatesPager(val source: CatalogueSource) : Pager() {
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.doOnNext { onPageReceived(it) }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,5 +12,4 @@ class LatestUpdatesPresenter(sourceId: Long) : BrowseCataloguePresenter(sourceId
|
||||
override fun createPager(query: String, filters: FilterList): Pager {
|
||||
return LatestUpdatesPager(source)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,5 +46,4 @@ class CategoryAdapter(controller: CategoryController) :
|
||||
*/
|
||||
fun onItemReleased(position: Int)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ class CategoryController : NucleusController<CategoryPresenter>(),
|
||||
private fun toggleSelection(position: Int) {
|
||||
val adapter = adapter ?: return
|
||||
|
||||
//Mark the position selected
|
||||
// Mark the position selected
|
||||
adapter.toggleSelection(position)
|
||||
|
||||
if (adapter.selectedItemCount == 0) {
|
||||
@@ -321,5 +321,4 @@ class CategoryController : NucleusController<CategoryPresenter>(),
|
||||
fun onCategoryExistsError() {
|
||||
activity?.toast(R.string.error_category_exists)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,5 +43,4 @@ class CategoryCreateDialog<T>(bundle: Bundle? = null) : DialogController(bundle)
|
||||
interface Listener {
|
||||
fun createCategory(name: String)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -50,5 +50,4 @@ class CategoryHolder(view: View, val adapter: CategoryAdapter) : BaseFlexibleVie
|
||||
super.onItemReleased(position)
|
||||
adapter.onItemReleaseListener.onItemReleased(position)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,10 +43,12 @@ class CategoryItem(val category: Category) : AbstractFlexibleItem<CategoryHolder
|
||||
* @param position The position of this item in the adapter.
|
||||
* @param payloads List of partial changes.
|
||||
*/
|
||||
override fun bindViewHolder(adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: CategoryHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?) {
|
||||
override fun bindViewHolder(
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: CategoryHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
) {
|
||||
|
||||
holder.bind(category)
|
||||
}
|
||||
@@ -69,5 +71,4 @@ class CategoryItem(val category: Category) : AbstractFlexibleItem<CategoryHolder
|
||||
override fun hashCode(): Int {
|
||||
return category.id!!
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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>() {
|
||||
|
||||
/**
|
||||
@@ -103,5 +103,4 @@ class CategoryPresenter(
|
||||
fun categoryExists(name: String): Boolean {
|
||||
return categories.any { it.name.equals(name, true) }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,5 +82,4 @@ class CategoryRenameDialog<T>(bundle: Bundle? = null) : DialogController(bundle)
|
||||
private companion object {
|
||||
const val CATEGORY_KEY = "CategoryRenameDialog.category"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -68,5 +68,4 @@ class DownloadAdapter : RecyclerView.Adapter<DownloadHolder>() {
|
||||
val download = items[position]
|
||||
holder.onSetValues(download)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@ import eu.kanade.tachiyomi.data.download.DownloadService
|
||||
import eu.kanade.tachiyomi.data.download.model.Download
|
||||
import eu.kanade.tachiyomi.source.model.Page
|
||||
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
||||
import java.util.HashMap
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlinx.android.synthetic.main.download_controller.empty_view
|
||||
import kotlinx.android.synthetic.main.download_controller.recycler
|
||||
import rx.Observable
|
||||
import rx.Subscription
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
import java.util.HashMap
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
* Controller that shows the currently active downloads.
|
||||
@@ -243,5 +243,4 @@ class DownloadController : NucleusController<DownloadPresenter>() {
|
||||
empty_view?.hide()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -65,5 +65,4 @@ class DownloadHolder(private val view: View) : BaseViewHolder(view) {
|
||||
val pages = download.pages ?: return
|
||||
view.download_progress_text.text = "${download.downloadedImages}/${pages.size}"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,11 +5,11 @@ import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||
import eu.kanade.tachiyomi.data.download.model.Download
|
||||
import eu.kanade.tachiyomi.data.download.model.DownloadQueue
|
||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
||||
import java.util.ArrayList
|
||||
import rx.Observable
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
import timber.log.Timber
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.util.ArrayList
|
||||
|
||||
/**
|
||||
* Presenter of [DownloadController].
|
||||
@@ -61,5 +61,4 @@ class DownloadPresenter : BasePresenter<DownloadController>() {
|
||||
fun clearQueue() {
|
||||
downloadManager.clearQueue()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
||||
import kotlinx.android.synthetic.main.extension_controller.ext_recycler
|
||||
import kotlinx.android.synthetic.main.extension_controller.ext_swipe_refresh
|
||||
|
||||
|
||||
/**
|
||||
* Controller to manage the catalogues available in the app.
|
||||
*/
|
||||
|
||||
@@ -196,5 +196,4 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
||||
const val PKGNAME_KEY = "pkg_name"
|
||||
const val LASTOPENPREFERENCE_KEY = "last_open_preference"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
|
||||
class ExtensionDetailsPresenter(
|
||||
val pkgName: String,
|
||||
private val extensionManager: ExtensionManager = Injekt.get()
|
||||
val pkgName: String,
|
||||
private val extensionManager: ExtensionManager = Injekt.get()
|
||||
) : BasePresenter<ExtensionDetailsController>() {
|
||||
|
||||
val extension = extensionManager.installedExtensions.find { it.pkgName == pkgName }
|
||||
|
||||
@@ -36,9 +36,12 @@ class ExtensionDividerItemDecoration(context: Context) : RecyclerView.ItemDecora
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView,
|
||||
state: RecyclerView.State) {
|
||||
override fun getItemOffsets(
|
||||
outRect: Rect,
|
||||
view: View,
|
||||
parent: RecyclerView,
|
||||
state: RecyclerView.State
|
||||
) {
|
||||
outRect.set(0, 0, 0, divider.intrinsicHeight)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,8 +32,12 @@ data class ExtensionGroupItem(val name: String, val size: Int, val showSize: Boo
|
||||
/**
|
||||
* Binds this item to the given view holder.
|
||||
*/
|
||||
override fun bindViewHolder(adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>, holder: ExtensionGroupHolder,
|
||||
position: Int, payloads: List<Any?>?) {
|
||||
override fun bindViewHolder(
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: ExtensionGroupHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
) {
|
||||
|
||||
holder.bind(this)
|
||||
}
|
||||
@@ -49,5 +53,4 @@ data class ExtensionGroupItem(val name: String, val size: Int, val showSize: Boo
|
||||
override fun hashCode(): Int {
|
||||
return name.hashCode()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -101,5 +101,4 @@ class ExtensionHolder(view: View, override val adapter: ExtensionAdapter) :
|
||||
setText(R.string.ext_install)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,9 +16,11 @@ import eu.kanade.tachiyomi.source.CatalogueSource
|
||||
* @param source Instance of [CatalogueSource] containing source information.
|
||||
* @param header The header for this item.
|
||||
*/
|
||||
data class ExtensionItem(val extension: Extension,
|
||||
val header: ExtensionGroupItem? = null,
|
||||
val installStep: InstallStep? = null) :
|
||||
data class ExtensionItem(
|
||||
val extension: Extension,
|
||||
val header: ExtensionGroupItem? = null,
|
||||
val installStep: InstallStep? = null
|
||||
) :
|
||||
AbstractSectionableItem<ExtensionHolder, ExtensionGroupItem>(header) {
|
||||
|
||||
/**
|
||||
@@ -38,8 +40,12 @@ data class ExtensionItem(val extension: Extension,
|
||||
/**
|
||||
* Binds this item to the given view holder.
|
||||
*/
|
||||
override fun bindViewHolder(adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>, holder: ExtensionHolder,
|
||||
position: Int, payloads: List<Any?>?) {
|
||||
override fun bindViewHolder(
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: ExtensionHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
) {
|
||||
|
||||
if (payloads == null || payloads.isEmpty()) {
|
||||
holder.bind(this)
|
||||
@@ -57,5 +63,4 @@ data class ExtensionItem(val extension: Extension,
|
||||
override fun hashCode(): Int {
|
||||
return extension.pkgName.hashCode()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,22 +10,22 @@ import eu.kanade.tachiyomi.extension.model.Extension
|
||||
import eu.kanade.tachiyomi.extension.model.InstallStep
|
||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
||||
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||
import java.util.concurrent.TimeUnit
|
||||
import rx.Observable
|
||||
import rx.Subscription
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
private typealias ExtensionTuple
|
||||
= Triple<List<Extension.Installed>, List<Extension.Untrusted>, List<Extension.Available>>
|
||||
private typealias ExtensionTuple =
|
||||
Triple<List<Extension.Installed>, List<Extension.Untrusted>, List<Extension.Available>>
|
||||
|
||||
/**
|
||||
* Presenter of [ExtensionController].
|
||||
*/
|
||||
open class ExtensionPresenter(
|
||||
private val extensionManager: ExtensionManager = Injekt.get(),
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
private val extensionManager: ExtensionManager = Injekt.get(),
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
) : BasePresenter<ExtensionController>() {
|
||||
|
||||
private var extensions = emptyList<ExtensionItem>()
|
||||
@@ -45,8 +45,7 @@ open class ExtensionPresenter(
|
||||
val availableObservable = extensionManager.getAvailableExtensionsObservable()
|
||||
.startWith(emptyList<Extension.Available>())
|
||||
|
||||
return Observable.combineLatest(installedObservable, untrustedObservable, availableObservable)
|
||||
{ installed, untrusted, available -> Triple(installed, untrusted, available) }
|
||||
return Observable.combineLatest(installedObservable, untrustedObservable, availableObservable) { installed, untrusted, available -> Triple(installed, untrusted, available) }
|
||||
.debounce(100, TimeUnit.MILLISECONDS)
|
||||
.map(::toItems)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@@ -68,9 +67,9 @@ open class ExtensionPresenter(
|
||||
val availableSorted = available
|
||||
// Filter out already installed extensions and disabled languages
|
||||
.filter { avail ->
|
||||
installed.none { it.pkgName == avail.pkgName }
|
||||
&& untrusted.none { it.pkgName == avail.pkgName }
|
||||
&& (avail.lang in activeLangs || avail.lang == "all")
|
||||
installed.none { it.pkgName == avail.pkgName } &&
|
||||
untrusted.none { it.pkgName == avail.pkgName } &&
|
||||
(avail.lang in activeLangs || avail.lang == "all")
|
||||
}
|
||||
.sortedBy { it.pkgName }
|
||||
|
||||
@@ -153,5 +152,4 @@ open class ExtensionPresenter(
|
||||
fun trustSignature(signatureHash: String) {
|
||||
extensionManager.trustSignature(signatureHash)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,8 +18,12 @@ class ChangeMangaCategoriesDialog<T>(bundle: Bundle? = null) :
|
||||
|
||||
private var preselected = emptyArray<Int>()
|
||||
|
||||
constructor(target: T, mangas: List<Manga>, categories: List<Category>,
|
||||
preselected: Array<Int>) : this() {
|
||||
constructor(
|
||||
target: T,
|
||||
mangas: List<Manga>,
|
||||
categories: List<Category>,
|
||||
preselected: Array<Int>
|
||||
) : this() {
|
||||
|
||||
this.mangas = mangas
|
||||
this.categories = categories
|
||||
@@ -44,5 +48,4 @@ class ChangeMangaCategoriesDialog<T>(bundle: Bundle? = null) :
|
||||
interface Listener {
|
||||
fun updateCategoriesForMangas(mangas: List<Manga>, categories: List<Category>)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,5 +99,4 @@ class LibraryAdapter(private val controller: LibraryController) : RecyclerViewPa
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -44,5 +44,4 @@ class LibraryCategoryAdapter(view: LibraryCategoryView) :
|
||||
}
|
||||
updateDataSet(mangas.filter { it.filter(s) })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -267,7 +267,6 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
controller.invalidateActionMode()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tells the presenter to set the selection for the given position.
|
||||
*
|
||||
@@ -279,5 +278,4 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
controller.setSelection(item.manga, true)
|
||||
controller.invalidateActionMode()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||
import eu.kanade.tachiyomi.ui.manga.MangaController
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import eu.kanade.tachiyomi.util.view.inflate
|
||||
import java.io.IOException
|
||||
import kotlinx.android.synthetic.main.library_controller.empty_view
|
||||
import kotlinx.android.synthetic.main.library_controller.library_pager
|
||||
import kotlinx.android.synthetic.main.main_activity.drawer
|
||||
@@ -43,12 +44,10 @@ import rx.Subscription
|
||||
import timber.log.Timber
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.io.IOException
|
||||
|
||||
|
||||
class LibraryController(
|
||||
bundle: Bundle? = null,
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
bundle: Bundle? = null,
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
) : NucleusController<LibraryPresenter>(bundle),
|
||||
TabbedController,
|
||||
SecondaryDrawerController,
|
||||
@@ -556,5 +555,4 @@ class LibraryController(
|
||||
*/
|
||||
const val REQUEST_IMAGE_OPEN = 101
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ import kotlinx.android.synthetic.main.catalogue_grid_item.*
|
||||
* @constructor creates a new library holder.
|
||||
*/
|
||||
class LibraryGridHolder(
|
||||
private val view: View,
|
||||
private val adapter: FlexibleAdapter<*>
|
||||
private val view: View,
|
||||
private val adapter: FlexibleAdapter<*>
|
||||
|
||||
) : LibraryHolder(view, adapter) {
|
||||
|
||||
@@ -42,7 +42,7 @@ class LibraryGridHolder(
|
||||
visibility = if (item.downloadCount > 0) View.VISIBLE else View.GONE
|
||||
text = item.downloadCount.toString()
|
||||
}
|
||||
//set local visibility if its local manga
|
||||
// set local visibility if its local manga
|
||||
local_text.visibility = if (item.manga.source == LocalSource.ID) View.VISIBLE else View.GONE
|
||||
|
||||
// Update the cover.
|
||||
@@ -53,5 +53,4 @@ class LibraryGridHolder(
|
||||
.centerCrop()
|
||||
.into(thumbnail)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
|
||||
*/
|
||||
|
||||
abstract class LibraryHolder(
|
||||
view: View,
|
||||
adapter: FlexibleAdapter<*>
|
||||
view: View,
|
||||
adapter: FlexibleAdapter<*>
|
||||
) : BaseFlexibleViewHolder(view, adapter) {
|
||||
|
||||
/**
|
||||
@@ -23,5 +23,4 @@ abstract class LibraryHolder(
|
||||
* @param item the manga item to bind.
|
||||
*/
|
||||
abstract fun onSetValues(item: LibraryItem)
|
||||
|
||||
}
|
||||
|
||||
@@ -49,10 +49,12 @@ class LibraryItem(val manga: LibraryManga, private val libraryAsList: Preference
|
||||
}
|
||||
}
|
||||
|
||||
override fun bindViewHolder(adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: LibraryHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?) {
|
||||
override fun bindViewHolder(
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: LibraryHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
) {
|
||||
holder.onSetValues(this)
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ import kotlinx.android.synthetic.main.catalogue_list_item.*
|
||||
*/
|
||||
|
||||
class LibraryListHolder(
|
||||
private val view: View,
|
||||
private val adapter: FlexibleAdapter<*>
|
||||
private val view: View,
|
||||
private val adapter: FlexibleAdapter<*>
|
||||
) : LibraryHolder(view, adapter) {
|
||||
|
||||
/**
|
||||
@@ -42,7 +42,7 @@ class LibraryListHolder(
|
||||
visibility = if (item.downloadCount > 0) View.VISIBLE else View.GONE
|
||||
text = "${item.downloadCount}"
|
||||
}
|
||||
//show local text badge if local manga
|
||||
// show local text badge if local manga
|
||||
local_text.visibility = if (item.manga.source == LocalSource.ID) View.VISIBLE else View.GONE
|
||||
|
||||
// Create thumbnail onclick to simulate long click
|
||||
@@ -61,5 +61,4 @@ class LibraryListHolder(
|
||||
.dontAnimate()
|
||||
.into(thumbnail)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ import uy.kohesive.injekt.injectLazy
|
||||
/**
|
||||
* The navigation view shown in a drawer with the different options to show the library.
|
||||
*/
|
||||
class LibraryNavigationView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null)
|
||||
: ExtendedNavigationView(context, attrs) {
|
||||
class LibraryNavigationView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
||||
ExtendedNavigationView(context, attrs) {
|
||||
|
||||
/**
|
||||
* Preferences helper.
|
||||
@@ -161,6 +161,5 @@ class LibraryNavigationView @JvmOverloads constructor(context: Context, attrs: A
|
||||
|
||||
item.group.items.forEach { adapter.notifyItemChanged(it) }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,17 +17,17 @@ import eu.kanade.tachiyomi.source.online.HttpSource
|
||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
||||
import eu.kanade.tachiyomi.util.lang.combineLatest
|
||||
import eu.kanade.tachiyomi.util.lang.isNullOrUnsubscribed
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
import java.util.ArrayList
|
||||
import java.util.Collections
|
||||
import java.util.Comparator
|
||||
import rx.Observable
|
||||
import rx.Subscription
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
import rx.schedulers.Schedulers
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
import java.util.ArrayList
|
||||
import java.util.Collections
|
||||
import java.util.Comparator
|
||||
|
||||
/**
|
||||
* Class containing library information.
|
||||
@@ -43,11 +43,11 @@ private typealias LibraryMap = Map<Int, List<LibraryItem>>
|
||||
* Presenter of [LibraryController].
|
||||
*/
|
||||
class LibraryPresenter(
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
private val preferences: PreferencesHelper = Injekt.get(),
|
||||
private val coverCache: CoverCache = Injekt.get(),
|
||||
private val sourceManager: SourceManager = Injekt.get(),
|
||||
private val downloadManager: DownloadManager = Injekt.get()
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
private val preferences: PreferencesHelper = Injekt.get(),
|
||||
private val coverCache: CoverCache = Injekt.get(),
|
||||
private val sourceManager: SourceManager = Injekt.get(),
|
||||
private val downloadManager: DownloadManager = Injekt.get()
|
||||
) : BasePresenter<LibraryController>() {
|
||||
|
||||
private val context = preferences.context
|
||||
@@ -375,5 +375,4 @@ class LibraryPresenter(
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,5 +8,4 @@ object LibrarySort {
|
||||
const val UNREAD = 3
|
||||
const val TOTAL = 4
|
||||
const val LATEST_CHAPTER = 6
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import eu.kanade.tachiyomi.ui.recent_updates.RecentChaptersController
|
||||
import eu.kanade.tachiyomi.ui.recently_read.RecentlyReadController
|
||||
import kotlinx.android.synthetic.main.main_activity.*
|
||||
|
||||
|
||||
class MainActivity : BaseActivity() {
|
||||
|
||||
private lateinit var router: Router
|
||||
@@ -92,17 +91,25 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
router.addChangeListener(object : ControllerChangeHandler.ControllerChangeListener {
|
||||
override fun onChangeStarted(to: Controller?, from: Controller?, isPush: Boolean,
|
||||
container: ViewGroup, handler: ControllerChangeHandler) {
|
||||
override fun onChangeStarted(
|
||||
to: Controller?,
|
||||
from: Controller?,
|
||||
isPush: Boolean,
|
||||
container: ViewGroup,
|
||||
handler: ControllerChangeHandler
|
||||
) {
|
||||
|
||||
syncActivityViewWithController(to, from)
|
||||
}
|
||||
|
||||
override fun onChangeCompleted(to: Controller?, from: Controller?, isPush: Boolean,
|
||||
container: ViewGroup, handler: ControllerChangeHandler) {
|
||||
|
||||
override fun onChangeCompleted(
|
||||
to: Controller?,
|
||||
from: Controller?,
|
||||
isPush: Boolean,
|
||||
container: ViewGroup,
|
||||
handler: ControllerChangeHandler
|
||||
) {
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
syncActivityViewWithController(router.backstack.lastOrNull()?.controller())
|
||||
@@ -142,10 +149,10 @@ class MainActivity : BaseActivity() {
|
||||
router.pushController(RouterTransaction.with(DownloadController()))
|
||||
}
|
||||
Intent.ACTION_SEARCH, "com.google.android.gms.actions.SEARCH_ACTION" -> {
|
||||
//If the intent match the "standard" Android search intent
|
||||
// If the intent match the "standard" Android search intent
|
||||
// or the Google-specific search intent (triggered by saying or typing "search *query* on *Tachiyomi*" in Google Search/Google Assistant)
|
||||
|
||||
//Get the search query provided in extras, and if not null, perform a global search with it.
|
||||
// Get the search query provided in extras, and if not null, perform a global search with it.
|
||||
val query = intent.getStringExtra(SearchManager.QUERY)
|
||||
if (query != null && query.isNotEmpty()) {
|
||||
if (router.backstackSize > 1) {
|
||||
@@ -245,5 +252,4 @@ class MainActivity : BaseActivity() {
|
||||
const val INTENT_SEARCH_QUERY = "query"
|
||||
const val INTENT_SEARCH_FILTER = "filter"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -102,5 +102,4 @@ class TabsAnimator(val tabs: TabLayout) {
|
||||
*/
|
||||
private val isMeasured: Boolean
|
||||
get() = tabsHeight > 0
|
||||
|
||||
}
|
||||
|
||||
@@ -27,12 +27,12 @@ import eu.kanade.tachiyomi.ui.manga.chapter.ChaptersController
|
||||
import eu.kanade.tachiyomi.ui.manga.info.MangaInfoController
|
||||
import eu.kanade.tachiyomi.ui.manga.track.TrackController
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import java.util.Date
|
||||
import kotlinx.android.synthetic.main.main_activity.tabs
|
||||
import kotlinx.android.synthetic.main.manga_controller.manga_pager
|
||||
import rx.Subscription
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.util.Date
|
||||
|
||||
class MangaController : RxController, TabbedController {
|
||||
|
||||
@@ -170,7 +170,6 @@ class MangaController : RxController, TabbedController {
|
||||
override fun getPageTitle(position: Int): CharSequence {
|
||||
return tabTitles[position]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
@@ -181,5 +180,4 @@ class MangaController : RxController, TabbedController {
|
||||
const val CHAPTERS_CONTROLLER = 1
|
||||
const val TRACK_CONTROLLER = 2
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,12 +9,12 @@ import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
import eu.kanade.tachiyomi.util.view.gone
|
||||
import eu.kanade.tachiyomi.util.view.setVectorCompat
|
||||
import kotlinx.android.synthetic.main.chapters_item.*
|
||||
import java.util.Date
|
||||
import kotlinx.android.synthetic.main.chapters_item.*
|
||||
|
||||
class ChapterHolder(
|
||||
private val view: View,
|
||||
private val adapter: ChaptersAdapter
|
||||
private val view: View,
|
||||
private val adapter: ChaptersAdapter
|
||||
) : BaseFlexibleViewHolder(view, adapter) {
|
||||
|
||||
init {
|
||||
@@ -49,9 +49,9 @@ class ChapterHolder(
|
||||
chapter_date.text = ""
|
||||
}
|
||||
|
||||
//add scanlator if exists
|
||||
// add scanlator if exists
|
||||
chapter_scanlator.text = chapter.scanlator
|
||||
//allow longer titles if there is no scanlator (most sources)
|
||||
// allow longer titles if there is no scanlator (most sources)
|
||||
if (chapter_scanlator.text.isNullOrBlank()) {
|
||||
chapter_title.maxLines = 2
|
||||
chapter_scanlator.gone()
|
||||
@@ -118,5 +118,4 @@ class ChapterHolder(
|
||||
// Finally show the PopupMenu
|
||||
popup.show()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,10 +35,12 @@ class ChapterItem(val chapter: Chapter, val manga: Manga) : AbstractFlexibleItem
|
||||
return ChapterHolder(view, adapter as ChaptersAdapter)
|
||||
}
|
||||
|
||||
override fun bindViewHolder(adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: ChapterHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?) {
|
||||
override fun bindViewHolder(
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: ChapterHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
) {
|
||||
|
||||
holder.bind(this, manga)
|
||||
}
|
||||
@@ -54,5 +56,4 @@ class ChapterItem(val chapter: Chapter, val manga: Manga) : AbstractFlexibleItem
|
||||
override fun hashCode(): Int {
|
||||
return chapter.id!!.hashCode()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,14 +7,14 @@ import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.text.DateFormat
|
||||
import java.text.DecimalFormat
|
||||
import java.text.DecimalFormatSymbols
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class ChaptersAdapter(
|
||||
controller: ChaptersController,
|
||||
context: Context
|
||||
controller: ChaptersController,
|
||||
context: Context
|
||||
) : FlexibleAdapter<ChapterItem>(null, controller, true) {
|
||||
|
||||
val preferences: PreferencesHelper by injectLazy()
|
||||
@@ -46,5 +46,4 @@ class ChaptersAdapter(
|
||||
interface OnMenuItemClickListener {
|
||||
fun onMenuItemClick(position: Int, item: MenuItem)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -233,7 +233,6 @@ class ChaptersController : NucleusController<ChaptersPresenter>(),
|
||||
}
|
||||
actionMode?.invalidate()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun initialFetchChapters() {
|
||||
@@ -466,7 +465,7 @@ class ChaptersController : NucleusController<ChaptersPresenter>(),
|
||||
|
||||
fun onChaptersDeleted(chapters: List<ChapterItem>) {
|
||||
dismissDeletingDialog()
|
||||
//this is needed so the downloaded text gets removed from the item
|
||||
// this is needed so the downloaded text gets removed from the item
|
||||
chapters.forEach {
|
||||
adapter?.updateItem(it)
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import eu.kanade.tachiyomi.source.Source
|
||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
||||
import eu.kanade.tachiyomi.util.chapter.syncChaptersWithSource
|
||||
import eu.kanade.tachiyomi.util.lang.isNullOrUnsubscribed
|
||||
import java.util.Date
|
||||
import rx.Observable
|
||||
import rx.Subscription
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
@@ -21,20 +22,19 @@ import rx.schedulers.Schedulers
|
||||
import timber.log.Timber
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.util.Date
|
||||
|
||||
/**
|
||||
* Presenter of [ChaptersController].
|
||||
*/
|
||||
class ChaptersPresenter(
|
||||
val manga: Manga,
|
||||
val source: Source,
|
||||
private val chapterCountRelay: BehaviorRelay<Float>,
|
||||
private val lastUpdateRelay: BehaviorRelay<Date>,
|
||||
private val mangaFavoriteRelay: PublishRelay<Boolean>,
|
||||
val preferences: PreferencesHelper = Injekt.get(),
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
private val downloadManager: DownloadManager = Injekt.get()
|
||||
val manga: Manga,
|
||||
val source: Source,
|
||||
private val chapterCountRelay: BehaviorRelay<Float>,
|
||||
private val lastUpdateRelay: BehaviorRelay<Date>,
|
||||
private val mangaFavoriteRelay: PublishRelay<Boolean>,
|
||||
val preferences: PreferencesHelper = Injekt.get(),
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
private val downloadManager: DownloadManager = Injekt.get()
|
||||
) : BasePresenter<ChaptersController>() {
|
||||
|
||||
/**
|
||||
@@ -98,7 +98,6 @@ class ChaptersPresenter(
|
||||
// Emit the upload date of the most recent chapter
|
||||
lastUpdateRelay.call(Date(chapters.maxBy { it.date_upload }?.date_upload
|
||||
?: 0))
|
||||
|
||||
}
|
||||
.subscribe { chaptersRelay.call(it) })
|
||||
}
|
||||
@@ -414,5 +413,4 @@ class ChaptersPresenter(
|
||||
fun sortDescending(): Boolean {
|
||||
return manga.sortDescending()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,5 +28,4 @@ class DeleteChaptersDialog<T>(bundle: Bundle? = null) : DialogController(bundle)
|
||||
interface Listener {
|
||||
fun deleteChapters()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,5 +23,4 @@ class DeletingChaptersDialog(bundle: Bundle? = null) : DialogController(bundle)
|
||||
override fun showDialog(router: Router) {
|
||||
showDialog(router, TAG)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -74,4 +74,4 @@ class DownloadCustomChaptersDialog<T> : DialogController
|
||||
// Key to retrieve max chapters from bundle on process death.
|
||||
const val KEY_ITEM_MAX = "DownloadCustomChaptersDialog.int.maxChapters"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,12 +45,12 @@ import eu.kanade.tachiyomi.ui.webview.WebViewActivity
|
||||
import eu.kanade.tachiyomi.util.lang.truncateCenter
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import eu.kanade.tachiyomi.util.view.snack
|
||||
import jp.wasabeef.glide.transformations.CropSquareTransformation
|
||||
import kotlinx.android.synthetic.main.manga_info_controller.*
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.text.DateFormat
|
||||
import java.text.DecimalFormat
|
||||
import java.util.Date
|
||||
import jp.wasabeef.glide.transformations.CropSquareTransformation
|
||||
import kotlinx.android.synthetic.main.manga_info_controller.*
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
/**
|
||||
* Fragment that shows manga information.
|
||||
@@ -153,14 +153,13 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
||||
* If true update view with manga information,
|
||||
* if false fetch manga information
|
||||
*
|
||||
* @param manga manga object containing information about manga.
|
||||
* @param manga manga object containing information about manga.
|
||||
* @param source the source of the manga.
|
||||
*/
|
||||
fun onNextManga(manga: Manga, source: Source) {
|
||||
if (manga.initialized) {
|
||||
// Update view.
|
||||
setMangaInfo(manga, source)
|
||||
|
||||
} else {
|
||||
// Initialize manga.
|
||||
fetchMangaFromSource()
|
||||
@@ -176,7 +175,7 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
||||
private fun setMangaInfo(manga: Manga, source: Source?) {
|
||||
val view = view ?: return
|
||||
|
||||
//update full title TextView.
|
||||
// update full title TextView.
|
||||
manga_full_title.text = if (manga.title.isBlank()) {
|
||||
view.context.getString(R.string.unknown)
|
||||
} else {
|
||||
@@ -339,7 +338,6 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
||||
presenter.fetchMangaFromSource()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update swipe refresh to stop showing refresh in progress spinner.
|
||||
*/
|
||||
@@ -577,5 +575,4 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
||||
successCallback.intentSender)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,13 +12,13 @@ import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||
import eu.kanade.tachiyomi.source.Source
|
||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
||||
import eu.kanade.tachiyomi.util.lang.isNullOrUnsubscribed
|
||||
import java.util.Date
|
||||
import rx.Observable
|
||||
import rx.Subscription
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
import rx.schedulers.Schedulers
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.util.Date
|
||||
|
||||
/**
|
||||
* Presenter of MangaInfoFragment.
|
||||
@@ -26,14 +26,14 @@ import java.util.Date
|
||||
* Observable updates should be called from here.
|
||||
*/
|
||||
class MangaInfoPresenter(
|
||||
val manga: Manga,
|
||||
val source: Source,
|
||||
private val chapterCountRelay: BehaviorRelay<Float>,
|
||||
private val lastUpdateRelay: BehaviorRelay<Date>,
|
||||
private val mangaFavoriteRelay: PublishRelay<Boolean>,
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
private val downloadManager: DownloadManager = Injekt.get(),
|
||||
private val coverCache: CoverCache = Injekt.get()
|
||||
val manga: Manga,
|
||||
val source: Source,
|
||||
private val chapterCountRelay: BehaviorRelay<Float>,
|
||||
private val lastUpdateRelay: BehaviorRelay<Date>,
|
||||
private val mangaFavoriteRelay: PublishRelay<Boolean>,
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
private val downloadManager: DownloadManager = Injekt.get(),
|
||||
private val coverCache: CoverCache = Injekt.get()
|
||||
) : BasePresenter<MangaInfoController>() {
|
||||
|
||||
/**
|
||||
@@ -59,7 +59,7 @@ class MangaInfoPresenter(
|
||||
.subscribe { setFavorite(it) }
|
||||
.apply { add(this) }
|
||||
|
||||
//update last update date
|
||||
// update last update date
|
||||
lastUpdateRelay.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeLatestCache(MangaInfoController::setLastUpdateDate)
|
||||
}
|
||||
@@ -169,5 +169,4 @@ class MangaInfoPresenter(
|
||||
fun moveMangaToCategory(manga: Manga, category: Category?) {
|
||||
moveMangaToCategories(manga, listOfNotNull(category))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -70,5 +70,4 @@ class SetTrackChaptersDialog<T> : DialogController
|
||||
private companion object {
|
||||
const val KEY_ITEM_TRACK = "SetTrackChaptersDialog.item.track"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,5 +76,4 @@ class SetTrackScoreDialog<T> : DialogController
|
||||
private companion object {
|
||||
const val KEY_ITEM_TRACK = "SetTrackScoreDialog.item.track"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,5 +54,4 @@ class SetTrackStatusDialog<T> : DialogController
|
||||
private companion object {
|
||||
const val KEY_ITEM_TRACK = "SetTrackStatusDialog.item.track"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,5 +41,4 @@ class TrackAdapter(controller: TrackController) : RecyclerView.Adapter<TrackHold
|
||||
fun onChaptersClick(position: Int)
|
||||
fun onScoreClick(position: Int)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -139,5 +139,4 @@ class TrackController : NucleusController<TrackPresenter>(),
|
||||
private companion object {
|
||||
const val TAG_SEARCH_CONTROLLER = "track_search_controller"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,12 +16,11 @@ import rx.schedulers.Schedulers
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
|
||||
|
||||
class TrackPresenter(
|
||||
val manga: Manga,
|
||||
preferences: PreferencesHelper = Injekt.get(),
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
private val trackManager: TrackManager = Injekt.get()
|
||||
val manga: Manga,
|
||||
preferences: PreferencesHelper = Injekt.get(),
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
private val trackManager: TrackManager = Injekt.get()
|
||||
) : BasePresenter<TrackController>() {
|
||||
|
||||
private val context = preferences.context
|
||||
@@ -130,5 +129,4 @@ class TrackPresenter(
|
||||
track.last_chapter_read = chapterNumber
|
||||
updateRemote(track, item.service)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@ import eu.kanade.tachiyomi.data.glide.GlideApp
|
||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||
import eu.kanade.tachiyomi.util.view.gone
|
||||
import eu.kanade.tachiyomi.util.view.inflate
|
||||
import kotlinx.android.synthetic.main.track_search_item.view.*
|
||||
import java.util.ArrayList
|
||||
import kotlinx.android.synthetic.main.track_search_item.view.*
|
||||
|
||||
class TrackSearchAdapter(context: Context)
|
||||
: ArrayAdapter<TrackSearch>(context, R.layout.track_search_item, ArrayList<TrackSearch>()) {
|
||||
class TrackSearchAdapter(context: Context) :
|
||||
ArrayAdapter<TrackSearch>(context, R.layout.track_search_item, ArrayList<TrackSearch>()) {
|
||||
|
||||
override fun getView(position: Int, view: View?, parent: ViewGroup): View {
|
||||
var v = view
|
||||
|
||||
@@ -13,6 +13,7 @@ import eu.kanade.tachiyomi.data.track.TrackService
|
||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import eu.kanade.tachiyomi.util.lang.plusAssign
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlinx.android.synthetic.main.track_search_dialog.view.progress
|
||||
import kotlinx.android.synthetic.main.track_search_dialog.view.track_search
|
||||
import kotlinx.android.synthetic.main.track_search_dialog.view.track_search_list
|
||||
@@ -21,7 +22,6 @@ import rx.android.schedulers.AndroidSchedulers
|
||||
import rx.subscriptions.CompositeSubscription
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class TrackSearchDialog : DialogController {
|
||||
|
||||
@@ -148,5 +148,4 @@ class TrackSearchDialog : DialogController {
|
||||
private companion object {
|
||||
const val KEY_SERVICE = "service_id"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,4 +14,4 @@ class MangaAdapter(controller: MigrationController) :
|
||||
super.updateDataSet(items)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ import kotlinx.android.synthetic.main.catalogue_list_item.thumbnail
|
||||
import kotlinx.android.synthetic.main.catalogue_list_item.title
|
||||
|
||||
class MangaHolder(
|
||||
private val view: View,
|
||||
private val adapter: FlexibleAdapter<*>
|
||||
private val view: View,
|
||||
private val adapter: FlexibleAdapter<*>
|
||||
) : BaseFlexibleViewHolder(view, adapter) {
|
||||
|
||||
fun bind(item: MangaItem) {
|
||||
@@ -33,5 +33,4 @@ class MangaHolder(
|
||||
.dontAnimate()
|
||||
.into(thumbnail)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,10 +18,12 @@ class MangaItem(val manga: Manga) : AbstractFlexibleItem<MangaHolder>() {
|
||||
return MangaHolder(view, adapter)
|
||||
}
|
||||
|
||||
override fun bindViewHolder(adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: MangaHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?) {
|
||||
override fun bindViewHolder(
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: MangaHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
) {
|
||||
|
||||
holder.bind(this)
|
||||
}
|
||||
|
||||
@@ -131,5 +131,4 @@ class MigrationController : NucleusController<MigrationPresenter>(),
|
||||
companion object {
|
||||
const val LOADING_DIALOG_TAG = "LoadingDialog"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,9 +21,9 @@ import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
|
||||
class MigrationPresenter(
|
||||
private val sourceManager: SourceManager = Injekt.get(),
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
private val sourceManager: SourceManager = Injekt.get(),
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
) : BasePresenter<MigrationController>() {
|
||||
|
||||
var state = ViewState()
|
||||
@@ -94,8 +94,13 @@ class MigrationPresenter(
|
||||
.subscribe()
|
||||
}
|
||||
|
||||
private fun migrateMangaInternal(source: Source, sourceChapters: List<SChapter>,
|
||||
prevManga: Manga, manga: Manga, replace: Boolean) {
|
||||
private fun migrateMangaInternal(
|
||||
source: Source,
|
||||
sourceChapters: List<SChapter>,
|
||||
prevManga: Manga,
|
||||
manga: Manga,
|
||||
replace: Boolean
|
||||
) {
|
||||
|
||||
val flags = preferences.migrateFlags().getOrDefault()
|
||||
val migrateChapters = MigrationFlags.hasChapters(flags)
|
||||
|
||||
@@ -13,7 +13,7 @@ import eu.kanade.tachiyomi.ui.catalogue.global_search.CatalogueSearchPresenter
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class SearchController(
|
||||
private var manga: Manga? = null
|
||||
private var manga: Manga? = null
|
||||
) : CatalogueSearchController(manga?.title) {
|
||||
|
||||
private var newManga: Manga? = null
|
||||
@@ -95,7 +95,5 @@ class SearchController(
|
||||
}
|
||||
.build()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ import eu.kanade.tachiyomi.ui.catalogue.global_search.CatalogueSearchItem
|
||||
import eu.kanade.tachiyomi.ui.catalogue.global_search.CatalogueSearchPresenter
|
||||
|
||||
class SearchPresenter(
|
||||
initialQuery: String? = "",
|
||||
private val manga: Manga
|
||||
initialQuery: String? = "",
|
||||
private val manga: Manga
|
||||
) : CatalogueSearchPresenter(initialQuery) {
|
||||
|
||||
override fun getEnabledSources(): List<CatalogueSource> {
|
||||
@@ -19,7 +19,7 @@ class SearchPresenter(
|
||||
}
|
||||
|
||||
override fun createCatalogueSearchItem(source: CatalogueSource, results: List<CatalogueSearchCardItem>?): CatalogueSearchItem {
|
||||
//Set the catalogue search item as highlighted if the source matches that of the selected manga
|
||||
// Set the catalogue search item as highlighted if the source matches that of the selected manga
|
||||
return CatalogueSearchItem(source, results, source.id == manga.source)
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,12 @@ class SelectionHeader : AbstractHeaderItem<SelectionHeader.Holder>() {
|
||||
/**
|
||||
* Binds this item to the given view holder.
|
||||
*/
|
||||
override fun bindViewHolder(adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>, holder: Holder,
|
||||
position: Int, payloads: List<Any?>?) {
|
||||
override fun bindViewHolder(
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: Holder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
) {
|
||||
// Intentionally empty
|
||||
}
|
||||
|
||||
|
||||
@@ -34,10 +34,13 @@ data class SourceItem(val source: Source, val header: SelectionHeader? = null) :
|
||||
/**
|
||||
* Binds this item to the given view holder.
|
||||
*/
|
||||
override fun bindViewHolder(adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>, holder: SourceHolder,
|
||||
position: Int, payloads: List<Any?>?) {
|
||||
override fun bindViewHolder(
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>,
|
||||
holder: SourceHolder,
|
||||
position: Int,
|
||||
payloads: List<Any?>?
|
||||
) {
|
||||
|
||||
holder.bind(this)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ package eu.kanade.tachiyomi.ui.migration
|
||||
import eu.kanade.tachiyomi.source.Source
|
||||
|
||||
data class ViewState(
|
||||
val selectedSource: Source? = null,
|
||||
val mangaForSource: List<MangaItem> = emptyList(),
|
||||
val sourcesWithManga: List<SourceItem> = emptyList(),
|
||||
val isReplacingManga: Boolean = false
|
||||
)
|
||||
val selectedSource: Source? = null,
|
||||
val mangaForSource: List<MangaItem> = emptyList(),
|
||||
val sourcesWithManga: List<SourceItem> = emptyList(),
|
||||
val isReplacingManga: Boolean = false
|
||||
)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user