b.templateDetailsAccountAmount.setText(Data.formatNumber(amt));
});
- b.negateAmountSwitch.setOnCheckedChangeListener(
- (buttonView, isChecked) -> 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) {
b.templateDetailsAccountAmountLayout.setVisibility(View.GONE);
b.negateAmountSwitch.setVisibility(View.VISIBLE);
b.negateAmountSwitch.setChecked(accRow.isNegateAmount());
+ b.templateDetailsNegateAmountText.setText(
+ accRow.isNegateAmount() ? R.string.template_account_change_amount_sign
+ : R.string.template_account_keep_amount_sign);
}
b.templateAccountNameSourceLabel.setOnClickListener(
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/template_account_amount_source_label"
/>
- <com.google.android.material.switchmaterial.SwitchMaterial
- android:id="@+id/negate_amount_switch"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- app:layout_constraintBottom_toBottomOf="@id/template_details_account_amount_source"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintTop_toTopOf="@id/template_account_amount_source_label"
- />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/template_details_account_amount_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/text_margin"
android:textAppearance="?attr/textAppearanceListItem"
- app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintBottom_toTopOf="@id/template_details_negate_amount_label"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/template_details_account_amount_source"
android:selectAllOnFocus="true"
/>
</com.google.android.material.textfield.TextInputLayout>
+ <TextView
+ android:id="@+id/template_details_negate_amount_label"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/text_margin"
+ android:text="@string/template_account_negate_amount_label"
+ android:textAppearance="?attr/textAppearanceListItem"
+ app:layout_constraintBottom_toTopOf="@id/template_details_negate_amount_text"
+ app:layout_constraintEnd_toStartOf="@+id/negate_amount_switch"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/template_details_account_amount_layout"
+ />
+ <TextView
+ android:id="@+id/template_details_negate_amount_text"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:text="@string/template_account_keep_amount_sign"
+ android:textAppearance="?attr/textAppearanceListItemSecondary"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintBottom_toTopOf="@id/template_details_negate_amount_text"
+ app:layout_constraintEnd_toStartOf="@+id/negate_amount_switch"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/template_details_negate_amount_label"
+ />
+ <com.google.android.material.switchmaterial.SwitchMaterial
+ android:id="@+id/negate_amount_switch"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:layout_constraintBottom_toBottomOf="@id/template_details_negate_amount_text"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="@id/template_details_negate_amount_label"
+ />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file