mirror of
https://codeberg.org/r4v3r23/mysu.git
synced 2024-11-10 08:00:02 +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> {
|
public class SubaddressAdapter extends RecyclerView.Adapter<SubaddressAdapter.ViewHolder> {
|
||||||
|
|
||||||
private List<Subaddress> localDataSet;
|
private List<Subaddress> localDataSet;
|
||||||
|
private SubaddressAdapterListener listener = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the dataset of the Adapter.
|
* Initialize the dataset of the Adapter.
|
||||||
*/
|
*/
|
||||||
public SubaddressAdapter() {
|
public SubaddressAdapter(SubaddressAdapterListener listener) {
|
||||||
this.localDataSet = new ArrayList<>();
|
this.localDataSet = new ArrayList<>();
|
||||||
|
this.listener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void submitList(List<Subaddress> dataSet) {
|
public void submitList(List<Subaddress> dataSet) {
|
||||||
|
@ -58,7 +60,7 @@ public class SubaddressAdapter extends RecyclerView.Adapter<SubaddressAdapter.Vi
|
||||||
View view = LayoutInflater.from(viewGroup.getContext())
|
View view = LayoutInflater.from(viewGroup.getContext())
|
||||||
.inflate(R.layout.address_item, viewGroup, false);
|
.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)
|
// 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).
|
* (custom ViewHolder).
|
||||||
*/
|
*/
|
||||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
private SubaddressAdapterListener listener = null;
|
||||||
|
|
||||||
public ViewHolder(View view) {
|
public ViewHolder(View view, SubaddressAdapterListener listener) {
|
||||||
super(view);
|
super(view);
|
||||||
|
this.listener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bind(Subaddress subaddress) {
|
public void bind(Subaddress subaddress) {
|
||||||
TextView addressTextView = itemView.findViewById(R.id.address_item_address_textview);
|
TextView addressTextView = itemView.findViewById(R.id.address_item_address_textview);
|
||||||
|
TextView addressLabelTextView = itemView.findViewById(R.id.address_label_textview);
|
||||||
|
|
||||||
addressTextView.setText(subaddress.getAddress());
|
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) {
|
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 recyclerView = view.findViewById(R.id.address_list_recyclerview);
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
recyclerView.setAdapter(adapter);
|
recyclerView.setAdapter(adapter);
|
||||||
|
@ -79,7 +79,10 @@ public class ReceiveFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAddress(Subaddress subaddress) {
|
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());
|
addressTextView.setText(subaddress.getAddress());
|
||||||
addressImageView.setImageBitmap(generate(subaddress.getAddress(), 256, 256));
|
addressImageView.setImageBitmap(generate(subaddress.getAddress(), 256, 256));
|
||||||
copyAddressImageButton.setOnClickListener(view1 -> Helper.clipBoardCopy(getContext(), "address", subaddress.getAddress()));
|
copyAddressImageButton.setOnClickListener(view1 -> Helper.clipBoardCopy(getContext(), "address", subaddress.getAddress()));
|
||||||
|
@ -99,7 +102,7 @@ public class ReceiveFragment extends Fragment {
|
||||||
if (bitMatrix.get(j, i)) {
|
if (bitMatrix.get(j, i)) {
|
||||||
pixels[i * width + j] = night ? 0xffffffff : 0x00000000;
|
pixels[i * width + j] = night ? 0xffffffff : 0x00000000;
|
||||||
} else {
|
} 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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="8dp"
|
|
||||||
android:layout_marginBottom="8dp">
|
android:layout_marginBottom="8dp">
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/address_item_address_textview"
|
android:id="@+id/address_item_address_textview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Address"
|
android:text="Address"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:textSize="16sp"
|
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_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="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"/>
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/address_item_amount_textview"
|
android:id="@+id/address_label_textview"
|
||||||
android:layout_width="0dp"
|
style="@style/MoneroText.Subaddress"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Amount"
|
android:text="Label"
|
||||||
|
android:paddingStart="8dp"
|
||||||
|
android:paddingEnd="8dp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:ellipsize="middle"
|
android:ellipsize="middle"
|
||||||
app:layout_constraintTop_toBottomOf="@id/address_item_address_textview"
|
app:layout_constraintTop_toBottomOf="@id/address_item_address_textview"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="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" />
|
android:singleLine="true" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
|
@ -53,31 +53,35 @@
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/address_textview"
|
android:id="@+id/address_textview"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:ellipsize="middle"
|
android:ellipsize="middle"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
android:paddingTop="4dp"
|
||||||
|
android:paddingBottom="4dp"
|
||||||
app:layout_constraintEnd_toStartOf="@id/copy_address_imagebutton"
|
app:layout_constraintEnd_toStartOf="@id/copy_address_imagebutton"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
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"
|
app:layout_constraintBottom_toTopOf="@id/address_label_textview"
|
||||||
tools:text="ADDRESS" />
|
tools:text="ADDRESS" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/address_label_textview"
|
android:id="@+id/address_label_textview"
|
||||||
android:layout_width="0dp"
|
style="@style/MoneroText.Subaddress"
|
||||||
android:layout_height="0dp"
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:ellipsize="middle"
|
android:ellipsize="middle"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
app:layout_constraintEnd_toStartOf="@id/copy_address_imagebutton"
|
android:paddingStart="8dp"
|
||||||
|
android:paddingEnd="8dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/address_textview"
|
app:layout_constraintTop_toBottomOf="@id/address_textview"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/copy_address_imagebutton"
|
tools:text="LABEL" />
|
||||||
tools:text="ADDRESS" />
|
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/copy_address_imagebutton"
|
android:id="@+id/copy_address_imagebutton"
|
||||||
|
@ -94,13 +98,29 @@
|
||||||
app:layout_constraintStart_toEndOf="@id/address_textview"
|
app:layout_constraintStart_toEndOf="@id/address_textview"
|
||||||
app:layout_constraintTop_toBottomOf="@id/monero_qr_imageview" />
|
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
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/address_list_recyclerview"
|
android:id="@+id/address_list_recyclerview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginTop="16dp"
|
android:background="@drawable/round_bg"
|
||||||
android:clipToPadding="false"
|
android:layout_marginTop="64dp"
|
||||||
android:paddingBottom="128dp"
|
android:paddingTop="8dp"
|
||||||
|
android:clipToPadding="true"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
<color name="oled_locked_utxo">#956E43</color>
|
<color name="oled_locked_utxo">#956E43</color>
|
||||||
<color name="oled_txBackgroundColor">#060606</color>
|
<color name="oled_txBackgroundColor">#060606</color>
|
||||||
<color name="oled_dialogBackgroundColor">#0E0E0E</color>
|
<color name="oled_dialogBackgroundColor">#0E0E0E</color>
|
||||||
|
<color name="oled_addressListColor">#353535</color>
|
||||||
|
|
||||||
<!-- CLASSIC -->
|
<!-- CLASSIC -->
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<color name="oled_streetColorA">@color/oled_gradientTopColor</color>
|
<color name="oled_streetColorA">@color/oled_gradientTopColor</color>
|
||||||
<color name="oled_streetColorB">@color/oled_colorBackground</color>
|
<color name="oled_streetColorB">@color/oled_colorBackground</color>
|
||||||
<color name="oled_toolbarTextColor">@color/oled_colorOnBackground</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_softFavouriteColor">@color/oled_favouriteColor</color>
|
||||||
<color name="oled_positiveColor">#19ED60</color>
|
<color name="oled_positiveColor">#19ED60</color>
|
||||||
<color name="oled_negativeColor">#f38854</color>
|
<color name="oled_negativeColor">#f38854</color>
|
||||||
|
@ -33,6 +33,7 @@
|
||||||
<color name="oled_locked_utxo">#B5895A</color>
|
<color name="oled_locked_utxo">#B5895A</color>
|
||||||
<color name="oled_txBackgroundColor">#FBFBFB</color>
|
<color name="oled_txBackgroundColor">#FBFBFB</color>
|
||||||
<color name="oled_dialogBackgroundColor">#E8E8E8</color>
|
<color name="oled_dialogBackgroundColor">#E8E8E8</color>
|
||||||
|
<color name="oled_addressListColor">#bbbbbb</color>
|
||||||
|
|
||||||
<!-- CLASSIC -->
|
<!-- CLASSIC -->
|
||||||
|
|
||||||
|
|
|
@ -117,4 +117,6 @@
|
||||||
<string name="wallet_restore_height_label">Restore height</string>
|
<string name="wallet_restore_height_label">Restore height</string>
|
||||||
<string name="block_height">Block Height</string>
|
<string name="block_height">Block Height</string>
|
||||||
<string name="use_password_as_seed_offset">Use password as seed offset</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>
|
</resources>
|
||||||
|
|
|
@ -70,6 +70,10 @@
|
||||||
<item name="cardElevation">1dp</item>
|
<item name="cardElevation">1dp</item>
|
||||||
</style>
|
</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">
|
<style name="MoneroText.PosAmount">
|
||||||
<item name="android:textSize">16sp</item>
|
<item name="android:textSize">16sp</item>
|
||||||
|
|
Loading…
Reference in a new issue