From a7822614a0442e0de5e65c3b59a9143efb41961a Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sun, 18 Apr 2021 12:41:28 +0300 Subject: [PATCH] fix template editor layout due to a glitch in the view chains on some devices the layout was broken noise: renaming of IDs --- .../ui/templates/TemplateDetailsAdapter.java | 43 ++++--- .../res/layout/template_details_header.xml | 108 +++++++++--------- app/src/main/res/values-bg/strings.xml | 4 +- app/src/main/res/values/dimens.xml | 1 + app/src/main/res/values/strings.xml | 4 +- 5 files changed, 82 insertions(+), 78 deletions(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/templates/TemplateDetailsAdapter.java b/app/src/main/java/net/ktnx/mobileledger/ui/templates/TemplateDetailsAdapter.java index cbc18bd8..1872ff2f 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/templates/TemplateDetailsAdapter.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/templates/TemplateDetailsAdapter.java @@ -415,10 +415,9 @@ class TemplateDetailsAdapter extends RecyclerView.Adapter b.templateIsFallbackSwitch.toggle(); b.templateIsFallbackLabel.setOnClickListener(fallbackLabelClickListener); b.templateIsFallbackText.setOnClickListener(fallbackLabelClickListener); - b.templateDetailsTemplateParamsHelpButton.setOnClickListener(v -> HelpDialog.show( - b.getRoot() - .getContext(), R.string.template_details_template_params_label, - R.array.template_params_help)); + b.templateParamsHelpButton.setOnClickListener(v -> HelpDialog.show(b.getRoot() + .getContext(), + R.string.template_details_template_params_label, R.array.template_params_help)); } @NotNull private TemplateDetailsItem.Header getItem() { @@ -498,57 +497,57 @@ class TemplateDetailsAdapter extends RecyclerView.Adapter selectHeaderDetailSource(v, HeaderDetail.DATE_YEAR)); - b.templateDetailsYearSource.setOnClickListener( + b.yearSource.setOnClickListener( v -> selectHeaderDetailSource(v, HeaderDetail.DATE_YEAR)); if (header.hasLiteralDateMonth()) { - b.templateDetailsMonthSource.setText(R.string.template_details_source_literal); + b.monthSource.setText(R.string.template_details_source_literal); final Integer dateMonth = header.getDateMonth(); b.templateDetailsDateMonth.setText( (dateMonth == null) ? null : String.valueOf(dateMonth)); - b.templateDetailsDateMonthLayout.setVisibility(View.VISIBLE); + b.monthLayout.setVisibility(View.VISIBLE); } else { - b.templateDetailsDateMonthLayout.setVisibility(View.GONE); - b.templateDetailsMonthSource.setText( + b.monthLayout.setVisibility(View.GONE); + b.monthSource.setText( String.format(Locale.US, groupNoText, header.getDateMonthMatchGroup(), getMatchGroupText(header.getDateMonthMatchGroup()))); } - b.templateDetailsMonthSourceLabel.setOnClickListener( + b.monthSourceLabel.setOnClickListener( v -> selectHeaderDetailSource(v, HeaderDetail.DATE_MONTH)); - b.templateDetailsMonthSource.setOnClickListener( + b.monthSource.setOnClickListener( v -> selectHeaderDetailSource(v, HeaderDetail.DATE_MONTH)); if (header.hasLiteralDateDay()) { - b.templateDetailsDaySource.setText(R.string.template_details_source_literal); + b.daySource.setText(R.string.template_details_source_literal); final Integer dateDay = header.getDateDay(); b.templateDetailsDateDay.setText( (dateDay == null) ? null : String.valueOf(dateDay)); - b.templateDetailsDateDayLayout.setVisibility(View.VISIBLE); + b.dayLayout.setVisibility(View.VISIBLE); } else { - b.templateDetailsDateDayLayout.setVisibility(View.GONE); - b.templateDetailsDaySource.setText( + b.dayLayout.setVisibility(View.GONE); + b.daySource.setText( String.format(Locale.US, groupNoText, header.getDateDayMatchGroup(), getMatchGroupText(header.getDateDayMatchGroup()))); } - b.templateDetailsDaySourceLabel.setOnClickListener( + b.daySourceLabel.setOnClickListener( v -> selectHeaderDetailSource(v, HeaderDetail.DATE_DAY)); - b.templateDetailsDaySource.setOnClickListener( + b.daySource.setOnClickListener( v -> selectHeaderDetailSource(v, HeaderDetail.DATE_DAY)); if (header.hasLiteralTransactionDescription()) { diff --git a/app/src/main/res/layout/template_details_header.xml b/app/src/main/res/layout/template_details_header.xml index c8617518..d2167c8c 100644 --- a/app/src/main/res/layout/template_details_header.xml +++ b/app/src/main/res/layout/template_details_header.xml @@ -24,19 +24,19 @@ android:padding="@dimen/text_margin" > @@ -57,7 +57,7 @@ app:layout_constraintBottom_toTopOf="@id/pattern_layout" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/template_details_template_params_label" + app:layout_constraintTop_toBottomOf="@id/template_params_label" > @@ -264,12 +266,11 @@ /> @@ -314,6 +314,7 @@ android:id="@+id/template_transaction_description_source_label" android:layout_width="0dp" android:layout_height="match_parent" + android:layout_marginTop="@dimen/text_margin" android:text="@string/transaction_description_source_label" android:textAppearance="?attr/textAppearanceListItem" app:layout_constraintBottom_toTopOf="@+id/template_transaction_description_source" @@ -327,6 +328,7 @@ android:layout_height="wrap_content" android:minWidth="100dp" android:textAppearance="?attr/textAppearanceListItemSecondary" + android:text="@string/template_details_source_literal" app:layout_constraintBottom_toTopOf="@+id/transaction_description_layout" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -367,6 +369,7 @@ android:layout_height="wrap_content" android:minWidth="100dp" android:textAppearance="?attr/textAppearanceListItemSecondary" + android:text="@string/template_details_source_literal" app:layout_constraintBottom_toTopOf="@+id/transaction_comment_layout" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -406,6 +409,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:textAppearance="?attr/textAppearanceListItemSecondary" + android:text="@string/template_is_fallback_no" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/template_is_fallback_switch" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index 8207ff5c..af958a08 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -154,7 +154,7 @@ ден година ден - месец + месец Макет без име Добавяне на макет Няма съвпадение с нито един макет @@ -187,5 +187,5 @@ Резервни макети Макети Параметри на макета - Помощна информация за пааметрите на макета + Помощна информация за пааметрите на макета diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index bbda5d17..2a957979 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -22,4 +22,5 @@ 16dp 200dp 16dp + 8dp \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 14ec1215..4e928c7f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -176,7 +176,7 @@ date year date - month + month Template with no name Add template No template matches @@ -196,5 +196,5 @@ Fallback templates Templates Template parameters - Show help on template parameters + Show help on template parameters -- 2.39.5