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; TextView tvTxDust;
EditText etNotes; EditText etNotes;
Button bSend; Button bSend;
Button bReallySend;
ProgressBar pbProgress; ProgressBar pbProgress;
final static int Mixins[] = {4, 6, 8, 10, 13}; // must match the layout XML 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); tvTxDust = (TextView) view.findViewById(R.id.tvTxDust);
etNotes = (EditText) view.findViewById(R.id.etNotes); etNotes = (EditText) view.findViewById(R.id.etNotes);
bSend = (Button) view.findViewById(R.id.bSend); bSend = (Button) view.findViewById(R.id.bSend);
bReallySend = (Button) view.findViewById(R.id.bReallySend);
pbProgress = (ProgressBar) view.findViewById(R.id.pbProgress); pbProgress = (ProgressBar) view.findViewById(R.id.pbProgress);
@ -229,6 +231,19 @@ public class SendFragment extends Fragment {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
bSend.setEnabled(false); 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(); send();
} }
}); });
@ -310,6 +325,7 @@ public class SendFragment extends Fragment {
bSweep.setEnabled(true); bSweep.setEnabled(true);
bPrepareSend.setEnabled(true); bPrepareSend.setEnabled(true);
llConfirmSend.setVisibility(View.GONE); llConfirmSend.setVisibility(View.GONE);
bReallySend.setVisibility(View.GONE);
} }
private void send() { private void send() {

View File

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

View File

@ -114,6 +114,7 @@
<string name="send_prepare_hint">Prepare</string> <string name="send_prepare_hint">Prepare</string>
<string name="send_dispose_hint">Dispose (Undo)</string> <string name="send_dispose_hint">Dispose (Undo)</string>
<string name="send_send_hint">Spend my sweet Moneroj</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> <string name="send_preparing_progress">Preparing transaction</string>