mirror of
https://codeberg.org/anoncontributorxmr/mysu.git
synced 2024-11-21 23:12:26 +00:00
Finalize receive screen design for 0.4.1 - TODO: Add feature to edit address labels
This commit is contained in:
parent
028b8b79b6
commit
713c34da72
9 changed files with 84 additions and 36 deletions
|
@ -37,12 +37,14 @@ import java.util.List;
|
|||
public class SubaddressAdapter extends RecyclerView.Adapter<SubaddressAdapter.ViewHolder> {
|
||||
|
||||
private List<Subaddress> 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<Subaddress> dataSet) {
|
||||
|
@ -58,7 +60,7 @@ public class SubaddressAdapter extends RecyclerView.Adapter<SubaddressAdapter.Vi
|
|||
View view = LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(R.layout.address_item, viewGroup, false);
|
||||
|
||||
return new ViewHolder(view);
|
||||
return new ViewHolder(view, listener);
|
||||
}
|
||||
|
||||
// Replace the contents of a view (invoked by the layout manager)
|
||||
|
@ -83,14 +85,26 @@ public class SubaddressAdapter extends RecyclerView.Adapter<SubaddressAdapter.Vi
|
|||
* (custom ViewHolder).
|
||||
*/
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
private SubaddressAdapterListener listener = null;
|
||||
|
||||
public ViewHolder(View view) {
|
||||
public ViewHolder(View view, SubaddressAdapterListener listener) {
|
||||
super(view);
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public void bind(Subaddress subaddress) {
|
||||
TextView addressTextView = itemView.findViewById(R.id.address_item_address_textview);
|
||||
TextView addressLabelTextView = itemView.findViewById(R.id.address_label_textview);
|
||||
|
||||
addressTextView.setText(subaddress.getAddress());
|
||||
|
||||
final String label = subaddress.getDisplayLabel();
|
||||
final String address = itemView.getContext().getString(R.string.subbaddress_info_subtitle,
|
||||
subaddress.getAddressIndex(), subaddress.getSquashedAddress());
|
||||
addressLabelTextView.setText(label.isEmpty() ? address : label);
|
||||
|
||||
|
||||
itemView.setOnClickListener(view -> listener.onSubaddressSelected(subaddress));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
9
app/src/main/res/drawable/round_bg.xml
Normal file
9
app/src/main/res/drawable/round_bg.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<padding
|
||||
android:left="8dp"
|
||||
android:right="8dp" />
|
||||
<solid android:color="@color/oled_dialogBackgroundColor" />
|
||||
<corners android:radius="16dp" />
|
||||
</shape>
|
|
@ -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">
|
||||
<TextView
|
||||
android:id="@+id/address_item_address_textview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Address"
|
||||
android:textStyle="bold"
|
||||
android:textSize="16sp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:ellipsize="middle"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/oled_addressListColor"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/address_item_amount_textview"
|
||||
app:layout_constraintBottom_toTopOf="@id/address_label_textview"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
<TextView
|
||||
android:id="@+id/address_item_amount_textview"
|
||||
android:layout_width="0dp"
|
||||
android:id="@+id/address_label_textview"
|
||||
style="@style/MoneroText.Subaddress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Amount"
|
||||
android:text="Label"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:textStyle="bold"
|
||||
android:ellipsize="middle"
|
||||
app:layout_constraintTop_toBottomOf="@id/address_item_address_textview"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/address_item_index_textview"
|
||||
android:singleLine="true" />
|
||||
<TextView
|
||||
android:id="@+id/address_item_index_textview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Idx"
|
||||
android:ellipsize="middle"
|
||||
android:gravity="end"
|
||||
app:layout_constraintTop_toBottomOf="@id/address_item_address_textview"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/address_item_amount_textview"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:singleLine="true" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
|
@ -53,31 +53,35 @@
|
|||
<TextView
|
||||
android:id="@+id/address_textview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:ellipsize="middle"
|
||||
android:singleLine="true"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
app:layout_constraintEnd_toStartOf="@id/copy_address_imagebutton"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/copy_address_imagebutton"
|
||||
app:layout_constraintTop_toBottomOf="@id/monero_qr_imageview"
|
||||
app:layout_constraintBottom_toTopOf="@id/address_label_textview"
|
||||
tools:text="ADDRESS" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/address_label_textview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
style="@style/MoneroText.Subaddress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="14sp"
|
||||
android:ellipsize="middle"
|
||||
android:singleLine="true"
|
||||
app:layout_constraintEnd_toStartOf="@id/copy_address_imagebutton"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/address_textview"
|
||||
app:layout_constraintBottom_toBottomOf="@id/copy_address_imagebutton"
|
||||
tools:text="ADDRESS" />
|
||||
tools:text="LABEL" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/copy_address_imagebutton"
|
||||
|
@ -94,13 +98,29 @@
|
|||
app:layout_constraintStart_toEndOf="@id/address_textview"
|
||||
app:layout_constraintTop_toBottomOf="@id/monero_qr_imageview" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/address_list_label_textview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:textSize="14sp"
|
||||
android:ellipsize="middle"
|
||||
android:singleLine="true"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/address_list_recyclerview"
|
||||
android:text="@string/previous_addresses" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/address_list_recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="128dp"
|
||||
android:background="@drawable/round_bg"
|
||||
android:layout_marginTop="64dp"
|
||||
android:paddingTop="8dp"
|
||||
android:clipToPadding="true"
|
||||
android:paddingBottom="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
<color name="oled_locked_utxo">#956E43</color>
|
||||
<color name="oled_txBackgroundColor">#060606</color>
|
||||
<color name="oled_dialogBackgroundColor">#0E0E0E</color>
|
||||
<color name="oled_addressListColor">#353535</color>
|
||||
|
||||
<!-- CLASSIC -->
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<color name="oled_streetColorA">@color/oled_gradientTopColor</color>
|
||||
<color name="oled_streetColorB">@color/oled_colorBackground</color>
|
||||
<color name="oled_toolbarTextColor">@color/oled_colorOnBackground</color>
|
||||
<color name="oled_favouriteColor">#FFDB72</color>
|
||||
<color name="oled_favouriteColor">#f38854</color>
|
||||
<color name="oled_softFavouriteColor">@color/oled_favouriteColor</color>
|
||||
<color name="oled_positiveColor">#19ED60</color>
|
||||
<color name="oled_negativeColor">#f38854</color>
|
||||
|
@ -33,6 +33,7 @@
|
|||
<color name="oled_locked_utxo">#B5895A</color>
|
||||
<color name="oled_txBackgroundColor">#FBFBFB</color>
|
||||
<color name="oled_dialogBackgroundColor">#E8E8E8</color>
|
||||
<color name="oled_addressListColor">#bbbbbb</color>
|
||||
|
||||
<!-- CLASSIC -->
|
||||
|
||||
|
|
|
@ -117,4 +117,6 @@
|
|||
<string name="wallet_restore_height_label">Restore height</string>
|
||||
<string name="block_height">Block Height</string>
|
||||
<string name="use_password_as_seed_offset">Use password as seed offset</string>
|
||||
<string name="subbaddress_info_subtitle" translatable="false">#%1$d: %2$s</string>
|
||||
<string name="previous_addresses">Previous addresses</string>
|
||||
</resources>
|
||||
|
|
|
@ -70,6 +70,10 @@
|
|||
<item name="cardElevation">1dp</item>
|
||||
</style>
|
||||
|
||||
<style name="MoneroText.Subaddress">
|
||||
<item name="android:background">@color/oled_favouriteColor</item>
|
||||
<item name="android:textColor">?android:colorBackground</item>
|
||||
</style>
|
||||
|
||||
<style name="MoneroText.PosAmount">
|
||||
<item name="android:textSize">16sp</item>
|
||||
|
|
Loading…
Reference in a new issue