Skip to content
Open
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,13 @@ import android.util.AttributeSet
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.View.OnClickListener
import android.widget.LinearLayout
import android.widget.TextView
import androidx.annotation.StringRes
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 = LoadErrorFeedbackView::class,
attribute = "loadErrorFeedbackTitle",
method = "setTitle"
),
BindingMethod(
type = LoadErrorFeedbackView::class,
attribute = "loadErrorFeedbackDescription",
method = "setDescription"
),
BindingMethod(
type = LoadErrorFeedbackView::class,
attribute = "loadErrorFeedbackIsLoading",
method = "setIsLoading"
),
BindingMethod(
type = LoadErrorFeedbackView::class,
attribute = "loadErrorFeedbackButtonOnClick",
method = "setButtonOnClick"
),
BindingMethod(
type = LoadErrorFeedbackView::class,
attribute = "loadErrorFeedbackButtonText",
method = "setButtonText"
),
BindingMethod(
type = LoadErrorFeedbackView::class,
attribute = "loadErrorFeedbackIsButtonVisible",
method = "setIsButtonVisible"
)
)
class LoadErrorFeedbackView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<img width="50%" src="../../../../../../../../../doc/images/load_feedback_error/load_feedback_error.png" />
</p>

Implemented as a custom view, `com.telefonica.mistica.feedback.error.LoadErrorFeedbackView` 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.feedback.error.LoadErrorFeedbackView` can be used inside any layout like a regular view. It supports **attribute-based configuration for all properties**.

```xml
<declare-styleable name="LoadErrorFeedback">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

It can be used inside any layout like a regular view. When adding it to the view hierarchy, entry animations will be performed.

In order to configure it for the specific purpose, it supports both **attribute configuration and databinding for all properties**
In order to configure it for the specific purpose, it supports **attribute-based configuration for all properties**.

## Available fields

Expand Down
114 changes: 30 additions & 84 deletions library/src/main/java/com/telefonica/mistica/header/HeaderView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,97 +15,13 @@ import androidx.annotation.ColorInt
import androidx.annotation.LayoutRes
import androidx.annotation.StringRes
import androidx.core.graphics.drawable.toDrawable
import androidx.databinding.BindingMethod
import androidx.databinding.BindingMethods
import com.telefonica.mistica.R
import com.telefonica.mistica.util.children
import com.telefonica.mistica.util.convertDpToPx
import com.telefonica.mistica.util.getMisticaThemeDrawable
import com.telefonica.mistica.util.getThemeColor
import com.telefonica.mistica.util.setTextAndVisibility

@BindingMethods(
BindingMethod(
type = HeaderView::class,
attribute = "headerInverse",
method = "setInverse"
),
BindingMethod(
type = HeaderView::class,
attribute = "headerHasTopPadding",
method = "setHasTopPadding"
),
BindingMethod(
type = HeaderView::class,
attribute = "headerFirstPretitle",
method = "setFirstPretitle"
),
BindingMethod(
type = HeaderView::class,
attribute = "headerFirstPretitleHasSecondaryColor",
method = "setFirstPretitleHasSecondaryColor"
),
BindingMethod(
type = HeaderView::class,
attribute = "headerTitle",
method = "setTitle"
),
BindingMethod(
type = HeaderView::class,
attribute = "headerSecondPretitle",
method = "setSecondPretitle"
),
BindingMethod(
type = HeaderView::class,
attribute = "headerSecondPretitleHasSecondaryColor",
method = "setSecondPretitleHasSecondaryColor"
),
BindingMethod(
type = HeaderView::class,
attribute = "headerNumeral",
method = "setNumeral"
),
BindingMethod(
type = HeaderView::class,
attribute = "headerNumeralHasErrorColor",
method = "setNumeralHasDangerColor"
),
BindingMethod(
type = HeaderView::class,
attribute = "headerActionButtonText",
method = "setActionButtonText"
),
BindingMethod(
type = HeaderView::class,
attribute = "headerSecondaryActionButtonText",
method = "setSecondaryActionButtonText"
),
BindingMethod(
type = HeaderView::class,
attribute = "headerActionButtonOnClick",
method = "setActionButtonOnClick"
),
BindingMethod(
type = HeaderView::class,
attribute = "headerSecondaryActionButtonOnClick",
method = "setSecondaryActionButtonOnClick"
),
BindingMethod(
type = HeaderView::class,
attribute = "headerSubtitle",
method = "setHeaderSubtitle"
),
BindingMethod(
type = HeaderView::class,
attribute = "headerSubtitleHasSecondaryColor",
method = "setSubtitleHasSecondaryColor"
),
BindingMethod(
type = HeaderView::class,
attribute = "bottomLayout",
method = "setBottomLayout"
),
)
class HeaderView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
Expand Down Expand Up @@ -319,6 +235,36 @@ class HeaderView @JvmOverloads constructor(
configureTextsColors()
}

fun setHeaderFirstPretitle(@StringRes textRes: Int?) = setFirstPretitle(textRes)
fun setHeaderTitle(text: CharSequence?) = setTitle(text)

fun setHeaderInverse(value: Boolean) = setInverse(value)
fun setHeaderHasTopPadding(value: Boolean) = setHasTopPadding(value)

fun setHeaderFirstPretitle(text: CharSequence?) = setFirstPretitle(text)
Comment on lines +238 to +244
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate method definition for setHeaderFirstPretitle. Line 238 accepts @stringres Int? while line 244 accepts CharSequence?. This creates a naming collision that will cause compilation errors.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently these methods do not launch any compilation errors due to signature is different.

fun setHeaderFirstPretitleHasSecondaryColor(value: Boolean) =
setFirstPretitleHasSecondaryColor(value)

fun setHeaderSecondPretitle(text: CharSequence?) = setSecondPretitle(text)
fun setHeaderSecondPretitleHasSecondaryColor(value: Boolean) =
setSecondPretitleHasSecondaryColor(value)

fun setHeaderNumeral(text: CharSequence?) = setNumeral(text)
fun setHeaderNumeralHasErrorColor(value: Boolean) = setNumeralHasDangerColor(value)

fun setHeaderSubtitle(text: CharSequence?) = setSubtitle(text)
fun setHeaderSubtitleHasSecondaryColor(value: Boolean) = setSubtitleHasSecondaryColor(value)

fun setHeaderActionButtonText(text: CharSequence?) = setActionButtonText(text)
fun setHeaderSecondaryActionButtonText(text: CharSequence?) = setSecondaryActionButtonText(text)
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line exceeds 120 characters. Consider breaking this line for better readability.

Suggested change
fun setHeaderSecondaryActionButtonText(text: CharSequence?) = setSecondaryActionButtonText(text)
fun setHeaderSecondaryActionButtonText(text: CharSequence?) =
setSecondaryActionButtonText(text)

Copilot uses AI. Check for mistakes.

fun setHeaderActionButtonOnClick(listener: OnClickListener?) = setActionButtonOnClick(listener)
fun setHeaderSecondaryActionButtonOnClick(listener: OnClickListener?) =
setSecondaryActionButtonOnClick(listener)

fun setHeaderBottomLayout(@LayoutRes layoutRes: Int) = setBottomLayout(layoutRes)


private fun configureTextsColors() {
val backgroundDrawable = if (isInverse) {
context.getMisticaThemeDrawable(R.attr.drawableBackgroundBrand)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<img src="../../../../../../../../doc/images/headers/headers_2.png" />
</p>

Implemented as a custom view, `com.telefonica.mistica.header.HeaderView` 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.header.HeaderView` can be used inside any layout like a regular view. It supports **attribute-based configuration for all properties**.

```xml
<declare-styleable name="HeaderView">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,84 +23,15 @@ import androidx.annotation.IntDef
import androidx.annotation.StringRes
import androidx.appcompat.content.res.AppCompatResources
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.graphics.createBitmap
import androidx.core.graphics.drawable.toDrawable
import androidx.databinding.BindingMethod
import androidx.databinding.BindingMethods
import com.telefonica.mistica.R
import com.telefonica.mistica.util.getDimension
import com.telefonica.mistica.util.getMisticaThemeDrawableBuilder
import com.telefonica.mistica.util.getThemeColor
import com.telefonica.mistica.util.hide
import com.telefonica.mistica.util.show
import androidx.core.graphics.createBitmap

@BindingMethods(
BindingMethod(
type = HighlightedCardView::class,
attribute = "highlightedCardBackground",
method = "setCustomBackground"
),
BindingMethod(
type = HighlightedCardView::class,
attribute = "highlightedCardInverse",
method = "setInverse"
),
BindingMethod(
type = HighlightedCardView::class,
attribute = "highlightedCardTitle",
method = "setTitle"
),
BindingMethod(
type = HighlightedCardView::class,
attribute = "highlightedCardContent",
method = "setContent"
),
BindingMethod(
type = HighlightedCardView::class,
attribute = "highlightedCardButtonStyle",
method = "setButtonStyle"
),
BindingMethod(
type = HighlightedCardView::class,
attribute = "highlightedCardImageStyle",
method = "setImageStyle"
),
BindingMethod(
type = HighlightedCardView::class,
attribute = "highlightedCardImage",
method = "setImage"
),
BindingMethod(
type = HighlightedCardView::class,
attribute = "highlightedCardButton",
method = "setButtonText"
),
BindingMethod(
type = HighlightedCardView::class,
attribute = "highlightedCardImageVisibility",
method = "setImageVisibility"
),
BindingMethod(
type = HighlightedCardView::class,
attribute = "highlightedCardCloseButtonVisibility",
method = "setCloseVisibility"
),
BindingMethod(
type = HighlightedCardView::class,
attribute = "highlightedCardButtonOnClick",
method = "setButtonOnClick"
),
BindingMethod(
type = HighlightedCardView::class,
attribute = "highlightedCardCloseButton",
method = "setCloseButton"
),
BindingMethod(
type = HighlightedCardView::class,
attribute = "highlightedCardCloseButtonOnClick",
method = "setCloseButtonOnClick"
)
)
class HighlightedCardView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<img src="../../../../../../../../doc/images/highlighted_cards/highlighted_cards_5.png" />
</p>

Implemented as a custom view, `com.telefonica.mistica.highlightedcard.HighlightedCardView` 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.highlightedcard.HighlightedCardView` can be used inside any layout like a regular view. It supports **attribute-based configuration for all properties**.

```xml
<declare-styleable name="HighlightedCardView">
Expand Down
58 changes: 23 additions & 35 deletions library/src/main/java/com/telefonica/mistica/input/CheckBoxInput.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,12 @@ import android.text.method.MovementMethod
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.CompoundButton
import androidx.annotation.StringRes
import androidx.appcompat.widget.AppCompatCheckBox
import androidx.databinding.BindingAdapter
import androidx.databinding.BindingMethod
import androidx.databinding.BindingMethods
import androidx.databinding.InverseBindingListener
import androidx.databinding.InverseBindingMethod
import androidx.databinding.InverseBindingMethods
import com.google.android.material.textfield.TextInputLayout
import com.telefonica.mistica.R
import com.telefonica.mistica.util.getThemeColor

@BindingMethods(
BindingMethod(
type = CheckBoxInput::class,
attribute = "inputCheckText",
method = "setText"
),
BindingMethod(
type = CheckBoxInput::class,
attribute = "inputChecked",
method = "setChecked"
)
)
@InverseBindingMethods(
InverseBindingMethod(
type = CheckBoxInput::class,
attribute = "inputChecked",
method = "isChecked"
)
)
class CheckBoxInput @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
Expand Down Expand Up @@ -102,6 +78,28 @@ class CheckBoxInput @JvmOverloads constructor(
checkBox.buttonTintList = ColorStateList(states, colors)
}

fun setInputError(@StringRes errorRes: Int?) {
if (errorRes == null) {
error = null
setErrorEnabled(false)
} else {
error = context.getString(errorRes)
setErrorEnabled(true)
}
}
Comment on lines +81 to +89
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a potential breaking change. The new public method setInputError(@stringres Int?) was introduced as a replacement for the removed data binding attribute 'inputError'. While this maintains functional compatibility through attribute-based configuration, consumers who were directly calling methods on CheckBoxInput instances may need to update their code if they were using the data binding setError method signature that accepted CharSequence. Please apply the 'Breaking change' label to this PR. Migration notes should be added when drafting the release.

Copilot generated this review using guidance from repository custom instructions.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After merging all this feature branch in Mistica, is necessary to fit current implementation in "android-messenger" incresing new Mistica version.


fun setInputEnabled(enabled: Boolean) {
isEnabled = enabled
}

fun setInputCheckText(text: CharSequence?) {
setText(text)
}

fun getInputCheckText(): CharSequence? {
return getText()
}
Comment on lines +95 to +101
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are potential breaking changes. The new public methods setInputCheckText and getInputCheckText replace the removed data binding methods setText and getText. While these maintain functional compatibility through attribute-based configuration, the change in method naming may affect consumers who were calling these methods directly. Please apply the 'Breaking change' label to this PR. Migration notes should be added when drafting the release.

Copilot generated this review using guidance from repository custom instructions.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same like previous one


fun setChecked(checked: Boolean) {
checkBox.isChecked = checked
}
Expand Down Expand Up @@ -131,14 +129,4 @@ class CheckBoxInput @JvmOverloads constructor(
super.setEnabled(enabled)
checkBox.isEnabled = enabled
}

companion object {
@BindingAdapter(
value = ["inputCheckedAttrChanged"]
)
@JvmStatic
fun setCheckWatcher(input: CheckBoxInput, listener: InverseBindingListener) {
input.setOnCheckedChangeListener(CompoundButton.OnCheckedChangeListener { _, _ -> listener.onChange() })
}
}
}
Loading
Loading