Fix UI issue when sending tx from UTXOs fragment

This commit is contained in:
pokkst 2022-10-08 01:01:16 -05:00
parent f7250b5525
commit 967e2bc58c
No known key found for this signature in database
GPG key ID: 90C2ED85E67A50FF
2 changed files with 16 additions and 2 deletions

View file

@ -56,6 +56,7 @@ public class SendBottomSheetDialog extends BottomSheetDialogFragment {
public LiveData<PendingTransaction> pendingTransaction = _pendingTransaction; public LiveData<PendingTransaction> pendingTransaction = _pendingTransaction;
public UriData uriData = null; public UriData uriData = null;
public boolean isChurning = false; public boolean isChurning = false;
public Listener listener = null;
public PendingTransaction.Priority priority; public PendingTransaction.Priority priority;
private EditText addressEditText; private EditText addressEditText;
private EditText amountEditText; private EditText amountEditText;
@ -252,6 +253,9 @@ public class SendBottomSheetDialog extends BottomSheetDialogFragment {
activity.runOnUiThread(() -> { activity.runOnUiThread(() -> {
if (success) { if (success) {
Toast.makeText(getActivity(), getString(R.string.sent_tx), Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), getString(R.string.sent_tx), Toast.LENGTH_SHORT).show();
if(listener != null) {
listener.onSentTransaction();
}
dismiss(); dismiss();
} else { } else {
sendButton.setEnabled(true); sendButton.setEnabled(true);
@ -337,5 +341,7 @@ public class SendBottomSheetDialog extends BottomSheetDialogFragment {
} }
} }
public interface Listener {
void onSentTransaction();
}
} }

View file

@ -24,7 +24,7 @@ import net.mynero.wallet.util.UriData;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
public class UtxosFragment extends Fragment implements CoinsInfoAdapter.CoinsInfoAdapterListener { public class UtxosFragment extends Fragment implements CoinsInfoAdapter.CoinsInfoAdapterListener, SendBottomSheetDialog.Listener {
private UtxosViewModel mViewModel; private UtxosViewModel mViewModel;
private final ArrayList<String> selectedUtxos = new ArrayList<>(); private final ArrayList<String> selectedUtxos = new ArrayList<>();
@ -53,11 +53,13 @@ public class UtxosFragment extends Fragment implements CoinsInfoAdapter.CoinsInf
churnUtxosButton.setVisibility(View.GONE); churnUtxosButton.setVisibility(View.GONE);
sendUtxosButton.setOnClickListener(view1 -> { sendUtxosButton.setOnClickListener(view1 -> {
SendBottomSheetDialog sendDialog = new SendBottomSheetDialog(); SendBottomSheetDialog sendDialog = new SendBottomSheetDialog();
sendDialog.listener = this;
sendDialog.selectedUtxos = selectedUtxos; sendDialog.selectedUtxos = selectedUtxos;
sendDialog.show(getActivity().getSupportFragmentManager(), null); sendDialog.show(getActivity().getSupportFragmentManager(), null);
}); });
churnUtxosButton.setOnClickListener(view1 -> { churnUtxosButton.setOnClickListener(view1 -> {
SendBottomSheetDialog sendDialog = new SendBottomSheetDialog(); SendBottomSheetDialog sendDialog = new SendBottomSheetDialog();
sendDialog.listener = this;
sendDialog.isChurning = true; sendDialog.isChurning = true;
sendDialog.uriData = UriData.parse(AddressService.getInstance().currentSubaddress().getAddress()); sendDialog.uriData = UriData.parse(AddressService.getInstance().currentSubaddress().getAddress());
sendDialog.selectedUtxos = selectedUtxos; sendDialog.selectedUtxos = selectedUtxos;
@ -108,4 +110,10 @@ public class UtxosFragment extends Fragment implements CoinsInfoAdapter.CoinsInf
adapter.updateSelectedUtxos(selectedUtxos); adapter.updateSelectedUtxos(selectedUtxos);
} }
@Override
public void onSentTransaction() {
churnUtxosButton.setVisibility(View.GONE);
sendUtxosButton.setVisibility(View.GONE);
}
} }