mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 17:51:50 +01:00
Rounded library badges
This commit is contained in:
parent
395ca3630c
commit
6ad3fcb91d
@ -40,7 +40,7 @@ class SourceComfortableGridHolder(private val view: View, private val adapter: F
|
||||
}
|
||||
|
||||
override fun setImage(manga: Manga) {
|
||||
// Setting this via XML doesn't work
|
||||
// For rounded corners
|
||||
card.clipToOutline = true
|
||||
|
||||
GlideApp.with(view.context).clear(thumbnail)
|
||||
|
@ -40,7 +40,7 @@ open class SourceGridHolder(private val view: View, private val adapter: Flexibl
|
||||
}
|
||||
|
||||
override fun setImage(manga: Manga) {
|
||||
// Setting this via XML doesn't work
|
||||
// For rounded corners
|
||||
card.clipToOutline = true
|
||||
|
||||
GlideApp.with(view.context).clear(thumbnail)
|
||||
|
@ -9,6 +9,7 @@ import eu.kanade.tachiyomi.data.glide.GlideApp
|
||||
import eu.kanade.tachiyomi.data.glide.toMangaThumbnail
|
||||
import eu.kanade.tachiyomi.util.isLocal
|
||||
import eu.kanade.tachiyomi.util.view.visibleIf
|
||||
import kotlinx.android.synthetic.main.source_comfortable_grid_item.badges
|
||||
import kotlinx.android.synthetic.main.source_comfortable_grid_item.card
|
||||
import kotlinx.android.synthetic.main.source_comfortable_grid_item.download_text
|
||||
import kotlinx.android.synthetic.main.source_comfortable_grid_item.local_text
|
||||
@ -28,7 +29,7 @@ import kotlinx.android.synthetic.main.source_comfortable_grid_item.unread_text
|
||||
class LibraryComfortableGridHolder(
|
||||
private val view: View,
|
||||
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>
|
||||
) : LibraryGridHolder(view, adapter) {
|
||||
) : LibraryCompactGridHolder(view, adapter) {
|
||||
|
||||
/**
|
||||
* Method called from [LibraryCategoryAdapter.onBindViewHolder]. It updates the data for this
|
||||
@ -40,6 +41,9 @@ class LibraryComfortableGridHolder(
|
||||
// Update the title of the manga.
|
||||
title.text = item.manga.title
|
||||
|
||||
// For rounded corners
|
||||
badges.clipToOutline = true
|
||||
|
||||
// Update the unread count and its visibility.
|
||||
with(unread_text) {
|
||||
visibleIf { item.unreadCount > 0 }
|
||||
@ -53,7 +57,7 @@ class LibraryComfortableGridHolder(
|
||||
// set local visibility if its local manga
|
||||
local_text.visibleIf { item.manga.isLocal() }
|
||||
|
||||
// Setting this via XML doesn't work
|
||||
// For rounded corners
|
||||
card.clipToOutline = true
|
||||
|
||||
// Update the cover.
|
||||
|
@ -7,6 +7,7 @@ import eu.kanade.tachiyomi.data.glide.GlideApp
|
||||
import eu.kanade.tachiyomi.data.glide.toMangaThumbnail
|
||||
import eu.kanade.tachiyomi.util.isLocal
|
||||
import eu.kanade.tachiyomi.util.view.visibleIf
|
||||
import kotlinx.android.synthetic.main.source_compact_grid_item.badges
|
||||
import kotlinx.android.synthetic.main.source_compact_grid_item.card
|
||||
import kotlinx.android.synthetic.main.source_compact_grid_item.download_text
|
||||
import kotlinx.android.synthetic.main.source_compact_grid_item.local_text
|
||||
@ -23,7 +24,7 @@ import kotlinx.android.synthetic.main.source_compact_grid_item.unread_text
|
||||
* @param listener a listener to react to single tap and long tap events.
|
||||
* @constructor creates a new library holder.
|
||||
*/
|
||||
open class LibraryGridHolder(
|
||||
open class LibraryCompactGridHolder(
|
||||
private val view: View,
|
||||
private val adapter: FlexibleAdapter<*>
|
||||
) : LibraryHolder(view, adapter) {
|
||||
@ -38,6 +39,9 @@ open class LibraryGridHolder(
|
||||
// Update the title of the manga.
|
||||
title.text = item.manga.title
|
||||
|
||||
// For rounded corners
|
||||
badges.clipToOutline = true
|
||||
|
||||
// Update the unread count and its visibility.
|
||||
with(unread_text) {
|
||||
visibleIf { item.unreadCount > 0 }
|
||||
@ -51,7 +55,7 @@ open class LibraryGridHolder(
|
||||
// set local visibility if its local manga
|
||||
local_text.visibleIf { item.manga.isLocal() }
|
||||
|
||||
// Setting this via XML doesn't work
|
||||
// For rounded corners
|
||||
card.clipToOutline = true
|
||||
|
||||
// Update the cover.
|
@ -48,7 +48,7 @@ class LibraryItem(val manga: LibraryManga, private val libraryDisplayMode: Prefe
|
||||
MATCH_PARENT, coverHeight / 2, Gravity.BOTTOM
|
||||
)
|
||||
}
|
||||
LibraryGridHolder(view, adapter)
|
||||
LibraryCompactGridHolder(view, adapter)
|
||||
}
|
||||
DisplayMode.COMFORTABLE_GRID -> {
|
||||
val parent = adapter.recyclerView as AutofitRecyclerView
|
||||
|
@ -11,6 +11,7 @@ import eu.kanade.tachiyomi.data.glide.GlideApp
|
||||
import eu.kanade.tachiyomi.data.glide.toMangaThumbnail
|
||||
import eu.kanade.tachiyomi.util.isLocal
|
||||
import eu.kanade.tachiyomi.util.view.visibleIf
|
||||
import kotlinx.android.synthetic.main.source_list_item.badges
|
||||
import kotlinx.android.synthetic.main.source_list_item.download_text
|
||||
import kotlinx.android.synthetic.main.source_list_item.local_text
|
||||
import kotlinx.android.synthetic.main.source_list_item.thumbnail
|
||||
@ -42,6 +43,9 @@ class LibraryListHolder(
|
||||
// Update the title of the manga.
|
||||
title.text = item.manga.title
|
||||
|
||||
// For rounded corners
|
||||
badges.clipToOutline = true
|
||||
|
||||
// Update the unread count and its visibility.
|
||||
with(unread_text) {
|
||||
visibleIf { item.unreadCount > 0 }
|
||||
|
@ -91,7 +91,7 @@ class MangaInfoController(private val fromSource: Boolean = false) :
|
||||
override fun onViewCreated(view: View) {
|
||||
super.onViewCreated(view)
|
||||
|
||||
// Setting this via XML doesn't work
|
||||
// For rounded corners
|
||||
binding.mangaCover.clipToOutline = true
|
||||
|
||||
binding.btnFavorite.clicks()
|
||||
|
@ -28,57 +28,19 @@
|
||||
tools:ignore="ContentDescription"
|
||||
tools:src="@mipmap/ic_launcher" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<LinearLayout
|
||||
android:id="@+id/badges"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:layout_editor_absoluteX="7dp"
|
||||
tools:layout_editor_absoluteY="7dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/unread_text"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:background="@color/colorAccentDark"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toEndOf="@+id/download_text"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="120"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/download_text"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:background="@color/md_red_500"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toEndOf="@+id/local_text"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="120"
|
||||
tools:visibility="visible" />
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:background="@drawable/rounded_rectangle">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/local_text"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:background="@color/md_teal_500"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="1dp"
|
||||
@ -87,11 +49,39 @@
|
||||
android:text="@string/local_source_badge"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<TextView
|
||||
android:id="@+id/unread_text"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/colorAccentDark"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
tools:text="120"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/download_text"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/md_red_500"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
tools:text="120"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
|
@ -28,57 +28,19 @@
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@drawable/gradient_shape" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<LinearLayout
|
||||
android:id="@+id/badges"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:layout_editor_absoluteX="7dp"
|
||||
tools:layout_editor_absoluteY="7dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/unread_text"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:background="@color/colorAccentDark"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toEndOf="@+id/download_text"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="120"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/download_text"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:background="@color/md_red_500"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toEndOf="@+id/local_text"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="120"
|
||||
tools:visibility="visible" />
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:background="@drawable/rounded_rectangle">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/local_text"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:background="@color/md_teal_500"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="1dp"
|
||||
@ -87,11 +49,39 @@
|
||||
android:text="@string/local_source_badge"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<TextView
|
||||
android:id="@+id/unread_text"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/colorAccentDark"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
tools:text="120"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/download_text"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/md_red_500"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
tools:text="120"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
|
@ -30,83 +30,71 @@
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/local_text"
|
||||
app:layout_constraintEnd_toStartOf="@+id/badges"
|
||||
app:layout_constraintHorizontal_bias="0.007"
|
||||
app:layout_constraintStart_toEndOf="@+id/thumbnail"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.523"
|
||||
tools:text="Manga title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/local_text"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
<LinearLayout
|
||||
android:id="@+id/badges"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="@color/md_teal_500"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:text="@string/local_source_badge"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/unread_text"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/unread_text"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="@color/colorAccentLight"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/rounded_rectangle"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/download_text"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="130"
|
||||
tools:visibility="visible" />
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/download_text"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_toStartOf="@+id/unread_text"
|
||||
android:background="@color/md_red_500"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="122"
|
||||
tools:visibility="visible" />
|
||||
<TextView
|
||||
android:id="@+id/local_text"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/md_teal_500"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:text="@string/local_source_badge"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/unread_text"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/colorAccentLight"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
tools:text="130"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/download_text"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/md_red_500"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingEnd="3dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone"
|
||||
tools:text="122"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
Loading…
Reference in New Issue
Block a user