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 UriData uriData = null;
public boolean isChurning = false;
public Listener listener = null;
public PendingTransaction.Priority priority;
private EditText addressEditText;
private EditText amountEditText;
@ -252,6 +253,9 @@ public class SendBottomSheetDialog extends BottomSheetDialogFragment {
activity.runOnUiThread(() -> {
if (success) {
Toast.makeText(getActivity(), getString(R.string.sent_tx), Toast.LENGTH_SHORT).show();
if(listener != null) {
listener.onSentTransaction();
}
dismiss();
} else {
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.Collections;
public class UtxosFragment extends Fragment implements CoinsInfoAdapter.CoinsInfoAdapterListener {
public class UtxosFragment extends Fragment implements CoinsInfoAdapter.CoinsInfoAdapterListener, SendBottomSheetDialog.Listener {
private UtxosViewModel mViewModel;
private final ArrayList<String> selectedUtxos = new ArrayList<>();
@ -53,11 +53,13 @@ public class UtxosFragment extends Fragment implements CoinsInfoAdapter.CoinsInf
churnUtxosButton.setVisibility(View.GONE);
sendUtxosButton.setOnClickListener(view1 -> {
SendBottomSheetDialog sendDialog = new SendBottomSheetDialog();
sendDialog.listener = this;
sendDialog.selectedUtxos = selectedUtxos;
sendDialog.show(getActivity().getSupportFragmentManager(), null);
});
churnUtxosButton.setOnClickListener(view1 -> {
SendBottomSheetDialog sendDialog = new SendBottomSheetDialog();
sendDialog.listener = this;
sendDialog.isChurning = true;
sendDialog.uriData = UriData.parse(AddressService.getInstance().currentSubaddress().getAddress());
sendDialog.selectedUtxos = selectedUtxos;
@ -108,4 +110,10 @@ public class UtxosFragment extends Fragment implements CoinsInfoAdapter.CoinsInf
adapter.updateSelectedUtxos(selectedUtxos);
}
@Override
public void onSentTransaction() {
churnUtxosButton.setVisibility(View.GONE);
sendUtxosButton.setVisibility(View.GONE);
}
}