mirror of
https://codeberg.org/r4v3r23/mysu.git
synced 2024-11-09 23:50:02 +00:00
Make send button into slider
This commit is contained in:
parent
991a806748
commit
73646e3f46
6 changed files with 29 additions and 21 deletions
|
@ -135,7 +135,7 @@ dependencies {
|
||||||
implementation 'androidx.preference:preference:1.2.0'
|
implementation 'androidx.preference:preference:1.2.0'
|
||||||
|
|
||||||
implementation 'com.google.android.material:material:1.8.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.journeyapps:zxing-android-embedded:4.3.0'
|
||||||
implementation "com.squareup.okhttp3:okhttp:4.10.0"
|
implementation "com.squareup.okhttp3:okhttp:4.10.0"
|
||||||
implementation "io.github.rburgst:okhttp-digest:2.6"
|
implementation "io.github.rburgst:okhttp-digest:2.6"
|
||||||
|
|
|
@ -129,7 +129,6 @@ public class TransactionInfoAdapter extends RecyclerView.Adapter<TransactionInfo
|
||||||
confirmationsProgressBar.setVisibility(View.GONE);
|
confirmationsProgressBar.setVisibility(View.GONE);
|
||||||
} else if (txInfo.isPending) {
|
} else if (txInfo.isPending) {
|
||||||
setTxColour(pendingColour);
|
setTxColour(pendingColour);
|
||||||
confirmationsProgressBar.setVisibility(View.GONE);
|
|
||||||
confirmationsProgressBar.setIndeterminate(true);
|
confirmationsProgressBar.setIndeterminate(true);
|
||||||
confirmationsProgressBar.setVisibility(View.VISIBLE);
|
confirmationsProgressBar.setVisibility(View.VISIBLE);
|
||||||
confirmationsTextView.setVisibility(View.GONE);
|
confirmationsTextView.setVisibility(View.GONE);
|
||||||
|
|
|
@ -31,6 +31,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||||
import com.google.zxing.client.android.Intents;
|
import com.google.zxing.client.android.Intents;
|
||||||
import com.journeyapps.barcodescanner.ScanContract;
|
import com.journeyapps.barcodescanner.ScanContract;
|
||||||
import com.journeyapps.barcodescanner.ScanOptions;
|
import com.journeyapps.barcodescanner.ScanOptions;
|
||||||
|
import com.ncorti.slidetoact.SlideToActView;
|
||||||
|
|
||||||
import net.mynero.wallet.MoneroApplication;
|
import net.mynero.wallet.MoneroApplication;
|
||||||
import net.mynero.wallet.R;
|
import net.mynero.wallet.R;
|
||||||
|
@ -53,7 +54,7 @@ public class SendFragment extends Fragment {
|
||||||
private LinearLayout destList;
|
private LinearLayout destList;
|
||||||
private LayoutInflater inflater;
|
private LayoutInflater inflater;
|
||||||
private Button createButton;
|
private Button createButton;
|
||||||
private Button sendButton;
|
private SlideToActView sendTxSlider;
|
||||||
private RadioGroup feeRadioGroup;
|
private RadioGroup feeRadioGroup;
|
||||||
private TextView feeRadioGroupLabelTextView;
|
private TextView feeRadioGroupLabelTextView;
|
||||||
|
|
||||||
|
@ -97,7 +98,7 @@ public class SendFragment extends Fragment {
|
||||||
createButton = view.findViewById(R.id.create_tx_button);
|
createButton = view.findViewById(R.id.create_tx_button);
|
||||||
feeRadioGroup = view.findViewById(R.id.tx_fee_radiogroup);
|
feeRadioGroup = view.findViewById(R.id.tx_fee_radiogroup);
|
||||||
feeTextView = view.findViewById(R.id.fee_textview);
|
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);
|
addressTextView = view.findViewById(R.id.address_pending_textview);
|
||||||
amountTextView = view.findViewById(R.id.amount_pending_textview);
|
amountTextView = view.findViewById(R.id.amount_pending_textview);
|
||||||
feeRadioGroup = view.findViewById(R.id.tx_fee_radiogroup);
|
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();
|
PendingTransaction pendingTx = mViewModel.pendingTransaction.getValue();
|
||||||
if (pendingTx != null) {
|
if (pendingTx != null) {
|
||||||
Toast.makeText(getActivity(), getString(R.string.sending_tx), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), getString(R.string.sending_tx), Toast.LENGTH_SHORT).show();
|
||||||
sendButton.setEnabled(false);
|
|
||||||
sendTx(pendingTx);
|
sendTx(pendingTx);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -359,7 +359,7 @@ public class SendFragment extends Fragment {
|
||||||
feeRadioGroup.setVisibility(View.GONE);
|
feeRadioGroup.setVisibility(View.GONE);
|
||||||
feeRadioGroupLabelTextView.setVisibility(View.GONE);
|
feeRadioGroupLabelTextView.setVisibility(View.GONE);
|
||||||
|
|
||||||
sendButton.setVisibility(View.VISIBLE);
|
sendTxSlider.setVisibility(View.VISIBLE);
|
||||||
feeTextView.setVisibility(View.VISIBLE);
|
feeTextView.setVisibility(View.VISIBLE);
|
||||||
addressTextView.setVisibility(View.VISIBLE);
|
addressTextView.setVisibility(View.VISIBLE);
|
||||||
amountTextView.setVisibility(View.VISIBLE);
|
amountTextView.setVisibility(View.VISIBLE);
|
||||||
|
@ -371,7 +371,7 @@ public class SendFragment extends Fragment {
|
||||||
feeRadioGroup.setVisibility(View.VISIBLE);
|
feeRadioGroup.setVisibility(View.VISIBLE);
|
||||||
feeRadioGroupLabelTextView.setVisibility(View.VISIBLE);
|
feeRadioGroupLabelTextView.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
sendButton.setVisibility(View.GONE);
|
sendTxSlider.setVisibility(View.GONE);
|
||||||
feeTextView.setVisibility(View.GONE);
|
feeTextView.setVisibility(View.GONE);
|
||||||
addressTextView.setVisibility(View.GONE);
|
addressTextView.setVisibility(View.GONE);
|
||||||
amountTextView.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();
|
Toast.makeText(getActivity(), getString(R.string.sent_tx), Toast.LENGTH_SHORT).show();
|
||||||
getActivity().onBackPressed();
|
getActivity().onBackPressed();
|
||||||
} else {
|
} else {
|
||||||
sendButton.setEnabled(true);
|
sendTxSlider.resetSlider();
|
||||||
Toast.makeText(getActivity(), getString(R.string.error_sending_tx), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), getString(R.string.error_sending_tx), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -203,18 +203,24 @@
|
||||||
app:layout_constraintTop_toBottomOf="@id/amount_pending_textview"
|
app:layout_constraintTop_toBottomOf="@id/amount_pending_textview"
|
||||||
tools:visibility="gone" />
|
tools:visibility="gone" />
|
||||||
|
|
||||||
<Button
|
<com.ncorti.slidetoact.SlideToActView
|
||||||
android:id="@+id/send_tx_button"
|
android:id="@+id/send_tx_slider"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginStart="32dp"
|
||||||
android:layout_marginEnd="24dp"
|
android:layout_marginEnd="32dp"
|
||||||
android:layout_marginStart="24dp"
|
|
||||||
android:layout_marginBottom="24dp"
|
android:layout_marginBottom="24dp"
|
||||||
android:background="@drawable/button_bg"
|
android:elevation="6dp"
|
||||||
android:text="@string/send"
|
|
||||||
android:visibility="gone"
|
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_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
tools:visibility="visible" />
|
app:text_size="18sp"
|
||||||
|
tools:visibility="visible"/>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -22,8 +22,8 @@
|
||||||
app:indicatorSize="30dp"
|
app:indicatorSize="30dp"
|
||||||
app:trackThickness="4dp"
|
app:trackThickness="4dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@id/tx_amount"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/tx_failed"/>
|
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvConfirmations"
|
android:id="@+id/tvConfirmations"
|
||||||
|
@ -45,7 +45,8 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
tools:text="+ 999.999999"
|
tools:text="+ 999.999999"
|
||||||
android:layout_marginStart="8dp"
|
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_constraintStart_toEndOf="@id/pbConfirmations"
|
||||||
app:layout_constraintEnd_toStartOf="@id/tx_datetime"/>
|
app:layout_constraintEnd_toStartOf="@id/tx_datetime"/>
|
||||||
|
|
||||||
|
@ -55,8 +56,9 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/tx_list_failed_text"
|
android:text="@string/tx_list_failed_text"
|
||||||
|
android:visibility="gone"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="@id/pbConfirmations"
|
||||||
app:layout_constraintStart_toEndOf="@id/pbConfirmations"
|
app:layout_constraintStart_toEndOf="@id/pbConfirmations"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tx_amount"/>
|
app:layout_constraintTop_toBottomOf="@id/tx_amount"/>
|
||||||
|
|
||||||
|
|
|
@ -127,5 +127,6 @@
|
||||||
<string name="to">To</string>
|
<string name="to">To</string>
|
||||||
<string name="max_outputs_allowed">Maximum allowed outputs</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="paymentid_paytomany">Cannot send to integrated addresses in a pay-to-many transaction</string>
|
||||||
|
<string name="slide_to_send">Slide to send</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue