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