mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-24 03:41:54 +01:00
layout improvements
This commit is contained in:
parent
49d95e2dd0
commit
c88fc38238
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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<LibraryHead
|
||||
|
||||
when {
|
||||
item.category.id == -1 -> {
|
||||
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<LibraryHead
|
||||
|
||||
private fun addCategoryToUpdate() {
|
||||
if (adapter.libraryListener.updateCategory(adapterPosition)) {
|
||||
catProgress.alpha = 1f
|
||||
updateButton.invisible()
|
||||
launchUI {
|
||||
adapter.notifyItemChanged(adapterPosition)
|
||||
}
|
||||
}
|
||||
}
|
||||
private fun showCatSortOptions() {
|
||||
|
@ -24,7 +24,7 @@
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/title"
|
||||
app:layout_constraintBottom_toTopOf="@+id/text_layout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@ -122,40 +122,45 @@
|
||||
app:layout_constraintBottom_toBottomOf="@id/badge_guide"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/title"
|
||||
style="@style/TextAppearance.Regular.Body1.Light"
|
||||
<LinearLayout
|
||||
android:id="@+id/text_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/subtitle"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:text="Sample name" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/subtitle"
|
||||
style="@style/TextAppearance.Regular.Body1.Light"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="-1dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:text="Sample artist" />
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="32sp">
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/title"
|
||||
style="@style/TextAppearance.Regular.Body1.Light"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/subtitle"
|
||||
tools:text="Sample name" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/subtitle"
|
||||
style="@style/TextAppearance.Regular.Body1.Light"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="-1dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="12sp"
|
||||
tools:text="Sample artist" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</FrameLayout>
|
@ -64,11 +64,9 @@
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/cat_progress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="30dp"
|
||||
android:indeterminate="true"
|
||||
android:layout_height="30dp"
|
||||
android:alpha="0.0"
|
||||
tools:alpha="1.0"
|
||||
android:layout_marginStart="0dp"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/update_button"
|
||||
|
Loading…
Reference in New Issue
Block a user