enable dispose of prepared transaction

This commit is contained in:
m2049r 2017-08-22 11:04:50 +02:00
parent 110621824a
commit 3ee8343074
6 changed files with 52 additions and 18 deletions

View File

@ -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 {

View File

@ -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) {

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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" />
</LinearLayout>
<LinearLayout
@ -94,8 +94,8 @@
android:layout_weight="2"
android:background="@color/colorPrimary"
android:enabled="true"
android:visibility="invisible"
android:text="@string/send_sweep_hint" />
android:text="@string/send_sweep_hint"
android:visibility="invisible" />
</LinearLayout>
<Button
@ -112,8 +112,8 @@
android:id="@+id/pbProgress"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:visibility="gone"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:visibility="gone" />
<LinearLayout
android:id="@+id/llConfirmSend"
@ -122,6 +122,16 @@
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"
@ -221,7 +231,6 @@
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="@color/colorPrimary"
android:enabled="false"
android:text="@string/send_send_hint" />
</LinearLayout>

View File

@ -107,6 +107,7 @@
<string name="send_sweep_hint">Sweep</string>
<string name="send_generate_paymentid_hint">Generate</string>
<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_preparing_progress">Preparing transaction</string>