Make send button into slider

This commit is contained in:
pokkst 2023-05-14 02:41:51 -05:00
parent 991a806748
commit 73646e3f46
No known key found for this signature in database
GPG Key ID: 90C2ED85E67A50FF
6 changed files with 29 additions and 21 deletions

View File

@ -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"

View File

@ -129,7 +129,6 @@ public class TransactionInfoAdapter extends RecyclerView.Adapter<TransactionInfo
confirmationsProgressBar.setVisibility(View.GONE);
} else if (txInfo.isPending) {
setTxColour(pendingColour);
confirmationsProgressBar.setVisibility(View.GONE);
confirmationsProgressBar.setIndeterminate(true);
confirmationsProgressBar.setVisibility(View.VISIBLE);
confirmationsTextView.setVisibility(View.GONE);

View File

@ -31,6 +31,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.google.zxing.client.android.Intents;
import com.journeyapps.barcodescanner.ScanContract;
import com.journeyapps.barcodescanner.ScanOptions;
import com.ncorti.slidetoact.SlideToActView;
import net.mynero.wallet.MoneroApplication;
import net.mynero.wallet.R;
@ -53,7 +54,7 @@ public class SendFragment extends Fragment {
private LinearLayout destList;
private LayoutInflater inflater;
private Button createButton;
private Button sendButton;
private SlideToActView sendTxSlider;
private RadioGroup feeRadioGroup;
private TextView feeRadioGroupLabelTextView;
@ -97,7 +98,7 @@ public class SendFragment extends Fragment {
createButton = view.findViewById(R.id.create_tx_button);
feeRadioGroup = view.findViewById(R.id.tx_fee_radiogroup);
feeTextView = view.findViewById(R.id.fee_textview);
sendButton = view.findViewById(R.id.send_tx_button);
sendTxSlider = view.findViewById(R.id.send_tx_slider);
addressTextView = view.findViewById(R.id.address_pending_textview);
amountTextView = view.findViewById(R.id.amount_pending_textview);
feeRadioGroup = view.findViewById(R.id.tx_fee_radiogroup);
@ -154,11 +155,10 @@ public class SendFragment extends Fragment {
}
});
sendButton.setOnClickListener(view1 -> {
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();
}
});

View File

@ -203,18 +203,24 @@
app:layout_constraintTop_toBottomOf="@id/amount_pending_textview"
tools:visibility="gone" />
<Button
android:id="@+id/send_tx_button"
<com.ncorti.slidetoact.SlideToActView
android:id="@+id/send_tx_slider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:layout_marginStart="24dp"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:layout_marginBottom="24dp"
android:background="@drawable/button_bg"
android:text="@string/send"
android:elevation="6dp"
android:visibility="gone"
app:area_margin="10dp"
app:border_radius="20dp"
app:inner_color="@android:color/white"
app:outer_color="@color/oled_colorSecondary"
app:slider_height="72dp"
app:slider_locked="false"
app:text="@string/slide_to_send"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:visibility="visible" />
app:text_size="18sp"
tools:visibility="visible"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -22,8 +22,8 @@
app:indicatorSize="30dp"
app:trackThickness="4dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/tx_amount"
app:layout_constraintBottom_toBottomOf="@id/tx_failed"/>
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<TextView
android:id="@+id/tvConfirmations"
@ -45,7 +45,8 @@
android:layout_height="wrap_content"
tools:text="+ 999.999999"
android:layout_marginStart="8dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tx_failed"
app:layout_constraintTop_toTopOf="@id/pbConfirmations"
app:layout_constraintStart_toEndOf="@id/pbConfirmations"
app:layout_constraintEnd_toStartOf="@id/tx_datetime"/>
@ -55,8 +56,9 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/tx_list_failed_text"
android:visibility="gone"
android:layout_marginStart="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toBottomOf="@id/pbConfirmations"
app:layout_constraintStart_toEndOf="@id/pbConfirmations"
app:layout_constraintTop_toBottomOf="@id/tx_amount"/>

View File

@ -127,5 +127,6 @@
<string name="to">To</string>
<string name="max_outputs_allowed">Maximum allowed outputs</string>
<string name="paymentid_paytomany">Cannot send to integrated addresses in a pay-to-many transaction</string>
<string name="slide_to_send">Slide to send</string>
</resources>