Add donate button to send dialog

This commit is contained in:
pokkst 2022-12-03 13:48:51 -06:00
parent 713c34da72
commit 3f0c213b47
No known key found for this signature in database
GPG key ID: 90C2ED85E67A50FF
4 changed files with 26 additions and 11 deletions

View file

@ -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);
}
}

View file

@ -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";
}

View file

@ -6,8 +6,6 @@
android:layout_height="match_parent"
android:background="@color/oled_dialogBackgroundColor"
android:fitsSystemWindows="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -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" />
<TextView
android:id="@+id/donate_label_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/donate_label"
android:layout_marginStart="24dp"
android:layout_marginBottom="16dp"
android:textSize="14sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/address_edittext"
app:layout_constraintBottom_toTopOf="@id/amount_edittext"/>
<ImageButton
android:id="@+id/paste_address_imagebutton"
android:layout_width="wrap_content"
@ -192,7 +200,7 @@
android:layout_marginStart="24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tx_fee_radiogroup"
app:layout_constraintTop_toBottomOf="@id/tx_fee_radiogroup_label_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" />
<TextView
android:id="@+id/amount_pending_textview"
@ -231,7 +239,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/address_pending_textview"
tools:visibility="visible" />
tools:visibility="gone" />
<TextView
android:id="@+id/fee_textview"
@ -248,7 +256,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/amount_pending_textview"
tools:visibility="visible" />
tools:visibility="gone" />
<Button
android:id="@+id/send_tx_button"
@ -264,7 +272,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/fee_textview"
tools:visibility="visible" />
tools:visibility="gone" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

View file

@ -119,4 +119,5 @@
<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>
<string name="donate_label">Donate to MyNero</string>
</resources>