Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANDROID-13619 Unify IDs Feedback error #286

Draft
wants to merge 1 commit into
base: feature_branch/unify_ids
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
Expand All @@ -25,12 +26,16 @@ fun LoadErrorFeedback(
) {

Column(
modifier = Modifier.padding(16.dp),
modifier = Modifier
.testTag(ErrorFeedbackTestTags.ERROR_FEEDBACK)
.padding(16.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
titleText?.let {
Text(
modifier = Modifier.padding(8.dp),
modifier = Modifier
.testTag(ErrorFeedbackTestTags.ERROR_FEEDBACK_TITLE)
.padding(8.dp),
text = it,
textAlign = TextAlign.Center,
style = MisticaTheme.typography.presetCardTitle,
Expand All @@ -39,6 +44,7 @@ fun LoadErrorFeedback(
}
descriptionText?.let {
Text(
modifier = Modifier.testTag(ErrorFeedbackTestTags.ERROR_FEEDBACK_DESCRIPTION),
text = it,
textAlign = TextAlign.Center,
style = MisticaTheme.typography.preset2,
Expand All @@ -47,7 +53,9 @@ fun LoadErrorFeedback(
}
buttonText?.let {
Button(
modifier = Modifier.padding(top = 24.dp),
modifier = Modifier
.testTag(ErrorFeedbackTestTags.ERROR_FEEDBACK_BUTTON)
.padding(top = 24.dp),
text = it,
loadingText = buttonLoadingText,
onClickListener = onButtonClick,
Expand All @@ -59,6 +67,13 @@ fun LoadErrorFeedback(

}

object ErrorFeedbackTestTags {
const val ERROR_FEEDBACK = "error_feedback"
const val ERROR_FEEDBACK_TITLE = "error_feedback_title"
const val ERROR_FEEDBACK_DESCRIPTION = "error_feedback_description"
const val ERROR_FEEDBACK_BUTTON = "error_feedback_button"
}

@Preview
@Composable
fun LoadErrorFeedbackPreview() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ class LoadErrorFeedbackView @JvmOverloads constructor(
gravity = Gravity.CENTER
orientation = VERTICAL

titleTextView = findViewById(R.id.load_error_feedback_title)
descriptionTextView = findViewById(R.id.load_error_feedback_description)
button = findViewById(R.id.load_error_feedback_button)
titleTextView = findViewById(R.id.error_feedback_title)
descriptionTextView = findViewById(R.id.error_feedback_description)
button = findViewById(R.id.error_feedback_button)
isFocusable = true

if (attrs != null) {
Expand Down Expand Up @@ -130,4 +130,4 @@ class LoadErrorFeedbackView @JvmOverloads constructor(
fun setButtonClickListener(listener: ((View) -> Unit)?) {
setButtonOnClick(OnClickListener { listener?.invoke(it) })
}
}
}
11 changes: 6 additions & 5 deletions library/src/main/res/layout/load_error_feedback.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<merge xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/error_feedback">

<TextView
android:id="@+id/load_error_feedback_title"
android:id="@+id/error_feedback_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
Expand All @@ -12,7 +13,7 @@
android:visibility="gone" />

<TextView
android:id="@+id/load_error_feedback_description"
android:id="@+id/error_feedback_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
Expand All @@ -21,10 +22,10 @@
android:textColor="?colorTextSecondary" />

<com.telefonica.mistica.button.ProgressButton
android:id="@+id/load_error_feedback_button"
android:id="@+id/error_feedback_button"
style="@style/AppTheme.Button.SecondaryButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="@string/generic_retry" />
</merge>
</merge>