mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-24 05:38:01 +03:00
Lighter weight method of rounding cover art
This commit is contained in:
parent
018dbce57e
commit
dabca5f09e
7 changed files with 34 additions and 44 deletions
|
@ -34,6 +34,9 @@ class SourceItem(val manga: Manga, private val catalogueAsList: Preference<Boole
|
|||
val parent = adapter.recyclerView
|
||||
return if (parent is AutofitRecyclerView) {
|
||||
view.apply {
|
||||
// Setting this via XML doesn't work
|
||||
card.clipToOutline = true
|
||||
|
||||
card.layoutParams = FrameLayout.LayoutParams(
|
||||
MATCH_PARENT, parent.itemWidth / 3 * 4
|
||||
)
|
||||
|
|
|
@ -38,6 +38,9 @@ class LibraryItem(val manga: LibraryManga, private val libraryAsList: Preference
|
|||
val parent = adapter.recyclerView
|
||||
return if (parent is AutofitRecyclerView) {
|
||||
view.apply {
|
||||
// Setting this via XML doesn't work
|
||||
card.clipToOutline = true
|
||||
|
||||
val coverHeight = parent.itemWidth / 3 * 4
|
||||
card.layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, coverHeight)
|
||||
gradient.layoutParams = FrameLayout.LayoutParams(
|
||||
|
|
|
@ -85,6 +85,9 @@ class MangaInfoController(private val fromSource: Boolean = false) :
|
|||
override fun onViewCreated(view: View) {
|
||||
super.onViewCreated(view)
|
||||
|
||||
// Setting this via XML doesn't work
|
||||
binding.mangaCover.clipToOutline = true
|
||||
|
||||
binding.btnFavorite.clicks()
|
||||
.onEach { onFavoriteClick() }
|
||||
.launchIn(scope)
|
||||
|
|
6
app/src/main/res/drawable/rounded_rectangle.xml
Normal file
6
app/src/main/res/drawable/rounded_rectangle.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="@dimen/card_radius" />
|
||||
<solid android:color="?attr/colorSurface" />
|
||||
</shape>
|
|
@ -11,45 +11,32 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/manga_cover_card"
|
||||
<ImageView
|
||||
android:id="@+id/manga_cover"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:cardCornerRadius="@dimen/card_radius"
|
||||
android:layout_margin="16dp"
|
||||
android:background="@drawable/rounded_rectangle"
|
||||
android:contentDescription="@string/description_cover"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="h,3:2"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/manga_cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="@string/description_cover"
|
||||
tools:background="@color/material_grey_700" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/info_scrollview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/manga_cover_card"
|
||||
app:layout_constraintStart_toEndOf="@+id/manga_cover"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/manga_full_title"
|
||||
|
|
|
@ -38,29 +38,18 @@
|
|||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:background="@color/material_grey_700" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/manga_cover_card"
|
||||
<ImageView
|
||||
android:id="@+id/manga_cover"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:cardCornerRadius="@dimen/card_radius"
|
||||
app:layout_constraintDimensionRatio="h,2:3"
|
||||
android:layout_margin="16dp"
|
||||
android:background="@drawable/rounded_rectangle"
|
||||
android:contentDescription="@string/description_cover"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="h,2:3"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline2"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/manga_cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="@string/description_cover"
|
||||
tools:background="@color/material_grey_700" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/manga_info_section"
|
||||
|
|
|
@ -7,18 +7,17 @@
|
|||
android:background="@drawable/library_item_selector"
|
||||
android:padding="4dp">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
<FrameLayout
|
||||
android:id="@+id/card"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="220dp"
|
||||
app:cardCornerRadius="@dimen/card_radius">
|
||||
android:background="@drawable/rounded_rectangle">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/thumbnail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/colorSurface"
|
||||
tools:background="?attr/colorSurface"
|
||||
tools:ignore="ContentDescription"
|
||||
tools:src="@mipmap/ic_launcher" />
|
||||
|
||||
|
@ -120,6 +119,6 @@
|
|||
android:layout_gravity="center"
|
||||
android:visibility="gone" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</FrameLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
|
Loading…
Reference in a new issue