Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ To create or modify components on this repository, follow the next steps:
3. Place the new component under `library` module, under `com.telefonica.mistica` package. The component should have a proper definition by the design team. When implementing the component, follow these guidelines:
- The component should be implemented to be reusable. Make it **generic** enough so that other teams can also use it.
- If it is designed to be part of a layout definition (It's not a floating element), it should be implemented as a **Custom View**.
- It must allow **configuration with layout attributes**.
- It must provide **databinding support** for these attributes.
- It must also provide relevant **public methods to configure the view programatically**.
- It must allow **configuration through XML layout attributes**.
- It must expose **public APIs (setters / methods)** to configure the view programmatically.
- In case it is a floating element, provide **necessary classes/builders to configure it** before display.
- Make sure the component **resizes correctly**, so it adapts correctly to any screen size (including rotation).
- If possible, take into account **accessibility** (TalkBack, Font size modification).
Expand All @@ -79,3 +78,8 @@ Y -> New components or features
Z -> Minor modifications or fixes

You can find more information here https://semver.org/

> [!NOTE]
> Mística components are implemented as standard Android Views and do not depend on Android DataBinding.
> Applications may still use DataBinding at app level if needed, but the library does not provide or require
> DataBinding-specific APIs.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ class LoadErrorFeedbackView @JvmOverloads constructor(
}

fun setButtonClickListener(listener: ((View) -> Unit)?) {
setButtonOnClick(OnClickListener { listener?.invoke(it) })
setButtonOnClick { v -> listener?.invoke(v) }
}

fun setLoadErrorFeedbackTitle(text: CharSequence?) = setTitle(text)
fun setLoadErrorFeedbackDescription(text: CharSequence?) = setDescription(text ?: "")
fun setLoadErrorFeedbackButtonText(text: CharSequence?) = setButtonText(text ?: "")
fun setLoadErrorFeedbackButtonText(@StringRes textId: Int) = setButtonText(textId)
fun setLoadErrorFeedbackIsLoading(loading: Boolean) = setIsLoading(loading)
fun setLoadErrorFeedbackIsButtonVisible(visible: Boolean) = setIsButtonVisible(visible)
fun setLoadErrorFeedbackButtonOnClick(listener: OnClickListener?) = setButtonOnClick(listener)
}
5 changes: 3 additions & 2 deletions library/src/main/res/values/attrs_components.xml
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@
<enum name="phone" value="4" />
<enum name="number" value="5" />
</attr>
<attr name="inputText" format="string" /> <!-- Supports inverse databinding -->
<attr name="inputText" format="string" />
<attr name="inputCounterEnabled" format="boolean" />
<attr name="inputMaxLength" format="integer" />
<attr name="inputAutofillEnabled" format="boolean" />
</declare-styleable>

<declare-styleable name="CheckBoxInput">
<attr name="inputChecked" format="boolean" /> <!-- Supports inverse databinding -->
<attr name="inputChecked" format="boolean" />
<attr name="inputCheckText" format="string" />
</declare-styleable>

Expand Down Expand Up @@ -329,6 +329,7 @@
</declare-styleable>

<declare-styleable name="Button">
<attr name="buttonOnClick" format="reference" />
<attr name="isLoading" format="boolean" />
<attr name="loadingText" format="string" />
<attr name="invalidatePaddings" format="boolean"/>
Expand Down
Loading