From 3f0c213b471bf356ab679f1a7291888c7e77725d Mon Sep 17 00:00:00 2001 From: pokkst Date: Sat, 3 Dec 2022 13:48:51 -0600 Subject: [PATCH] Add donate button to send dialog --- .../dialog/SendBottomSheetDialog.java | 7 ++++- .../net/mynero/wallet/util/Constants.java | 1 + .../res/layout/send_bottom_sheet_dialog.xml | 28 ++++++++++++------- app/src/main/res/values/strings.xml | 1 + 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/net/mynero/wallet/fragment/dialog/SendBottomSheetDialog.java b/app/src/main/java/net/mynero/wallet/fragment/dialog/SendBottomSheetDialog.java index 51cb4ac..9184787 100644 --- a/app/src/main/java/net/mynero/wallet/fragment/dialog/SendBottomSheetDialog.java +++ b/app/src/main/java/net/mynero/wallet/fragment/dialog/SendBottomSheetDialog.java @@ -33,6 +33,7 @@ import net.mynero.wallet.model.Wallet; import net.mynero.wallet.service.BalanceService; import net.mynero.wallet.service.TxService; import net.mynero.wallet.service.UTXOService; +import net.mynero.wallet.util.Constants; import net.mynero.wallet.util.Helper; import net.mynero.wallet.util.UriData; @@ -76,6 +77,7 @@ public class SendBottomSheetDialog extends BottomSheetDialogFragment { private ImageButton pasteAddressImageButton; private ImageButton scanAddressImageButton; private RadioGroup feeRadioGroup; + private TextView donateTextView; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -99,7 +101,8 @@ public class SendBottomSheetDialog extends BottomSheetDialogFragment { feeRadioGroup = view.findViewById(R.id.tx_fee_radiogroup); feeRadioGroupLabelTextView = view.findViewById(R.id.tx_fee_radiogroup_label_textview); selectedUtxosValueTextView = view.findViewById(R.id.selected_utxos_value_textview); - + donateTextView = view.findViewById(R.id.donate_label_textview); + donateTextView.setOnClickListener(view1 -> addressEditText.setText(Constants.DONATE_ADDRESS)); if (uriData != null) { addressEditText.setText(uriData.getAddress()); if (uriData.hasAmount()) { @@ -306,6 +309,7 @@ public class SendBottomSheetDialog extends BottomSheetDialogFragment { selectedUtxosValueTextView.setVisibility(View.GONE); feeRadioGroup.setVisibility(View.GONE); feeRadioGroupLabelTextView.setVisibility(View.GONE); + donateTextView.setVisibility(View.GONE); } else { sendButton.setVisibility(View.GONE); addressEditText.setVisibility(View.VISIBLE); @@ -323,6 +327,7 @@ public class SendBottomSheetDialog extends BottomSheetDialogFragment { } feeRadioGroup.setVisibility(View.VISIBLE); feeRadioGroupLabelTextView.setVisibility(View.VISIBLE); + donateTextView.setVisibility(View.VISIBLE); } } diff --git a/app/src/main/java/net/mynero/wallet/util/Constants.java b/app/src/main/java/net/mynero/wallet/util/Constants.java index 3d68df7..864f263 100644 --- a/app/src/main/java/net/mynero/wallet/util/Constants.java +++ b/app/src/main/java/net/mynero/wallet/util/Constants.java @@ -18,4 +18,5 @@ public class Constants { public static final String NAV_ARG_TXINFO = "nav_arg_txinfo"; public static final String STREET_MODE_BALANCE = "#.############"; + public static final String DONATE_ADDRESS = "87MRtZPrWUCVUgcFHdsVb5MoZUcLtqfD3FvQVGwftFb8eSdMnE39JhAJcbuSW8X2vRaRsB9RQfuCpFciybJFHaz3QYPhCLw"; } diff --git a/app/src/main/res/layout/send_bottom_sheet_dialog.xml b/app/src/main/res/layout/send_bottom_sheet_dialog.xml index 9ce5aec..3f5bf23 100644 --- a/app/src/main/res/layout/send_bottom_sheet_dialog.xml +++ b/app/src/main/res/layout/send_bottom_sheet_dialog.xml @@ -6,8 +6,6 @@ android:layout_height="match_parent" android:background="@color/oled_dialogBackgroundColor" android:fitsSystemWindows="true"> - - @@ -44,18 +42,28 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginTop="16dp" - android:layout_marginBottom="16dp" + android:layout_marginBottom="4dp" android:background="@drawable/edittext_bg" android:layout_marginStart="24dp" android:ellipsize="middle" android:hint="@string/address" android:singleLine="true" - app:layout_constraintBottom_toTopOf="@id/amount_edittext" + app:layout_constraintBottom_toTopOf="@id/donate_label_textview" app:layout_constraintEnd_toStartOf="@id/paste_address_imagebutton" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/selected_utxos_value_textview" tools:visibility="visible" /> - + @@ -214,7 +222,7 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/send_monero_textview" - tools:visibility="visible" /> + tools:visibility="gone" /> + tools:visibility="gone" /> + tools:visibility="gone" />