mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 03:21:51 +01: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:recyclerview-v7:$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-v14:$SUPPORT_LIBRARY_VERSION"
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
package eu.kanade.tachiyomi.ui.catalogue
|
||||
|
||||
import android.view.Gravity
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
|
||||
import android.widget.RelativeLayout
|
||||
import android.widget.FrameLayout
|
||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||
import eu.kanade.tachiyomi.R
|
||||
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 {
|
||||
if (parent.id == R.id.catalogue_grid) {
|
||||
val v = parent.inflate(R.layout.item_catalogue_grid)
|
||||
v.image_container.layoutParams = RelativeLayout.LayoutParams(MATCH_PARENT, coverHeight)
|
||||
return CatalogueGridHolder(v, this, fragment)
|
||||
val view = parent.inflate(R.layout.item_catalogue_grid).apply {
|
||||
card.layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, coverHeight)
|
||||
gradient.layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, coverHeight / 2, Gravity.BOTTOM)
|
||||
}
|
||||
return CatalogueGridHolder(view, this, fragment)
|
||||
} else {
|
||||
val v = parent.inflate(R.layout.item_catalogue_list)
|
||||
return CatalogueListHolder(v, this, fragment)
|
||||
val view = parent.inflate(R.layout.item_catalogue_list)
|
||||
return CatalogueListHolder(view, this, fragment)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
package eu.kanade.tachiyomi.ui.library
|
||||
|
||||
import android.view.Gravity
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
|
||||
import android.widget.RelativeLayout
|
||||
import android.widget.FrameLayout
|
||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||
import eu.kanade.tachiyomi.R
|
||||
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.
|
||||
*/
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): LibraryHolder {
|
||||
val view = parent.inflate(R.layout.item_catalogue_grid)
|
||||
view.image_container.layoutParams = RelativeLayout.LayoutParams(MATCH_PARENT, coverHeight)
|
||||
val view = parent.inflate(R.layout.item_catalogue_grid).apply {
|
||||
card.layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, coverHeight)
|
||||
gradient.layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, coverHeight / 2, Gravity.BOTTOM)
|
||||
}
|
||||
return LibraryHolder(view, this, fragment)
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ class LibraryHolder(private val view: View, private val adapter: LibraryCategory
|
||||
view.title.text = manga.title
|
||||
|
||||
// Update the unread count and its visibility.
|
||||
with(view.unreadText) {
|
||||
with(view.unread_text) {
|
||||
visibility = if (manga.unread > 0) View.VISIBLE else View.GONE
|
||||
text = manga.unread.toString()
|
||||
}
|
||||
|
@ -7,40 +7,32 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectable_list_drawable">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="220dp"
|
||||
android:id="@+id/card"
|
||||
android:background="@drawable/card_background">
|
||||
|
||||
<android.support.percent.PercentFrameLayout
|
||||
android:id="@+id/image_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="220dp">
|
||||
<ImageView
|
||||
android:id="@+id/thumbnail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:attr/colorBackground"
|
||||
tools:background="?android:attr/colorBackground"
|
||||
tools:src="@mipmap/ic_launcher" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/thumbnail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:attr/colorBackground"
|
||||
tools:background="?android:attr/colorBackground"
|
||||
tools:src="@mipmap/ic_launcher"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@drawable/gradient_shape"
|
||||
app:layout_heightPercent="50%"/>
|
||||
|
||||
|
||||
</android.support.percent.PercentFrameLayout>
|
||||
<View
|
||||
android:id="@+id/gradient"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@drawable/gradient_shape" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/unreadText"
|
||||
android:id="@+id/unread_text"
|
||||
style="@style/TextAppearance.Regular.Caption.Light"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:background="?attr/colorAccent"
|
||||
android:paddingBottom="1dp"
|
||||
android:paddingLeft="3dp"
|
||||
@ -54,8 +46,7 @@
|
||||
app:typeface="ptsansNarrowBold"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/image_container"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_gravity="bottom"
|
||||
android:ellipsize="end"
|
||||
android:lineSpacingExtra="-4dp"
|
||||
android:maxLines="2"
|
||||
@ -66,6 +57,6 @@
|
||||
android:shadowRadius="4"
|
||||
tools:text="Sample name"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
||||
|
||||
</FrameLayout>
|
Loading…
Reference in New Issue
Block a user