From 214008ac5cd25d1438efb40534cabc8d8ca9a638 Mon Sep 17 00:00:00 2001 From: Jay Date: Sat, 15 Feb 2020 02:48:47 -0800 Subject: [PATCH] Using badges for downloads/unread again Added compact grid option in sort sheet, closer to the old style --- .../data/preference/PreferenceKeys.kt | 4 +- .../data/preference/PreferencesHelper.kt | 4 +- .../catalogue/browse/CatalogueGridHolder.kt | 14 +- .../ui/catalogue/browse/CatalogueItem.kt | 9 +- .../ui/library/LibraryCategoryView.kt | 7 +- .../tachiyomi/ui/library/LibraryController.kt | 2 + .../tachiyomi/ui/library/LibraryGridHolder.kt | 100 +++++++--- .../tachiyomi/ui/library/LibraryHolder.kt | 4 + .../tachiyomi/ui/library/LibraryItem.kt | 16 +- .../tachiyomi/ui/library/LibraryListHolder.kt | 82 +++++---- .../tachiyomi/ui/library/LibraryPresenter.kt | 5 +- .../library/filter/SortFilterBottomSheet.kt | 17 +- .../ui/setting/SettingsLibraryController.kt | 7 - .../tachiyomi/util/view/ViewExtensions.kt | 1 - .../drawable/ic_library_books_white_24dp.xml | 5 + .../drawable/ic_start_reading_white_24dp.xml | 5 + .../library_compact_grid_selector.xml | 35 ++++ .../res/drawable/library_item_selector.xml | 8 +- .../main/res/drawable/unread_angled_badge.xml | 15 ++ .../res/layout-land/filter_bottom_sheet.xml | 24 +-- .../layout-sw600dp/filter_bottom_sheet.xml | 20 +- .../main/res/layout/catalogue_grid_item.xml | 174 ++++++++++++------ .../main/res/layout/catalogue_list_item.xml | 121 ++++++++---- .../main/res/layout/filter_bottom_sheet.xml | 27 +-- .../main/res/layout/library_controller.xml | 1 + app/src/main/res/values/arrays.xml | 6 + app/src/main/res/values/colors.xml | 2 + app/src/main/res/values/strings.xml | 5 +- 28 files changed, 463 insertions(+), 257 deletions(-) create mode 100644 app/src/main/res/drawable/ic_library_books_white_24dp.xml create mode 100644 app/src/main/res/drawable/ic_start_reading_white_24dp.xml create mode 100644 app/src/main/res/drawable/library_compact_grid_selector.xml create mode 100644 app/src/main/res/drawable/unread_angled_badge.xml diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt index 17d860f941..5a53c7f96d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt @@ -111,9 +111,7 @@ object PreferenceKeys { const val downloadNewCategories = "download_new_categories" - const val libraryAsList = "pref_display_library_as_list" - - const val libraryGridFixed = "library_grid_fixes" + const val libraryLayout = "pref_display_library_layout" const val lang = "app_language" diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt index 8fff8b56e9..8f7b6eb0e3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt @@ -171,9 +171,7 @@ class PreferencesHelper(val context: Context) { fun libraryUpdatePrioritization() = rxPrefs.getInteger(Keys.libraryUpdatePrioritization, 0) - fun libraryAsList() = rxPrefs.getBoolean(Keys.libraryAsList, false) - - fun libraryGridFixedSize() = rxPrefs.getBoolean(Keys.libraryGridFixed, false) + fun libraryLayout() = rxPrefs.getInteger(Keys.libraryLayout, 1) fun downloadBadge() = rxPrefs.getBoolean(Keys.downloadBadge, false) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueGridHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueGridHolder.kt index 97fc021bb5..e65ba70715 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueGridHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueGridHolder.kt @@ -5,14 +5,15 @@ import androidx.recyclerview.widget.RecyclerView import com.bumptech.glide.Glide import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions -import com.bumptech.glide.signature.ObjectKey import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.items.IFlexible +import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Manga -import eu.kanade.tachiyomi.data.database.models.MangaImpl import eu.kanade.tachiyomi.data.glide.GlideApp import eu.kanade.tachiyomi.ui.library.LibraryCategoryAdapter +import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.view.gone +import eu.kanade.tachiyomi.util.view.updatePaddingRelative import eu.kanade.tachiyomi.widget.StateImageViewTarget import kotlinx.android.synthetic.main.catalogue_grid_item.* @@ -38,10 +39,15 @@ class CatalogueGridHolder( */ override fun onSetValues(manga: Manga) { // Update the title of the manga. - title.text = manga.currentTitle() subtitle.gone() + title.gone() + compact_title.text = manga.currentTitle() - bookmark_text.visibility = if (manga.favorite) View.VISIBLE else View.GONE + badge_view.visibility = if (manga.favorite) View.VISIBLE else View.GONE + unread_angle.visibility = View.GONE + unread_text.updatePaddingRelative(start = 5.dpToPx) + unread_text.visibility = if (manga.favorite) View.VISIBLE else View.GONE + unread_text.text = itemView.resources.getText(R.string.in_library) // Update the cover. setImage(manga) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueItem.kt index 071dfb2540..81e1faffa8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/browse/CatalogueItem.kt @@ -4,6 +4,7 @@ import android.view.View import android.view.ViewGroup.LayoutParams.MATCH_PARENT import android.view.ViewGroup.LayoutParams.WRAP_CONTENT import android.widget.FrameLayout +import androidx.constraintlayout.widget.ConstraintLayout import androidx.recyclerview.widget.RecyclerView import com.f2prateek.rx.preferences.Preference import eu.davidea.flexibleadapter.FlexibleAdapter @@ -12,6 +13,7 @@ import eu.davidea.flexibleadapter.items.IFlexible import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.preference.getOrDefault +import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.widget.AutofitRecyclerView import kotlinx.android.synthetic.main.catalogue_grid_item.view.* @@ -30,7 +32,12 @@ class CatalogueItem(val manga: Manga, private val catalogueAsList: Preference 0 -> when (item.unreadType) { - 1 -> view.resources.getQuantityString(R.plurals.unread_count, unread, unread) - 0 -> view.resources.getString(R.string.new_chapter) - else -> item.manga.originalAuthor() - } - else -> item.manga.originalAuthor() - } - setTextColor( - view.context.getResourceColor( - if (item.manga.unread > 0 && item.unreadType > -1) android.R.attr.colorAccent - else android.R.attr.textColorSecondary - ) - ) + with(unread_text) { + text = unread.toString() + visibility = if (unread > 0) View.VISIBLE else View.GONE } - play_layout.visibility = if (unread > 0) View.VISIBLE else View.GONE - play_layout.setOnClickListener { playButtonClicked() } // Update the download count or local status and its visibility. with(download_text) { visibility = if (item.downloadCount > -1 && (item.downloadCount > 0 || item.manga - .source == LocalSource.ID)) + .source == LocalSource.ID)) View.VISIBLE else View.GONE text = if (item.manga.source == LocalSource.ID) itemView.resources.getString(R.string.local_source_badge) - else item.downloadCount.toString() - backgroundTintList = ContextCompat.getColorStateList(itemView.context, - if (item.manga.source == LocalSource.ID) R.color.md_teal_500 - else R.color.md_red_500) + else item.downloadCount.toString() + } + + // Show the bade card if unread or downloads exists + badge_view.visibility = if (download_text.visibility == View.VISIBLE || unread_text + .visibility == View.VISIBLE) View.VISIBLE else View.GONE + + // Show the angles divider if both unread and downloads exists + unread_angle.visibility = if (download_text.visibility == View.VISIBLE && unread_text + .visibility == View.VISIBLE) View.VISIBLE else View.GONE + + if (unread_angle.visibility == View.VISIBLE) { + download_text.updatePaddingRelative(end = 8.dpToPx) + unread_text.updatePaddingRelative(start = 2.dpToPx) + } + else { + download_text.updatePaddingRelative(end = 5.dpToPx) + unread_text.updatePaddingRelative(start = 5.dpToPx) + } + + play_layout.visibility = if (unread > 0) View.VISIBLE else View.GONE + play_layout.setOnClickListener { playButtonClicked() } + + if (fixedSize) { + title.gone() + subtitle.gone() + } + else { + compact_title.gone() + gradient.gone() } // Update the cover. - if (item.manga.thumbnail_url == null) Glide.with(view.context).clear(cover_thumbnail) + if (item.manga.thumbnail_url == null) GlideApp.with(view.context).clear(cover_thumbnail) else { val id = item.manga.id ?: return var glide = GlideApp.with(view.context).load(item.manga) @@ -94,13 +132,15 @@ class LibraryGridHolder( override fun onActionStateChanged(position: Int, actionState: Int) { super.onActionStateChanged(position, actionState) if (actionState == 2) { - view.card.isDragged = true + card.isDragged = true + badge_view.isDragged = true } } override fun onItemReleased(position: Int) { super.onItemReleased(position) - view.card.isDragged = false + card.isDragged = false + badge_view.isDragged = false } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHolder.kt index f08fd847df..7691121905 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHolder.kt @@ -1,6 +1,7 @@ package eu.kanade.tachiyomi.ui.library import android.view.View +import androidx.core.content.ContextCompat import eu.davidea.flexibleadapter.FlexibleAdapter import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import androidx.recyclerview.widget.RecyclerView @@ -37,4 +38,7 @@ abstract class LibraryHolder( (adapter as? LibraryCategoryAdapter)?.onItemReleaseListener?.onItemReleased(position) } + protected fun convertColor(color: Int):String { + return Integer.toHexString(color and 0x00ffffff) + } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt index 381e1b7ba9..270296f60d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt @@ -4,6 +4,8 @@ import android.annotation.SuppressLint import android.view.View import android.view.ViewGroup import android.widget.FrameLayout +import androidx.constraintlayout.widget.ConstraintLayout +import androidx.core.content.ContextCompat import androidx.recyclerview.widget.RecyclerView import com.f2prateek.rx.preferences.Preference import eu.davidea.flexibleadapter.FlexibleAdapter @@ -14,19 +16,19 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.LibraryManga import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.source.SourceManager +import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.widget.AutofitRecyclerView import kotlinx.android.synthetic.main.catalogue_grid_item.view.* import uy.kohesive.injekt.injectLazy -class LibraryItem(val manga: LibraryManga, private val libraryAsList: Preference, - private val fixedGrid: Preference) : +class LibraryItem(val manga: LibraryManga, private val libraryLayout: Preference) : AbstractFlexibleItem(), IFilterable { var downloadCount = -1 var unreadType = 1 override fun getLayoutRes(): Int { - return if (libraryAsList.getOrDefault()) + return if (libraryLayout.getOrDefault() == 0) R.layout.catalogue_list_item else R.layout.catalogue_grid_item @@ -35,7 +37,7 @@ class LibraryItem(val manga: LibraryManga, private val libraryAsList: Preference override fun createViewHolder(view: View, adapter: FlexibleAdapter>): LibraryHolder { val parent = adapter.recyclerView return if (parent is AutofitRecyclerView) { - val fixedSize = fixedGrid.getOrDefault() + val fixedSize = libraryLayout.getOrDefault() == 1 view.apply { val coverHeight = (parent.itemWidth / 3f * 4f).toInt() if (fixedSize) { @@ -43,12 +45,18 @@ class LibraryItem(val manga: LibraryManga, private val libraryAsList: Preference ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT ) + val marginParams = card.layoutParams as ConstraintLayout.LayoutParams + marginParams.bottomMargin = 10.dpToPx + card.layoutParams = marginParams + constraint_layout.minHeight = 0 cover_thumbnail.adjustViewBounds = false cover_thumbnail.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, coverHeight) } else { constraint_layout.minHeight = coverHeight cover_thumbnail.maxHeight = (parent.itemWidth / 3f * 6f).toInt() + constraint_layout.background = ContextCompat.getDrawable(context, + R.drawable.library_item_selector) } } LibraryGridHolder(view, adapter as LibraryCategoryAdapter, parent.itemWidth, fixedSize) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt index 7a80328bc8..e347fab9d7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt @@ -12,9 +12,18 @@ import kotlinx.android.synthetic.main.catalogue_list_item.* import com.bumptech.glide.signature.ObjectKey import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.MangaImpl +import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.getResourceColor +import eu.kanade.tachiyomi.util.view.updatePaddingRelative +import kotlinx.android.synthetic.main.catalogue_grid_item.* +import kotlinx.android.synthetic.main.catalogue_list_item.badge_view +import kotlinx.android.synthetic.main.catalogue_list_item.cover_thumbnail +import kotlinx.android.synthetic.main.catalogue_list_item.download_text +import kotlinx.android.synthetic.main.catalogue_list_item.play_layout import kotlinx.android.synthetic.main.catalogue_list_item.subtitle import kotlinx.android.synthetic.main.catalogue_list_item.title +import kotlinx.android.synthetic.main.catalogue_list_item.unread_angle +import kotlinx.android.synthetic.main.catalogue_list_item.unread_text import kotlinx.android.synthetic.main.catalogue_list_item.view.* /** @@ -45,25 +54,39 @@ class LibraryListHolder( // Update the unread count and its visibility. val unread = item.manga.unread - // Update the subtitle of the manga with artist or the unread count and download count - "First Color" - val subtitleText = when { - unread > 0 -> when (item.unreadType) { - 1 -> view.resources.getQuantityString(R.plurals.unread_count, unread, unread) - 0 -> view.resources.getString(R.string.new_chapter) - else -> item.manga.originalAuthor() - } - else -> item.manga.originalAuthor() + with(unread_text) { + text = unread.toString() + visibility = if (unread > 0) View.VISIBLE else View.GONE } - // Update the download count or local status and its visibility. - val downloadText = - if (item.manga.source == LocalSource.ID) - itemView.resources.getString(R.string.local_source_badge) - else view.resources.getQuantityString(R.plurals.download_count, - item.downloadCount, item.downloadCount) - // Combine the 2 above using html - val subText = if (item.downloadCount > 0 || item.manga.source == LocalSource.ID) { + // Update the download count or local status and its visibility. + with(download_text) { + visibility = if (item.downloadCount > -1 && (item.downloadCount > 0 || item.manga + .source == LocalSource.ID)) + View.VISIBLE else View.GONE + text = if (item.manga.source == LocalSource.ID) + itemView.resources.getString(R.string.local_source_badge) + else item.downloadCount.toString() + } + + // Show the bade card if unread or downloads exists + badge_view.visibility = if (download_text.visibility == View.VISIBLE || unread_text + .visibility == View.VISIBLE) View.VISIBLE else View.GONE + + // Show the angles divider if both unread and downloads exists + unread_angle.visibility = if (download_text.visibility == View.VISIBLE && unread_text + .visibility == View.VISIBLE) View.VISIBLE else View.GONE + + if (unread_angle.visibility == View.VISIBLE) { + download_text.updatePaddingRelative(end = 8.dpToPx) + unread_text.updatePaddingRelative(start = 2.dpToPx) + } + else { + download_text.updatePaddingRelative(end = 5.dpToPx) + unread_text.updatePaddingRelative(start = 5.dpToPx) + } + + /* if (item.downloadCount > 0 || item.manga.source == LocalSource.ID) { val downloadColor = convertColor(ContextCompat.getColor(itemView.context, if (item.manga.source == LocalSource.ID) R.color.md_teal_500 else R.color.md_red_500)) @@ -76,21 +99,14 @@ class LibraryListHolder( subtitleText else -> "$downloadText" } - } - else { + }*/ + /*else { subtitleText - } - with(subtitle) { - text = HtmlCompat.fromHtml(subText ?: "", HtmlCompat.FROM_HTML_MODE_LEGACY) - setTextColor( - view.context.getResourceColor( - if (item.manga.unread > 0 && item.unreadType > -1 && item.downloadCount <= 0 - && item.manga.source != LocalSource.ID) - android.R.attr.colorAccent - else android.R.attr.textColorSecondary - ) - ) - } + }*/ + subtitle.text = item.manga.originalAuthor()?.trim() + subtitle.visibility = if (!item.manga.originalAuthor().isNullOrBlank()) View.VISIBLE + else View.GONE + play_layout.visibility = if (unread > 0) View.VISIBLE else View.GONE play_layout.setOnClickListener { playButtonClicked() } @@ -108,10 +124,6 @@ class LibraryListHolder( } } - private fun convertColor(color: Int):String { - return Integer.toHexString(color and 0x00ffffff) - } - private fun playButtonClicked() { adapter.libraryListener.startReading(adapterPosition) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt index 83d268221c..34b2c11f5c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt @@ -417,15 +417,14 @@ class LibraryPresenter( */ private fun getLibraryFromDB(): Library { val categories = db.getCategories().executeAsBlocking().toMutableList() - val libraryAsList = preferences.libraryAsList() - val fixedGrid = preferences.libraryGridFixedSize() + val libraryLayout = preferences.libraryLayout() val showCategories = !preferences.hideCategories().getOrDefault() val unreadBadgeType = preferences.unreadBadgeType().getOrDefault() var libraryManga = db.getLibraryMangas().executeAsBlocking() if (!showCategories) libraryManga = libraryManga.distinctBy { it.id } val libraryMap = libraryManga.map { manga -> - LibraryItem(manga, libraryAsList, fixedGrid).apply { unreadType = unreadBadgeType } + LibraryItem(manga, libraryLayout).apply { unreadType = unreadBadgeType } }.groupBy { if (showCategories) it.manga.category else 0 } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/SortFilterBottomSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/SortFilterBottomSheet.kt index d890cf9254..4594d72ab4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/SortFilterBottomSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/filter/SortFilterBottomSheet.kt @@ -12,6 +12,7 @@ import android.widget.ImageView import android.widget.LinearLayout import android.widget.RadioButton import android.widget.RadioGroup +import android.widget.Spinner import androidx.appcompat.view.menu.MenuBuilder import androidx.appcompat.widget.PopupMenu import androidx.core.content.ContextCompat @@ -34,6 +35,7 @@ import eu.kanade.tachiyomi.util.view.updateLayoutParams import eu.kanade.tachiyomi.util.view.updatePadding import eu.kanade.tachiyomi.util.view.updatePaddingRelative import eu.kanade.tachiyomi.util.view.visible +import eu.kanade.tachiyomi.widget.IgnoreFirstSpinnerListener import kotlinx.android.synthetic.main.filter_bottom_sheet.view.* import kotlinx.coroutines.CoroutineStart import kotlinx.coroutines.Dispatchers @@ -188,7 +190,7 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A showUnreadMenu() } - display_group.bindToPreference(preferences.libraryAsList()) + display_spinner.bindToPreference(preferences.libraryLayout()) } override fun onSaveInstanceState(): Parcelable? { @@ -612,19 +614,16 @@ class SortFilterBottomSheet @JvmOverloads constructor(context: Context, attrs: A } /** - * Binds a radio group with a boolean preference. + * Binds a Spinner with a boolean preference. */ - private fun RadioGroup.bindToPreference(pref: Preference) { - (getChildAt(pref.getOrDefault().toInt()) as RadioButton).isChecked = true - setOnCheckedChangeListener { _, value -> - val index = indexOfChild(findViewById(value)) - pref.set(index == 1) + private fun Spinner.bindToPreference(pref: Preference) { + onItemSelectedListener = IgnoreFirstSpinnerListener { position -> + pref.set(position) onGroupClicked(ACTION_DISPLAY) } + setSelection(pref.getOrDefault(), false) } - private fun Boolean.toInt() = if (this) 1 else 0 - private fun tintVector(resId: Int): Drawable? { return ContextCompat.getDrawable(context, resId)?.mutate()?.apply { setTint(context.getResourceColor(android.R.attr.colorAccent)) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt index d7fec0040e..657fa022d8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt @@ -52,13 +52,6 @@ class SettingsLibraryController : SettingsController() { } } - switchPreference { - key = Keys.libraryGridFixed - titleRes = R.string.pref_fixed_grid - summaryRes = R.string.pref_fixed_grid_summary - defaultValue = false - } - switchPreference { key = Keys.removeArticles titleRes = R.string.pref_remove_articles diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt index 1ba78f3807..8dc92e44ad 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt @@ -229,7 +229,6 @@ fun Controller.setOnQueryTextChangeListener(searchView: SearchView, f: (text: St }) } -@RequiresApi(17) inline fun View.updatePaddingRelative( @Px start: Int = paddingStart, @Px top: Int = paddingTop, diff --git a/app/src/main/res/drawable/ic_library_books_white_24dp.xml b/app/src/main/res/drawable/ic_library_books_white_24dp.xml new file mode 100644 index 0000000000..6fdb7fab80 --- /dev/null +++ b/app/src/main/res/drawable/ic_library_books_white_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_start_reading_white_24dp.xml b/app/src/main/res/drawable/ic_start_reading_white_24dp.xml new file mode 100644 index 0000000000..1587b50330 --- /dev/null +++ b/app/src/main/res/drawable/ic_start_reading_white_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/library_compact_grid_selector.xml b/app/src/main/res/drawable/library_compact_grid_selector.xml new file mode 100644 index 0000000000..3475ccd592 --- /dev/null +++ b/app/src/main/res/drawable/library_compact_grid_selector.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/library_item_selector.xml b/app/src/main/res/drawable/library_item_selector.xml index 658066ad8e..4ff60d3d73 100644 --- a/app/src/main/res/drawable/library_item_selector.xml +++ b/app/src/main/res/drawable/library_item_selector.xml @@ -2,8 +2,8 @@ @@ -12,8 +12,8 @@ diff --git a/app/src/main/res/drawable/unread_angled_badge.xml b/app/src/main/res/drawable/unread_angled_badge.xml new file mode 100644 index 0000000000..b634e73025 --- /dev/null +++ b/app/src/main/res/drawable/unread_angled_badge.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout-land/filter_bottom_sheet.xml b/app/src/main/res/layout-land/filter_bottom_sheet.xml index 67aaa40f14..e49983463f 100644 --- a/app/src/main/res/layout-land/filter_bottom_sheet.xml +++ b/app/src/main/res/layout-land/filter_bottom_sheet.xml @@ -135,35 +135,21 @@ - - - - - - + android:entries="@array/library_display"/> - - - - - - + android:entries="@array/library_display"/> @@ -21,9 +21,9 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" - android:layout_marginTop="2dp" - android:layout_marginStart="6dp" - android:layout_marginEnd="6dp" + android:layout_marginStart="8dp" + android:layout_marginTop="10dp" + android:layout_marginEnd="8dp" app:layout_constraintBottom_toTopOf="@+id/title" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -46,54 +46,12 @@ tools:background="?android:attr/colorBackground" tools:ignore="ContentDescription" tools:src="@mipmap/ic_launcher" /> - - - + + + + + + + + + + + + + + + + + + + + + + + - + app:cardElevation="5dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:visibility="visible"> - + + + + android:id="@+id/unread_angle" + android:layout_width="10dp" + android:layout_height="0dp" + android:scaleType="fitXY" + android:src="@drawable/unread_angled_badge" + app:layout_constraintBottom_toBottomOf="@+id/unread_text" + app:layout_constraintEnd_toStartOf="@id/unread_text" + app:layout_constraintTop_toTopOf="@+id/unread_text" /> - - - + + + - - - - - - - + android:entries="@array/library_display"/> @string/filter_mode_screen + + @string/action_display_list + @string/action_display_grid + @string/action_display_comfy_grid + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 8faae86f5d..38d3fa5d6d 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -68,6 +68,7 @@ #000000 #FAFAFA + #CCCCCC #424242 #80448AFF @@ -82,4 +83,5 @@ #009688 + #99CC99 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 289638ab53..465ff0826f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -94,7 +94,8 @@ Add to home screen Display mode Display - Grid + Comfy Grid + Compact Grid List Download badges Unread text @@ -647,6 +648,6 @@ Skip this step next time To show this screen again, go to Settings -> Library. Reset Tags - Display as: + Display as