Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Following classes should be used to place buttons in the app:
* `com.telefonica.mistica.Button` --> Simple button with primary style applied by default
* `com.telefonica.mistica.ProgressButton` --> In case of the need of a loading state (a button with progress), this one can be used to show an spinner (with an optional loading text) with an animation. `app:isLoading` attribute can be used in order to set it as loading on xml layouts, also with databinding.
* `com.telefonica.mistica.ProgressButton` --> In case of the need of a loading state (a button with progress), this one can be used to show a spinner (with an optional loading text) with an animation. `app:isLoading` attribute can be used to set it as loading in XML layouts.

Buttons are based on material components, so all material functionalities are applicable on them.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class Button @JvmOverloads constructor(
onClick = { listener?.onClick(this) }
}

fun setButtonOnClick(action: (() -> Unit)?) {
onClick = { action?.invoke() }
}

fun updateLoadingText(text: String) {
loadingText = text
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,85 +17,11 @@ import androidx.annotation.DrawableRes
import androidx.annotation.IntDef
import androidx.appcompat.content.res.AppCompatResources
import androidx.core.view.ViewCompat
import androidx.databinding.BindingMethod
import androidx.databinding.BindingMethods
import com.google.android.material.imageview.ShapeableImageView
import com.telefonica.mistica.R
import com.telefonica.mistica.button.Button
import com.telefonica.mistica.util.getThemeColor

@BindingMethods(
BindingMethod(
type = CalloutView::class,
attribute = "calloutTitle",
method = "setTitle",
),
BindingMethod(
type = CalloutView::class,
attribute = "calloutTitleAsHeading",
method = "setTitleAsHeading",
),
BindingMethod(
type = CalloutView::class,
attribute = "calloutDescription",
method = "setDescription",
),
BindingMethod(
type = CalloutView::class,
attribute = "calloutAsset",
method = "setAsset",
),
BindingMethod(
type = CalloutView::class,
attribute = "calloutAssetType",
method = "setAssetType",
),
BindingMethod(
type = CalloutView::class,
attribute = "calloutButtonsConfig",
method = "setButtonsConfig",
),
BindingMethod(
type = CalloutView::class,
attribute = "calloutPrimaryButtonText",
method = "setPrimaryButtonText",
),
BindingMethod(
type = CalloutView::class,
attribute = "calloutPrimaryButtonOnClick",
method = "setPrimaryButtonOnClick",
),
BindingMethod(
type = CalloutView::class,
attribute = "calloutSecondaryButtonText",
method = "setSecondaryButtonText",
),
BindingMethod(
type = CalloutView::class,
attribute = "calloutSecondaryButtonOnClick",
method = "setSecondaryButtonOnClick",
),
BindingMethod(
type = CalloutView::class,
attribute = "calloutLinkButtonText",
method = "setLinkButtonText",
),
BindingMethod(
type = CalloutView::class,
attribute = "calloutLinkButtonOnClick",
method = "setLinkButtonOnClick",
),
BindingMethod(
type = CalloutView::class,
attribute = "calloutDismissable",
method = "setDismissable",
),
BindingMethod(
type = CalloutView::class,
attribute = "calloutOnDismiss",
method = "setOnDismiss",
),
)
class CalloutView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<img src="../../../../../../../../doc/images/callout/callout_3.gif" />
</p>

Implemented as a custom view, `com.telefonica.mistica.callout.CalloutView` can be used inside any layout like a regular view. It supports both **attribute
configuration and databinding for all properties**.
Implemented as a custom view, `com.telefonica.mistica.callout.CalloutView` can be used inside any layout like a regular view. It supports **attribute-based
configuration for all properties**.

```xml
<declare-styleable name="CalloutView">
Expand Down
54 changes: 0 additions & 54 deletions library/src/main/java/com/telefonica/mistica/card/CardView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,65 +11,11 @@ import androidx.annotation.StringRes
import androidx.appcompat.content.res.AppCompatResources
import androidx.cardview.widget.CardView
import androidx.core.content.res.ResourcesCompat
import androidx.databinding.BindingMethod
import androidx.databinding.BindingMethods
import com.telefonica.mistica.R
import com.telefonica.mistica.tag.TagStyle
import com.telefonica.mistica.tag.TagView
import com.telefonica.mistica.util.getDimension

@BindingMethods(
BindingMethod(
type = CardView::class,
attribute = "cardTag",
method = "setTag"
),
BindingMethod(
type = CardView::class,
attribute = "cardTagColor",
method = "setTagColor"
),
BindingMethod(
type = CardView::class,
attribute = "cardTitle",
method = "setTitle"
),
BindingMethod(
type = CardView::class,
attribute = "cardTitleMaxLines",
method = "setTitleMaxLines"
),
BindingMethod(
type = CardView::class,
attribute = "cardDescription",
method = "setDescription"
),
BindingMethod(
type = CardView::class,
attribute = "cardDescriptionMaxLines",
method = "setDescriptionMaxLines"
),
BindingMethod(
type = CardView::class,
attribute = "cardPrimaryButtonText",
method = "setPrimaryButtonText"
),
BindingMethod(
type = CardView::class,
attribute = "cardLinkButtonText",
method = "setLinkButtonText"
),
BindingMethod(
type = CardView::class,
attribute = "cardPrimaryButtonOnClick",
method = "setPrimaryButtonOnClick"
),
BindingMethod(
type = CardView::class,
attribute = "cardLinkButtonOnClick",
method = "setLinkButtonOnClick"
)
)
abstract class CardView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import androidx.annotation.DrawableRes
import androidx.annotation.IntDef
import androidx.annotation.StringRes
import androidx.appcompat.content.res.AppCompatResources
import androidx.databinding.BindingMethod
import androidx.databinding.BindingMethods
import com.telefonica.mistica.R
import com.telefonica.mistica.card.CardView
import com.telefonica.mistica.card.datacard.DataCardView.IconType.Companion.TYPE_CIRCULAR_ICON
Expand All @@ -22,23 +20,6 @@ import com.telefonica.mistica.card.datacard.DataCardView.IconType.Companion.TYPE
import com.telefonica.mistica.card.datacard.DataCardView.IconType.Companion.TYPE_SQUARE_IMAGE
import com.telefonica.mistica.util.convertDpToPx

@BindingMethods(
BindingMethod(
type = DataCardView::class,
attribute = "cardIcon",
method = "setIcon"
),
BindingMethod(
type = DataCardView::class,
attribute = "cardIconType",
method = "setIconType"
),
BindingMethod(
type = DataCardView::class,
attribute = "cardSubtitle",
method = "setSubtitle"
)
)
class DataCardView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</p>

Data cards require a minimum content of a **title, description and a link button.**
Implemented as a custom view, `com.telefonica.mistica.card.datacard.DataCardView` can be used inside any layout like a regular view. It supports both **attribute configuration and databinding for all properties**.
Implemented as a custom view, `com.telefonica.mistica.card.datacard.DataCardView` can be used inside any layout like a regular view. It supports **attribute-based configuration for all properties**.

```xml
<declare-styleable name="CardView">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,11 @@ import android.widget.ImageView
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import androidx.appcompat.content.res.AppCompatResources
import androidx.databinding.BindingMethod
import androidx.databinding.BindingMethods
import com.telefonica.mistica.R
import com.telefonica.mistica.card.CardView
import com.telefonica.mistica.util.hide
import com.telefonica.mistica.util.show

@BindingMethods(
BindingMethod(
type = MediaCardView::class,
attribute = "mediaCardImageDrawable",
method = "setImageDrawable"
),
BindingMethod(
type = MediaCardView::class,
attribute = "cardPretitle",
method = "setPretitle"
),
BindingMethod(
type = MediaCardView::class,
attribute = "cardImageContentDescription",
method = "setCardImageContentDescription"
)
)
class MediaCardView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,74 +14,10 @@ import android.widget.TextView
import androidx.annotation.DrawableRes
import androidx.annotation.IntDef
import androidx.appcompat.content.res.AppCompatResources
import androidx.databinding.BindingMethod
import androidx.databinding.BindingMethods
import com.telefonica.mistica.R
import com.telefonica.mistica.button.ProgressButton
import com.telefonica.mistica.util.convertDpToPx

@BindingMethods(
BindingMethod(
type = EmptyStateCardView::class,
attribute = "emptyStateCardImage",
method = "setImage"
),
BindingMethod(
type = EmptyStateCardView::class,
attribute = "emptyStateCardImageContentDescription",
method = "setImageContentDescription"
),
BindingMethod(
type = EmptyStateCardView::class,
attribute = "emptyStateCardTitle",
method = "setTitle"
),
BindingMethod(
type = EmptyStateCardView::class,
attribute = "emptyStateCardSubtitle",
method = "setSubtitle"
),
BindingMethod(
type = EmptyStateCardView::class,
attribute = "emptyStateCardButtonsConfig",
method = "setButtonsConfig"
),
BindingMethod(
type = EmptyStateCardView::class,
attribute = "emptyStateCardPrimaryButtonText",
method = "setPrimaryButtonText"
),
BindingMethod(
type = EmptyStateCardView::class,
attribute = "emptyStateCardPrimaryButtonOnClick",
method = "setPrimaryButtonOnClick"
),
BindingMethod(
type = EmptyStateCardView::class,
attribute = "emptyStateCardSecondaryButtonText",
method = "setSecondaryButtonText"
),
BindingMethod(
type = EmptyStateCardView::class,
attribute = "emptyStateCardSecondaryButtonOnClick",
method = "setSecondaryButtonOnClick"
),
BindingMethod(
type = EmptyStateCardView::class,
attribute = "emptyStateCardLinkButtonText",
method = "setLinkButtonText"
),
BindingMethod(
type = EmptyStateCardView::class,
attribute = "emptyStateCardLinkButtonOnClick",
method = "setLinkButtonOnClick"
),
BindingMethod(
type = EmptyStateCardView::class,
attribute = "emptyStateCardImageSize",
method = "setImageSize"
),
)
class EmptyStateCardView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ Implemented as a custom view,
`com.telefonica.mistica.emptystate.card.EmptyStateCardView` can be used
inside any layout like a regular view.

It supports both **attribute
configuration and databinding for all properties**.
It supports **attribute-based configuration for all properties**.

```xml
<declare-styleable name="EmptyStateCardView">
Expand Down
Loading
Loading