mirror of
https://codeberg.org/r4v3r23/mysu.git
synced 2024-11-09 23:50:02 +00:00
Enforce sending all when churning
This commit is contained in:
parent
9d8bc28fdc
commit
55fa5340ed
3 changed files with 10 additions and 2 deletions
|
@ -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 -> {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue