Add amount to subaddress list

This commit is contained in:
pokkst 2022-12-04 09:46:31 -06:00
parent ea0849a88c
commit fd78ebc89c
No known key found for this signature in database
GPG Key ID: 90C2ED85E67A50FF
4 changed files with 33 additions and 2 deletions

View File

@ -30,6 +30,7 @@ import net.mynero.wallet.model.CoinsInfo;
import net.mynero.wallet.model.Wallet;
import net.mynero.wallet.service.PrefService;
import net.mynero.wallet.util.Constants;
import net.mynero.wallet.util.Helper;
import java.util.ArrayList;
import java.util.List;
@ -94,6 +95,7 @@ public class SubaddressAdapter extends RecyclerView.Adapter<SubaddressAdapter.Vi
public void bind(Subaddress subaddress) {
TextView addressTextView = itemView.findViewById(R.id.address_item_address_textview);
TextView addressLabelTextView = itemView.findViewById(R.id.address_label_textview);
TextView addressAmountTextView = itemView.findViewById(R.id.address_amount_textview);
addressTextView.setText(subaddress.getAddress());
@ -102,6 +104,19 @@ public class SubaddressAdapter extends RecyclerView.Adapter<SubaddressAdapter.Vi
subaddress.getAddressIndex(), subaddress.getSquashedAddress());
addressLabelTextView.setText(label.isEmpty() ? address : label);
final long amount = subaddress.getAmount();
if (amount > 0) {
boolean streetMode = PrefService.getInstance().getBoolean(Constants.PREF_STREET_MODE, false);
if(streetMode) {
addressAmountTextView.setText(itemView.getContext().getString(R.string.tx_list_amount_positive,
Constants.STREET_MODE_BALANCE));
} else {
addressAmountTextView.setText(itemView.getContext().getString(R.string.tx_list_amount_positive,
Helper.getDisplayAmount(amount, Helper.DISPLAY_DIGITS_INFO)));
}
}
else
addressAmountTextView.setText("");
itemView.setOnClickListener(view -> listener.onSubaddressSelected(subaddress));
}

View File

@ -35,4 +35,20 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:singleLine="true" />
<TextView
android:id="@+id/address_amount_textview"
android:layout_width="0dp"
android:layout_height="0dp"
android:text="Amount"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:ellipsize="middle"
android:textAlignment="viewEnd"
android:textColor="@color/oled_positiveColor"
app:layout_constraintTop_toBottomOf="@id/address_item_address_textview"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/address_label_textview"
android:singleLine="true" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -11,7 +11,7 @@
<color name="oled_toolbarTextColor">#F4F4F4</color>
<color name="oled_favouriteColor">#cb5a2e</color>
<color name="oled_softFavouriteColor">#FF104E</color>
<color name="oled_positiveColor">#19ED60</color>
<color name="oled_positiveColor">#13D855</color>
<color name="oled_negativeColor">#CB2E2E</color>
<color name="oled_neutralColor">#838383</color>
<color name="oled_noticeColor">#7E37F1</color>

View File

@ -11,7 +11,7 @@
<color name="oled_toolbarTextColor">@color/oled_colorOnBackground</color>
<color name="oled_favouriteColor">#f38854</color>
<color name="oled_softFavouriteColor">@color/oled_favouriteColor</color>
<color name="oled_positiveColor">#19ED60</color>
<color name="oled_positiveColor">#13D855</color>
<color name="oled_negativeColor">#f38854</color>
<color name="oled_neutralColor">#171717</color>
<color name="oled_noticeColor">#3DC2FF</color>