From 3ee83430743f6fbf052aa5d9ee7c3a0ca10cd33e Mon Sep 17 00:00:00 2001 From: m2049r <30435443+m2049r@users.noreply.github.com> Date: Tue, 22 Aug 2017 11:04:50 +0200 Subject: [PATCH] enable dispose of prepared transaction --- app/build.gradle | 4 ++-- .../com/m2049r/xmrwallet/SendFragment.java | 19 ++++++++++----- .../com/m2049r/xmrwallet/WalletActivity.java | 8 ++++--- .../com/m2049r/xmrwallet/util/TxData.java | 15 ++++++++++++ app/src/main/res/layout/send_fragment.xml | 23 +++++++++++++------ app/src/main/res/values/strings.xml | 1 + 6 files changed, 52 insertions(+), 18 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 89cea44..4513384 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "com.m2049r.xmrwallet" minSdkVersion 21 targetSdkVersion 25 - versionCode 5 - versionName "0.4.1" + versionCode 6 + versionName "0.4.2" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" externalNativeBuild { cmake { diff --git a/app/src/main/java/com/m2049r/xmrwallet/SendFragment.java b/app/src/main/java/com/m2049r/xmrwallet/SendFragment.java index c28c7fe..eb217a9 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/SendFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/SendFragment.java @@ -17,8 +17,6 @@ package com.m2049r.xmrwallet; import android.app.Fragment; -import android.content.ClipData; -import android.content.ClipboardManager; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; @@ -26,7 +24,6 @@ import android.support.v7.app.AlertDialog; import android.text.Editable; import android.text.InputType; import android.text.TextWatcher; -import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; @@ -40,8 +37,6 @@ import android.widget.Spinner; import android.widget.TextView; import com.m2049r.xmrwallet.model.PendingTransaction; -import com.m2049r.xmrwallet.model.TransactionInfo; -import com.m2049r.xmrwallet.model.Transfer; import com.m2049r.xmrwallet.model.Wallet; import com.m2049r.xmrwallet.model.WalletManager; import com.m2049r.xmrwallet.util.Helper; @@ -57,6 +52,7 @@ public class SendFragment extends Fragment { Spinner sMixin; Spinner sPriority; Button bPrepareSend; + Button bDispose; Button bPaymentId; LinearLayout llConfirmSend; TextView tvTxAmount; @@ -86,6 +82,7 @@ public class SendFragment extends Fragment { bSweep = (Button) view.findViewById(R.id.bSweep); bPrepareSend = (Button) view.findViewById(R.id.bPrepareSend); bPaymentId = (Button) view.findViewById(R.id.bPaymentId); + bDispose = (Button) view.findViewById(R.id.bDispose); llConfirmSend = (LinearLayout) view.findViewById(R.id.llConfirmSend); tvTxAmount = (TextView) view.findViewById(R.id.tvTxAmount); @@ -191,6 +188,14 @@ public class SendFragment extends Fragment { } }); + bDispose.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + activityCallback.onDisposeRequest(); + enableEdit(); + } + }); + bPaymentId.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -304,6 +309,7 @@ public class SendFragment extends Fragment { bPaymentId.setEnabled(true); bSweep.setEnabled(true); bPrepareSend.setEnabled(true); + llConfirmSend.setVisibility(View.GONE); } private void send() { @@ -327,6 +333,8 @@ public class SendFragment extends Fragment { String getWalletAddress(); + void onDisposeRequest(); + } @Override @@ -350,7 +358,6 @@ public class SendFragment extends Fragment { tvTxAmount.setText(Wallet.getDisplayAmount(pendingTransaction.getAmount())); tvTxFee.setText(Wallet.getDisplayAmount(pendingTransaction.getFee())); tvTxDust.setText(Wallet.getDisplayAmount(pendingTransaction.getDust())); - bSend.setEnabled(true); } public void onCreatedTransactionFailed(String errorText) { diff --git a/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java b/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java index 7b6dad0..9e57d69 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java @@ -16,7 +16,6 @@ package com.m2049r.xmrwallet; -import android.app.Activity; import android.app.Fragment; import android.app.FragmentManager; import android.app.FragmentTransaction; @@ -36,9 +35,7 @@ import android.widget.Toast; import com.m2049r.xmrwallet.model.PendingTransaction; import com.m2049r.xmrwallet.model.TransactionInfo; import com.m2049r.xmrwallet.model.Wallet; -import com.m2049r.xmrwallet.model.WalletManager; import com.m2049r.xmrwallet.service.WalletService; -import com.m2049r.xmrwallet.util.Helper; import com.m2049r.xmrwallet.util.TxData; public class WalletActivity extends AppCompatActivity implements WalletFragment.Listener, @@ -545,4 +542,9 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment. replaceFragment(new GenerateReviewFragment(), null, extras); } } + + @Override + public void onDisposeRequest() { + getWallet().disposePendingTransaction(); + } } \ No newline at end of file diff --git a/app/src/main/java/com/m2049r/xmrwallet/util/TxData.java b/app/src/main/java/com/m2049r/xmrwallet/util/TxData.java index 13b3c4d..147b0ac 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/util/TxData.java +++ b/app/src/main/java/com/m2049r/xmrwallet/util/TxData.java @@ -75,4 +75,19 @@ public class TxData implements Parcelable { return 0; } + @Override + public String toString() { + StringBuffer sb = new StringBuffer(); + sb.append("dst_addr:"); + sb.append(dst_addr); + sb.append(",paymentId:"); + sb.append(paymentId); + sb.append(",amount:"); + sb.append(amount); + sb.append(",mixin:"); + sb.append(mixin); + sb.append(",priority:"); + sb.append(priority.toString()); + return sb.toString(); + } } diff --git a/app/src/main/res/layout/send_fragment.xml b/app/src/main/res/layout/send_fragment.xml index 53a4903..572835c 100644 --- a/app/src/main/res/layout/send_fragment.xml +++ b/app/src/main/res/layout/send_fragment.xml @@ -64,8 +64,8 @@ android:layout_weight="2" android:background="@color/colorPrimary" android:enabled="true" - android:textSize="12sp" - android:text="@string/send_generate_paymentid_hint" /> + android:text="@string/send_generate_paymentid_hint" + android:textSize="12sp" /> + android:text="@string/send_sweep_hint" + android:visibility="invisible" />