/*
- * Copyright © 2020 Damyan Ivanov.
+ * Copyright © 2021 Damyan Ivanov.
* This file is part of MoLe.
* MoLe is free software: you can distribute it and/or modify it
* under the term of the GNU General Public License as published by
private final Observer<Boolean> showCurrencyObserver;
private final Observer<String> commentObserver;
private final Observer<Boolean> amountValidityObserver;
+ private final View tvCurrencyButton;
private String decimalSeparator;
private NewTransactionModel.Item item;
private Date date;
new TextViewClearHelper().attachToTextView((EditText) tvComment);
tvAmount = itemView.findViewById(R.id.account_row_acc_amounts);
tvCurrency = itemView.findViewById(R.id.currency);
+ tvCurrencyButton = lAccount.findViewById(R.id.currencyButton);
tvDate = itemView.findViewById(R.id.new_transaction_date);
tvDescription = itemView.findViewById(R.id.new_transaction_description);
tvDummy = itemView.findViewById(R.id.dummy_text);
tvComment.addTextChangedListener(tw);
tvAmount.addTextChangedListener(amountWatcher);
- tvCurrency.setOnClickListener(v -> {
+ tvCurrencyButton.setOnClickListener(v -> {
CurrencySelectorFragment cpf = new CurrencySelectorFragment();
cpf.showPositionAndPadding();
cpf.setOnCurrencySelectedListener(c -> item.setCurrency(c));
showCurrencyObserver = showCurrency -> {
if (showCurrency) {
tvCurrency.setVisibility(View.VISIBLE);
+ tvCurrencyButton.setVisibility(View.VISIBLE);
String defaultCommodity = mProfile.getDefaultCommodity();
item.setCurrency(
(defaultCommodity == null) ? null : Currency.loadByName(defaultCommodity));
}
else {
tvCurrency.setVisibility(View.GONE);
+ tvCurrencyButton.setVisibility(View.GONE);
item.setCurrency(null);
}
};
<?xml version="1.0" encoding="utf-8"?><!--
- ~ Copyright © 2020 Damyan Ivanov.
+ ~ Copyright © 2021 Damyan Ivanov.
~ This file is part of MoLe.
~ MoLe is free software: you can distribute it and/or modify it
~ under the term of the GNU General Public License as published by
app:layout_constraintTop_toBottomOf="@id/account_row_acc_name"
>
+ <TextView
+ android:id="@+id/currencyButton"
+ android:layout_width="wrap_content"
+ android:layout_height="0dp"
+ android:minWidth="30dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="@id/currency"
+ app:layout_constraintStart_toStartOf="@id/currency"
+ app:layout_constraintTop_toTopOf="parent"
+ />
<EditText
android:id="@+id/account_row_acc_amounts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center_horizontal"
- android:minWidth="24dp"
+ android:minWidth="30dp"
android:text="@string/currency_symbol"
android:textAllCaps="false"
- android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"