mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-09 19:55:11 +01:00
Update source migration ui
Also fixed library grid back to center crop
This commit is contained in:
parent
dbaa12a0e7
commit
b174b954f5
@ -17,7 +17,7 @@ class MangaHolder(
|
||||
fun bind(item: MangaItem) {
|
||||
// Update the title of the manga.
|
||||
title.text = item.manga.title
|
||||
subtitle.text = item.manga.author?.trim()
|
||||
subtitle.text = ""
|
||||
|
||||
// Update the cover.
|
||||
cover_thumbnail.clear()
|
||||
|
@ -24,8 +24,7 @@ import uy.kohesive.injekt.api.get
|
||||
|
||||
class MigrationController : NucleusController<MigrationPresenter>(),
|
||||
FlexibleAdapter.OnItemClickListener,
|
||||
SourceAdapter.OnSelectClickListener,
|
||||
SourceAdapter.OnAutoClickListener,
|
||||
SourceAdapter.OnAllClickListener,
|
||||
MigrationInterface {
|
||||
|
||||
private var adapter: FlexibleAdapter<IFlexible<*>>? = null
|
||||
@ -115,11 +114,7 @@ class MigrationController : NucleusController<MigrationPresenter>(),
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onSelectClick(position: Int) {
|
||||
onItemClick(view, position)
|
||||
}
|
||||
|
||||
override fun onAutoClick(position: Int) {
|
||||
override fun onAllClick(position: Int) {
|
||||
val item = adapter?.getItem(position) as? SourceItem ?: return
|
||||
|
||||
launchUI {
|
||||
|
@ -42,7 +42,7 @@ class SelectionHeader : AbstractHeaderItem<SelectionHeader.Holder>() {
|
||||
|
||||
class Holder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>) : BaseFlexibleViewHolder(view, adapter) {
|
||||
init {
|
||||
title.text = view.context.getString(R.string.select_a_source_to_migrate_from)
|
||||
title.text = view.context.getString(R.string.select_a_source_then_item_to_migrate)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,28 +17,16 @@ class SourceAdapter(val controller: MigrationController) :
|
||||
setDisplayHeadersAtStartUp(true)
|
||||
}
|
||||
|
||||
/**
|
||||
* Listener for browse item clicks.
|
||||
*/
|
||||
val selectClickListener: OnSelectClickListener? = controller
|
||||
|
||||
/**
|
||||
* Listener which should be called when user clicks select.
|
||||
*/
|
||||
interface OnSelectClickListener {
|
||||
fun onSelectClick(position: Int)
|
||||
}
|
||||
|
||||
/**
|
||||
* Listener for auto item clicks.
|
||||
*/
|
||||
val autoClickListener: OnAutoClickListener? = controller
|
||||
val allClickListener: OnAllClickListener? = controller
|
||||
|
||||
/**
|
||||
* Listener which should be called when user clicks select.
|
||||
*/
|
||||
interface OnAutoClickListener {
|
||||
fun onAutoClick(position: Int)
|
||||
interface OnAllClickListener {
|
||||
fun onAllClick(position: Int)
|
||||
}
|
||||
|
||||
override fun updateDataSet(items: MutableList<IFlexible<*>>?) {
|
||||
|
@ -11,11 +11,8 @@ class SourceHolder(view: View, val adapter: SourceAdapter) :
|
||||
BaseFlexibleViewHolder(view, adapter) {
|
||||
|
||||
init {
|
||||
migration_auto.setOnClickListener {
|
||||
adapter.autoClickListener?.onAutoClick(adapterPosition)
|
||||
}
|
||||
migration_select.setOnClickListener {
|
||||
adapter.selectClickListener?.onSelectClick(adapterPosition)
|
||||
migration_all.setOnClickListener {
|
||||
adapter.allClickListener?.onAllClick(adapterPosition)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,34 +15,15 @@ class SourceAdapter(val controller: SourceController) :
|
||||
setDisplayHeadersAtStartUp(true)
|
||||
}
|
||||
|
||||
/**
|
||||
* Listener for browse item clicks.
|
||||
*/
|
||||
val browseClickListener: OnBrowseClickListener = controller
|
||||
|
||||
/**
|
||||
* Listener for latest item clicks.
|
||||
*/
|
||||
val latestClickListener: OnLatestClickListener = controller
|
||||
val sourceListener: SourceListener = controller
|
||||
|
||||
override fun onItemSwiped(position: Int, direction: Int) {
|
||||
super.onItemSwiped(position, direction)
|
||||
controller.hideCatalogue(position)
|
||||
}
|
||||
|
||||
/**
|
||||
* Listener which should be called when user clicks browse.
|
||||
* Note: Should only be handled by [SourceController]
|
||||
*/
|
||||
interface OnBrowseClickListener {
|
||||
fun onBrowseClick(position: Int)
|
||||
}
|
||||
|
||||
/**
|
||||
* Listener which should be called when user clicks latest.
|
||||
* Note: Should only be handled by [SourceController]
|
||||
*/
|
||||
interface OnLatestClickListener {
|
||||
interface SourceListener {
|
||||
fun onPinClick(position: Int)
|
||||
fun onLatestClick(position: Int)
|
||||
}
|
||||
}
|
||||
|
@ -53,15 +53,14 @@ import kotlin.math.max
|
||||
/**
|
||||
* This controller shows and manages the different catalogues enabled by the user.
|
||||
* This controller should only handle UI actions, IO actions should be done by [SourcePresenter]
|
||||
* [SourceAdapter.OnBrowseClickListener] call function data on browse item click.
|
||||
* [SourceAdapter.SourceListener] call function data on browse item click.
|
||||
* [SourceAdapter.OnLatestClickListener] call function data on latest item click
|
||||
*/
|
||||
class SourceController : NucleusController<SourcePresenter>(),
|
||||
FlexibleAdapter.OnItemClickListener,
|
||||
SourceAdapter.OnBrowseClickListener,
|
||||
SourceAdapter.SourceListener,
|
||||
RootSearchInterface,
|
||||
BottomSheetController,
|
||||
SourceAdapter.OnLatestClickListener {
|
||||
BottomSheetController {
|
||||
|
||||
/**
|
||||
* Application preferences.
|
||||
@ -260,7 +259,7 @@ class SourceController : NucleusController<SourcePresenter>(),
|
||||
/**
|
||||
* Called when browse is clicked in [SourceAdapter]
|
||||
*/
|
||||
override fun onBrowseClick(position: Int) {
|
||||
override fun onPinClick(position: Int) {
|
||||
val item = adapter?.getItem(position) as? SourceItem ?: return
|
||||
val isPinned = item.isPinned ?: item.header?.code?.equals(SourcePresenter.PINNED_KEY)
|
||||
?: false
|
||||
|
@ -14,19 +14,12 @@ import kotlinx.android.synthetic.main.source_item.*
|
||||
class SourceHolder(view: View, val adapter: SourceAdapter) :
|
||||
BaseFlexibleViewHolder(view, adapter) {
|
||||
|
||||
/*override val slice = Slice(card).apply {
|
||||
setColor(adapter.cardBackground)
|
||||
}
|
||||
|
||||
override val viewToSlice: View
|
||||
get() = card*/
|
||||
|
||||
init {
|
||||
source_pin.setOnClickListener {
|
||||
adapter.browseClickListener.onBrowseClick(adapterPosition)
|
||||
adapter.sourceListener.onPinClick(adapterPosition)
|
||||
}
|
||||
source_latest.setOnClickListener {
|
||||
adapter.latestClickListener.onLatestClick(adapterPosition)
|
||||
adapter.sourceListener.onLatestClick(adapterPosition)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cover_thumbnail"
|
||||
android:layout_width="@dimen/material_layout_avatar"
|
||||
@ -34,6 +33,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:scaleType="centerCrop"
|
||||
tools:background="?android:attr/colorBackground"
|
||||
tools:ignore="ContentDescription"
|
||||
tools:src="@mipmap/ic_launcher" />
|
||||
|
@ -36,26 +36,15 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/edit_button"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/migration_auto"
|
||||
app:layout_constraintEnd_toStartOf="@+id/migration_all"
|
||||
tools:text="Source title"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/migration_auto"
|
||||
android:id="@+id/migration_all"
|
||||
style="@style/Theme.Widget.Button.Borderless.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/auto"
|
||||
app:layout_constraintEnd_toStartOf="@id/migration_select"
|
||||
android:layout_marginEnd="12dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/migration_select"
|
||||
style="@style/Theme.Widget.Button.Borderless.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/select"
|
||||
android:text="@string/all"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginEnd="12dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
@ -426,7 +426,8 @@
|
||||
<string name="source_migration">Source migration</string>
|
||||
<string name="migration">Migration</string>
|
||||
<string name="skip_pre_migration">Skip pre-migration</string>
|
||||
<string name="select_a_source_to_migrate_from">Select a source to migrate from</string>
|
||||
<string name="select_a_source_then_item_to_migrate">Select a source, then select an item to
|
||||
migrate</string>
|
||||
<string name="data_to_include_in_migration">Data to include in migration</string>
|
||||
<string name="search_parameter_eg">Search parameter (e.g. language:english)</string>
|
||||
<string name="include_extra_search_parameter">Include extra search parameter when searching</string>
|
||||
|
Loading…
Reference in New Issue
Block a user