mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-09-10 05:23:18 +02:00
Remove RelativeLayout from covers for better performance
This commit is contained in:
parent
f9783407bd
commit
47bc1f7a9f
@ -107,7 +107,6 @@ dependencies {
|
|||||||
compile "com.android.support:design:$SUPPORT_LIBRARY_VERSION"
|
compile "com.android.support:design:$SUPPORT_LIBRARY_VERSION"
|
||||||
compile "com.android.support:recyclerview-v7:$SUPPORT_LIBRARY_VERSION"
|
compile "com.android.support:recyclerview-v7:$SUPPORT_LIBRARY_VERSION"
|
||||||
compile "com.android.support:support-annotations:$SUPPORT_LIBRARY_VERSION"
|
compile "com.android.support:support-annotations:$SUPPORT_LIBRARY_VERSION"
|
||||||
compile "com.android.support:percent:$SUPPORT_LIBRARY_VERSION"
|
|
||||||
compile "com.android.support:preference-v7:$SUPPORT_LIBRARY_VERSION"
|
compile "com.android.support:preference-v7:$SUPPORT_LIBRARY_VERSION"
|
||||||
compile "com.android.support:preference-v14:$SUPPORT_LIBRARY_VERSION"
|
compile "com.android.support:preference-v14:$SUPPORT_LIBRARY_VERSION"
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package eu.kanade.tachiyomi.ui.catalogue
|
package eu.kanade.tachiyomi.ui.catalogue
|
||||||
|
|
||||||
|
import android.view.Gravity
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
|
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
import android.widget.RelativeLayout
|
import android.widget.FrameLayout
|
||||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
@ -71,12 +72,14 @@ class CatalogueAdapter(val fragment: CatalogueFragment) : FlexibleAdapter<Catalo
|
|||||||
*/
|
*/
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CatalogueHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CatalogueHolder {
|
||||||
if (parent.id == R.id.catalogue_grid) {
|
if (parent.id == R.id.catalogue_grid) {
|
||||||
val v = parent.inflate(R.layout.item_catalogue_grid)
|
val view = parent.inflate(R.layout.item_catalogue_grid).apply {
|
||||||
v.image_container.layoutParams = RelativeLayout.LayoutParams(MATCH_PARENT, coverHeight)
|
card.layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, coverHeight)
|
||||||
return CatalogueGridHolder(v, this, fragment)
|
gradient.layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, coverHeight / 2, Gravity.BOTTOM)
|
||||||
|
}
|
||||||
|
return CatalogueGridHolder(view, this, fragment)
|
||||||
} else {
|
} else {
|
||||||
val v = parent.inflate(R.layout.item_catalogue_list)
|
val view = parent.inflate(R.layout.item_catalogue_list)
|
||||||
return CatalogueListHolder(v, this, fragment)
|
return CatalogueListHolder(view, this, fragment)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package eu.kanade.tachiyomi.ui.library
|
package eu.kanade.tachiyomi.ui.library
|
||||||
|
|
||||||
|
import android.view.Gravity
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
|
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
import android.widget.RelativeLayout
|
import android.widget.FrameLayout
|
||||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
@ -83,8 +84,10 @@ class LibraryCategoryAdapter(val fragment: LibraryCategoryFragment) :
|
|||||||
* @return a new view holder for a manga.
|
* @return a new view holder for a manga.
|
||||||
*/
|
*/
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): LibraryHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): LibraryHolder {
|
||||||
val view = parent.inflate(R.layout.item_catalogue_grid)
|
val view = parent.inflate(R.layout.item_catalogue_grid).apply {
|
||||||
view.image_container.layoutParams = RelativeLayout.LayoutParams(MATCH_PARENT, coverHeight)
|
card.layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, coverHeight)
|
||||||
|
gradient.layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, coverHeight / 2, Gravity.BOTTOM)
|
||||||
|
}
|
||||||
return LibraryHolder(view, this, fragment)
|
return LibraryHolder(view, this, fragment)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class LibraryHolder(private val view: View, private val adapter: LibraryCategory
|
|||||||
view.title.text = manga.title
|
view.title.text = manga.title
|
||||||
|
|
||||||
// Update the unread count and its visibility.
|
// Update the unread count and its visibility.
|
||||||
with(view.unreadText) {
|
with(view.unread_text) {
|
||||||
visibility = if (manga.unread > 0) View.VISIBLE else View.GONE
|
visibility = if (manga.unread > 0) View.VISIBLE else View.GONE
|
||||||
text = manga.unread.toString()
|
text = manga.unread.toString()
|
||||||
}
|
}
|
||||||
|
@ -7,15 +7,11 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectable_list_drawable">
|
android:background="?attr/selectable_list_drawable">
|
||||||
|
|
||||||
<RelativeLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@drawable/card_background">
|
|
||||||
|
|
||||||
<android.support.percent.PercentFrameLayout
|
|
||||||
android:id="@+id/image_container"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="220dp">
|
android:layout_height="220dp"
|
||||||
|
android:id="@+id/card"
|
||||||
|
android:background="@drawable/card_background">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/thumbnail"
|
android:id="@+id/thumbnail"
|
||||||
@ -23,24 +19,20 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?android:attr/colorBackground"
|
android:background="?android:attr/colorBackground"
|
||||||
tools:background="?android:attr/colorBackground"
|
tools:background="?android:attr/colorBackground"
|
||||||
tools:src="@mipmap/ic_launcher"/>
|
tools:src="@mipmap/ic_launcher" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
|
android:id="@+id/gradient"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:background="@drawable/gradient_shape"
|
android:background="@drawable/gradient_shape" />
|
||||||
app:layout_heightPercent="50%"/>
|
|
||||||
|
|
||||||
|
|
||||||
</android.support.percent.PercentFrameLayout>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/unreadText"
|
android:id="@+id/unread_text"
|
||||||
style="@style/TextAppearance.Regular.Caption.Light"
|
style="@style/TextAppearance.Regular.Caption.Light"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="end"
|
|
||||||
android:background="?attr/colorAccent"
|
android:background="?attr/colorAccent"
|
||||||
android:paddingBottom="1dp"
|
android:paddingBottom="1dp"
|
||||||
android:paddingLeft="3dp"
|
android:paddingLeft="3dp"
|
||||||
@ -54,8 +46,7 @@
|
|||||||
app:typeface="ptsansNarrowBold"
|
app:typeface="ptsansNarrowBold"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignBottom="@+id/image_container"
|
android:layout_gravity="bottom"
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:lineSpacingExtra="-4dp"
|
android:lineSpacingExtra="-4dp"
|
||||||
android:maxLines="2"
|
android:maxLines="2"
|
||||||
@ -66,6 +57,6 @@
|
|||||||
android:shadowRadius="4"
|
android:shadowRadius="4"
|
||||||
tools:text="Sample name"/>
|
tools:text="Sample name"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
Loading…
Reference in New Issue
Block a user