From 713c34da72cd78d239c8c1ebabbd0fbcd75ad0b7 Mon Sep 17 00:00:00 2001 From: pokkst Date: Sat, 3 Dec 2022 13:36:30 -0600 Subject: [PATCH] Finalize receive screen design for 0.4.1 - TODO: Add feature to edit address labels --- .../wallet/adapter/SubaddressAdapter.java | 20 ++++++++-- .../fragment/receive/ReceiveFragment.java | 9 +++-- app/src/main/res/drawable/round_bg.xml | 9 +++++ app/src/main/res/layout/address_item.xml | 32 ++++++--------- app/src/main/res/layout/fragment_receive.xml | 40 ++++++++++++++----- app/src/main/res/values-night/colors.xml | 1 + app/src/main/res/values/colors.xml | 3 +- app/src/main/res/values/strings.xml | 2 + app/src/main/res/values/styles.xml | 4 ++ 9 files changed, 84 insertions(+), 36 deletions(-) create mode 100644 app/src/main/res/drawable/round_bg.xml diff --git a/app/src/main/java/net/mynero/wallet/adapter/SubaddressAdapter.java b/app/src/main/java/net/mynero/wallet/adapter/SubaddressAdapter.java index d03fc55..2d17712 100644 --- a/app/src/main/java/net/mynero/wallet/adapter/SubaddressAdapter.java +++ b/app/src/main/java/net/mynero/wallet/adapter/SubaddressAdapter.java @@ -37,12 +37,14 @@ import java.util.List; public class SubaddressAdapter extends RecyclerView.Adapter { private List localDataSet; + private SubaddressAdapterListener listener = null; /** * Initialize the dataset of the Adapter. */ - public SubaddressAdapter() { + public SubaddressAdapter(SubaddressAdapterListener listener) { this.localDataSet = new ArrayList<>(); + this.listener = listener; } public void submitList(List dataSet) { @@ -58,7 +60,7 @@ public class SubaddressAdapter extends RecyclerView.Adapter listener.onSubaddressSelected(subaddress)); } } } diff --git a/app/src/main/java/net/mynero/wallet/fragment/receive/ReceiveFragment.java b/app/src/main/java/net/mynero/wallet/fragment/receive/ReceiveFragment.java index faf26f9..c7dc8a3 100644 --- a/app/src/main/java/net/mynero/wallet/fragment/receive/ReceiveFragment.java +++ b/app/src/main/java/net/mynero/wallet/fragment/receive/ReceiveFragment.java @@ -70,7 +70,7 @@ public class ReceiveFragment extends Fragment { } private void bindObservers(View view) { - SubaddressAdapter adapter = new SubaddressAdapter(); + SubaddressAdapter adapter = new SubaddressAdapter(mViewModel::selectAddress); RecyclerView recyclerView = view.findViewById(R.id.address_list_recyclerview); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.setAdapter(adapter); @@ -79,7 +79,10 @@ public class ReceiveFragment extends Fragment { } private void setAddress(Subaddress subaddress) { - addressLabelTextView.setText(subaddress.getLabel()); + final String label = subaddress.getDisplayLabel(); + final String address = getContext().getString(R.string.subbaddress_info_subtitle, + subaddress.getAddressIndex(), subaddress.getSquashedAddress()); + addressLabelTextView.setText(label.isEmpty() ? address : label); addressTextView.setText(subaddress.getAddress()); addressImageView.setImageBitmap(generate(subaddress.getAddress(), 256, 256)); copyAddressImageButton.setOnClickListener(view1 -> Helper.clipBoardCopy(getContext(), "address", subaddress.getAddress())); @@ -99,7 +102,7 @@ public class ReceiveFragment extends Fragment { if (bitMatrix.get(j, i)) { pixels[i * width + j] = night ? 0xffffffff : 0x00000000; } else { - pixels[i * height + j] = getResources().getColor(R.color.oled_dialogBackgroundColor); + pixels[i * height + j] = getResources().getColor(R.color.oled_colorBackground); } } } diff --git a/app/src/main/res/drawable/round_bg.xml b/app/src/main/res/drawable/round_bg.xml new file mode 100644 index 0000000..0851402 --- /dev/null +++ b/app/src/main/res/drawable/round_bg.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/app/src/main/res/layout/address_item.xml b/app/src/main/res/layout/address_item.xml index f7a2d2e..42cacdb 100644 --- a/app/src/main/res/layout/address_item.xml +++ b/app/src/main/res/layout/address_item.xml @@ -4,41 +4,35 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:padding="8dp" android:layout_marginBottom="8dp"> - diff --git a/app/src/main/res/layout/fragment_receive.xml b/app/src/main/res/layout/fragment_receive.xml index 600ade1..50781ec 100644 --- a/app/src/main/res/layout/fragment_receive.xml +++ b/app/src/main/res/layout/fragment_receive.xml @@ -53,31 +53,35 @@ + tools:text="LABEL" /> + + #956E43 #060606 #0E0E0E + #353535 diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 3e50678..865c09f 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -9,7 +9,7 @@ @color/oled_gradientTopColor @color/oled_colorBackground @color/oled_colorOnBackground - #FFDB72 + #f38854 @color/oled_favouriteColor #19ED60 #f38854 @@ -33,6 +33,7 @@ #B5895A #FBFBFB #E8E8E8 + #bbbbbb diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 56778a1..1394d7e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -117,4 +117,6 @@ Restore height Block Height Use password as seed offset + #%1$d: %2$s + Previous addresses diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 6d07006..0391f2a 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -70,6 +70,10 @@ 1dp +