From c88fc382381758347ba195a91f4d16d9b77e51a9 Mon Sep 17 00:00:00 2001 From: Jay Date: Thu, 20 Feb 2020 00:10:15 -0800 Subject: [PATCH] layout improvements --- .../tachiyomi/ui/library/LibraryGridHolder.kt | 17 ++--- .../tachiyomi/ui/library/LibraryHeaderItem.kt | 12 ++-- .../main/res/layout/catalogue_grid_item.xml | 67 ++++++++++--------- .../layout/library_category_header_item.xml | 4 +- 4 files changed, 51 insertions(+), 49 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryGridHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryGridHolder.kt index ed7bfdc141..0a1520dfee 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryGridHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryGridHolder.kt @@ -2,17 +2,13 @@ package eu.kanade.tachiyomi.ui.library import android.view.Gravity import android.view.View -import android.view.ViewTreeObserver import android.widget.FrameLayout -import androidx.constraintlayout.widget.ConstraintLayout import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.signature.ObjectKey import eu.kanade.tachiyomi.data.database.models.MangaImpl import eu.kanade.tachiyomi.data.glide.GlideApp import eu.kanade.tachiyomi.source.LocalSource -import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.view.gone -import eu.kanade.tachiyomi.util.view.visible import kotlinx.android.synthetic.main.catalogue_grid_item.* import kotlinx.android.synthetic.main.unread_download_badge.* @@ -35,8 +31,7 @@ class LibraryGridHolder( init { play_layout.setOnClickListener { playButtonClicked() } if (fixedSize) { - title.gone() - subtitle.gone() + text_layout.gone() } else { compact_title.gone() @@ -61,7 +56,7 @@ class LibraryGridHolder( title.text = item.manga.currentTitle() subtitle.text = item.manga.originalAuthor()?.trim() - if (!fixedSize) { + /* if (!fixedSize) { title.viewTreeObserver.addOnPreDrawListener(object : ViewTreeObserver.OnPreDrawListener { override fun onPreDraw(): Boolean { title.viewTreeObserver.removeOnPreDrawListener(this) @@ -81,7 +76,7 @@ class LibraryGridHolder( return true } }) - } + }*/ compact_title.text = title.text @@ -103,10 +98,10 @@ class LibraryGridHolder( 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) - .diskCacheStrategy(DiskCacheStrategy.RESOURCE) + var glide = GlideApp.with(adapter.recyclerView.context).load(item.manga) + .diskCacheStrategy(DiskCacheStrategy.AUTOMATIC) .signature(ObjectKey(MangaImpl.getLastCoverFetch(id).toString())) - glide = if (fixedSize) glide.centerCrop() else glide.override(width) + glide = if (fixedSize) glide.centerCrop() else glide.override(cover_thumbnail.maxHeight) glide.into(cover_thumbnail) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderItem.kt index dc90dcebbf..db2411ef02 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHeaderItem.kt @@ -17,6 +17,8 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Category import eu.kanade.tachiyomi.data.library.LibraryUpdateService import eu.kanade.tachiyomi.util.system.getResourceColor +import eu.kanade.tachiyomi.util.system.launchUI +import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.invisible import eu.kanade.tachiyomi.util.view.visible import kotlinx.android.synthetic.main.library_category_header_item.view.* @@ -92,15 +94,15 @@ class LibraryHeaderItem(val category: Category) : AbstractHeaderItem { - catProgress.alpha = 1f + catProgress.gone() updateButton.invisible() } LibraryUpdateService.categoryInQueue(item.category.id) -> { - catProgress.alpha = 1f + catProgress.visible() updateButton.invisible() } else -> { - catProgress.alpha = 0f + catProgress.gone() updateButton.visible() } } @@ -108,8 +110,10 @@ class LibraryHeaderItem(val category: Category) : AbstractHeaderItem - - - + android:layout_marginTop="8dp" + android:layout_marginBottom="8dp" + android:orientation="vertical" + android:layout_height="32sp"> + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/library_category_header_item.xml b/app/src/main/res/layout/library_category_header_item.xml index 76790bd747..03cecaa925 100644 --- a/app/src/main/res/layout/library_category_header_item.xml +++ b/app/src/main/res/layout/library_category_header_item.xml @@ -64,11 +64,9 @@