mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-20 04:29:18 +01:00
Recent covers now follows the uniform covers setting
Can also change in in Recents' display options
This commit is contained in:
parent
66f71ef9f4
commit
8b511b5708
@ -22,6 +22,7 @@ class RecentMangaAdapter(val delegate: RecentsInterface) :
|
||||
var showRemoveHistory = preferences.showRecentsRemHistory().get()
|
||||
var showTitleFirst = preferences.showTitleFirstInRecents().get()
|
||||
var showUpdatedTime = preferences.showUpdatedTime().get()
|
||||
var uniformCovers = preferences.uniformGrid().get()
|
||||
|
||||
val viewType: Int
|
||||
get() = delegate.getViewType()
|
||||
@ -45,6 +46,7 @@ class RecentMangaAdapter(val delegate: RecentsInterface) :
|
||||
preferences.showRecentsRemHistory().register { showRemoveHistory = it }
|
||||
preferences.showTitleFirstInRecents().register { showTitleFirst = it }
|
||||
preferences.showUpdatedTime().register { showUpdatedTime = it }
|
||||
preferences.uniformGrid().register { uniformCovers = it }
|
||||
}
|
||||
|
||||
private fun <T> Preference<T>.register(onChanged: (T) -> Unit) {
|
||||
|
@ -40,15 +40,15 @@ class RecentMangaHolder(
|
||||
RecentMangaAdapter.ShowRecentsDLs.All -> true
|
||||
} && !item.mch.manga.isLocal()
|
||||
|
||||
val isUpdates = adapter.viewType == RecentsPresenter.VIEW_TYPE_ONLY_UPDATES &&
|
||||
val isSmallUpdates = adapter.viewType == RecentsPresenter.VIEW_TYPE_ONLY_UPDATES &&
|
||||
!adapter.showUpdatedTime
|
||||
binding.cardLayout.updateLayoutParams<ConstraintLayout.LayoutParams> {
|
||||
height = (if (isUpdates) 40 else 80).dpToPx
|
||||
width = (if (isUpdates) 40 else 60).dpToPx
|
||||
height = (if (isSmallUpdates) 40 else 80).dpToPx
|
||||
width = (if (isSmallUpdates) 40 else 60).dpToPx
|
||||
}
|
||||
listOf(binding.title, binding.subtitle).forEach {
|
||||
it.updateLayoutParams<ConstraintLayout.LayoutParams> {
|
||||
if (isUpdates) {
|
||||
if (isSmallUpdates) {
|
||||
if (it == binding.title) topMargin = 5.dpToPx
|
||||
endToStart = R.id.button_layout
|
||||
endToEnd = -1
|
||||
@ -60,7 +60,7 @@ class RecentMangaHolder(
|
||||
}
|
||||
}
|
||||
binding.buttonLayout.updateLayoutParams<ConstraintLayout.LayoutParams> {
|
||||
if (isUpdates) {
|
||||
if (isSmallUpdates) {
|
||||
topToBottom = -1
|
||||
topToTop = R.id.front_view
|
||||
} else {
|
||||
@ -68,13 +68,14 @@ class RecentMangaHolder(
|
||||
topToBottom = R.id.subtitle
|
||||
}
|
||||
}
|
||||
val freeformCovers = !isSmallUpdates && !adapter.uniformCovers
|
||||
with(binding.coverThumbnail) {
|
||||
adjustViewBounds = !isUpdates
|
||||
scaleType = if (isUpdates) ImageView.ScaleType.CENTER_CROP else ImageView.ScaleType.FIT_CENTER
|
||||
adjustViewBounds = freeformCovers
|
||||
scaleType = if (!freeformCovers) ImageView.ScaleType.CENTER_CROP else ImageView.ScaleType.FIT_CENTER
|
||||
}
|
||||
listOf(binding.coverThumbnail, binding.card).forEach {
|
||||
it.updateLayoutParams<ViewGroup.LayoutParams> {
|
||||
width = if (isUpdates) {
|
||||
width = if (!freeformCovers) {
|
||||
ViewGroup.LayoutParams.MATCH_PARENT
|
||||
} else {
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
@ -108,13 +109,13 @@ class RecentMangaHolder(
|
||||
)
|
||||
}
|
||||
val notValidNum = item.mch.chapter.chapter_number <= 0
|
||||
binding.body.isVisible = !isUpdates
|
||||
binding.body.isVisible = !isSmallUpdates
|
||||
binding.body.text = when {
|
||||
item.mch.chapter.id == null -> binding.body.context.getString(
|
||||
R.string.added_,
|
||||
item.mch.manga.date_added.timeSpanFromNow(itemView.context)
|
||||
)
|
||||
isUpdates -> ""
|
||||
isSmallUpdates -> ""
|
||||
item.mch.history.id == null -> binding.body.context.getString(
|
||||
R.string.updated_,
|
||||
item.chapter.date_upload.timeSpanFromNow(itemView.context)
|
||||
|
@ -14,11 +14,15 @@ class RecentsGeneralView @JvmOverloads constructor(context: Context, attrs: Attr
|
||||
override fun inflateBinding() = RecentsGeneralViewBinding.bind(this)
|
||||
override fun initGeneralPreferences() {
|
||||
val titleText = context.getString(R.string.show_reset_history_button)
|
||||
val uniformText = context.getString(R.string.uniform_covers)
|
||||
binding.showRemoveHistory.text = titleText
|
||||
.withSubtitle(binding.showRemoveHistory.context, R.string.press_and_hold_to_also_reset)
|
||||
binding.uniformCovers.text = uniformText
|
||||
.withSubtitle(binding.uniformCovers.context, R.string.affects_library_grid)
|
||||
binding.showRecentsDownload.bindToPreference(preferences.showRecentsDownloads())
|
||||
binding.showRemoveHistory.bindToPreference(preferences.showRecentsRemHistory())
|
||||
binding.showReadInAll.bindToPreference(preferences.showReadInAllRecents())
|
||||
binding.showTitleFirst.bindToPreference(preferences.showTitleFirstInRecents())
|
||||
binding.uniformCovers.bindToPreference(preferences.uniformGrid())
|
||||
}
|
||||
}
|
||||
|
@ -47,5 +47,13 @@
|
||||
android:text="@string/show_title_first"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:layout_marginTop="8dp" />
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/uniform_covers"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/uniform_covers"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:layout_marginTop="8dp" />
|
||||
</LinearLayout>
|
||||
</eu.kanade.tachiyomi.ui.recents.options.RecentsGeneralView>
|
@ -173,7 +173,6 @@
|
||||
<string name="download_badge">Download badges</string>
|
||||
<string name="hide_start_reading_button">Hide start reading button</string>
|
||||
<string name="badges">Badges</string>
|
||||
<string name="uniform_covers">Uniform covers</string>
|
||||
<string name="uniform_grid_covers">Uniform grid covers</string>
|
||||
<string name="grid_size">Grid size</string>
|
||||
<string name="x_small">XS</string>
|
||||
@ -261,12 +260,16 @@
|
||||
<string name="only_unread">Only unread</string>
|
||||
<string name="only_downloaded">Only downloaded</string>
|
||||
<string name="unread_or_downloaded">Unread or downloaded</string>
|
||||
|
||||
<!-- Recents Settings -->
|
||||
<string name="show_reset_history_button">Show reset history button</string>
|
||||
<string name="show_read_chapters_all">Show read chapters in Grouped and All</string>
|
||||
<string name="show_title_first">Show title first</string>
|
||||
<string name="a_while_ago">A while ago</string>
|
||||
<string name="show_updated_time">Show updated time</string>
|
||||
<string name="group_chapters_together">Group chapters together</string>
|
||||
<string name="uniform_covers">Uniform covers</string>
|
||||
<string name="affects_library_grid">Affects library grid covers</string>
|
||||
|
||||
<!-- Browse -->
|
||||
<string name="search_filters">Search filters</string>
|
||||
|
Loading…
Reference in New Issue
Block a user