Enforce sending all when churning

This commit is contained in:
pokkst 2022-10-08 00:41:44 -05:00
parent 9d8bc28fdc
commit 55fa5340ed
No known key found for this signature in database
GPG key ID: 90C2ED85E67A50FF
3 changed files with 10 additions and 2 deletions

View file

@ -120,6 +120,8 @@ public class SendBottomSheetDialog extends BottomSheetDialogFragment {
String valueString = Wallet.getDisplayAmount(selectedValue);
selectedUtxosValueTextView.setVisibility(View.VISIBLE);
if(isChurning) {
_sendingMax.postValue(true);
sendMaxButton.setEnabled(false);
selectedUtxosValueTextView.setText(getResources().getString(R.string.selected_utxos_value_churning, valueString));
} else {
selectedUtxosValueTextView.setText(getResources().getString(R.string.selected_utxos_value, valueString));
@ -136,7 +138,9 @@ public class SendBottomSheetDialog extends BottomSheetDialogFragment {
BalanceService.getInstance().balance.observe(getViewLifecycleOwner(), balance -> {
createButton.setEnabled(balance != 0);
sendMaxButton.setEnabled(balance != 0);
if(!isChurning) {
sendMaxButton.setEnabled(balance != 0);
}
});
sendingMax.observe(getViewLifecycleOwner(), sendingMax -> {

View file

@ -59,7 +59,7 @@ public class UtxosFragment extends Fragment implements CoinsInfoAdapter.CoinsInf
churnUtxosButton.setOnClickListener(view1 -> {
SendBottomSheetDialog sendDialog = new SendBottomSheetDialog();
sendDialog.isChurning = true;
sendDialog.uriData = UriData.parse(AddressService.getInstance().getLatestSubaddress().getAddress());
sendDialog.uriData = UriData.parse(AddressService.getInstance().currentSubaddress().getAddress());
sendDialog.selectedUtxos = selectedUtxos;
sendDialog.show(getActivity().getSupportFragmentManager(), null);
});
@ -100,8 +100,10 @@ public class UtxosFragment extends Fragment implements CoinsInfoAdapter.CoinsInf
if (selectedUtxos.isEmpty()) {
sendUtxosButton.setVisibility(View.GONE);
churnUtxosButton.setVisibility(View.GONE);
} else {
sendUtxosButton.setVisibility(View.VISIBLE);
churnUtxosButton.setVisibility(View.VISIBLE);
}
adapter.updateSelectedUtxos(selectedUtxos);

View file

@ -51,6 +51,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/button_bg_left"
android:layout_marginEnd="1dp"
android:text="@string/churn"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/send_utxos_button"
@ -61,6 +62,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/button_bg_right"
android:layout_marginStart="1dp"
android:text="@string/send"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"