For #9140: Remove drawable from title in empty state panes
parent
5ed131969a
commit
756b1fbadd
|
@ -77,13 +77,11 @@ sealed class AdapterItem(@LayoutRes val viewType: Int) {
|
|||
|
||||
object PrivateBrowsingDescription : AdapterItem(PrivateBrowsingDescriptionViewHolder.LAYOUT_ID)
|
||||
data class NoContentMessage(
|
||||
@DrawableRes val icon: Int,
|
||||
@StringRes val header: Int,
|
||||
@StringRes val description: Int
|
||||
) : AdapterItem(NoContentMessageViewHolder.LAYOUT_ID)
|
||||
|
||||
data class NoContentMessageWithAction(
|
||||
@DrawableRes val icon: Int,
|
||||
@StringRes val header: Int,
|
||||
@StringRes val description: Int,
|
||||
@DrawableRes val buttonIcon: Int = 0,
|
||||
|
@ -208,12 +206,12 @@ class SessionControlAdapter(
|
|||
}
|
||||
is NoContentMessageWithActionViewHolder -> {
|
||||
val listener = { interactor.onOpenNewTabClicked() }
|
||||
val (icon, header, description, buttonIcon, buttonText) = item as AdapterItem.NoContentMessageWithAction
|
||||
holder.bind(icon, header, description, buttonIcon, buttonText, listener)
|
||||
val (header, description, buttonIcon, buttonText) = item as AdapterItem.NoContentMessageWithAction
|
||||
holder.bind(header, description, buttonIcon, buttonText, listener)
|
||||
}
|
||||
is NoContentMessageViewHolder -> {
|
||||
val (icon, header, description) = item as AdapterItem.NoContentMessage
|
||||
holder.bind(icon, header, description)
|
||||
val (header, description) = item as AdapterItem.NoContentMessage
|
||||
holder.bind(header, description)
|
||||
}
|
||||
is CollectionViewHolder -> {
|
||||
val (collection, expanded, sessionHasOpenTabs) = item as AdapterItem.CollectionItem
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.mozilla.fenix.home.OnboardingState
|
|||
import org.mozilla.fenix.home.Tab
|
||||
|
||||
val noTabMessage = AdapterItem.NoContentMessageWithAction(
|
||||
R.drawable.ic_tabs,
|
||||
R.string.no_open_tabs_header_2,
|
||||
R.string.no_open_tabs_description,
|
||||
R.drawable.ic_new,
|
||||
|
@ -32,7 +31,6 @@ val noTabMessage = AdapterItem.NoContentMessageWithAction(
|
|||
)
|
||||
|
||||
val noCollectionMessage = AdapterItem.NoContentMessage(
|
||||
R.drawable.ic_tab_collection,
|
||||
R.string.no_collections_header,
|
||||
R.string.collections_description
|
||||
)
|
||||
|
|
|
@ -5,22 +5,18 @@
|
|||
package org.mozilla.fenix.home.sessioncontrol.viewholders
|
||||
|
||||
import android.view.View
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import kotlinx.android.synthetic.main.no_content_message.view.*
|
||||
import mozilla.components.support.ktx.android.view.putCompoundDrawablesRelativeWithIntrinsicBounds
|
||||
import org.mozilla.fenix.R
|
||||
|
||||
open class NoContentMessageViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
|
||||
|
||||
fun bind(
|
||||
@DrawableRes icon: Int,
|
||||
@StringRes header: Int,
|
||||
@StringRes description: Int
|
||||
) {
|
||||
with(view.context) {
|
||||
view.no_content_header.putCompoundDrawablesRelativeWithIntrinsicBounds(end = getDrawable(icon))
|
||||
view.no_content_header.text = getString(header)
|
||||
view.no_content_description.text = getString(description)
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ class NoContentMessageWithActionViewHolder(
|
|||
) : NoContentMessageViewHolder(view) {
|
||||
|
||||
/**
|
||||
* @param icon The visible label for header text this menu item.
|
||||
* @param header ID of string resource for title text.
|
||||
* @param description ID of string resource for description text.
|
||||
* @param buttonIcon Optional ID of drawable resource for button icon.
|
||||
|
@ -25,14 +24,13 @@ class NoContentMessageWithActionViewHolder(
|
|||
*/
|
||||
@Suppress("LongParameterList")
|
||||
fun bind(
|
||||
@DrawableRes icon: Int,
|
||||
@StringRes header: Int,
|
||||
@StringRes description: Int,
|
||||
@DrawableRes buttonIcon: Int = 0,
|
||||
@StringRes buttonText: Int = 0,
|
||||
listener: (() -> Unit)? = null
|
||||
) {
|
||||
super.bind(icon, header, description)
|
||||
super.bind(header, description)
|
||||
with(view.context) {
|
||||
|
||||
if (buttonIcon != 0 || buttonText != 0) {
|
||||
|
|
|
@ -18,10 +18,7 @@
|
|||
android:id="@+id/no_content_header"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:drawableTint="?primaryText"
|
||||
android:drawablePadding="8dp"
|
||||
tools:text="@tools:sample/lorem"
|
||||
tools:drawableEnd="@drawable/ic_tab_collection"
|
||||
android:textAppearance="@style/HeaderTextStyle"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
|
|
@ -18,11 +18,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:drawablePadding="8dp"
|
||||
android:textAppearance="@style/HeaderTextStyle"
|
||||
android:textSize="16sp"
|
||||
app:drawableTint="?primaryText"
|
||||
tools:drawableEnd="@drawable/ic_tabs"
|
||||
tools:text="@tools:sample/lorem" />
|
||||
|
||||
<TextView
|
||||
|
|
Loading…
Reference in New Issue