From 1f7142d161a181be9781bf9b9ad34797fa6a6067 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sat, 13 Feb 2021 20:53:37 +0200 Subject: [PATCH] self-explanatory amount reversal switch --- .../ui/templates/TemplateDetailsAdapter.java | 16 ++++++- .../res/layout/template_details_account.xml | 42 +++++++++++++++---- app/src/main/res/values-bg/strings.xml | 3 ++ app/src/main/res/values/strings.xml | 3 ++ 4 files changed, 53 insertions(+), 11 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 80c6df49..23260e00 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 @@ -549,8 +549,17 @@ class TemplateDetailsAdapter extends RecyclerView.Adapter getItem().setNegateAmount(isChecked)); + b.negateAmountSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> { + getItem().setNegateAmount(isChecked); + b.templateDetailsNegateAmountText.setText( + isChecked ? R.string.template_account_change_amount_sign + : R.string.template_account_keep_amount_sign); + }); + final View.OnClickListener negLabelClickListener = (view) -> { + b.negateAmountSwitch.toggle(); + }; + b.templateDetailsNegateAmountLabel.setOnClickListener(negLabelClickListener); + b.templateDetailsNegateAmountText.setOnClickListener(negLabelClickListener); } @Override void bind(TemplateDetailsItem item) { @@ -601,6 +610,9 @@ class TemplateDetailsAdapter extends RecyclerView.Adapter - + + + \ No newline at end of file diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index c2df39b4..360c3fc7 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -219,4 +219,7 @@ Връщане Резултат от прилагането на шаблона Група %1$d (%2$s) + Без промяна на знака + Обръщане на знака на сумата (от плюс на минус и от минус на плюс) + Знак на сумата diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index dc477843..4def8849 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -229,4 +229,7 @@ Undo Pattern match result Group %1$d (%2$s) + Sign will not be altered + Amount sign will be changed (plus to minus; minus to plus) + Change amount sign -- 2.39.5