From 73646e3f46cf3d239571e2b8090da39eaacae252 Mon Sep 17 00:00:00 2001 From: pokkst Date: Sun, 14 May 2023 02:41:51 -0500 Subject: [PATCH] Make send button into slider --- app/build.gradle | 2 +- .../adapter/TransactionInfoAdapter.java | 1 - .../wallet/fragment/send/SendFragment.java | 14 ++++++------ app/src/main/res/layout/fragment_send.xml | 22 ++++++++++++------- .../res/layout/transaction_history_item.xml | 10 +++++---- app/src/main/res/values/strings.xml | 1 + 6 files changed, 29 insertions(+), 21 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c059253..6fdf5a4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -135,7 +135,7 @@ dependencies { implementation 'androidx.preference:preference:1.2.0' implementation 'com.google.android.material:material:1.8.0' - + implementation 'com.ncorti:slidetoact:0.9.0' implementation 'com.journeyapps:zxing-android-embedded:4.3.0' implementation "com.squareup.okhttp3:okhttp:4.10.0" implementation "io.github.rburgst:okhttp-digest:2.6" diff --git a/app/src/main/java/net/mynero/wallet/adapter/TransactionInfoAdapter.java b/app/src/main/java/net/mynero/wallet/adapter/TransactionInfoAdapter.java index d0d162e..c8001e7 100644 --- a/app/src/main/java/net/mynero/wallet/adapter/TransactionInfoAdapter.java +++ b/app/src/main/java/net/mynero/wallet/adapter/TransactionInfoAdapter.java @@ -129,7 +129,6 @@ public class TransactionInfoAdapter extends RecyclerView.Adapter { + sendTxSlider.setOnSlideCompleteListener(slideToActView -> { PendingTransaction pendingTx = mViewModel.pendingTransaction.getValue(); if (pendingTx != null) { Toast.makeText(getActivity(), getString(R.string.sending_tx), Toast.LENGTH_SHORT).show(); - sendButton.setEnabled(false); sendTx(pendingTx); } }); @@ -359,7 +359,7 @@ public class SendFragment extends Fragment { feeRadioGroup.setVisibility(View.GONE); feeRadioGroupLabelTextView.setVisibility(View.GONE); - sendButton.setVisibility(View.VISIBLE); + sendTxSlider.setVisibility(View.VISIBLE); feeTextView.setVisibility(View.VISIBLE); addressTextView.setVisibility(View.VISIBLE); amountTextView.setVisibility(View.VISIBLE); @@ -371,7 +371,7 @@ public class SendFragment extends Fragment { feeRadioGroup.setVisibility(View.VISIBLE); feeRadioGroupLabelTextView.setVisibility(View.VISIBLE); - sendButton.setVisibility(View.GONE); + sendTxSlider.setVisibility(View.GONE); feeTextView.setVisibility(View.GONE); addressTextView.setVisibility(View.GONE); amountTextView.setVisibility(View.GONE); @@ -465,7 +465,7 @@ public class SendFragment extends Fragment { Toast.makeText(getActivity(), getString(R.string.sent_tx), Toast.LENGTH_SHORT).show(); getActivity().onBackPressed(); } else { - sendButton.setEnabled(true); + sendTxSlider.resetSlider(); Toast.makeText(getActivity(), getString(R.string.error_sending_tx), Toast.LENGTH_SHORT).show(); } }); diff --git a/app/src/main/res/layout/fragment_send.xml b/app/src/main/res/layout/fragment_send.xml index dfd07b5..37a0f3b 100644 --- a/app/src/main/res/layout/fragment_send.xml +++ b/app/src/main/res/layout/fragment_send.xml @@ -203,18 +203,24 @@ app:layout_constraintTop_toBottomOf="@id/amount_pending_textview" tools:visibility="gone" /> -