Fixes full height cards problem.
This commit is contained in:
parent
95d64dc5e8
commit
07e545079c
@ -52,7 +52,7 @@ class ItemCardAdapter(private val app: Activity,
|
|||||||
private val generator: ColorGenerator = ColorGenerator.MATERIAL
|
private val generator: ColorGenerator = ColorGenerator.MATERIAL
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
val v = LayoutInflater.from(c).inflate(R.layout.card_item, parent, false) as ConstraintLayout
|
val v = LayoutInflater.from(c).inflate(R.layout.card_item, parent, false) as CardView
|
||||||
return ViewHolder(v)
|
return ViewHolder(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,15 +68,10 @@ class ItemCardAdapter(private val app: Activity,
|
|||||||
if (itm.getThumbnail(c).isEmpty()) {
|
if (itm.getThumbnail(c).isEmpty()) {
|
||||||
Glide.with(c).clear(holder.itemImage)
|
Glide.with(c).clear(holder.itemImage)
|
||||||
holder.itemImage.setImageDrawable(null)
|
holder.itemImage.setImageDrawable(null)
|
||||||
} else {
|
|
||||||
if (fullHeightCards) {
|
|
||||||
c.bitmapFitCenter(itm.getThumbnail(c), holder.itemImage)
|
|
||||||
} else {
|
} else {
|
||||||
c.bitmapCenterCrop(itm.getThumbnail(c), holder.itemImage)
|
c.bitmapCenterCrop(itm.getThumbnail(c), holder.itemImage)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
val fHolder = holder
|
|
||||||
if (itm.getIcon(c).isEmpty()) {
|
if (itm.getIcon(c).isEmpty()) {
|
||||||
val color = generator.getColor(itm.sourcetitle)
|
val color = generator.getColor(itm.sourcetitle)
|
||||||
|
|
||||||
@ -163,7 +158,7 @@ class ItemCardAdapter(private val app: Activity,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class ViewHolder(val mView: ConstraintLayout) : RecyclerView.ViewHolder(mView) {
|
inner class ViewHolder(val mView: CardView) : RecyclerView.ViewHolder(mView) {
|
||||||
lateinit var saveBtn: LikeButton
|
lateinit var saveBtn: LikeButton
|
||||||
lateinit var browserBtn: ImageButton
|
lateinit var browserBtn: ImageButton
|
||||||
lateinit var shareBtn: ImageButton
|
lateinit var shareBtn: ImageButton
|
||||||
@ -173,7 +168,7 @@ class ItemCardAdapter(private val app: Activity,
|
|||||||
lateinit var sourceTitleAndDate: TextView
|
lateinit var sourceTitleAndDate: TextView
|
||||||
|
|
||||||
init {
|
init {
|
||||||
(mView.findViewById<CardView>(R.id.card)).setCardBackgroundColor(appColors.cardBackground)
|
mView.setCardBackgroundColor(appColors.cardBackground)
|
||||||
handleClickListeners()
|
handleClickListeners()
|
||||||
handleCustomTabActions()
|
handleCustomTabActions()
|
||||||
}
|
}
|
||||||
|
@ -1,65 +1,58 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<android.support.v7.widget.CardView
|
<android.support.v7.widget.CardView
|
||||||
android:id="@+id/card"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="0dp"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
android:id="@+id/card"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
app:layout_constraintHorizontal_bias="0.62"
|
app:layout_constraintHorizontal_bias="0.62"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
card_view:cardElevation="2dp"
|
card_view:cardElevation="2dp"
|
||||||
card_view:cardUseCompatPadding="true"
|
card_view:cardUseCompatPadding="true"
|
||||||
android:layout_height="wrap_content"
|
card_view:layout_constraintBottom_toBottomOf="parent">
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:layout_marginLeft="8dp"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
android:layout_marginRight="8dp">
|
|
||||||
|
|
||||||
<android.support.constraint.ConstraintLayout
|
<android.support.constraint.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/itemImage"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:srcCompat="@drawable/background_splash"
|
|
||||||
android:id="@+id/itemImage"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:cropToPadding="true"
|
android:cropToPadding="true"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
android:layout_marginTop="0dp"
|
|
||||||
android:layout_marginRight="0dp"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
android:layout_marginLeft="0dp"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent" />
|
app:srcCompat="@drawable/background_splash"
|
||||||
|
card_view:layout_constraintBottom_toTopOf="@+id/constraintLayout" />
|
||||||
|
|
||||||
<android.support.constraint.ConstraintLayout
|
<android.support.constraint.ConstraintLayout
|
||||||
|
android:id="@+id/constraintLayout"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/itemImage"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
>
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/itemImage">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_height="40dp"
|
|
||||||
app:srcCompat="@drawable/background_splash"
|
|
||||||
android:id="@+id/sourceImage"
|
android:id="@+id/sourceImage"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
android:layout_width="40dp"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_height="40dp"
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
android:layout_marginStart="8dp"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:layout_width="40dp" />
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:srcCompat="@drawable/background_splash" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
@ -79,40 +72,40 @@
|
|||||||
tools:text="Titre" />
|
tools:text="Titre" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/sourceTitleAndDate"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/sourceTitleAndDate"
|
|
||||||
android:textSize="14sp"
|
|
||||||
tools:text="Google Actualité Il y a 5h"
|
|
||||||
android:textAlignment="viewStart"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/title"
|
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
|
android:gravity="start"
|
||||||
|
android:textAlignment="viewStart"
|
||||||
|
android:textSize="14sp"
|
||||||
app:layout_constraintLeft_toLeftOf="@+id/title"
|
app:layout_constraintLeft_toLeftOf="@+id/title"
|
||||||
android:gravity="start" />
|
app:layout_constraintTop_toBottomOf="@+id/title"
|
||||||
|
tools:text="Google Actualité Il y a 5h" />
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/sourceTitleAndDate"
|
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent">
|
app:layout_constraintTop_toBottomOf="@+id/sourceTitleAndDate">
|
||||||
|
|
||||||
<com.like.LikeButton
|
<com.like.LikeButton
|
||||||
app:icon_type="heart"
|
|
||||||
app:icon_size="22dp"
|
|
||||||
android:id="@+id/favButton"
|
android:id="@+id/favButton"
|
||||||
android:layout_width="35dp"
|
android:layout_width="35dp"
|
||||||
android:layout_height="35dp"
|
android:layout_height="35dp"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_marginEnd="8dp"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_marginRight="8dp"
|
||||||
android:elevation="5dp"
|
android:elevation="5dp"
|
||||||
android:padding="4dp"
|
android:padding="4dp"
|
||||||
android:layout_marginRight="8dp"
|
app:icon_size="22dp"
|
||||||
android:layout_marginEnd="8dp"/>
|
app:icon_type="heart" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/shareBtn"
|
android:id="@+id/shareBtn"
|
||||||
@ -154,4 +147,3 @@
|
|||||||
</android.support.constraint.ConstraintLayout>
|
</android.support.constraint.ConstraintLayout>
|
||||||
|
|
||||||
</android.support.v7.widget.CardView>
|
</android.support.v7.widget.CardView>
|
||||||
</android.support.constraint.ConstraintLayout>
|
|
Loading…
Reference in New Issue
Block a user