second spend confirmation for mainnet

This commit is contained in:
m2049r 2017-08-29 22:04:39 +02:00
parent e39cd1c988
commit 186ed5cd39
3 changed files with 219 additions and 196 deletions

View File

@ -60,6 +60,7 @@ public class SendFragment extends Fragment {
TextView tvTxDust;
EditText etNotes;
Button bSend;
Button bReallySend;
ProgressBar pbProgress;
final static int Mixins[] = {4, 6, 8, 10, 13}; // must match the layout XML
@ -90,6 +91,7 @@ public class SendFragment extends Fragment {
tvTxDust = (TextView) view.findViewById(R.id.tvTxDust);
etNotes = (EditText) view.findViewById(R.id.etNotes);
bSend = (Button) view.findViewById(R.id.bSend);
bReallySend = (Button) view.findViewById(R.id.bReallySend);
pbProgress = (ProgressBar) view.findViewById(R.id.pbProgress);
@ -229,6 +231,19 @@ public class SendFragment extends Fragment {
@Override
public void onClick(View v) {
bSend.setEnabled(false);
boolean testnet = WalletManager.getInstance().isTestNet();
if (testnet) {
send();
} else {
bReallySend.setVisibility(View.VISIBLE);
}
}
});
bReallySend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bReallySend.setEnabled(false);
send();
}
});
@ -310,6 +325,7 @@ public class SendFragment extends Fragment {
bSweep.setEnabled(true);
bPrepareSend.setEnabled(true);
llConfirmSend.setVisibility(View.GONE);
bReallySend.setVisibility(View.GONE);
}
private void send() {

View File

@ -1,246 +1,252 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="match_parent">
<LinearLayout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
android:layout_height="match_parent"
android:orientation="vertical">
<Spinner
android:id="@+id/sMixin"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:entries="@array/mixin"
android:textAlignment="center" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<Spinner
android:id="@+id/sPriority"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:entries="@array/priority"
android:textAlignment="center" />
<Spinner
android:id="@+id/sMixin"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:entries="@array/mixin"
android:textAlignment="center" />
</LinearLayout>
<Spinner
android:id="@+id/sPriority"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:entries="@array/priority"
android:textAlignment="center" />
<EditText
android:id="@+id/etAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/send_address_hint"
android:imeOptions="actionNext"
android:inputType="textMultiLine"
android:textAlignment="center"
android:textSize="16sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="10">
</LinearLayout>
<EditText
android:id="@+id/etPaymentId"
android:layout_width="0dp"
android:id="@+id/etAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="8"
android:hint="@string/send_paymentid_hint"
android:hint="@string/send_address_hint"
android:imeOptions="actionNext"
android:inputType="textMultiLine"
android:textAlignment="center"
android:textSize="16sp" />
<Button
android:id="@+id/bPaymentId"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:layout_weight="2"
android:background="@color/colorPrimary"
android:enabled="true"
android:text="@string/send_generate_paymentid_hint"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="10">
<EditText
android:id="@+id/etAmount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="8"
android:hint="@string/send_amount_hint"
android:imeOptions="actionDone"
android:inputType="numberDecimal"
android:textAlignment="center"
android:textSize="16sp" />
<Button
android:id="@+id/bSweep"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:layout_weight="2"
android:background="@color/colorPrimary"
android:enabled="true"
android:text="@string/send_sweep_hint"
android:visibility="invisible" />
</LinearLayout>
<Button
android:id="@+id/bPrepareSend"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="@color/colorPrimary"
android:enabled="false"
android:text="@string/send_prepare_hint" />
<ProgressBar
android:id="@+id/pbProgress"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone" />
<LinearLayout
android:id="@+id/llConfirmSend"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<Button
android:id="@+id/bDispose"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="@color/colorPrimary"
android:text="@string/send_dispose_hint" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
android:weightSum="10">
<TextView
android:id="@+id/tvTxAmountLabel"
<EditText
android:id="@+id/etPaymentId"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:text="@string/send_amount_label"
android:textAlignment="textEnd"
android:textColor="@color/colorAccent"
android:textSize="20sp" />
android:layout_weight="8"
android:hint="@string/send_paymentid_hint"
android:imeOptions="actionNext"
android:inputType="textMultiLine"
android:textAlignment="center"
android:textSize="16sp" />
<TextView
android:id="@+id/tvTxAmount"
<Button
android:id="@+id/bPaymentId"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:layout_weight="2"
android:textAlignment="textEnd"
android:textSize="20sp" />
android:background="@color/colorPrimary"
android:enabled="true"
android:text="@string/send_generate_paymentid_hint"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
android:weightSum="10">
<TextView
android:id="@+id/tvTxFeeLabel"
<EditText
android:id="@+id/etAmount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:text="@string/send_fee_label"
android:textAlignment="textEnd"
android:textColor="@color/colorAccent"
android:textSize="20sp" />
android:layout_weight="8"
android:hint="@string/send_amount_hint"
android:imeOptions="actionDone"
android:inputType="numberDecimal"
android:textAlignment="center"
android:textSize="16sp" />
<TextView
android:id="@+id/tvTxFee"
<Button
android:id="@+id/bSweep"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:layout_weight="2"
android:textAlignment="textEnd"
android:textSize="20sp" />
android:background="@color/colorPrimary"
android:enabled="true"
android:text="@string/send_sweep_hint"
android:visibility="invisible" />
</LinearLayout>
<Button
android:id="@+id/bPrepareSend"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="@color/colorPrimary"
android:enabled="false"
android:text="@string/send_prepare_hint" />
<ProgressBar
android:id="@+id/pbProgress"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone" />
<LinearLayout
android:id="@+id/llConfirmSend"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
android:orientation="vertical"
android:visibility="gone">
<TextView
android:id="@+id/tvTxDustLabel"
android:layout_width="0dp"
<Button
android:id="@+id/bDispose"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:text="@string/send_dust_label"
android:textAlignment="textEnd"
android:textColor="@color/colorAccent"
android:textSize="20sp" />
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="@color/colorPrimary"
android:text="@string/send_dispose_hint" />
<TextView
android:id="@+id/tvTxDust"
android:layout_width="0dp"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_weight="2"
android:textAlignment="textEnd"
android:textSize="20sp" />
android:orientation="horizontal"
android:weightSum="3">
<TextView
android:id="@+id/tvTxAmountLabel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:text="@string/send_amount_label"
android:textAlignment="textEnd"
android:textColor="@color/colorAccent"
android:textSize="20sp" />
<TextView
android:id="@+id/tvTxAmount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_weight="2"
android:textAlignment="textEnd"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<TextView
android:id="@+id/tvTxFeeLabel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:text="@string/send_fee_label"
android:textAlignment="textEnd"
android:textColor="@color/colorAccent"
android:textSize="20sp" />
<TextView
android:id="@+id/tvTxFee"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_weight="2"
android:textAlignment="textEnd"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<TextView
android:id="@+id/tvTxDustLabel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:text="@string/send_dust_label"
android:textAlignment="textEnd"
android:textColor="@color/colorAccent"
android:textSize="20sp" />
<TextView
android:id="@+id/tvTxDust"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_weight="2"
android:textAlignment="textEnd"
android:textSize="20sp" />
</LinearLayout>
<EditText
android:id="@+id/etNotes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:hint="@string/send_notes_hint"
android:imeOptions="actionDone"
android:inputType="textMultiLine"
android:textAlignment="center"
android:textSize="16sp" />
<Button
android:id="@+id/bSend"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="@color/colorPrimary"
android:text="@string/send_send_hint" />
<Button
android:id="@+id/bReallySend"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="@color/moneroOrange"
android:text="@string/send_really_send_hint"
android:visibility="gone" />
</LinearLayout>
<EditText
android:id="@+id/etNotes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:hint="@string/send_notes_hint"
android:imeOptions="actionDone"
android:inputType="textMultiLine"
android:textAlignment="center"
android:textSize="16sp" />
<Button
android:id="@+id/bSend"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="@color/colorPrimary"
android:text="@string/send_send_hint" />
<Button
android:id="@+id/bSend"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="@color/colorPrimary"
android:text="@string/send_send_hint" />
</LinearLayout>
</LinearLayout>
</ScrollView>

View File

@ -114,6 +114,7 @@
<string name="send_prepare_hint">Prepare</string>
<string name="send_dispose_hint">Dispose (Undo)</string>
<string name="send_send_hint">Spend my sweet Moneroj</string>
<string name="send_really_send_hint">I understand I am on mainnet\nTHis is real Monero!</string>
<string name="send_preparing_progress">Preparing transaction</string>