mirror of
https://codeberg.org/anoncontributorxmr/mysu.git
synced 2024-11-13 22:53:29 +01:00
Transaction output item now has two paste buttons, one for amount and one for address
This commit is contained in:
parent
511cf1ea0e
commit
69c62ee713
@ -64,7 +64,7 @@ public class SendFragment extends Fragment {
|
|||||||
private final ActivityResultLauncher<ScanOptions> qrCodeLauncher = registerForActivityResult(new ScanContract(), result -> {
|
private final ActivityResultLauncher<ScanOptions> qrCodeLauncher = registerForActivityResult(new ScanContract(), result -> {
|
||||||
if (result.getContents() != null) {
|
if (result.getContents() != null) {
|
||||||
if(currentEntryIndex != -1) {
|
if(currentEntryIndex != -1) {
|
||||||
pasteAddress(getDestView(currentEntryIndex), result.getContents());
|
pasteAddress(getDestView(currentEntryIndex), result.getContents(), false);
|
||||||
currentEntryIndex = -1;
|
currentEntryIndex = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -221,12 +221,21 @@ public class SendFragment extends Fragment {
|
|||||||
ConstraintLayout entryView = (ConstraintLayout)inflater.inflate(R.layout.transaction_output_item, null);
|
ConstraintLayout entryView = (ConstraintLayout)inflater.inflate(R.layout.transaction_output_item, null);
|
||||||
ImageButton removeOutputImageButton = entryView.findViewById(R.id.remove_output_imagebutton);
|
ImageButton removeOutputImageButton = entryView.findViewById(R.id.remove_output_imagebutton);
|
||||||
|
|
||||||
|
entryView.findViewById(R.id.paste_amount_imagebutton).setOnClickListener(view1 -> {
|
||||||
|
Context ctx = getContext();
|
||||||
|
if (ctx != null) {
|
||||||
|
String clipboard = Helper.getClipBoardText(ctx);
|
||||||
|
if (clipboard != null) {
|
||||||
|
pasteAddress(entryView, clipboard, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
entryView.findViewById(R.id.paste_address_imagebutton).setOnClickListener(view1 -> {
|
entryView.findViewById(R.id.paste_address_imagebutton).setOnClickListener(view1 -> {
|
||||||
Context ctx = getContext();
|
Context ctx = getContext();
|
||||||
if (ctx != null) {
|
if (ctx != null) {
|
||||||
String clipboard = Helper.getClipBoardText(ctx);
|
String clipboard = Helper.getClipBoardText(ctx);
|
||||||
if (clipboard != null) {
|
if (clipboard != null) {
|
||||||
pasteAddress(entryView, clipboard);
|
pasteAddress(entryView, clipboard, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -312,8 +321,8 @@ public class SendFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pasteAddress(ConstraintLayout entryView, String address) {
|
private void pasteAddress(ConstraintLayout entryView, String clipboard, boolean pastingAmount) {
|
||||||
UriData uriData = UriData.parse(address);
|
UriData uriData = UriData.parse(clipboard);
|
||||||
if (uriData != null) {
|
if (uriData != null) {
|
||||||
EditText addressField = entryView.findViewById(R.id.address_edittext);
|
EditText addressField = entryView.findViewById(R.id.address_edittext);
|
||||||
addressField.setText(uriData.getAddress());
|
addressField.setText(uriData.getAddress());
|
||||||
@ -322,10 +331,21 @@ public class SendFragment extends Fragment {
|
|||||||
EditText amountField = entryView.findViewById(R.id.amount_edittext);
|
EditText amountField = entryView.findViewById(R.id.amount_edittext);
|
||||||
amountField.setText(uriData.getAmount());
|
amountField.setText(uriData.getAmount());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if(pastingAmount) {
|
||||||
|
try {
|
||||||
|
Double.parseDouble(clipboard);
|
||||||
|
sendMaxButton.setEnabled(false);
|
||||||
|
EditText amountField = entryView.findViewById(R.id.amount_edittext);
|
||||||
|
amountField.setText(clipboard);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Toast.makeText(getActivity(), getString(R.string.send_amount_invalid), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getActivity(), getString(R.string.send_address_invalid), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), getString(R.string.send_address_invalid), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void createTx(List<Pair<String, String>> dests, boolean sendAll, PendingTransaction.Priority feePriority) {
|
private void createTx(List<Pair<String, String>> dests, boolean sendAll, PendingTransaction.Priority feePriority) {
|
||||||
((MoneroApplication)getActivity().getApplication()).getExecutor().execute(() -> {
|
((MoneroApplication)getActivity().getApplication()).getExecutor().execute(() -> {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
android:inputType="numberDecimal"
|
android:inputType="numberDecimal"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toTopOf="@id/address_edittext"
|
app:layout_constraintBottom_toTopOf="@id/address_edittext"
|
||||||
app:layout_constraintEnd_toStartOf="@id/paste_address_imagebutton"
|
app:layout_constraintEnd_toStartOf="@id/paste_amount_imagebutton"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
@ -54,17 +54,31 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:layout_marginEnd="24dp"
|
|
||||||
android:layout_marginBottom="4dp"
|
android:layout_marginBottom="4dp"
|
||||||
android:background="@drawable/edittext_bg"
|
android:background="@drawable/edittext_bg"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
android:ellipsize="middle"
|
android:ellipsize="middle"
|
||||||
android:hint="@string/address"
|
android:hint="@string/address"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toStartOf="@id/paste_address_imagebutton"
|
||||||
app:layout_constraintStart_toEndOf="@id/to_address_label_textview"
|
app:layout_constraintStart_toEndOf="@id/to_address_label_textview"
|
||||||
app:layout_constraintTop_toBottomOf="@id/amount_edittext"
|
app:layout_constraintTop_toBottomOf="@id/amount_edittext"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/paste_amount_imagebutton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:minWidth="48dp"
|
||||||
|
android:minHeight="48dp"
|
||||||
|
android:src="@drawable/ic_content_paste_24dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/amount_edittext"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/remove_output_imagebutton"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/amount_edittext"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/amount_edittext"
|
||||||
|
tools:ignore="SpeakableTextPresentCheck"
|
||||||
|
tools:visibility="visible" />
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/paste_address_imagebutton"
|
android:id="@+id/paste_address_imagebutton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -74,13 +88,12 @@
|
|||||||
android:minWidth="48dp"
|
android:minWidth="48dp"
|
||||||
android:minHeight="48dp"
|
android:minHeight="48dp"
|
||||||
android:src="@drawable/ic_content_paste_24dp"
|
android:src="@drawable/ic_content_paste_24dp"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/amount_edittext"
|
app:layout_constraintBottom_toBottomOf="@id/address_edittext"
|
||||||
app:layout_constraintEnd_toStartOf="@id/scan_address_imagebutton"
|
app:layout_constraintEnd_toStartOf="@id/scan_address_imagebutton"
|
||||||
app:layout_constraintStart_toEndOf="@id/amount_edittext"
|
app:layout_constraintStart_toEndOf="@id/address_edittext"
|
||||||
app:layout_constraintTop_toTopOf="@id/amount_edittext"
|
app:layout_constraintTop_toTopOf="@id/address_edittext"
|
||||||
tools:ignore="SpeakableTextPresentCheck"
|
tools:ignore="SpeakableTextPresentCheck"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/scan_address_imagebutton"
|
android:id="@+id/scan_address_imagebutton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -88,11 +101,12 @@
|
|||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:minWidth="48dp"
|
android:minWidth="48dp"
|
||||||
android:minHeight="48dp"
|
android:minHeight="48dp"
|
||||||
|
android:layout_marginEnd="24dp"
|
||||||
android:src="@drawable/ic_scan"
|
android:src="@drawable/ic_scan"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/amount_edittext"
|
app:layout_constraintBottom_toBottomOf="@id/address_edittext"
|
||||||
app:layout_constraintEnd_toStartOf="@id/remove_output_imagebutton"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/paste_address_imagebutton"
|
app:layout_constraintStart_toEndOf="@id/paste_address_imagebutton"
|
||||||
app:layout_constraintTop_toTopOf="@id/amount_edittext"
|
app:layout_constraintTop_toTopOf="@id/address_edittext"
|
||||||
tools:ignore="SpeakableTextPresentCheck"
|
tools:ignore="SpeakableTextPresentCheck"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
<ImageButton
|
<ImageButton
|
||||||
@ -106,7 +120,7 @@
|
|||||||
android:src="@android:drawable/ic_delete"
|
android:src="@android:drawable/ic_delete"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/amount_edittext"
|
app:layout_constraintBottom_toBottomOf="@id/amount_edittext"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/scan_address_imagebutton"
|
app:layout_constraintStart_toEndOf="@id/paste_amount_imagebutton"
|
||||||
app:layout_constraintTop_toTopOf="@id/amount_edittext"
|
app:layout_constraintTop_toTopOf="@id/amount_edittext"
|
||||||
tools:ignore="SpeakableTextPresentCheck"
|
tools:ignore="SpeakableTextPresentCheck"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
<string name="bad_password">Incorrect password!</string>
|
<string name="bad_password">Incorrect password!</string>
|
||||||
|
|
||||||
<string name="send_address_invalid">Not a valid address</string>
|
<string name="send_address_invalid">Not a valid address</string>
|
||||||
|
<string name="send_amount_invalid">Not a valid amount</string>
|
||||||
|
|
||||||
<string name="tx_list_failed_text">failed</string>
|
<string name="tx_list_failed_text">failed</string>
|
||||||
<string name="tx_list_amount_negative">- %1$s</string>
|
<string name="tx_list_amount_negative">- %1$s</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user