Rework of Send flow + refactoring (#146)
This commit is contained in:
parent
d2429da044
commit
0cb8ece336
|
@ -32,7 +32,7 @@ import android.view.inputmethod.EditorInfo;
|
|||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.m2049r.xmrwallet.layout.Toolbar;
|
||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||
import com.m2049r.xmrwallet.model.Wallet;
|
||||
import com.m2049r.xmrwallet.model.WalletManager;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
|
|
|
@ -34,7 +34,7 @@ import android.widget.ScrollView;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.m2049r.xmrwallet.layout.Toolbar;
|
||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||
import com.m2049r.xmrwallet.model.Wallet;
|
||||
import com.m2049r.xmrwallet.model.WalletManager;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
|
@ -295,4 +295,4 @@ public class GenerateReviewFragment extends Fragment {
|
|||
inflater.inflate(R.menu.wallet_details_menu, menu);
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,12 +49,12 @@ import com.m2049r.xmrwallet.dialog.AboutFragment;
|
|||
import com.m2049r.xmrwallet.dialog.DonationFragment;
|
||||
import com.m2049r.xmrwallet.dialog.HelpFragment;
|
||||
import com.m2049r.xmrwallet.dialog.PrivacyFragment;
|
||||
import com.m2049r.xmrwallet.layout.Toolbar;
|
||||
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.MoneroThreadPoolExecutor;
|
||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
@ -314,7 +314,6 @@ public class LoginActivity extends SecureActivity
|
|||
dialog.show();
|
||||
}
|
||||
|
||||
|
||||
private class AsyncBackup extends AsyncTask<String, Void, Boolean> {
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
|
@ -503,9 +502,9 @@ public class LoginActivity extends SecureActivity
|
|||
public void onClick(View view) {
|
||||
String pass = etPassword.getEditText().getText().toString();
|
||||
if (processPasswordEntry(wallet, pass, action)) {
|
||||
Helper.hideKeyboardAlways(LoginActivity.this);
|
||||
passwordDialog.dismiss();
|
||||
passwordDialog = null;
|
||||
Helper.hideKeyboardAlways(LoginActivity.this);
|
||||
} else {
|
||||
etPassword.setError(getString(R.string.bad_password));
|
||||
}
|
||||
|
@ -520,10 +519,10 @@ public class LoginActivity extends SecureActivity
|
|||
etPassword.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
|
||||
Helper.hideKeyboardAlways(LoginActivity.this);
|
||||
String pass = etPassword.getEditText().getText().toString();
|
||||
if (processPasswordEntry(wallet, pass, action)) {
|
||||
passwordDialog.cancel();
|
||||
Helper.hideKeyboardAlways(LoginActivity.this);
|
||||
passwordDialog.dismiss();
|
||||
passwordDialog = null;
|
||||
} else {
|
||||
etPassword.setError(getString(R.string.bad_password));
|
||||
|
@ -646,7 +645,7 @@ public class LoginActivity extends SecureActivity
|
|||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
//activity.finish();
|
||||
// prevent back button
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -718,7 +717,6 @@ public class LoginActivity extends SecureActivity
|
|||
String msg = getString(R.string.message_strorage_not_permitted);
|
||||
Timber.e(msg);
|
||||
Toast.makeText(this, msg, Toast.LENGTH_LONG).show();
|
||||
//throw new IllegalStateException(msg);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -1198,7 +1196,7 @@ public class LoginActivity extends SecureActivity
|
|||
switch (result) {
|
||||
case OK:
|
||||
Timber.d("selected wallet is ." + walletNode.name + ".");
|
||||
// now it's getting real, check if wallet exists
|
||||
// now it's getting real, onValidateFields if wallet exists
|
||||
promptAndStart(walletNode);
|
||||
break;
|
||||
case TIMEOUT:
|
||||
|
|
|
@ -43,12 +43,12 @@ import android.widget.RelativeLayout;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.m2049r.xmrwallet.layout.DropDownEditText;
|
||||
import com.m2049r.xmrwallet.layout.Toolbar;
|
||||
import com.m2049r.xmrwallet.layout.WalletInfoAdapter;
|
||||
import com.m2049r.xmrwallet.model.WalletManager;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
import com.m2049r.xmrwallet.util.NodeList;
|
||||
import com.m2049r.xmrwallet.widget.DropDownEditText;
|
||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
@ -315,7 +315,7 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter
|
|||
}
|
||||
|
||||
public boolean onTestnetMenuItem() {
|
||||
boolean lastState = testnet;//item.isChecked();
|
||||
boolean lastState = testnet;
|
||||
setNet(!lastState, true); // set and save
|
||||
return !lastState;
|
||||
}
|
||||
|
@ -336,7 +336,6 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter
|
|||
|
||||
private static final String PREF_DAEMON_TESTNET = "daemon_testnet";
|
||||
private static final String PREF_DAEMON_MAINNET = "daemon_mainnet";
|
||||
//private static final String PREF_TESTNET = "testnet";
|
||||
|
||||
private static final String PREF_DAEMONLIST_MAINNET =
|
||||
"node.moneroworld.com:18089;node.xmrbackb.one;node.xmr.be";
|
||||
|
@ -372,7 +371,6 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter
|
|||
|
||||
SharedPreferences sharedPref = activityCallback.getPrefs();
|
||||
SharedPreferences.Editor editor = sharedPref.edit();
|
||||
//editor.putBoolean(PREF_TESTNET, testnet);
|
||||
editor.putString(PREF_DAEMON_MAINNET, daemonMainNet.toString());
|
||||
editor.putString(PREF_DAEMON_TESTNET, daemonTestNet.toString());
|
||||
editor.apply();
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Copyright (c) 2017 m2049r
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.m2049r.xmrwallet;
|
||||
|
||||
public interface OnBackPressedListener {
|
||||
boolean onBackPressed();
|
||||
}
|
|
@ -46,12 +46,12 @@ import com.google.zxing.WriterException;
|
|||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.qrcode.QRCodeWriter;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import com.m2049r.xmrwallet.layout.ExchangeView;
|
||||
import com.m2049r.xmrwallet.layout.Toolbar;
|
||||
import com.m2049r.xmrwallet.model.Wallet;
|
||||
import com.m2049r.xmrwallet.model.WalletManager;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
import com.m2049r.xmrwallet.util.MoneroThreadPoolExecutor;
|
||||
import com.m2049r.xmrwallet.widget.ExchangeView;
|
||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -71,8 +71,6 @@ public class ReceiveFragment extends Fragment {
|
|||
private EditText etDummy;
|
||||
private ImageButton bCopyAddress;
|
||||
|
||||
//String name;
|
||||
|
||||
public interface Listener {
|
||||
void setToolbarButton(int type);
|
||||
|
||||
|
@ -151,7 +149,6 @@ public class ReceiveFragment extends Fragment {
|
|||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
});
|
||||
|
||||
bPaymentId.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -189,7 +186,7 @@ public class ReceiveFragment extends Fragment {
|
|||
Bundle b = getArguments();
|
||||
String address = b.getString("address");
|
||||
String walletName = b.getString("name");
|
||||
Timber.d("%s/%s",address, walletName);
|
||||
Timber.d("%s/%s", address, walletName);
|
||||
if (address == null) {
|
||||
String path = b.getString("path");
|
||||
String password = b.getString("password");
|
||||
|
@ -300,7 +297,7 @@ public class ReceiveFragment extends Fragment {
|
|||
String address = tvAddress.getText().toString();
|
||||
String paymentId = etPaymentId.getEditText().getText().toString();
|
||||
String xmrAmount = evAmount.getAmount();
|
||||
Timber.d("%s/%s/%s",xmrAmount, paymentId, address);
|
||||
Timber.d("%s/%s/%s", xmrAmount, paymentId, address);
|
||||
if ((xmrAmount == null) || !Wallet.isAddressValid(address, WalletManager.getInstance().isTestNet())) {
|
||||
clearQR();
|
||||
Timber.d("CLEARQR");
|
||||
|
@ -360,7 +357,6 @@ public class ReceiveFragment extends Fragment {
|
|||
return null;
|
||||
}
|
||||
|
||||
// TODO check if we can sensibly cache some of this
|
||||
private Bitmap addLogo(Bitmap qrBitmap) {
|
||||
Bitmap logo = getMoneroLogo();
|
||||
int qrWidth = qrBitmap.getWidth();
|
||||
|
@ -414,9 +410,6 @@ public class ReceiveFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
static final String PREF_CURRENCY_A = "PREF_CURRENCY_A";
|
||||
static final String PREF_CURRENCY_B = "PREF_CURRENCY_B";
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
Timber.d("onPause()");
|
||||
|
|
|
@ -33,10 +33,10 @@ import timber.log.Timber;
|
|||
|
||||
public class ScannerFragment extends Fragment implements ZXingScannerView.ResultHandler {
|
||||
|
||||
private Listener activityCallback;
|
||||
private OnScannedListener onScannedListener;
|
||||
|
||||
public interface Listener {
|
||||
boolean onAddressScanned(String uri);
|
||||
public interface OnScannedListener {
|
||||
boolean onScanned(String uri);
|
||||
}
|
||||
|
||||
private ZXingScannerView mScannerView;
|
||||
|
@ -64,7 +64,7 @@ public class ScannerFragment extends Fragment implements ZXingScannerView.Result
|
|||
public void handleResult(Result rawResult) {
|
||||
if ((rawResult.getBarcodeFormat() == BarcodeFormat.QR_CODE) &&
|
||||
(rawResult.getText().startsWith(QR_SCHEME))) {
|
||||
if (activityCallback.onAddressScanned(rawResult.getText())) {
|
||||
if (onScannedListener.onScanned(rawResult.getText())) {
|
||||
return;
|
||||
} else {
|
||||
Toast.makeText(getActivity(), getString(R.string.send_qr_address_invalid), Toast.LENGTH_SHORT).show();
|
||||
|
@ -98,11 +98,11 @@ public class ScannerFragment extends Fragment implements ZXingScannerView.Result
|
|||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
if (context instanceof Listener) {
|
||||
this.activityCallback = (Listener) context;
|
||||
if (context instanceof OnScannedListener) {
|
||||
this.onScannedListener = (OnScannedListener) context;
|
||||
} else {
|
||||
throw new ClassCastException(context.toString()
|
||||
+ " must implement Listener");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,237 @@
|
|||
/*
|
||||
* Copyright (c) 2017 m2049r
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.m2049r.xmrwallet;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.TextInputLayout;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.text.Editable;
|
||||
import android.text.InputType;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.m2049r.xmrwallet.data.BarcodeData;
|
||||
import com.m2049r.xmrwallet.model.Wallet;
|
||||
import com.m2049r.xmrwallet.model.WalletManager;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
public class SendAddressWizardFragment extends SendWizardFragment {
|
||||
|
||||
public static SendAddressWizardFragment newInstance(Listener listener) {
|
||||
SendAddressWizardFragment instance = new SendAddressWizardFragment();
|
||||
instance.setSendListener(listener);
|
||||
return instance;
|
||||
}
|
||||
|
||||
Listener sendListener;
|
||||
|
||||
public SendAddressWizardFragment setSendListener(Listener listener) {
|
||||
this.sendListener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
interface Listener {
|
||||
void setAddress(final String address);
|
||||
|
||||
void setPaymentId(final String paymentId);
|
||||
|
||||
void setBarcodeData(BarcodeData data);
|
||||
}
|
||||
|
||||
private EditText etDummy;
|
||||
private TextInputLayout etAddress;
|
||||
private TextInputLayout etPaymentId;
|
||||
private Button bPaymentId;
|
||||
private CardView cvScan;
|
||||
|
||||
private String scannedAmount = null;
|
||||
|
||||
OnScanListener onScanListener;
|
||||
|
||||
public interface OnScanListener {
|
||||
void onScan();
|
||||
|
||||
BarcodeData popScannedData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
Timber.d("onCreateView() %s", (String.valueOf(savedInstanceState)));
|
||||
|
||||
View view = inflater.inflate(R.layout.fragment_send_address, container, false);
|
||||
|
||||
etAddress = (TextInputLayout) view.findViewById(R.id.etAddress);
|
||||
etAddress.getEditText().setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||
|
||||
etPaymentId = (TextInputLayout) view.findViewById(R.id.etPaymentId);
|
||||
etPaymentId.getEditText().setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||
etPaymentId.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
|
||||
if (checkPaymentId()) {
|
||||
etDummy.requestFocus();
|
||||
Helper.hideKeyboard(getActivity());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
etPaymentId.getEditText().addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
etPaymentId.setError(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
});
|
||||
|
||||
bPaymentId = (Button) view.findViewById(R.id.bPaymentId);
|
||||
bPaymentId.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
etPaymentId.getEditText().setText((Wallet.generatePaymentId()));
|
||||
}
|
||||
});
|
||||
|
||||
cvScan = (CardView) view.findViewById(R.id.bScan);
|
||||
cvScan.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onScanListener.onScan();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
etDummy = (EditText) view.findViewById(R.id.etDummy);
|
||||
etDummy.setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||
etDummy.requestFocus();
|
||||
Helper.hideKeyboard(getActivity());
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private boolean checkAddressNoError() {
|
||||
String address = etAddress.getEditText().getText().toString();
|
||||
return Wallet.isAddressValid(address, WalletManager.getInstance().isTestNet());
|
||||
}
|
||||
|
||||
private boolean checkAddress() {
|
||||
boolean ok = checkAddressNoError();
|
||||
if (!ok) {
|
||||
etAddress.setError(getString(R.string.send_qr_address_invalid));
|
||||
} else {
|
||||
etAddress.setError(null);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
private boolean checkPaymentId() {
|
||||
String paymentId = etPaymentId.getEditText().getText().toString();
|
||||
boolean ok = paymentId.isEmpty() || Wallet.isPaymentIdValid(paymentId);
|
||||
if (!ok) {
|
||||
etPaymentId.setError(getString(R.string.receive_paymentid_invalid));
|
||||
} else {
|
||||
etPaymentId.setError(null);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onValidateFields() {
|
||||
boolean ok = true;
|
||||
if (!checkAddressNoError()) {
|
||||
etAddress.startAnimation(Helper.getShakeAnimation(getContext()));
|
||||
ok = false;
|
||||
}
|
||||
if (!checkPaymentId()) {
|
||||
etPaymentId.startAnimation(Helper.getShakeAnimation(getContext()));
|
||||
ok = false;
|
||||
}
|
||||
if (!ok) return false;
|
||||
if (sendListener != null) {
|
||||
sendListener.setAddress(etAddress.getEditText().getText().toString());
|
||||
sendListener.setPaymentId(etPaymentId.getEditText().getText().toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
if (context instanceof OnScanListener) {
|
||||
onScanListener = (OnScanListener) context;
|
||||
} else {
|
||||
throw new ClassCastException(context.toString()
|
||||
+ " must implement ScanListener");
|
||||
}
|
||||
}
|
||||
|
||||
// QR Scan Stuff
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Timber.d("onResume");
|
||||
BarcodeData data = onScanListener.popScannedData();
|
||||
sendListener.setBarcodeData(data);
|
||||
if (data != null) {
|
||||
Timber.d("GOT DATA");
|
||||
String scannedAddress = data.address;
|
||||
if (scannedAddress != null) {
|
||||
etAddress.getEditText().setText(scannedAddress);
|
||||
checkAddress();
|
||||
} else {
|
||||
etAddress.getEditText().getText().clear();
|
||||
etAddress.setError(null);
|
||||
}
|
||||
String scannedPaymenId = data.paymentId;
|
||||
if (scannedPaymenId != null) {
|
||||
etPaymentId.getEditText().setText(scannedPaymenId);
|
||||
checkPaymentId();
|
||||
} else {
|
||||
etPaymentId.getEditText().getText().clear();
|
||||
etPaymentId.setError(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResumeFragment() {
|
||||
super.onResumeFragment();
|
||||
Timber.d("onResumeFragment()");
|
||||
Helper.hideKeyboard(getActivity());
|
||||
etDummy.requestFocus();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
/*
|
||||
* Copyright (c) 2017 m2049r
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.m2049r.xmrwallet;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.m2049r.xmrwallet.data.BarcodeData;
|
||||
import com.m2049r.xmrwallet.widget.ExchangeTextView;
|
||||
import com.m2049r.xmrwallet.model.Wallet;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
import com.m2049r.xmrwallet.widget.NumberPadView;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
public class SendAmountWizardFragment extends SendWizardFragment {
|
||||
|
||||
public static SendAmountWizardFragment newInstance(Listener listener) {
|
||||
SendAmountWizardFragment instance = new SendAmountWizardFragment();
|
||||
instance.setSendListener(listener);
|
||||
return instance;
|
||||
}
|
||||
|
||||
Listener sendListener;
|
||||
|
||||
public SendAmountWizardFragment setSendListener(Listener listener) {
|
||||
this.sendListener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
interface Listener {
|
||||
SendFragmentNew.Listener getActivityCallback();
|
||||
|
||||
void setAmount(final long amount);
|
||||
|
||||
BarcodeData popBarcodeData();
|
||||
}
|
||||
|
||||
private TextView tvFunds;
|
||||
private ExchangeTextView evAmount;
|
||||
//private Button bSendAll;
|
||||
private NumberPadView numberPad;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
Timber.d("onCreateView() %s", (String.valueOf(savedInstanceState)));
|
||||
|
||||
sendListener = (Listener) getParentFragment();
|
||||
|
||||
View view = inflater.inflate(R.layout.fragment_send_amount, container, false);
|
||||
|
||||
tvFunds = (TextView) view.findViewById(R.id.tvFunds);
|
||||
|
||||
evAmount = (ExchangeTextView) view.findViewById(R.id.evAmount);
|
||||
numberPad = (NumberPadView) view.findViewById(R.id.numberPad);
|
||||
numberPad.setListener(evAmount);
|
||||
|
||||
/*
|
||||
bSendAll = (Button) view.findViewById(R.id.bSendAll);
|
||||
bSendAll.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO: send all - figure out how to display this
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
Helper.hideKeyboard(getActivity());
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onValidateFields() {
|
||||
if (!evAmount.validate(maxFunds)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sendListener != null) {
|
||||
String xmr = evAmount.getAmount();
|
||||
if (xmr != null) {
|
||||
sendListener.setAmount(Wallet.getAmountFromString(xmr));
|
||||
} else {
|
||||
sendListener.setAmount(0L);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
double maxFunds = 0;
|
||||
|
||||
@Override
|
||||
public void onResumeFragment() {
|
||||
super.onResumeFragment();
|
||||
Timber.d("onResumeFragment()");
|
||||
Helper.hideKeyboard(getActivity());
|
||||
final long funds = getTotalFunds();
|
||||
maxFunds = funds / 1000000000000L;
|
||||
tvFunds.setText(getString(R.string.send_available,
|
||||
Wallet.getDisplayAmount(funds)));
|
||||
if (evAmount.getAmount().isEmpty()) {
|
||||
final BarcodeData data = sendListener.popBarcodeData();
|
||||
if ((data != null) && (data.amount > 0)) {
|
||||
evAmount.setAmount(Wallet.getDisplayAmount(data.amount));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long getTotalFunds() {
|
||||
return sendListener.getActivityCallback().getTotalFunds();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,306 @@
|
|||
/*
|
||||
* Copyright (c) 2017 m2049r
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.m2049r.xmrwallet;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.TextInputLayout;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.m2049r.xmrwallet.data.TxData;
|
||||
import com.m2049r.xmrwallet.model.PendingTransaction;
|
||||
import com.m2049r.xmrwallet.model.Wallet;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
public class SendConfirmWizardFragment extends SendWizardFragment {
|
||||
|
||||
public static SendConfirmWizardFragment newInstance(Listener listener) {
|
||||
SendConfirmWizardFragment instance = new SendConfirmWizardFragment();
|
||||
instance.setSendListener(listener);
|
||||
return instance;
|
||||
}
|
||||
|
||||
Listener sendListener;
|
||||
|
||||
public SendConfirmWizardFragment setSendListener(Listener listener) {
|
||||
this.sendListener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
interface Listener {
|
||||
SendFragmentNew.Listener getActivityCallback();
|
||||
|
||||
TxData getTxData();
|
||||
|
||||
String getNotes();
|
||||
|
||||
void commitTransaction();
|
||||
|
||||
void disposeTransaction();
|
||||
}
|
||||
|
||||
private TextView tvTxAddress;
|
||||
private TextView tvTxPaymentId;
|
||||
private TextView tvTxNotes;
|
||||
private TextView tvTxAmount;
|
||||
private TextView tvTxFee;
|
||||
private TextView tvTxTotal;
|
||||
private View pbProgress;
|
||||
private View bSend;
|
||||
private View llConfirmSend;
|
||||
private View pbProgressSend;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
Timber.d("onCreateView() %s", (String.valueOf(savedInstanceState)));
|
||||
|
||||
View view = inflater.inflate(
|
||||
R.layout.fragment_send_confirm, container, false);
|
||||
|
||||
tvTxAddress = (TextView) view.findViewById(R.id.tvTxAddress);
|
||||
tvTxPaymentId = (TextView) view.findViewById(R.id.tvTxPaymentId);
|
||||
tvTxNotes = (TextView) view.findViewById(R.id.tvTxNotes);
|
||||
tvTxAmount = ((TextView) view.findViewById(R.id.tvTxAmount));
|
||||
tvTxFee = (TextView) view.findViewById(R.id.tvTxFee);
|
||||
tvTxTotal = (TextView) view.findViewById(R.id.tvTxTotal);
|
||||
|
||||
pbProgress = view.findViewById(R.id.pbProgress);
|
||||
pbProgressSend = view.findViewById(R.id.pbProgressSend);
|
||||
llConfirmSend = view.findViewById(R.id.llConfirmSend);
|
||||
|
||||
bSend = view.findViewById(R.id.bSend);
|
||||
bSend.setEnabled(false);
|
||||
bSend.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Timber.d("bSend.setOnClickListener");
|
||||
bSend.setEnabled(false);
|
||||
preSend();
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
boolean inProgress = false;
|
||||
|
||||
public void hideProgress() {
|
||||
pbProgress.setVisibility(View.INVISIBLE);
|
||||
inProgress = false;
|
||||
}
|
||||
|
||||
public void showProgress() {
|
||||
pbProgress.setVisibility(View.VISIBLE);
|
||||
inProgress = true;
|
||||
}
|
||||
|
||||
PendingTransaction pendingTransaction = null;
|
||||
|
||||
// callback from wallet when PendingTransaction created
|
||||
void transactionCreated(PendingTransaction pendingTransaction) {
|
||||
hideProgress();
|
||||
if (isResumed) {
|
||||
this.pendingTransaction = pendingTransaction;
|
||||
refreshTransactionDetails();
|
||||
} else {
|
||||
sendListener.disposeTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
void send() {
|
||||
sendListener.commitTransaction();
|
||||
pbProgressSend.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
void sendFailed() {
|
||||
pbProgressSend.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onValidateFields() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean isResumed = false;
|
||||
|
||||
@Override
|
||||
public void onPauseFragment() {
|
||||
isResumed = false;
|
||||
pendingTransaction = null;
|
||||
sendListener.disposeTransaction();
|
||||
refreshTransactionDetails();
|
||||
super.onPauseFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResumeFragment() {
|
||||
super.onResumeFragment();
|
||||
Timber.d("onResumeFragment()");
|
||||
Helper.hideKeyboard(getActivity());
|
||||
isResumed = true;
|
||||
|
||||
final TxData txData = sendListener.getTxData();
|
||||
tvTxAddress.setText(txData.getDestinationAddress());
|
||||
String paymentId = txData.getPaymentId();
|
||||
if ((paymentId != null) && (!paymentId.isEmpty())) {
|
||||
tvTxPaymentId.setText(txData.getPaymentId());
|
||||
} else {
|
||||
tvTxPaymentId.setText("-");
|
||||
}
|
||||
String notes = sendListener.getNotes();
|
||||
if ((notes != null) && (!notes.isEmpty())) {
|
||||
tvTxNotes.setText(sendListener.getNotes());
|
||||
} else {
|
||||
tvTxNotes.setText("-");
|
||||
}
|
||||
refreshTransactionDetails();
|
||||
if ((pendingTransaction == null) && (!inProgress)) {
|
||||
showProgress();
|
||||
prepareSend(txData);
|
||||
}
|
||||
}
|
||||
|
||||
void refreshTransactionDetails() {
|
||||
Timber.d("refreshTransactionDetails()");
|
||||
if (pendingTransaction != null) {
|
||||
llConfirmSend.setVisibility(View.VISIBLE);
|
||||
bSend.setEnabled(true);
|
||||
tvTxAmount.setText(Wallet.getDisplayAmount(pendingTransaction.getAmount()));
|
||||
tvTxFee.setText(Wallet.getDisplayAmount(pendingTransaction.getFee()));
|
||||
//tvTxDust.setText(Wallet.getDisplayAmount(pendingTransaction.getDust()));
|
||||
tvTxTotal.setText(Wallet.getDisplayAmount(
|
||||
pendingTransaction.getFee() + pendingTransaction.getAmount()));
|
||||
} else {
|
||||
llConfirmSend.setVisibility(View.GONE);
|
||||
bSend.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void preSend() {
|
||||
final Activity activity = getActivity();
|
||||
View promptsView = getLayoutInflater().inflate(R.layout.prompt_password, null);
|
||||
android.app.AlertDialog.Builder alertDialogBuilder = new android.app.AlertDialog.Builder(activity);
|
||||
alertDialogBuilder.setView(promptsView);
|
||||
|
||||
final TextInputLayout etPassword = (TextInputLayout) promptsView.findViewById(R.id.etPassword);
|
||||
etPassword.setHint(getString(R.string.prompt_send_password));
|
||||
|
||||
etPassword.getEditText().addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (etPassword.getError() != null) {
|
||||
etPassword.setError(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start,
|
||||
int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start,
|
||||
int before, int count) {
|
||||
}
|
||||
});
|
||||
|
||||
alertDialogBuilder
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
String pass = etPassword.getEditText().getText().toString();
|
||||
if (getActivityCallback().verifyWalletPassword(pass)) {
|
||||
dialog.dismiss();
|
||||
Helper.hideKeyboardAlways(activity);
|
||||
send();
|
||||
} else {
|
||||
etPassword.setError(getString(R.string.bad_password));
|
||||
}
|
||||
}
|
||||
})
|
||||
.setNegativeButton("Cancel",
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
Helper.hideKeyboardAlways(activity);
|
||||
dialog.cancel();
|
||||
bSend.setEnabled(true); // allow to try again
|
||||
}
|
||||
});
|
||||
|
||||
final android.app.AlertDialog passwordDialog = alertDialogBuilder.create();
|
||||
passwordDialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||
@Override
|
||||
public void onShow(DialogInterface dialog) {
|
||||
Button button = ((android.app.AlertDialog) dialog).getButton(android.app.AlertDialog.BUTTON_POSITIVE);
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
String pass = etPassword.getEditText().getText().toString();
|
||||
if (getActivityCallback().verifyWalletPassword(pass)) {
|
||||
Helper.hideKeyboardAlways(activity);
|
||||
passwordDialog.dismiss();
|
||||
send();
|
||||
} else {
|
||||
etPassword.setError(getString(R.string.bad_password));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Helper.showKeyboard(passwordDialog);
|
||||
|
||||
// accept keyboard "ok"
|
||||
etPassword.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
|
||||
String pass = etPassword.getEditText().getText().toString();
|
||||
if (getActivityCallback().verifyWalletPassword(pass)) {
|
||||
Helper.hideKeyboardAlways(activity);
|
||||
passwordDialog.dismiss();
|
||||
send();
|
||||
} else {
|
||||
etPassword.setError(getString(R.string.bad_password));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
passwordDialog.show();
|
||||
}
|
||||
|
||||
void prepareSend(TxData txData) {
|
||||
getActivityCallback().onPrepareSend(txData);
|
||||
}
|
||||
|
||||
SendFragmentNew.Listener getActivityCallback() {
|
||||
return sendListener.getActivityCallback();
|
||||
}
|
||||
}
|
|
@ -1,534 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2017 m2049r
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.m2049r.xmrwallet;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.TextInputLayout;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.text.Editable;
|
||||
import android.text.InputType;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.m2049r.xmrwallet.layout.ExchangeView;
|
||||
import com.m2049r.xmrwallet.layout.Toolbar;
|
||||
import com.m2049r.xmrwallet.model.PendingTransaction;
|
||||
import com.m2049r.xmrwallet.model.Wallet;
|
||||
import com.m2049r.xmrwallet.model.WalletManager;
|
||||
import com.m2049r.xmrwallet.util.BarcodeData;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
import com.m2049r.xmrwallet.util.TxData;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
public class SendFragment extends Fragment {
|
||||
|
||||
private EditText etDummy;
|
||||
|
||||
private ScrollView scrollview;
|
||||
|
||||
private TextInputLayout etAddress;
|
||||
private TextInputLayout etPaymentId;
|
||||
|
||||
private ExchangeView evAmount;
|
||||
|
||||
private Button bScan;
|
||||
private Spinner sMixin;
|
||||
private Spinner sPriority;
|
||||
private Button bPrepareSend;
|
||||
private Button bDispose;
|
||||
private Button bPaymentId;
|
||||
private LinearLayout llConfirmSend;
|
||||
private TextView tvTxAmount;
|
||||
private TextView tvTxFee;
|
||||
//TextView tvTxDust;
|
||||
private TextView tvTxTotal;
|
||||
private EditText etNotes;
|
||||
private Button bSend;
|
||||
private Button bReallySend;
|
||||
private ProgressBar pbProgress;
|
||||
|
||||
final static int Mixins[] = {4, 7, 12, 25}; // must match the layout XML
|
||||
final static PendingTransaction.Priority Priorities[] =
|
||||
{PendingTransaction.Priority.Priority_Default,
|
||||
PendingTransaction.Priority.Priority_Low,
|
||||
PendingTransaction.Priority.Priority_Medium,
|
||||
PendingTransaction.Priority.Priority_High}; // must match the layout XML
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
View view = inflater.inflate(R.layout.fragment_send, container, false);
|
||||
|
||||
etDummy = (EditText) view.findViewById(R.id.etDummy);
|
||||
etDummy.setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||
|
||||
scrollview = (ScrollView) view.findViewById(R.id.scrollview);
|
||||
|
||||
sMixin = (Spinner) view.findViewById(R.id.sMixin);
|
||||
sPriority = (Spinner) view.findViewById(R.id.sPriority);
|
||||
etAddress = (TextInputLayout) view.findViewById(R.id.etAddress);
|
||||
etPaymentId = (TextInputLayout) view.findViewById(R.id.etPaymentId);
|
||||
evAmount = (ExchangeView) view.findViewById(R.id.evAmount);
|
||||
|
||||
bScan = (Button) view.findViewById(R.id.bScan);
|
||||
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);
|
||||
tvTxFee = (TextView) view.findViewById(R.id.tvTxFee);
|
||||
//tvTxDust = (TextView) view.findViewById(R.id.tvTxDust);
|
||||
tvTxTotal = (TextView) view.findViewById(R.id.tvTxTotal);
|
||||
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);
|
||||
|
||||
etAddress.getEditText().setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||
etPaymentId.getEditText().setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||
etNotes.setRawInputType(InputType.TYPE_CLASS_TEXT);
|
||||
|
||||
Helper.showKeyboard(getActivity());
|
||||
etAddress.getEditText().requestFocus();
|
||||
etAddress.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_NEXT)) {
|
||||
if (checkAddress()) {
|
||||
evAmount.focus();
|
||||
} // otherwise ignore
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
etAddress.getEditText().addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
etAddress.setError(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
});
|
||||
|
||||
etPaymentId.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
|
||||
if (checkPaymentId()) {
|
||||
etDummy.requestFocus();
|
||||
Helper.hideKeyboard(getActivity());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
etPaymentId.getEditText().addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
etPaymentId.setError(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
});
|
||||
|
||||
bPrepareSend.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (checkAddress() && checkAmountWithError() && checkPaymentId()) {
|
||||
Helper.hideKeyboard(getActivity());
|
||||
prepareSend();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
bDispose.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
activityCallback.onDisposeRequest();
|
||||
enableEdit();
|
||||
}
|
||||
});
|
||||
|
||||
bScan.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
activityCallback.onScanAddress();
|
||||
}
|
||||
});
|
||||
|
||||
bPaymentId.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
etPaymentId.getEditText().setText((Wallet.generatePaymentId()));
|
||||
etPaymentId.getEditText().setSelection(etPaymentId.getEditText().getText().length());
|
||||
}
|
||||
});
|
||||
|
||||
etNotes.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
|
||||
Helper.hideKeyboard(getActivity());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
bSend.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
bSend.setEnabled(false);
|
||||
boolean testnet = WalletManager.getInstance().isTestNet();
|
||||
if (testnet) {
|
||||
send();
|
||||
} else {
|
||||
etNotes.setEnabled(false);
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
bReallySend.setVisibility(View.VISIBLE);
|
||||
bReallySend.setEnabled(true);
|
||||
scrollview.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
scrollview.fullScroll(ScrollView.FOCUS_DOWN);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
bReallySend.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
bReallySend.setEnabled(false);
|
||||
send();
|
||||
}
|
||||
});
|
||||
|
||||
sMixin.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(final AdapterView<?> parentView, View selectedItemView, int position, long id) {
|
||||
parentView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isAdded())
|
||||
((TextView) parentView.getChildAt(0)).setTextColor(getResources().getColor(R.color.moneroGray));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parentView) {
|
||||
// nothing (yet?)
|
||||
}
|
||||
});
|
||||
sPriority.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(final AdapterView<?> parentView, View selectedItemView, int position, long id) {
|
||||
parentView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isAdded())
|
||||
((TextView) parentView.getChildAt(0)).setTextColor(getResources().getColor(R.color.moneroGray));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parentView) {
|
||||
// nothing (yet?)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
etDummy.requestFocus();
|
||||
Helper.hideKeyboard(getActivity());
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private boolean checkAddressNoError() {
|
||||
String address = etAddress.getEditText().getText().toString();
|
||||
return Wallet.isAddressValid(address, WalletManager.getInstance().isTestNet());
|
||||
}
|
||||
|
||||
private boolean checkAddress() {
|
||||
boolean ok = checkAddressNoError();
|
||||
if (!ok) {
|
||||
etAddress.setError(getString(R.string.send_qr_address_invalid));
|
||||
} else {
|
||||
etAddress.setError(null);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
private boolean checkAmount() {
|
||||
String xmr = evAmount.getAmount();
|
||||
return (xmr != null) && (Wallet.getAmountFromString(xmr) > 0);
|
||||
}
|
||||
|
||||
private boolean checkAmountWithError() {
|
||||
boolean ok = checkAmount();
|
||||
if (!ok) {
|
||||
evAmount.setError(getString(R.string.receive_amount_empty));
|
||||
} else {
|
||||
evAmount.setError(null);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
private boolean checkPaymentId() {
|
||||
String paymentId = etPaymentId.getEditText().getText().toString();
|
||||
boolean ok = paymentId.isEmpty() || Wallet.isPaymentIdValid(paymentId);
|
||||
if (!ok) {
|
||||
etPaymentId.setError(getString(R.string.receive_paymentid_invalid));
|
||||
} else {
|
||||
etPaymentId.setError(null);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
private void prepareSend() {
|
||||
etDummy.requestFocus();
|
||||
disableEdit();
|
||||
String dst_addr = etAddress.getEditText().getText().toString();
|
||||
String paymentId = etPaymentId.getEditText().getText().toString();
|
||||
long amount = Wallet.getAmountFromString(evAmount.getAmount());
|
||||
int mixin = Mixins[sMixin.getSelectedItemPosition()];
|
||||
int priorityIndex = sPriority.getSelectedItemPosition();
|
||||
PendingTransaction.Priority priority = Priorities[priorityIndex];
|
||||
Timber.d("%s/%s/%d/%d/%s", dst_addr, paymentId, amount, mixin, priority.toString());
|
||||
TxData txData = new TxData(
|
||||
dst_addr,
|
||||
paymentId,
|
||||
amount,
|
||||
mixin,
|
||||
priority);
|
||||
showProgress();
|
||||
activityCallback.onPrepareSend(txData);
|
||||
}
|
||||
|
||||
private void disableEdit() {
|
||||
sMixin.setEnabled(false);
|
||||
sPriority.setEnabled(false);
|
||||
etAddress.getEditText().setEnabled(false);
|
||||
etPaymentId.getEditText().setEnabled(false);
|
||||
evAmount.enable(false);
|
||||
bScan.setEnabled(false);
|
||||
bPaymentId.setEnabled(false);
|
||||
bPrepareSend.setEnabled(false);
|
||||
bPrepareSend.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void enableEdit() {
|
||||
sMixin.setEnabled(true);
|
||||
sPriority.setEnabled(true);
|
||||
etAddress.getEditText().setEnabled(true);
|
||||
etPaymentId.getEditText().setEnabled(true);
|
||||
evAmount.enable(true);
|
||||
bScan.setEnabled(true);
|
||||
bPaymentId.setEnabled(true);
|
||||
bPrepareSend.setEnabled(true);
|
||||
bPrepareSend.setVisibility(View.VISIBLE);
|
||||
|
||||
llConfirmSend.setVisibility(View.GONE);
|
||||
etNotes.setEnabled(true);
|
||||
bSend.setEnabled(false);
|
||||
bReallySend.setVisibility(View.GONE);
|
||||
bReallySend.setEnabled(false);
|
||||
etDummy.requestFocus();
|
||||
}
|
||||
|
||||
private void send() {
|
||||
etNotes.setEnabled(false);
|
||||
etDummy.requestFocus();
|
||||
String notes = etNotes.getText().toString();
|
||||
activityCallback.onSend(notes);
|
||||
}
|
||||
|
||||
Listener activityCallback;
|
||||
|
||||
public interface Listener {
|
||||
void onPrepareSend(TxData data);
|
||||
|
||||
void onSend(String notes);
|
||||
|
||||
String getWalletAddress();
|
||||
|
||||
String getWalletName();
|
||||
|
||||
void onDisposeRequest();
|
||||
|
||||
void onScanAddress();
|
||||
|
||||
BarcodeData popScannedData();
|
||||
|
||||
void setSubtitle(String subtitle);
|
||||
|
||||
void setToolbarButton(int type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Timber.d("onResume");
|
||||
activityCallback.setToolbarButton(Toolbar.BUTTON_BACK);
|
||||
activityCallback.setSubtitle(getString(R.string.send_title));
|
||||
BarcodeData data = activityCallback.popScannedData();
|
||||
if (data != null) {
|
||||
Timber.d("GOT DATA");
|
||||
String scannedAddress = data.address;
|
||||
if (scannedAddress != null) {
|
||||
etAddress.getEditText().setText(scannedAddress);
|
||||
checkAddress();
|
||||
} else {
|
||||
etAddress.getEditText().getText().clear();
|
||||
etAddress.setError(null);
|
||||
}
|
||||
String scannedPaymenId = data.paymentId;
|
||||
if (scannedPaymenId != null) {
|
||||
etPaymentId.getEditText().setText(scannedPaymenId);
|
||||
checkPaymentId();
|
||||
} else {
|
||||
etPaymentId.getEditText().getText().clear();
|
||||
etPaymentId.setError(null);
|
||||
}
|
||||
if (data.amount > 0) {
|
||||
String scannedAmount = Helper.getDisplayAmount(data.amount);
|
||||
evAmount.setAmount(scannedAmount);
|
||||
} else {
|
||||
evAmount.setAmount("");
|
||||
}
|
||||
}
|
||||
if ((data != null) && (data.amount <= 0)) {
|
||||
evAmount.focus();
|
||||
} else {
|
||||
etDummy.requestFocus();
|
||||
Helper.hideKeyboard(getActivity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
if (context instanceof SendFragment.Listener) {
|
||||
this.activityCallback = (SendFragment.Listener) context;
|
||||
} else {
|
||||
throw new ClassCastException(context.toString()
|
||||
+ " must implement Listener");
|
||||
}
|
||||
}
|
||||
|
||||
public void onCreatedTransaction(PendingTransaction pendingTransaction) {
|
||||
hideProgress();
|
||||
if (pendingTransaction == null) {
|
||||
enableEdit();
|
||||
return;
|
||||
}
|
||||
llConfirmSend.setVisibility(View.VISIBLE);
|
||||
bSend.setEnabled(true);
|
||||
tvTxAmount.setText(Wallet.getDisplayAmount(pendingTransaction.getAmount()));
|
||||
tvTxFee.setText(Wallet.getDisplayAmount(pendingTransaction.getFee()));
|
||||
//tvTxDust.setText(Wallet.getDisplayAmount(pendingTransaction.getDust()));
|
||||
tvTxTotal.setText(Wallet.getDisplayAmount(
|
||||
pendingTransaction.getFee() + pendingTransaction.getAmount()));
|
||||
scrollview.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
scrollview.fullScroll(ScrollView.FOCUS_DOWN);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void onCreatedTransactionFailed(String errorText) {
|
||||
hideProgress();
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setTitle(getString(R.string.send_error_title));
|
||||
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
enableEdit();
|
||||
}
|
||||
});
|
||||
builder.setMessage(errorText);
|
||||
builder.setCancelable(false);
|
||||
builder.create().show();
|
||||
}
|
||||
|
||||
public void showProgress() {
|
||||
pbProgress.setIndeterminate(true);
|
||||
pbProgress.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
public void hideProgress() {
|
||||
pbProgress.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.send_menu, menu);
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,486 @@
|
|||
/*
|
||||
* Copyright (c) 2017 m2049r
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.m2049r.xmrwallet;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.text.InputType;
|
||||
import android.util.SparseArray;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.m2049r.xmrwallet.data.BarcodeData;
|
||||
import com.m2049r.xmrwallet.data.PendingTx;
|
||||
import com.m2049r.xmrwallet.data.TxData;
|
||||
import com.m2049r.xmrwallet.layout.SpendViewPager;
|
||||
import com.m2049r.xmrwallet.model.PendingTransaction;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
import com.m2049r.xmrwallet.widget.DotBar;
|
||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
public class SendFragmentNew extends Fragment
|
||||
implements SendAddressWizardFragment.Listener,
|
||||
SendAmountWizardFragment.Listener,
|
||||
SendSettingsWizardFragment.Listener,
|
||||
SendConfirmWizardFragment.Listener,
|
||||
SendSuccessWizardFragment.Listener,
|
||||
OnBackPressedListener {
|
||||
|
||||
private Listener activityCallback;
|
||||
|
||||
public interface Listener {
|
||||
long getTotalFunds();
|
||||
|
||||
void onPrepareSend(TxData data);
|
||||
|
||||
boolean verifyWalletPassword(String password);
|
||||
|
||||
void onSend(String notes);
|
||||
|
||||
void onDisposeRequest();
|
||||
|
||||
void onFragmentDone();
|
||||
|
||||
void setToolbarButton(int type);
|
||||
|
||||
void setTitle(String title);
|
||||
|
||||
void setSubtitle(String subtitle);
|
||||
}
|
||||
|
||||
private EditText etDummy;
|
||||
private Drawable arrowPrev;
|
||||
private Drawable arrowNext;
|
||||
|
||||
private View llNavBar;
|
||||
private DotBar dotBar;
|
||||
private Button bPrev;
|
||||
private Button bNext;
|
||||
|
||||
private Button bDone;
|
||||
|
||||
static private int MAX_FALLBACK = Integer.MAX_VALUE;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
final View view = inflater.inflate(R.layout.fragment_send_new, container, false);
|
||||
|
||||
llNavBar = view.findViewById(R.id.llNavBar);
|
||||
bDone = (Button) view.findViewById(R.id.bDone);
|
||||
|
||||
dotBar = (DotBar) view.findViewById(R.id.dotBar);
|
||||
bPrev = (Button) view.findViewById(R.id.bPrev);
|
||||
bNext = (Button) view.findViewById(R.id.bNext);
|
||||
arrowPrev = getResources().getDrawable(R.drawable.ic_navigate_prev_white_24dp);
|
||||
arrowNext = getResources().getDrawable(R.drawable.ic_navigate_next_white_24dp);
|
||||
|
||||
spendViewPager = (SpendViewPager) view.findViewById(R.id.pager);
|
||||
pagerAdapter = new SpendPagerAdapter(getChildFragmentManager());
|
||||
spendViewPager.setOffscreenPageLimit(pagerAdapter.getCount()); // load & keep all pages in cache
|
||||
spendViewPager.setAdapter(pagerAdapter);
|
||||
|
||||
spendViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
private int fallbackPosition = MAX_FALLBACK;
|
||||
private int currentPosition = 0;
|
||||
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int newPosition) {
|
||||
Timber.d("onPageSelected=%d/%d", newPosition, fallbackPosition);
|
||||
if (fallbackPosition < newPosition) {
|
||||
spendViewPager.setCurrentItem(fallbackPosition);
|
||||
} else {
|
||||
pagerAdapter.getFragment(currentPosition).onPauseFragment();
|
||||
pagerAdapter.getFragment(newPosition).onResumeFragment();
|
||||
updatePosition(newPosition);
|
||||
currentPosition = newPosition;
|
||||
fallbackPosition = MAX_FALLBACK;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
if (state == ViewPager.SCROLL_STATE_DRAGGING) {
|
||||
if (!spendViewPager.validateFields(spendViewPager.getCurrentItem())) {
|
||||
fallbackPosition = spendViewPager.getCurrentItem();
|
||||
} else {
|
||||
fallbackPosition = spendViewPager.getCurrentItem() + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
bPrev.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
spendViewPager.previous();
|
||||
}
|
||||
});
|
||||
|
||||
bNext.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
spendViewPager.next();
|
||||
}
|
||||
});
|
||||
|
||||
bDone.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
Timber.d("bDone.onClick");
|
||||
activityCallback.onFragmentDone();
|
||||
}
|
||||
});
|
||||
|
||||
updatePosition(0);
|
||||
|
||||
etDummy = (EditText) view.findViewById(R.id.etDummy);
|
||||
etDummy.setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||
etDummy.requestFocus();
|
||||
Helper.hideKeyboard(getActivity());
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
void updatePosition(int position) {
|
||||
dotBar.setActiveDot(position);
|
||||
CharSequence nextLabel = pagerAdapter.getPageTitle(position + 1);
|
||||
bNext.setText(nextLabel);
|
||||
if (nextLabel != null) {
|
||||
bNext.setCompoundDrawablesWithIntrinsicBounds(null, null, arrowNext, null);
|
||||
} else {
|
||||
bNext.setCompoundDrawables(null, null, null, null);
|
||||
}
|
||||
CharSequence prevLabel = pagerAdapter.getPageTitle(position - 1);
|
||||
bPrev.setText(prevLabel);
|
||||
if (prevLabel != null) {
|
||||
bPrev.setCompoundDrawablesWithIntrinsicBounds(arrowPrev, null, null, null);
|
||||
} else {
|
||||
bPrev.setCompoundDrawables(null, null, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Timber.d("onResume");
|
||||
activityCallback.setSubtitle(getString(R.string.send_title));
|
||||
if (getConfirmFragment() != null) {
|
||||
activityCallback.setToolbarButton(Toolbar.BUTTON_NONE);
|
||||
} else {
|
||||
activityCallback.setToolbarButton(Toolbar.BUTTON_BACK);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
Timber.d("onAttach %s", context);
|
||||
super.onAttach(context);
|
||||
if (context instanceof Listener) {
|
||||
this.activityCallback = (Listener) context;
|
||||
} else {
|
||||
throw new ClassCastException(context.toString()
|
||||
+ " must implement Listener");
|
||||
}
|
||||
}
|
||||
|
||||
private SpendViewPager spendViewPager;
|
||||
private SpendPagerAdapter pagerAdapter;
|
||||
|
||||
@Override
|
||||
public boolean onBackPressed() {
|
||||
if (isComitted()) return true; // no going back
|
||||
if (spendViewPager.getCurrentItem() == 0) {
|
||||
return false;
|
||||
} else {
|
||||
spendViewPager.previous();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class SpendPagerAdapter extends FragmentPagerAdapter {
|
||||
private static final int POS_ADDRESS = 0;
|
||||
private static final int POS_AMOUNT = 1;
|
||||
private static final int POS_SETTINGS = 2;
|
||||
private static final int POS_CONFIRM = 3;
|
||||
private static final int POS_SUCCESS = 4;
|
||||
private int numPages = 4;
|
||||
|
||||
SparseArray<WeakReference<SendWizardFragment>> myFragments = new SparseArray<>();
|
||||
|
||||
public SpendPagerAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
}
|
||||
|
||||
public void addSuccess() {
|
||||
numPages++;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return numPages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object instantiateItem(ViewGroup container, int position) {
|
||||
SendWizardFragment fragment = (SendWizardFragment) super.instantiateItem(container, position);
|
||||
myFragments.put(position, new WeakReference<>(fragment));
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyItem(ViewGroup container, int position, Object object) {
|
||||
myFragments.remove(position);
|
||||
super.destroyItem(container, position, object);
|
||||
}
|
||||
|
||||
public SendWizardFragment getFragment(int position) {
|
||||
WeakReference ref = myFragments.get(position);
|
||||
if (ref != null)
|
||||
return myFragments.get(position).get();
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SendWizardFragment getItem(int position) {
|
||||
Timber.d("getItem(%d) CREATE", position);
|
||||
switch (position) {
|
||||
case POS_ADDRESS:
|
||||
return SendAddressWizardFragment.newInstance(SendFragmentNew.this);
|
||||
case POS_AMOUNT:
|
||||
return SendAmountWizardFragment.newInstance(SendFragmentNew.this);
|
||||
case POS_SETTINGS:
|
||||
return SendSettingsWizardFragment.newInstance(SendFragmentNew.this);
|
||||
case POS_CONFIRM:
|
||||
return SendConfirmWizardFragment.newInstance(SendFragmentNew.this);
|
||||
case POS_SUCCESS:
|
||||
return SendSuccessWizardFragment.newInstance(SendFragmentNew.this);
|
||||
default:
|
||||
throw new IllegalArgumentException("no such send position(" + position + ")");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
Timber.d("getPageTitle(%d)", position);
|
||||
if (position >= numPages) return null;
|
||||
switch (position) {
|
||||
case POS_ADDRESS:
|
||||
return getString(R.string.send_address_title);
|
||||
case POS_AMOUNT:
|
||||
return getString(R.string.send_amount_title);
|
||||
case POS_SETTINGS:
|
||||
return getString(R.string.send_settings_title);
|
||||
case POS_CONFIRM:
|
||||
return getString(R.string.send_confirm_title);
|
||||
case POS_SUCCESS:
|
||||
return getString(R.string.send_success_title);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TxData getTxData() {
|
||||
return new TxData(sendAddress, sendPaymentId, sendAmount, sendMixin, sendPriority);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNotes() {
|
||||
return sendNotes;
|
||||
}
|
||||
|
||||
private String sendAddress;
|
||||
private String sendPaymentId;
|
||||
private long sendAmount;
|
||||
private PendingTransaction.Priority sendPriority;
|
||||
private int sendMixin;
|
||||
private String sendNotes;
|
||||
private BarcodeData barcodeData;
|
||||
|
||||
// Listeners
|
||||
@Override
|
||||
public void setBarcodeData(BarcodeData data) {
|
||||
barcodeData = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BarcodeData popBarcodeData() {
|
||||
BarcodeData data = barcodeData;
|
||||
barcodeData = null;
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAddress(final String address) {
|
||||
sendAddress = address;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPaymentId(final String paymentId) {
|
||||
sendPaymentId = paymentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAmount(final long amount) {
|
||||
sendAmount = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPriority(final PendingTransaction.Priority priority) {
|
||||
sendPriority = priority;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMixin(final int mixin) {
|
||||
sendMixin = mixin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNotes(final String notes) {
|
||||
sendNotes = notes;
|
||||
}
|
||||
|
||||
boolean isComitted() {
|
||||
return committedTx != null;
|
||||
}
|
||||
|
||||
PendingTx committedTx;
|
||||
|
||||
@Override
|
||||
public PendingTx getCommittedTx() {
|
||||
return committedTx;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void commitTransaction() {
|
||||
Timber.d("REALLY SEND A %s", getNotes());
|
||||
disableNavigation(); // committed - disable all navigation
|
||||
activityCallback.onSend(getNotes());
|
||||
committedTx = pendingTx;
|
||||
}
|
||||
|
||||
void disableNavigation() {
|
||||
spendViewPager.allowSwipe(false);
|
||||
}
|
||||
|
||||
void enableNavigation() {
|
||||
spendViewPager.allowSwipe(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableDone() {
|
||||
llNavBar.setVisibility(View.INVISIBLE);
|
||||
bDone.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
public Listener getActivityCallback() {
|
||||
return activityCallback;
|
||||
}
|
||||
|
||||
|
||||
// callbacks from send service
|
||||
|
||||
public void onTransactionCreated(PendingTransaction pendingTransaction) {
|
||||
//public void onTransactionCreated(TestTransaction pendingTransaction) {
|
||||
final SendConfirmWizardFragment confirmFragment = getConfirmFragment();
|
||||
if (confirmFragment != null) {
|
||||
pendingTx = new PendingTx(pendingTransaction);
|
||||
confirmFragment.transactionCreated(pendingTransaction);
|
||||
} else {
|
||||
// not in confirm fragment => dispose & move on
|
||||
disposeTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeTransaction() {
|
||||
pendingTx = null;
|
||||
activityCallback.onDisposeRequest();
|
||||
}
|
||||
|
||||
PendingTx pendingTx;
|
||||
|
||||
public PendingTx getPendingTx() {
|
||||
return pendingTx;
|
||||
}
|
||||
|
||||
public void onCreateTransactionFailed(String errorText) {
|
||||
final SendConfirmWizardFragment confirmFragment = getConfirmFragment();
|
||||
if (confirmFragment != null) {
|
||||
confirmFragment.hideProgress();
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setCancelable(false).
|
||||
setTitle(getString(R.string.send_error_title)).
|
||||
setMessage(errorText).
|
||||
create().
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
SendConfirmWizardFragment getConfirmFragment() {
|
||||
final SendWizardFragment fragment = pagerAdapter.getFragment(SpendPagerAdapter.POS_CONFIRM);
|
||||
if (fragment instanceof SendConfirmWizardFragment) {
|
||||
return (SendConfirmWizardFragment) fragment;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void onTransactionSent(final String txId) {
|
||||
Timber.d("txid=%s", txId);
|
||||
pagerAdapter.addSuccess();
|
||||
Timber.d("numPages=%d", spendViewPager.getAdapter().getCount());
|
||||
spendViewPager.setCurrentItem(SpendPagerAdapter.POS_SUCCESS);
|
||||
activityCallback.setToolbarButton(Toolbar.BUTTON_NONE);
|
||||
}
|
||||
|
||||
public void onSendTransactionFailed(final String error) {
|
||||
Timber.d("error=%s", error);
|
||||
committedTx = null;
|
||||
Toast.makeText(getContext(), getString(R.string.status_transaction_failed, error), Toast.LENGTH_SHORT).show();
|
||||
enableNavigation();
|
||||
final SendConfirmWizardFragment fragment = getConfirmFragment();
|
||||
if (fragment != null) {
|
||||
fragment.sendFailed();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* Copyright (c) 2017 m2049r
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.m2049r.xmrwallet;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.InputType;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.m2049r.xmrwallet.model.PendingTransaction;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
public class SendSettingsWizardFragment extends SendWizardFragment {
|
||||
|
||||
public static SendSettingsWizardFragment newInstance(Listener listener) {
|
||||
SendSettingsWizardFragment instance = new SendSettingsWizardFragment();
|
||||
instance.setSendListener(listener);
|
||||
return instance;
|
||||
}
|
||||
|
||||
Listener sendListener;
|
||||
|
||||
public SendSettingsWizardFragment setSendListener(Listener listener) {
|
||||
this.sendListener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
interface Listener {
|
||||
|
||||
void setPriority(final PendingTransaction.Priority priority);
|
||||
|
||||
void setMixin(final int mixin);
|
||||
|
||||
void setNotes(final String notes);
|
||||
}
|
||||
|
||||
final static int Mixins[] = {4, 7, 12, 25}; // must match the layout XML
|
||||
final static PendingTransaction.Priority Priorities[] =
|
||||
{PendingTransaction.Priority.Priority_Default,
|
||||
PendingTransaction.Priority.Priority_Low,
|
||||
PendingTransaction.Priority.Priority_Medium,
|
||||
PendingTransaction.Priority.Priority_High}; // must match the layout XML
|
||||
|
||||
private Spinner sMixin;
|
||||
private Spinner sPriority;
|
||||
private EditText etNotes;
|
||||
private EditText etDummy;
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
Timber.d("onCreateView() %s", (String.valueOf(savedInstanceState)));
|
||||
|
||||
View view = inflater.inflate(
|
||||
R.layout.fragment_send_settings, container, false);
|
||||
|
||||
sMixin = (Spinner) view.findViewById(R.id.sMixin);
|
||||
sPriority = (Spinner) view.findViewById(R.id.sPriority);
|
||||
|
||||
etNotes = (EditText) view.findViewById(R.id.etNotes);
|
||||
etNotes.setRawInputType(InputType.TYPE_CLASS_TEXT);
|
||||
etNotes.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
|
||||
etDummy.requestFocus();
|
||||
Helper.hideKeyboard(getActivity());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
etDummy = (EditText) view.findViewById(R.id.etDummy);
|
||||
etDummy.setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onValidateFields() {
|
||||
if (sendListener != null) {
|
||||
int mixin = Mixins[sMixin.getSelectedItemPosition()];
|
||||
int priorityIndex = sPriority.getSelectedItemPosition();
|
||||
PendingTransaction.Priority priority = Priorities[priorityIndex];
|
||||
sendListener.setPriority(priority);
|
||||
sendListener.setMixin(mixin);
|
||||
String notes = etNotes.getText().toString();
|
||||
sendListener.setNotes(notes);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResumeFragment() {
|
||||
super.onResumeFragment();
|
||||
Timber.d("onResumeFragment()");
|
||||
Helper.hideKeyboard(getActivity());
|
||||
etDummy.requestFocus();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,146 @@
|
|||
/*
|
||||
* Copyright (c) 2017 m2049r
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.m2049r.xmrwallet;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.m2049r.xmrwallet.model.Wallet;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
import com.m2049r.xmrwallet.data.PendingTx;
|
||||
import com.m2049r.xmrwallet.data.TxData;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
public class SendSuccessWizardFragment extends SendWizardFragment {
|
||||
|
||||
public static SendSuccessWizardFragment newInstance(Listener listener) {
|
||||
SendSuccessWizardFragment instance = new SendSuccessWizardFragment();
|
||||
instance.setSendListener(listener);
|
||||
return instance;
|
||||
}
|
||||
|
||||
Listener sendListener;
|
||||
|
||||
public SendSuccessWizardFragment setSendListener(Listener listener) {
|
||||
this.sendListener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
interface Listener {
|
||||
String getNotes();
|
||||
|
||||
TxData getTxData();
|
||||
|
||||
PendingTx getCommittedTx();
|
||||
|
||||
void enableDone();
|
||||
}
|
||||
|
||||
ImageButton bCopyAddress;
|
||||
private TextView tvTxId;
|
||||
private TextView tvTxAddress;
|
||||
private TextView tvTxPaymentId;
|
||||
private TextView tvTxNotes;
|
||||
private TextView tvTxAmount;
|
||||
private TextView tvTxFee;
|
||||
private TextView tvTxTotal;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
Timber.d("onCreateView() %s", (String.valueOf(savedInstanceState)));
|
||||
|
||||
View view = inflater.inflate(
|
||||
R.layout.fragment_send_success, container, false);
|
||||
|
||||
bCopyAddress = (ImageButton) view.findViewById(R.id.bCopyAddress);
|
||||
bCopyAddress.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
copyAddress();
|
||||
}
|
||||
});
|
||||
|
||||
tvTxId = (TextView) view.findViewById(R.id.tvTxId);
|
||||
tvTxAddress = (TextView) view.findViewById(R.id.tvTxAddress);
|
||||
tvTxPaymentId = (TextView) view.findViewById(R.id.tvTxPaymentId);
|
||||
tvTxNotes = (TextView) view.findViewById(R.id.tvTxNotes);
|
||||
tvTxAmount = ((TextView) view.findViewById(R.id.tvTxAmount));
|
||||
tvTxFee = (TextView) view.findViewById(R.id.tvTxFee);
|
||||
tvTxTotal = (TextView) view.findViewById(R.id.tvTxTotal);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onValidateFields() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPauseFragment() {
|
||||
super.onPauseFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResumeFragment() {
|
||||
super.onResumeFragment();
|
||||
Timber.d("onResumeFragment()");
|
||||
Helper.hideKeyboard(getActivity());
|
||||
|
||||
final TxData txData = sendListener.getTxData();
|
||||
tvTxAddress.setText(txData.getDestinationAddress());
|
||||
String paymentId = txData.getPaymentId();
|
||||
if ((paymentId != null) && (!paymentId.isEmpty())) {
|
||||
tvTxPaymentId.setText(txData.getPaymentId());
|
||||
} else {
|
||||
tvTxPaymentId.setText("-");
|
||||
}
|
||||
String notes = sendListener.getNotes();
|
||||
if ((notes != null) && (!notes.isEmpty())) {
|
||||
tvTxNotes.setText(sendListener.getNotes());
|
||||
} else {
|
||||
tvTxNotes.setText("-");
|
||||
}
|
||||
|
||||
final PendingTx committedTx = sendListener.getCommittedTx();
|
||||
if (committedTx != null) {
|
||||
tvTxId.setText(committedTx.txId);
|
||||
bCopyAddress.setEnabled(true);
|
||||
bCopyAddress.setImageResource(R.drawable.ic_content_copy_black_24dp);
|
||||
tvTxAmount.setText(Wallet.getDisplayAmount(committedTx.amount));
|
||||
tvTxFee.setText(Wallet.getDisplayAmount(committedTx.fee));
|
||||
//tvTxDust.setText(Wallet.getDisplayAmount(pendingTransaction.getDust()));
|
||||
tvTxTotal.setText(Wallet.getDisplayAmount(
|
||||
committedTx.fee + committedTx.amount));
|
||||
}
|
||||
sendListener.enableDone();
|
||||
}
|
||||
|
||||
void copyAddress() {
|
||||
Helper.clipBoardCopy(getActivity(), getString(R.string.label_send_txid), tvTxId.getText().toString());
|
||||
Toast.makeText(getActivity(), getString(R.string.message_copy_address), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) 2017 m2049r
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.m2049r.xmrwallet;
|
||||
|
||||
import android.support.v4.app.Fragment;
|
||||
|
||||
import com.m2049r.xmrwallet.layout.SpendViewPager;
|
||||
|
||||
abstract public class SendWizardFragment extends Fragment
|
||||
implements SpendViewPager.OnValidateFieldsListener {
|
||||
|
||||
@Override
|
||||
public boolean onValidateFields() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onPauseFragment() {
|
||||
}
|
||||
|
||||
public void onResumeFragment() {
|
||||
}
|
||||
}
|
|
@ -31,10 +31,10 @@ import android.view.ViewGroup;
|
|||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.m2049r.xmrwallet.layout.Toolbar;
|
||||
import com.m2049r.xmrwallet.model.TransactionInfo;
|
||||
import com.m2049r.xmrwallet.model.Transfer;
|
||||
import com.m2049r.xmrwallet.model.Wallet;
|
||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
|
@ -166,8 +166,7 @@ public class TxFragment extends Fragment {
|
|||
sb.append("-");
|
||||
}
|
||||
sb.append("\n\n");
|
||||
//Helper.clipBoardCopy(getActivity(), getString(R.string.tx_copy_label), sb.toString());
|
||||
//Toast.makeText(getActivity(), getString(R.string.tx_copy_message), Toast.LENGTH_SHORT).show();
|
||||
|
||||
Intent sendIntent = new Intent();
|
||||
sendIntent.setAction(Intent.ACTION_SEND);
|
||||
sendIntent.putExtra(Intent.EXTRA_TEXT, sb.toString());
|
||||
|
@ -308,4 +307,4 @@ public class TxFragment extends Fragment {
|
|||
+ " must implement Listener");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,28 +34,30 @@ import android.support.v4.app.FragmentTransaction;
|
|||
import android.view.MenuItem;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.m2049r.xmrwallet.data.BarcodeData;
|
||||
import com.m2049r.xmrwallet.data.TxData;
|
||||
import com.m2049r.xmrwallet.dialog.DonationFragment;
|
||||
import com.m2049r.xmrwallet.dialog.HelpFragment;
|
||||
import com.m2049r.xmrwallet.layout.Toolbar;
|
||||
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.BarcodeData;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
import com.m2049r.xmrwallet.util.TxData;
|
||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
public class WalletActivity extends SecureActivity implements WalletFragment.Listener,
|
||||
WalletService.Observer, SendFragment.Listener, TxFragment.Listener,
|
||||
WalletService.Observer, SendFragmentNew.Listener, TxFragment.Listener,
|
||||
GenerateReviewFragment.ListenerWithWallet,
|
||||
GenerateReviewFragment.Listener,
|
||||
ScannerFragment.Listener, ReceiveFragment.Listener {
|
||||
ScannerFragment.OnScannedListener, ReceiveFragment.Listener,
|
||||
SendAddressWizardFragment.OnScanListener {
|
||||
|
||||
public static final String REQUEST_ID = "id";
|
||||
public static final String REQUEST_PW = "pw";
|
||||
|
@ -108,7 +110,7 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
Timber.d( "onStart()");
|
||||
Timber.d("onStart()");
|
||||
}
|
||||
|
||||
private void startWalletService() {
|
||||
|
@ -176,7 +178,6 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
Timber.d("onCreate()");
|
||||
|
@ -254,7 +255,7 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
}
|
||||
}
|
||||
updateProgress();
|
||||
Timber.d( "CONNECTED");
|
||||
Timber.d("CONNECTED");
|
||||
}
|
||||
|
||||
public void onServiceDisconnected(ComponentName className) {
|
||||
|
@ -264,7 +265,7 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
// see this happen.
|
||||
mBoundService = null;
|
||||
setTitle(getString(R.string.wallet_activity_name), getString(R.string.status_wallet_disconnected));
|
||||
Timber.d( "DISCONNECTED");
|
||||
Timber.d("DISCONNECTED");
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -280,7 +281,7 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
startService(intent);
|
||||
bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
|
||||
mIsBound = true;
|
||||
Timber.d( "BOUND");
|
||||
Timber.d("BOUND");
|
||||
}
|
||||
|
||||
void disconnectWalletService() {
|
||||
|
@ -289,20 +290,20 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
mBoundService.setObserver(null);
|
||||
unbindService(mConnection);
|
||||
mIsBound = false;
|
||||
Timber.d( "UNBOUND");
|
||||
Timber.d("UNBOUND");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
Timber.d( "onPause()");
|
||||
Timber.d("onPause()");
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
Timber.d( "onResume()");
|
||||
Timber.d("onResume()");
|
||||
}
|
||||
|
||||
private PowerManager.WakeLock wl = null;
|
||||
|
@ -313,9 +314,9 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
this.wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, getString(R.string.app_name));
|
||||
try {
|
||||
wl.acquire();
|
||||
Timber.d( "WakeLock acquired");
|
||||
Timber.d("WakeLock acquired");
|
||||
} catch (SecurityException ex) {
|
||||
Timber.w( "WakeLock NOT acquired: %s", ex.getLocalizedMessage());
|
||||
Timber.w("WakeLock NOT acquired: %s", ex.getLocalizedMessage());
|
||||
wl = null;
|
||||
}
|
||||
}
|
||||
|
@ -324,7 +325,7 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
if ((wl == null) || !wl.isHeld()) return;
|
||||
wl.release();
|
||||
wl = null;
|
||||
Timber.d( "WakeLock released");
|
||||
Timber.d("WakeLock released");
|
||||
}
|
||||
|
||||
public void saveWallet() {
|
||||
|
@ -332,9 +333,9 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
Intent intent = new Intent(getApplicationContext(), WalletService.class);
|
||||
intent.putExtra(WalletService.REQUEST, WalletService.REQUEST_CMD_STORE);
|
||||
startService(intent);
|
||||
Timber.d( "STORE request sent");
|
||||
Timber.d("STORE request sent");
|
||||
} else {
|
||||
Timber.e( "Service not bound");
|
||||
Timber.e("Service not bound");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -359,7 +360,7 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
|
||||
@Override
|
||||
public void onSendRequest() {
|
||||
replaceFragment(new SendFragment(), null, null);
|
||||
replaceFragment(new SendFragmentNew(), null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -374,7 +375,7 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
try {
|
||||
onRefreshed(getWallet(), true);
|
||||
} catch (IllegalStateException ex) {
|
||||
Timber.e( ex.getLocalizedMessage());
|
||||
Timber.e(ex.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -382,10 +383,10 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
// WalletService.Observer
|
||||
///////////////////////////
|
||||
|
||||
// refresh and return if successful
|
||||
// refresh and return true if successful
|
||||
@Override
|
||||
public boolean onRefreshed(final Wallet wallet, final boolean full) {
|
||||
Timber.d( "onRefreshed()");
|
||||
Timber.d("onRefreshed()");
|
||||
try {
|
||||
final WalletFragment walletFragment = (WalletFragment)
|
||||
getSupportFragmentManager().findFragmentByTag(WalletFragment.class.getName());
|
||||
|
@ -460,9 +461,9 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onCreatedTransaction(final PendingTransaction pendingTransaction) {
|
||||
public void onTransactionCreated(final PendingTransaction pendingTransaction) {
|
||||
try {
|
||||
final SendFragment sendFragment = (SendFragment)
|
||||
final SendFragmentNew sendFragment = (SendFragmentNew)
|
||||
getSupportFragmentManager().findFragmentById(R.id.fragment_container);
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
|
@ -470,9 +471,9 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
if (status != PendingTransaction.Status.Status_Ok) {
|
||||
String errorText = pendingTransaction.getErrorString();
|
||||
getWallet().disposePendingTransaction();
|
||||
sendFragment.onCreatedTransactionFailed(errorText);
|
||||
sendFragment.onCreateTransactionFailed(errorText);
|
||||
} else {
|
||||
sendFragment.onCreatedTransaction(pendingTransaction);
|
||||
sendFragment.onTransactionCreated(pendingTransaction);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -485,17 +486,35 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSentTransaction(final boolean success) {
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
if (success) {
|
||||
Toast.makeText(WalletActivity.this, getString(R.string.status_transaction_sent), Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(WalletActivity.this, getString(R.string.status_transaction_failed), Toast.LENGTH_SHORT).show();
|
||||
public void onSendTransactionFailed(final String error) {
|
||||
try {
|
||||
final SendFragmentNew sendFragment = (SendFragmentNew)
|
||||
getSupportFragmentManager().findFragmentById(R.id.fragment_container);
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
sendFragment.onSendTransactionFailed(error);
|
||||
}
|
||||
popFragmentStack(null);
|
||||
}
|
||||
});
|
||||
});
|
||||
} catch (ClassCastException ex) {
|
||||
// not in spend fragment
|
||||
Timber.d(ex.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransactionSent(final String txId) {
|
||||
try {
|
||||
final SendFragmentNew sendFragment = (SendFragmentNew)
|
||||
getSupportFragmentManager().findFragmentById(R.id.fragment_container);
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
sendFragment.onTransactionSent(txId);
|
||||
}
|
||||
});
|
||||
} catch (ClassCastException ex) {
|
||||
// not in spend fragment
|
||||
Timber.d(ex.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -514,7 +533,7 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
} catch (ClassCastException ex) {
|
||||
// not in tx fragment
|
||||
Timber.d(ex.getLocalizedMessage());
|
||||
// never min
|
||||
// never mind
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -611,7 +630,6 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
return getWallet().getAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWalletName() {
|
||||
return getWallet().getName();
|
||||
}
|
||||
|
@ -693,7 +711,7 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
|
||||
/// QR scanner callbacks
|
||||
@Override
|
||||
public void onScanAddress() {
|
||||
public void onScan() {
|
||||
if (Helper.getCameraPermission(this)) {
|
||||
startScanFragment();
|
||||
} else {
|
||||
|
@ -705,7 +723,7 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
private BarcodeData scannedData = null;
|
||||
|
||||
@Override
|
||||
public boolean onAddressScanned(String uri) {
|
||||
public boolean onScanned(String uri) {
|
||||
BarcodeData bcData = parseMoneroUri(uri);
|
||||
if (bcData != null) {
|
||||
this.scannedData = bcData;
|
||||
|
@ -759,7 +777,6 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BarcodeData popScannedData() {
|
||||
BarcodeData data = scannedData;
|
||||
|
@ -793,7 +810,7 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
}
|
||||
|
||||
void startReceive(String address) {
|
||||
Timber.d( "startReceive()");
|
||||
Timber.d("startReceive()");
|
||||
Bundle b = new Bundle();
|
||||
b.putString("address", address);
|
||||
b.putString("name", getWalletName());
|
||||
|
@ -802,6 +819,35 @@ public class WalletActivity extends SecureActivity implements WalletFragment.Lis
|
|||
|
||||
void startReceiveFragment(Bundle extras) {
|
||||
replaceFragment(new ReceiveFragment(), null, extras);
|
||||
Timber.d( "ReceiveFragment placed");
|
||||
Timber.d("ReceiveFragment placed");
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTotalFunds() {
|
||||
return getWallet().getUnlockedBalance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean verifyWalletPassword(String password) {
|
||||
String walletPath = new File(Helper.getStorageRoot(this),
|
||||
getWalletName() + ".keys").getAbsolutePath();
|
||||
return WalletManager.getInstance().verifyWalletPassword(walletPath, password, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
final Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_container);
|
||||
if (fragment instanceof OnBackPressedListener) {
|
||||
if (!((OnBackPressedListener) fragment).onBackPressed()) {
|
||||
super.onBackPressed();
|
||||
}
|
||||
} else {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFragmentDone() {
|
||||
popFragmentStack(null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ import android.widget.ProgressBar;
|
|||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.m2049r.xmrwallet.layout.Toolbar;
|
||||
import com.m2049r.xmrwallet.layout.TransactionInfoAdapter;
|
||||
import com.m2049r.xmrwallet.model.TransactionInfo;
|
||||
import com.m2049r.xmrwallet.model.Wallet;
|
||||
|
@ -47,6 +46,7 @@ import com.m2049r.xmrwallet.service.exchange.api.ExchangeRate;
|
|||
import com.m2049r.xmrwallet.service.exchange.kraken.ExchangeApiImpl;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
import com.m2049r.xmrwallet.util.OkHttpClientSingleton;
|
||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.List;
|
||||
|
@ -136,7 +136,6 @@ public class WalletFragment extends Fragment
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
if (activityCallback.isSynced()) {
|
||||
onSynced();
|
||||
}
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (c) 2017 m2049r et al.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.m2049r.xmrwallet;
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.m2049r.xmrwallet.util;
|
||||
package com.m2049r.xmrwallet.data;
|
||||
|
||||
public class BarcodeData {
|
||||
public String address = null;
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2017 m2049r
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.m2049r.xmrwallet.data;
|
||||
|
||||
import com.m2049r.xmrwallet.model.PendingTransaction;
|
||||
|
||||
public class PendingTx {
|
||||
final public PendingTransaction.Status status;
|
||||
final public String error;
|
||||
final public long amount;
|
||||
final public long dust;
|
||||
final public long fee;
|
||||
final public String txId;
|
||||
final public long txCount;
|
||||
|
||||
public PendingTx(PendingTransaction pendingTransaction) {
|
||||
status = pendingTransaction.getStatus();
|
||||
error = pendingTransaction.getErrorString();
|
||||
amount = pendingTransaction.getAmount();
|
||||
dust = pendingTransaction.getDust();
|
||||
fee = pendingTransaction.getFee();
|
||||
txId = pendingTransaction.getFirstTxId();
|
||||
txCount = pendingTransaction.getTxCount();
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.m2049r.xmrwallet.util;
|
||||
package com.m2049r.xmrwallet.data;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
@ -23,6 +23,15 @@ import com.m2049r.xmrwallet.model.PendingTransaction;
|
|||
|
||||
// https://stackoverflow.com/questions/2139134/how-to-send-an-object-from-one-android-activity-to-another-using-intents
|
||||
public class TxData implements Parcelable {
|
||||
|
||||
public TxData(TxData txData) {
|
||||
this.dst_addr = txData.dst_addr;
|
||||
this.paymentId = txData.paymentId;
|
||||
this.amount = txData.amount;
|
||||
this.mixin = txData.mixin;
|
||||
this.priority = txData.priority;
|
||||
}
|
||||
|
||||
public TxData(String dst_addr,
|
||||
String paymentId,
|
||||
long amount,
|
||||
|
@ -35,11 +44,35 @@ public class TxData implements Parcelable {
|
|||
this.priority = priority;
|
||||
}
|
||||
|
||||
public String dst_addr;
|
||||
public String paymentId;
|
||||
public long amount;
|
||||
public int mixin;
|
||||
public PendingTransaction.Priority priority;
|
||||
public long getFee() {
|
||||
return 0L;
|
||||
}
|
||||
|
||||
public String getDestinationAddress() {
|
||||
return dst_addr;
|
||||
}
|
||||
|
||||
public String getPaymentId() {
|
||||
return paymentId;
|
||||
}
|
||||
|
||||
public long getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public int getMixin() {
|
||||
return mixin;
|
||||
}
|
||||
|
||||
public PendingTransaction.Priority getPriority() {
|
||||
return priority;
|
||||
}
|
||||
|
||||
final private String dst_addr;
|
||||
final private String paymentId;
|
||||
final private long amount;
|
||||
final private int mixin;
|
||||
final private PendingTransaction.Priority priority;
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
|
@ -87,7 +120,7 @@ public class TxData implements Parcelable {
|
|||
sb.append(",mixin:");
|
||||
sb.append(mixin);
|
||||
sb.append(",priority:");
|
||||
sb.append(priority.toString());
|
||||
sb.append(String.valueOf(priority));
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* Copyright (c) 2017 m2049r
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.m2049r.xmrwallet.layout;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.m2049r.xmrwallet.SendFragmentNew;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
public class SpendViewPager extends ViewPager {
|
||||
|
||||
public interface OnValidateFieldsListener {
|
||||
boolean onValidateFields();
|
||||
}
|
||||
|
||||
public SpendViewPager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public SpendViewPager(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public void next() {
|
||||
int pos = getCurrentItem();
|
||||
if (validateFields(pos)) {
|
||||
setCurrentItem(pos + 1);
|
||||
}
|
||||
}
|
||||
|
||||
public void previous() {
|
||||
setCurrentItem(getCurrentItem() - 1);
|
||||
}
|
||||
|
||||
private boolean allowSwipe = true;
|
||||
|
||||
public void allowSwipe(boolean allow) {
|
||||
allowSwipe = allow;
|
||||
}
|
||||
|
||||
public boolean validateFields(int position) {
|
||||
OnValidateFieldsListener c = ((SendFragmentNew.SpendPagerAdapter) getAdapter()).getFragment(position);
|
||||
return c.onValidateFields();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent event) {
|
||||
if (allowSwipe) return super.onInterceptTouchEvent(event);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if (allowSwipe) return super.onTouchEvent(event);
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -42,11 +42,6 @@ public class TransactionInfoAdapter extends RecyclerView.Adapter<TransactionInfo
|
|||
|
||||
private final SimpleDateFormat DATETIME_FORMATTER = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
|
||||
//static final int TX_RED = Color.rgb(255, 79, 65);
|
||||
//static final int TX_GREEN = Color.rgb(54, 176, 91);
|
||||
//static final int TX_PENDING = Color.rgb(72, 53, 176);
|
||||
//static final int TX_FAILED = Color.rgb(208, 0, 255);
|
||||
|
||||
private int outboundColour;
|
||||
private int inboundColour;
|
||||
private int pendingColour;
|
||||
|
|
|
@ -19,8 +19,6 @@ package com.m2049r.xmrwallet.model;
|
|||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.m2049r.xmrwallet.util.TxData;
|
||||
|
||||
public class Transfer implements Parcelable {
|
||||
public long amount;
|
||||
public String address;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package com.m2049r.xmrwallet.model;
|
||||
|
||||
import android.util.Log;
|
||||
import com.m2049r.xmrwallet.data.TxData;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
@ -187,6 +187,15 @@ public class Wallet {
|
|||
}
|
||||
}
|
||||
|
||||
public PendingTransaction createTransaction(TxData txData) {
|
||||
return createTransaction(
|
||||
txData.getDestinationAddress(),
|
||||
txData.getPaymentId(),
|
||||
txData.getAmount(),
|
||||
txData.getMixin(),
|
||||
txData.getPriority());
|
||||
}
|
||||
|
||||
public PendingTransaction createTransaction(String dst_addr, String payment_id,
|
||||
long amount, int mixin_count,
|
||||
PendingTransaction.Priority priority) {
|
||||
|
|
|
@ -206,8 +206,9 @@ public class WalletManager {
|
|||
|
||||
public boolean isTestNet() {
|
||||
if (daemonAddress == null) {
|
||||
return true;
|
||||
// assume testnet not explicitly initialised
|
||||
throw new IllegalStateException("use setDaemon() to initialise daemon and net first!");
|
||||
//throw new IllegalStateException("use setDaemon() to initialise daemon and net first!");
|
||||
}
|
||||
return testnet;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ import com.m2049r.xmrwallet.model.Wallet;
|
|||
import com.m2049r.xmrwallet.model.WalletListener;
|
||||
import com.m2049r.xmrwallet.model.WalletManager;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
import com.m2049r.xmrwallet.util.TxData;
|
||||
import com.m2049r.xmrwallet.data.TxData;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
|
@ -76,7 +76,6 @@ public class WalletService extends Service {
|
|||
Timber.d("MyWalletListener.start()");
|
||||
Wallet wallet = getWallet();
|
||||
if (wallet == null) throw new IllegalStateException("No wallet!");
|
||||
//acquireWakeLock();
|
||||
wallet.setListener(this);
|
||||
wallet.startRefresh();
|
||||
}
|
||||
|
@ -87,7 +86,6 @@ public class WalletService extends Service {
|
|||
if (wallet == null) throw new IllegalStateException("No wallet!");
|
||||
wallet.pauseRefresh();
|
||||
wallet.setListener(null);
|
||||
//releaseWakeLock();
|
||||
}
|
||||
|
||||
// WalletListener callbacks
|
||||
|
@ -96,7 +94,7 @@ public class WalletService extends Service {
|
|||
}
|
||||
|
||||
public void moneyReceived(String txId, long amount) {
|
||||
Timber.d("moneyReceived() %d @ %s",amount, txId);
|
||||
Timber.d("moneyReceived() %d @ %s", amount, txId);
|
||||
}
|
||||
|
||||
public void unconfirmedMoneyReceived(String txId, long amount) {
|
||||
|
@ -180,7 +178,6 @@ public class WalletService extends Service {
|
|||
}
|
||||
}
|
||||
}
|
||||
//Timber.d("updated daemon status: " + daemonHeight + "/" + connectionStatus.toString());
|
||||
}
|
||||
|
||||
public long getDaemonHeight() {
|
||||
|
@ -212,9 +209,11 @@ public class WalletService extends Service {
|
|||
|
||||
void onWalletStored(boolean success);
|
||||
|
||||
void onCreatedTransaction(PendingTransaction pendingTransaction);
|
||||
void onTransactionCreated(PendingTransaction pendingTransaction);
|
||||
|
||||
void onSentTransaction(boolean success);
|
||||
void onTransactionSent(String txid);
|
||||
|
||||
void onSendTransactionFailed(String error);
|
||||
|
||||
void onSetNotes(boolean success);
|
||||
|
||||
|
@ -303,15 +302,14 @@ public class WalletService extends Service {
|
|||
Wallet myWallet = getWallet();
|
||||
Timber.d("CREATE TX for wallet: %s", myWallet.getName());
|
||||
TxData txData = extras.getParcelable(REQUEST_CMD_TX_DATA);
|
||||
PendingTransaction pendingTransaction = myWallet.createTransaction(
|
||||
txData.dst_addr, txData.paymentId, txData.amount, txData.mixin, txData.priority);
|
||||
PendingTransaction pendingTransaction = myWallet.createTransaction(txData);
|
||||
PendingTransaction.Status status = pendingTransaction.getStatus();
|
||||
Timber.d("transaction status %s", status);
|
||||
if (status != PendingTransaction.Status.Status_Ok) {
|
||||
Timber.w("Create Transaction failed: %s", pendingTransaction.getErrorString());
|
||||
}
|
||||
if (observer != null) {
|
||||
observer.onCreatedTransaction(pendingTransaction);
|
||||
observer.onTransactionCreated(pendingTransaction);
|
||||
} else {
|
||||
myWallet.disposePendingTransaction();
|
||||
}
|
||||
|
@ -325,7 +323,7 @@ public class WalletService extends Service {
|
|||
Timber.w("Create Transaction failed: %s", pendingTransaction.getErrorString());
|
||||
}
|
||||
if (observer != null) {
|
||||
observer.onCreatedTransaction(pendingTransaction);
|
||||
observer.onTransactionCreated(pendingTransaction);
|
||||
} else {
|
||||
myWallet.disposePendingTransaction();
|
||||
}
|
||||
|
@ -336,14 +334,15 @@ public class WalletService extends Service {
|
|||
if ((pendingTransaction == null)
|
||||
|| (pendingTransaction.getStatus() != PendingTransaction.Status.Status_Ok)) {
|
||||
Timber.e("PendingTransaction is %s", pendingTransaction.getStatus());
|
||||
final String error = pendingTransaction.getErrorString();
|
||||
myWallet.disposePendingTransaction(); // it's broken anyway
|
||||
if (observer != null) observer.onSentTransaction(false);
|
||||
if (observer != null) observer.onSendTransactionFailed(error);
|
||||
return;
|
||||
}
|
||||
String txid = pendingTransaction.getFirstTxId();
|
||||
final String txid = pendingTransaction.getFirstTxId();
|
||||
boolean success = pendingTransaction.commit("", true);
|
||||
myWallet.disposePendingTransaction();
|
||||
if (observer != null) observer.onSentTransaction(success);
|
||||
if (observer != null) observer.onTransactionSent(txid);
|
||||
if (success) {
|
||||
String notes = extras.getString(REQUEST_CMD_SEND_NOTES);
|
||||
if ((notes != null) && (!notes.isEmpty())) {
|
||||
|
|
|
@ -138,6 +138,3 @@ public class ExchangeApiImpl implements ExchangeApi {
|
|||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ package com.m2049r.xmrwallet.service.exchange.kraken;
|
|||
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeCallback;
|
||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeException;
|
||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeRate;
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@ import android.graphics.drawable.VectorDrawable;
|
|||
import android.os.Environment;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import com.m2049r.xmrwallet.R;
|
||||
|
@ -53,7 +55,6 @@ public class Helper {
|
|||
static private final String WALLET_DIR = "monerujo";
|
||||
|
||||
static public int DISPLAY_DIGITS_INFO = 5;
|
||||
static public int DISPLAY_DIGITS_SHORT = 5;
|
||||
|
||||
static public File getStorageRoot(Context context) {
|
||||
if (!isExternalStorageWritable()) {
|
||||
|
@ -92,7 +93,7 @@ public class Helper {
|
|||
}
|
||||
}
|
||||
|
||||
static public final int PERMISSIONS_REQUEST_CAMERA = 1;
|
||||
static public final int PERMISSIONS_REQUEST_CAMERA = 7;
|
||||
|
||||
static public boolean getCameraPermission(Activity context) {
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
|
||||
|
@ -174,9 +175,14 @@ public class Helper {
|
|||
static public String getFormattedAmount(double amount, boolean isXmr) {
|
||||
// at this point selection is XMR in case of error
|
||||
String displayB;
|
||||
if (isXmr) { // not XMR
|
||||
displayB = String.format(Locale.US, "%,.5f", amount);
|
||||
} else { // XMR
|
||||
if (isXmr) { // XMR
|
||||
long xmr = Wallet.getAmountFromDouble(amount);
|
||||
if ((xmr > 0) || (amount == 0)) {
|
||||
displayB = String.format(Locale.US, "%,.5f", amount);
|
||||
} else {
|
||||
displayB = null;
|
||||
}
|
||||
} else { // not XMR
|
||||
displayB = String.format(Locale.US, "%,.2f", amount);
|
||||
}
|
||||
return displayB;
|
||||
|
@ -241,4 +247,17 @@ public class Helper {
|
|||
clipboardManager.setPrimaryClip(clip);
|
||||
}
|
||||
|
||||
static private Animation ShakeAnimation;
|
||||
|
||||
static public Animation getShakeAnimation(Context context) {
|
||||
if (ShakeAnimation == null) {
|
||||
synchronized (Helper.class) {
|
||||
if (ShakeAnimation == null) {
|
||||
ShakeAnimation = AnimationUtils.loadAnimation(context, R.anim.shake);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ShakeAnimation;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
// based on from https://stackoverflow.com/a/45325876 (which did not work for me)
|
||||
|
||||
package com.m2049r.xmrwallet.layout;
|
||||
package com.m2049r.xmrwallet.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.design.widget.TextInputLayout;
|
|
@ -0,0 +1,156 @@
|
|||
/*
|
||||
* Copyright (c) 2017 m2049r et al.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// based on https://github.com/marcokstephen/StepProgressBar
|
||||
|
||||
package com.m2049r.xmrwallet.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import com.m2049r.xmrwallet.R;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
public class DotBar extends View {
|
||||
|
||||
final private int inactiveColor;
|
||||
final private int activeColor;
|
||||
|
||||
final private float dotSize;
|
||||
private float dotSpacing;
|
||||
|
||||
final private int numDots;
|
||||
private int activeDot;
|
||||
|
||||
final private Paint paint;
|
||||
|
||||
public DotBar(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
TypedArray ta = context.getTheme().obtainStyledAttributes(attrs, R.styleable.DotBar, 0, 0);
|
||||
try {
|
||||
inactiveColor = ta.getInt(R.styleable.DotBar_inactiveColor, 0);
|
||||
activeColor = ta.getInt(R.styleable.DotBar_activeColor, 0);
|
||||
dotSize = ta.getDimensionPixelSize(R.styleable.DotBar_dotSize, 8);
|
||||
numDots = ta.getInt(R.styleable.DotBar_numberDots, 5);
|
||||
activeDot = ta.getInt(R.styleable.DotBar_activeDot, 0);
|
||||
} finally {
|
||||
ta.recycle();
|
||||
}
|
||||
|
||||
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int desiredWidth = (int) ((numDots * dotSize) + getPaddingLeft() + getPaddingRight());
|
||||
int desiredHeight = (int) (dotSize + getPaddingBottom() + getPaddingTop());
|
||||
|
||||
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
|
||||
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
|
||||
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
|
||||
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
|
||||
|
||||
int width;
|
||||
int height;
|
||||
|
||||
//Measure Width
|
||||
if (widthMode == MeasureSpec.EXACTLY) {
|
||||
//Must be this size
|
||||
width = widthSize;
|
||||
} else if (widthMode == MeasureSpec.AT_MOST) {
|
||||
//Can't be bigger than...
|
||||
width = Math.min(desiredWidth, widthSize);
|
||||
} else {
|
||||
//Be whatever you want
|
||||
width = desiredWidth;
|
||||
}
|
||||
|
||||
//Measure Height
|
||||
if (heightMode == MeasureSpec.EXACTLY) {
|
||||
//Must be this size
|
||||
height = heightSize;
|
||||
} else if (heightMode == MeasureSpec.AT_MOST) {
|
||||
//Can't be bigger than...
|
||||
height = Math.min(desiredHeight, heightSize);
|
||||
} else {
|
||||
//Be whatever you want
|
||||
height = desiredHeight;
|
||||
}
|
||||
|
||||
dotSpacing = (int) (((1.0 * width - (getPaddingLeft() + getPaddingRight())) / numDots - dotSize) / (numDots - 1));
|
||||
|
||||
Timber.d("dotSpacing=%f", dotSpacing);
|
||||
//MUST CALL THIS
|
||||
setMeasuredDimension(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
|
||||
// Centering the dots in the middle of the canvas
|
||||
float singleDotSize = dotSpacing + dotSize;
|
||||
float combinedDotSize = singleDotSize * numDots - dotSpacing;
|
||||
int startingX = (int) ((canvas.getWidth() - combinedDotSize) / 2);
|
||||
int startingY = (int) ((canvas.getHeight() - dotSize) / 2);
|
||||
|
||||
for (int i = 0; i < numDots; i++) {
|
||||
int x = (int) (startingX + i * singleDotSize);
|
||||
if (i == activeDot) {
|
||||
paint.setColor(activeColor);
|
||||
} else {
|
||||
paint.setColor(inactiveColor);
|
||||
}
|
||||
canvas.drawCircle(x + dotSize / 2, startingY + dotSize / 2, dotSize / 2, paint);
|
||||
}
|
||||
}
|
||||
|
||||
public void next() {
|
||||
if (activeDot < numDots - 2) {
|
||||
activeDot++;
|
||||
invalidate();
|
||||
} // else no next - stay stuck at end
|
||||
}
|
||||
|
||||
public void previous() {
|
||||
if (activeDot >= 0) {
|
||||
activeDot--;
|
||||
invalidate();
|
||||
} // else no previous - stay stuck at beginning
|
||||
}
|
||||
|
||||
public void setActiveDot(int i) {
|
||||
if ((i >= 0) && (i < numDots)) {
|
||||
activeDot = i;
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public int getActiveDot() {
|
||||
return activeDot;
|
||||
}
|
||||
|
||||
public int getNumDots() {
|
||||
return numDots;
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
// https://stackoverflow.com/questions/2126717/android-autocompletetextview-show-suggestions-when-no-text-entered
|
||||
|
||||
package com.m2049r.xmrwallet.layout;
|
||||
package com.m2049r.xmrwallet.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
|
@ -0,0 +1,449 @@
|
|||
/*
|
||||
* Copyright (c) 2017 m2049r
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// based on https://code.tutsplus.com/tutorials/creating-compound-views-on-android--cms-22889
|
||||
|
||||
package com.m2049r.xmrwallet.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.m2049r.xmrwallet.R;
|
||||
import com.m2049r.xmrwallet.model.Wallet;
|
||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeApi;
|
||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeCallback;
|
||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeRate;
|
||||
import com.m2049r.xmrwallet.service.exchange.kraken.ExchangeApiImpl;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
import com.m2049r.xmrwallet.util.OkHttpClientSingleton;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
public class ExchangeTextView extends LinearLayout
|
||||
implements NumberPadView.NumberPadListener {
|
||||
|
||||
String xmrAmount = null;
|
||||
String notXmrAmount = null;
|
||||
|
||||
void setXmr(String xmr) {
|
||||
xmrAmount = xmr;
|
||||
if (onNewAmountListener != null) {
|
||||
onNewAmountListener.onNewAmount(xmr);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean validate(double max) {
|
||||
boolean ok = true;
|
||||
if (xmrAmount != null) {
|
||||
try {
|
||||
double amount = Double.parseDouble(xmrAmount);
|
||||
if (amount > max) {
|
||||
ok = false;
|
||||
}
|
||||
if (amount <= 0) {
|
||||
ok = false;
|
||||
}
|
||||
} catch (NumberFormatException ex) {
|
||||
// this cannot be
|
||||
Timber.e(ex.getLocalizedMessage());
|
||||
ok = false;
|
||||
}
|
||||
} else {
|
||||
ok = false;
|
||||
}
|
||||
if (!ok) {
|
||||
shakeAmountField();
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
void shakeAmountField() {
|
||||
tvAmountA.startAnimation(Helper.getShakeAnimation(getContext()));
|
||||
}
|
||||
|
||||
public void setAmount(String xmrAmount) {
|
||||
if (xmrAmount != null) {
|
||||
setCurrencyA(0);
|
||||
tvAmountA.setText(xmrAmount);
|
||||
setXmr(xmrAmount);
|
||||
this.notXmrAmount = null;
|
||||
doExchange();
|
||||
} else {
|
||||
setXmr(null);
|
||||
this.notXmrAmount = null;
|
||||
tvAmountB.setText(null);
|
||||
}
|
||||
}
|
||||
|
||||
public String getAmount() {
|
||||
return xmrAmount;
|
||||
}
|
||||
|
||||
TextView tvAmountA;
|
||||
TextView tvAmountB;
|
||||
Spinner sCurrencyA;
|
||||
Spinner sCurrencyB;
|
||||
ImageView evExchange;
|
||||
ProgressBar pbExchange;
|
||||
|
||||
|
||||
public void setCurrencyA(int currency) {
|
||||
if ((currency != 0) && (getCurrencyB() != 0)) {
|
||||
setCurrencyB(0);
|
||||
}
|
||||
sCurrencyA.setSelection(currency, true);
|
||||
doExchange();
|
||||
}
|
||||
|
||||
public void setCurrencyB(int currency) {
|
||||
if ((currency != 0) && (getCurrencyA() != 0)) {
|
||||
setCurrencyA(0);
|
||||
}
|
||||
sCurrencyB.setSelection(currency, true);
|
||||
doExchange();
|
||||
}
|
||||
|
||||
public int getCurrencyA() {
|
||||
return sCurrencyA.getSelectedItemPosition();
|
||||
}
|
||||
|
||||
public int getCurrencyB() {
|
||||
return sCurrencyB.getSelectedItemPosition();
|
||||
}
|
||||
|
||||
public ExchangeTextView(Context context) {
|
||||
super(context);
|
||||
initializeViews(context);
|
||||
}
|
||||
|
||||
public ExchangeTextView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initializeViews(context);
|
||||
}
|
||||
|
||||
public ExchangeTextView(Context context,
|
||||
AttributeSet attrs,
|
||||
int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
initializeViews(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inflates the views in the layout.
|
||||
*
|
||||
* @param context the current context for the view.
|
||||
*/
|
||||
private void initializeViews(Context context) {
|
||||
LayoutInflater inflater = (LayoutInflater) context
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
inflater.inflate(R.layout.view_exchange_text, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
tvAmountA = (TextView) findViewById(R.id.tvAmountA);
|
||||
tvAmountB = (TextView) findViewById(R.id.tvAmountB);
|
||||
sCurrencyA = (Spinner) findViewById(R.id.sCurrencyA);
|
||||
sCurrencyB = (Spinner) findViewById(R.id.sCurrencyB);
|
||||
evExchange = (ImageView) findViewById(R.id.evExchange);
|
||||
pbExchange = (ProgressBar) findViewById(R.id.pbExchange);
|
||||
|
||||
// make progress circle gray
|
||||
pbExchange.getIndeterminateDrawable().
|
||||
setColorFilter(getResources().getColor(R.color.trafficGray),
|
||||
android.graphics.PorterDuff.Mode.MULTIPLY);
|
||||
|
||||
|
||||
sCurrencyA.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
|
||||
if (position != 0) { // if not XMR, select XMR on other
|
||||
sCurrencyB.setSelection(0, true);
|
||||
}
|
||||
doExchange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parentView) {
|
||||
// nothing
|
||||
}
|
||||
});
|
||||
|
||||
sCurrencyB.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(final AdapterView<?> parentView, View selectedItemView, int position, long id) {
|
||||
if (position != 0) { // if not XMR, select XMR on other
|
||||
sCurrencyA.setSelection(0, true);
|
||||
}
|
||||
doExchange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parentView) {
|
||||
// nothing
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void doExchange() {
|
||||
tvAmountB.setText(null);
|
||||
// use cached exchange rate if we have it
|
||||
if (!isExchangeInProgress()) {
|
||||
String enteredCurrencyA = (String) sCurrencyA.getSelectedItem();
|
||||
String enteredCurrencyB = (String) sCurrencyB.getSelectedItem();
|
||||
if ((enteredCurrencyA + enteredCurrencyB).equals(assetPair)) {
|
||||
if (prepareExchange()) {
|
||||
exchange(assetRate);
|
||||
} else {
|
||||
clearAmounts();
|
||||
}
|
||||
} else {
|
||||
clearAmounts();
|
||||
startExchange();
|
||||
}
|
||||
} else {
|
||||
clearAmounts();
|
||||
}
|
||||
}
|
||||
|
||||
private void clearAmounts() {
|
||||
Timber.d("clearAmounts");
|
||||
if ((xmrAmount != null) || (notXmrAmount != null)) {
|
||||
tvAmountB.setText(null);
|
||||
setXmr(null);
|
||||
notXmrAmount = null;
|
||||
}
|
||||
}
|
||||
|
||||
private final ExchangeApi exchangeApi = new ExchangeApiImpl(OkHttpClientSingleton.getOkHttpClient());
|
||||
|
||||
void startExchange() {
|
||||
showProgress();
|
||||
String currencyA = (String) sCurrencyA.getSelectedItem();
|
||||
String currencyB = (String) sCurrencyB.getSelectedItem();
|
||||
exchangeApi.queryExchangeRate(currencyA, currencyB,
|
||||
new ExchangeCallback() {
|
||||
@Override
|
||||
public void onSuccess(final ExchangeRate exchangeRate) {
|
||||
if (isAttachedToWindow())
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
exchange(exchangeRate);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(final Exception e) {
|
||||
Timber.e(e.getLocalizedMessage());
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
exchangeFailed();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void exchange(double rate) {
|
||||
Timber.d("%s / %s", xmrAmount, notXmrAmount);
|
||||
if (getCurrencyA() == 0) {
|
||||
if (xmrAmount == null) return;
|
||||
if (!xmrAmount.isEmpty() && (rate > 0)) {
|
||||
double amountB = rate * Double.parseDouble(xmrAmount);
|
||||
notXmrAmount = Helper.getFormattedAmount(amountB, getCurrencyB() == 0);
|
||||
} else {
|
||||
notXmrAmount = "";
|
||||
}
|
||||
tvAmountB.setText(notXmrAmount);
|
||||
Timber.d("%s / %s", xmrAmount, notXmrAmount);
|
||||
} else if (getCurrencyB() == 0) {
|
||||
if (notXmrAmount == null) return;
|
||||
if (!notXmrAmount.isEmpty() && (rate > 0)) {
|
||||
double amountB = rate * Double.parseDouble(notXmrAmount);
|
||||
setXmr(Helper.getFormattedAmount(amountB, true));
|
||||
} else {
|
||||
setXmr("");
|
||||
}
|
||||
tvAmountB.setText(xmrAmount);
|
||||
if (xmrAmount == null) {
|
||||
shakeAmountField();
|
||||
}
|
||||
} else { // no XMR currency - cannot happen!
|
||||
Timber.e("No XMR currency!");
|
||||
setXmr(null);
|
||||
notXmrAmount = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
boolean prepareExchange() {
|
||||
Timber.d("prepareExchange()");
|
||||
String enteredAmount = tvAmountA.getText().toString();
|
||||
if (!enteredAmount.isEmpty()) {
|
||||
String cleanAmount = "";
|
||||
if (getCurrencyA() == 0) {
|
||||
// sanitize the input
|
||||
long xmr = Wallet.getAmountFromString(enteredAmount);
|
||||
if (xmr >= 0) {
|
||||
cleanAmount = Helper.getDisplayAmount(xmr);
|
||||
} else {
|
||||
cleanAmount = null;
|
||||
}
|
||||
setXmr(cleanAmount);
|
||||
notXmrAmount = null;
|
||||
Timber.d("cleanAmount = %s", cleanAmount);
|
||||
if (cleanAmount == null) {
|
||||
shakeAmountField();
|
||||
return false;
|
||||
}
|
||||
} else if (getCurrencyB() == 0) { // we use B & 0 here for the else below ...
|
||||
// sanitize the input
|
||||
double amountA = Double.parseDouble(enteredAmount);
|
||||
cleanAmount = String.format(Locale.US, "%.2f", amountA);
|
||||
setXmr(null);
|
||||
notXmrAmount = cleanAmount;
|
||||
} else { // no XMR currency - cannot happen!
|
||||
Timber.e("No XMR currency!");
|
||||
setXmr(null);
|
||||
notXmrAmount = null;
|
||||
return false;
|
||||
}
|
||||
Timber.d("prepareExchange() %s", cleanAmount);
|
||||
} else {
|
||||
setXmr("");
|
||||
notXmrAmount = "";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void exchangeFailed() {
|
||||
hideProgress();
|
||||
exchange(0);
|
||||
if (onFailedExchangeListener != null) {
|
||||
onFailedExchangeListener.onFailedExchange();
|
||||
}
|
||||
}
|
||||
|
||||
String assetPair = null;
|
||||
double assetRate = 0;
|
||||
|
||||
public void exchange(ExchangeRate exchangeRate) {
|
||||
hideProgress();
|
||||
// first, make sure this is what we want
|
||||
String enteredCurrencyA = (String) sCurrencyA.getSelectedItem();
|
||||
String enteredCurrencyB = (String) sCurrencyB.getSelectedItem();
|
||||
if (!exchangeRate.getBaseCurrency().equals(enteredCurrencyA)
|
||||
|| !exchangeRate.getQuoteCurrency().equals(enteredCurrencyB)) {
|
||||
// something's wrong
|
||||
Timber.e("Currencies don't match!");
|
||||
return;
|
||||
}
|
||||
assetPair = enteredCurrencyA + enteredCurrencyB;
|
||||
assetRate = exchangeRate.getRate();
|
||||
if (prepareExchange()) {
|
||||
exchange(exchangeRate.getRate());
|
||||
}
|
||||
}
|
||||
|
||||
private void showProgress() {
|
||||
pbExchange.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private boolean isExchangeInProgress() {
|
||||
return pbExchange.getVisibility() == View.VISIBLE;
|
||||
}
|
||||
|
||||
private void hideProgress() {
|
||||
pbExchange.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
// Hooks
|
||||
public interface OnNewAmountListener {
|
||||
void onNewAmount(String xmr);
|
||||
}
|
||||
|
||||
OnNewAmountListener onNewAmountListener;
|
||||
|
||||
public void setOnNewAmountListener(OnNewAmountListener listener) {
|
||||
onNewAmountListener = listener;
|
||||
}
|
||||
|
||||
public interface OnAmountInvalidatedListener {
|
||||
void onAmountInvalidated();
|
||||
}
|
||||
|
||||
OnAmountInvalidatedListener onAmountInvalidatedListener;
|
||||
|
||||
public void setOnAmountInvalidatedListener(OnAmountInvalidatedListener listener) {
|
||||
onAmountInvalidatedListener = listener;
|
||||
}
|
||||
|
||||
public interface OnFailedExchangeListener {
|
||||
void onFailedExchange();
|
||||
}
|
||||
|
||||
OnFailedExchangeListener onFailedExchangeListener;
|
||||
|
||||
public void setOnFailedExchangeListener(OnFailedExchangeListener listener) {
|
||||
onFailedExchangeListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDigitPressed(final int digit) {
|
||||
tvAmountA.append(String.valueOf(digit));
|
||||
doExchange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPointPressed() {
|
||||
//TODO locale?
|
||||
if (tvAmountA.getText().toString().indexOf('.') == -1) {
|
||||
tvAmountA.append(".");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackSpacePressed() {
|
||||
String entry = tvAmountA.getText().toString();
|
||||
int length = entry.length();
|
||||
if (length > 0) {
|
||||
tvAmountA.setText(entry.substring(0, entry.length() - 1));
|
||||
doExchange();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClearAll() {
|
||||
tvAmountA.setText(null);
|
||||
doExchange();
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
// based on https://code.tutsplus.com/tutorials/creating-compound-views-on-android--cms-22889
|
||||
|
||||
package com.m2049r.xmrwallet.layout;
|
||||
package com.m2049r.xmrwallet.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
|
@ -49,7 +49,14 @@ import java.util.Locale;
|
|||
|
||||
import timber.log.Timber;
|
||||
|
||||
public class ExchangeView extends LinearLayout {
|
||||
// TODO combine this with ExchangeTextView
|
||||
|
||||
public class ExchangeView extends LinearLayout
|
||||
implements NumberPadView.NumberPadListener {
|
||||
|
||||
public void enableSoftKeyboard(final boolean isEnabled) {
|
||||
etAmount.getEditText().setShowSoftInputOnFocus(isEnabled);
|
||||
}
|
||||
|
||||
public boolean focus() {
|
||||
return etAmount.requestFocus();
|
||||
|
@ -201,7 +208,7 @@ public class ExchangeView extends LinearLayout {
|
|||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parentView) {
|
||||
// nothing (yet?)
|
||||
// nothing
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -229,11 +236,7 @@ public class ExchangeView extends LinearLayout {
|
|||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
etAmount.setError(null);
|
||||
if ((xmrAmount != null) || (notXmrAmount != null)) {
|
||||
tvAmountB.setText("--");
|
||||
setXmr(null);
|
||||
notXmrAmount = null;
|
||||
}
|
||||
//doExchange();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -280,8 +283,31 @@ public class ExchangeView extends LinearLayout {
|
|||
|
||||
public void doExchange() {
|
||||
tvAmountB.setText("--");
|
||||
// TODO cache & use cached exchange rate here
|
||||
startExchange();
|
||||
// use cached exchange rate if we have it
|
||||
if (!isExchangeInProgress()) {
|
||||
String enteredCurrencyA = (String) sCurrencyA.getSelectedItem();
|
||||
String enteredCurrencyB = (String) sCurrencyB.getSelectedItem();
|
||||
if ((enteredCurrencyA + enteredCurrencyB).equals(assetPair)) {
|
||||
if (prepareExchange()) {
|
||||
exchange(assetRate);
|
||||
} else {
|
||||
clearAmounts();
|
||||
}
|
||||
} else {
|
||||
clearAmounts();
|
||||
startExchange();
|
||||
}
|
||||
} else {
|
||||
clearAmounts();
|
||||
}
|
||||
}
|
||||
|
||||
private void clearAmounts() {
|
||||
if ((xmrAmount != null) || (notXmrAmount != null)) {
|
||||
tvAmountB.setText("--");
|
||||
setXmr(null);
|
||||
notXmrAmount = null;
|
||||
}
|
||||
}
|
||||
|
||||
private final ExchangeApi exchangeApi = new ExchangeApiImpl(OkHttpClientSingleton.getOkHttpClient());
|
||||
|
@ -368,7 +394,6 @@ public class ExchangeView extends LinearLayout {
|
|||
return false;
|
||||
}
|
||||
Timber.d("prepareExchange() %s", cleanAmount);
|
||||
//etAmount.getEditText().setText(cleanAmount); // display what we use
|
||||
} else {
|
||||
setXmr("");
|
||||
notXmrAmount = "";
|
||||
|
@ -389,6 +414,9 @@ public class ExchangeView extends LinearLayout {
|
|||
}
|
||||
}
|
||||
|
||||
String assetPair = null;
|
||||
double assetRate = 0;
|
||||
|
||||
public void exchange(ExchangeRate exchangeRate) {
|
||||
hideProgress();
|
||||
// first, make sure this is what we want
|
||||
|
@ -400,6 +428,8 @@ public class ExchangeView extends LinearLayout {
|
|||
Timber.e("Currencies don't match!");
|
||||
return;
|
||||
}
|
||||
assetPair = enteredCurrencyA + enteredCurrencyB;
|
||||
assetRate = exchangeRate.getRate();
|
||||
if (prepareExchange()) {
|
||||
exchange(exchangeRate.getRate());
|
||||
}
|
||||
|
@ -409,6 +439,10 @@ public class ExchangeView extends LinearLayout {
|
|||
pbExchange.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private boolean isExchangeInProgress() {
|
||||
return pbExchange.getVisibility() == View.VISIBLE;
|
||||
}
|
||||
|
||||
private void hideProgress() {
|
||||
pbExchange.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
@ -443,4 +477,31 @@ public class ExchangeView extends LinearLayout {
|
|||
public void setOnFailedExchangeListener(OnFailedExchangeListener listener) {
|
||||
onFailedExchangeListener = listener;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDigitPressed(final int digit) {
|
||||
etAmount.getEditText().append(String.valueOf(digit));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPointPressed() {
|
||||
//TODO locale?
|
||||
if (etAmount.getEditText().getText().toString().indexOf('.') == -1) {
|
||||
etAmount.getEditText().append(".");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackSpacePressed() {
|
||||
Editable editable = etAmount.getEditText().getText();
|
||||
int length = editable.length();
|
||||
if (length > 0) {
|
||||
editable.delete(length - 1, length);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClearAll() {
|
||||
etAmount.getEditText().getText().clear();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
package com.m2049r.xmrwallet.widget;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.m2049r.xmrwallet.R;
|
||||
|
||||
public class NumberPadView extends LinearLayout
|
||||
implements View.OnClickListener, View.OnLongClickListener {
|
||||
|
||||
@Override
|
||||
public void onClick(final View view) {
|
||||
if (listener == null) {
|
||||
throw new IllegalArgumentException("NumberPadListener has to be set, use setListener() to set it.");
|
||||
}
|
||||
switch (view.getId()) {
|
||||
case R.id.numberPadPoint:
|
||||
listener.onPointPressed();
|
||||
break;
|
||||
case R.id.numberPadBackSpace:
|
||||
listener.onBackSpacePressed();
|
||||
break;
|
||||
default:
|
||||
if (view.getTag() != null) {
|
||||
listener.onDigitPressed(Integer.parseInt(view.getTag().toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLongClick(final View view) {
|
||||
if (view.getId() == R.id.numberPadBackSpace) {
|
||||
listener.onClearAll();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setListener(final NumberPadListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public interface NumberPadListener {
|
||||
void onDigitPressed(final int digit);
|
||||
|
||||
void onBackSpacePressed();
|
||||
|
||||
void onPointPressed();
|
||||
|
||||
void onClearAll();
|
||||
}
|
||||
|
||||
private NumberPadListener listener;
|
||||
|
||||
public NumberPadView(final Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public NumberPadView(final Context context,
|
||||
@Nullable final AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public NumberPadView(final Context context, @Nullable final AttributeSet attrs,
|
||||
final int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
final View view = View.inflate(context, R.layout.view_number_pad, this);
|
||||
setOrientation(VERTICAL);
|
||||
view.findViewById(R.id.numberPad0).setOnClickListener(this);
|
||||
view.findViewById(R.id.numberPad1).setOnClickListener(this);
|
||||
view.findViewById(R.id.numberPad2).setOnClickListener(this);
|
||||
view.findViewById(R.id.numberPad3).setOnClickListener(this);
|
||||
view.findViewById(R.id.numberPad4).setOnClickListener(this);
|
||||
view.findViewById(R.id.numberPad5).setOnClickListener(this);
|
||||
view.findViewById(R.id.numberPad6).setOnClickListener(this);
|
||||
view.findViewById(R.id.numberPad7).setOnClickListener(this);
|
||||
view.findViewById(R.id.numberPad8).setOnClickListener(this);
|
||||
view.findViewById(R.id.numberPad9).setOnClickListener(this);
|
||||
view.findViewById(R.id.numberPadPoint).setOnClickListener(this);
|
||||
view.findViewById(R.id.numberPadBackSpace).setOnClickListener(this);
|
||||
view.findViewById(R.id.numberPadBackSpace).setOnLongClickListener(this);
|
||||
}
|
||||
}
|
|
@ -16,12 +16,11 @@
|
|||
|
||||
// based on https://code.tutsplus.com/tutorials/creating-compound-views-on-android--cms-22889
|
||||
|
||||
package com.m2049r.xmrwallet.layout;
|
||||
package com.m2049r.xmrwallet.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
@ -30,9 +29,9 @@ import android.widget.TextView;
|
|||
|
||||
import com.m2049r.xmrwallet.R;
|
||||
|
||||
public class Toolbar extends android.support.v7.widget.Toolbar {
|
||||
static final String TAG = "Toolbar";
|
||||
import timber.log.Timber;
|
||||
|
||||
public class Toolbar extends android.support.v7.widget.Toolbar {
|
||||
public interface OnButtonListener {
|
||||
void onButton(int type);
|
||||
}
|
||||
|
@ -124,26 +123,26 @@ public class Toolbar extends android.support.v7.widget.Toolbar {
|
|||
public void setButton(int type) {
|
||||
switch (type) {
|
||||
case BUTTON_BACK:
|
||||
Log.d(TAG, "BUTTON_BACK");
|
||||
Timber.d("BUTTON_BACK");
|
||||
bDonate.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_arrow_back_white_24dp, 0, 0, 0);
|
||||
bDonate.setText(null);
|
||||
bDonate.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case BUTTON_CLOSE:
|
||||
Log.d(TAG, "BUTTON_CLOSE");
|
||||
Timber.d("BUTTON_CLOSE");
|
||||
bDonate.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_close_white_24dp, 0, 0, 0);
|
||||
bDonate.setText(R.string.label_close);
|
||||
bDonate.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case BUTTON_DONATE:
|
||||
Log.d(TAG, "BUTTON_DONATE");
|
||||
Timber.d("BUTTON_DONATE");
|
||||
bDonate.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_favorite_white_24dp, 0, 0, 0);
|
||||
bDonate.setText(R.string.label_donate);
|
||||
bDonate.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case BUTTON_NONE:
|
||||
default:
|
||||
Log.d(TAG, "BUTTON_NONE");
|
||||
Timber.d("BUTTON_NONE");
|
||||
bDonate.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
|
||||
bDonate.setText(null);
|
||||
bDonate.setVisibility(View.INVISIBLE);
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:cycles="7" />
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<translate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="1000"
|
||||
android:fromYDelta="0%"
|
||||
android:interpolator="@anim/cycle_7"
|
||||
android:toYDelta="3%" />
|
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="36dp"
|
||||
android:height="36dp"
|
||||
android:autoMirrored="true"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M22,3L7,3c-0.69,0 -1.23,0.35 -1.59,0.88L0,12l5.41,8.11c0.36,0.53 0.9,0.89 1.59,0.89h15c1.1,0 2,-0.9 2,-2L24,5c0,-1.1 -0.9,-2 -2,-2zM19,15.59L17.59,17 14,13.41 10.41,17 9,15.59 12.59,12 9,8.41 10.41,7 14,10.59 17.59,7 19,8.41 15.41,12 19,15.59z" />
|
||||
</vector>
|
|
@ -0,0 +1,24 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="74.0"
|
||||
android:viewportWidth="74.0">
|
||||
<path android:pathData="M21.83,29.97L16.65,35.15L33.3,51.8L70.3,14.8L65.12,9.62L33.3,41.44L21.83,29.97L21.83,29.97ZM66.6,37C66.6,53.28 53.28,66.6 37,66.6C20.72,66.6 7.4,53.28 7.4,37C7.4,20.72 20.72,7.4 37,7.4C39.96,7.4 42.55,7.77 45.14,8.51L51.06,2.59C46.62,1.11 41.81,0 37,0C16.65,0 0,16.65 0,37C0,57.35 16.65,74 37,74C57.35,74 74,57.35 74,37L66.6,37L66.6,37Z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="74.0"
|
||||
android:endY="8.215650348E-15"
|
||||
android:startX="2.7745556003999997E-31"
|
||||
android:startY="74.0"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#FFF0006B"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#FFFF6600"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector android:height="24dp" android:viewportHeight="25.0"
|
||||
android:viewportWidth="25.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF6105" android:fillType="evenOdd"
|
||||
android:pathData="M3,0L22,0A3,3 0,0 1,25 3L25,22A3,3 0,0 1,22 25L3,25A3,3 0,0 1,0 22L0,3A3,3 0,0 1,3 0z"
|
||||
android:strokeColor="#00000000" android:strokeWidth="1"/>
|
||||
<path android:fillColor="#FFFFFF" android:fillType="evenOdd"
|
||||
android:pathData="M13.556,13.214L13.556,5L11.968,5L11.968,13.214L9.111,10L8,11.25L12.762,16.607L17.524,11.25L16.413,10L13.556,13.214ZM17.524,17.5L8,17.5L8,19.286L17.524,19.286L17.524,17.5L17.524,17.5Z"
|
||||
android:strokeColor="#00000000" android:strokeWidth="1"/>
|
||||
</vector>
|
|
@ -1,9 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z"/>
|
||||
android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z" />
|
||||
</vector>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="#FFffffff"
|
||||
android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z" />
|
||||
</vector>
|
|
@ -0,0 +1,13 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<group
|
||||
android:scaleX="-1"
|
||||
android:translateX="24">
|
||||
<path
|
||||
android:fillColor="#FFffffff"
|
||||
android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z" />
|
||||
</group>
|
||||
</vector>
|
|
@ -4,6 +4,6 @@
|
|||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="@color/moneroGray"
|
||||
android:fillColor="@color/gradientOrange"
|
||||
android:pathData="M19.43,12.98c0.04,-0.32 0.07,-0.64 0.07,-0.98s-0.03,-0.66 -0.07,-0.98l2.11,-1.65c0.19,-0.15 0.24,-0.42 0.12,-0.64l-2,-3.46c-0.12,-0.22 -0.39,-0.3 -0.61,-0.22l-2.49,1c-0.52,-0.4 -1.08,-0.73 -1.69,-0.98l-0.38,-2.65C14.46,2.18 14.25,2 14,2h-4c-0.25,0 -0.46,0.18 -0.49,0.42l-0.38,2.65c-0.61,0.25 -1.17,0.59 -1.69,0.98l-2.49,-1c-0.23,-0.09 -0.49,0 -0.61,0.22l-2,3.46c-0.13,0.22 -0.07,0.49 0.12,0.64l2.11,1.65c-0.04,0.32 -0.07,0.65 -0.07,0.98s0.03,0.66 0.07,0.98l-2.11,1.65c-0.19,0.15 -0.24,0.42 -0.12,0.64l2,3.46c0.12,0.22 0.39,0.3 0.61,0.22l2.49,-1c0.52,0.4 1.08,0.73 1.69,0.98l0.38,2.65c0.03,0.24 0.24,0.42 0.49,0.42h4c0.25,0 0.46,-0.18 0.49,-0.42l0.38,-2.65c0.61,-0.25 1.17,-0.59 1.69,-0.98l2.49,1c0.23,0.09 0.49,0 0.61,-0.22l2,-3.46c0.12,-0.22 0.07,-0.49 -0.12,-0.64l-2.11,-1.65zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z" />
|
||||
</vector>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.m2049r.xmrwallet.layout.Toolbar
|
||||
<com.m2049r.xmrwallet.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/ToolBarStyle.Event"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/backgound_all"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.m2049r.xmrwallet.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/ToolBarStyle.Event"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@drawable/backgound_toolbar_mainnet"
|
||||
android:minHeight="?attr/actionBarSize" />
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
|
@ -6,7 +6,7 @@
|
|||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.m2049r.xmrwallet.layout.Toolbar
|
||||
<com.m2049r.xmrwallet.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/ToolBarStyle.Event"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
android:layout_margin="16dp"
|
||||
android:hint="@string/label_daemon">
|
||||
|
||||
<com.m2049r.xmrwallet.layout.DropDownEditText
|
||||
<com.m2049r.xmrwallet.widget.DropDownEditText
|
||||
android:id="@+id/etDaemonAddress"
|
||||
style="@style/MoneroEdit.Small"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etDummy"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp" />
|
||||
|
||||
<LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -49,7 +54,7 @@
|
|||
android:textAlignment="center"
|
||||
tools:text="9wZnnNctRc7RaLya1rxykH21dUwfQpNGmVLjAvkvqe7nKT2Mw848AJNGMunW5xjoSZ5vCCU3uDnUoVqSSHxzRtQBE3f6crx" />
|
||||
|
||||
<com.m2049r.xmrwallet.layout.ExchangeView
|
||||
<com.m2049r.xmrwallet.widget.ExchangeView
|
||||
android:id="@+id/evAmount"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -111,10 +116,10 @@
|
|||
android:layout_gravity="center"
|
||||
android:drawablePadding="4dp"
|
||||
android:drawableStart="@drawable/ic_info_outline_gray_24dp"
|
||||
android:text="@string/label_receive_gen_qr_code"
|
||||
android:text="@string/label_receive_info_gen_qr_code"
|
||||
android:textAlignment="center"
|
||||
android:textSize="16sp"
|
||||
android:visibility="invisible"/>
|
||||
android:visibility="invisible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/qrCode"
|
||||
|
@ -124,11 +129,6 @@
|
|||
android:background="#00000000" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etDummy"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/scrollview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="8dp">
|
||||
|
@ -49,7 +48,7 @@
|
|||
android:text="@string/send_qr_hint" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.m2049r.xmrwallet.layout.ExchangeView
|
||||
<com.m2049r.xmrwallet.widget.ExchangeView
|
||||
android:id="@+id/evAmount"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etDummy"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp" />
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/etAddress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:errorEnabled="true">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
style="@style/MoneroEdit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/send_address_hint"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="textMultiLine"
|
||||
android:textAlignment="textStart" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="10">
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/etPaymentId"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="10"
|
||||
app:counterEnabled="true"
|
||||
app:counterMaxLength="16"
|
||||
app:errorEnabled="true">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
style="@style/MoneroEdit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="10"
|
||||
android:hint="@string/send_paymentid_hint"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="textMultiLine"
|
||||
android:textAlignment="textStart" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/bPaymentId"
|
||||
style="@style/MoneroText.Button.Small"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="8dp"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:drawableTop="@drawable/ic_settings_orange_24dp"
|
||||
android:text="@string/send_generate_paymentid_hint" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/bScan"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="32dp"
|
||||
android:clickable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
card_view:cardCornerRadius="2dp"
|
||||
card_view:cardElevation="8dp"
|
||||
card_view:contentPadding="16dp">
|
||||
|
||||
<TextView
|
||||
style="@style/MoneroText.Button"
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="96dp"
|
||||
android:background="@drawable/ic_scan"
|
||||
android:gravity="center"
|
||||
android:text="@string/send_qr_hint"
|
||||
android:textSize="20dp" />
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFunds"
|
||||
style="@style/MoneroText.Funds"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/send_available" />
|
||||
|
||||
<com.m2049r.xmrwallet.widget.ExchangeTextView
|
||||
android:id="@+id/evAmount"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<com.m2049r.xmrwallet.widget.NumberPadView
|
||||
android:id="@+id/numberPad"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
android:gravity="center" />
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,185 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/MoneroText.Confirm.Label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_send_address"
|
||||
android:textAlignment="textStart" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxAddress"
|
||||
style="@style/MoneroText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textAlignment="textStart"
|
||||
tools:text="4AdkPJoxn7JCvAby9szgnt93MSEwdnxdhaASxbTBm6x5dCwmsDep2UYN4FhStDn5i11nsJbpU7oj59ahg8gXb1Mg3viqCuk" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/MoneroText.Confirm.Label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_send_payment_id"
|
||||
android:textAlignment="textStart" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxPaymentId"
|
||||
style="@style/MoneroText.Confirm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:textAlignment="textStart"
|
||||
tools:text="d666a38d4a28fb38" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/MoneroText.Confirm.Label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_send_notes"
|
||||
android:textAlignment="textStart" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxNotes"
|
||||
style="@style/MoneroText.Confirm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:textAlignment="textStart"
|
||||
tools:text="gunegugumobil" />
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pbProgress"
|
||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:indeterminate="true"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llConfirmSend"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="vertical"
|
||||
android:visibility="invisible">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxAmountLabel"
|
||||
style="@style/MoneroLabel.Gray"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/send_amount_label"
|
||||
android:textAlignment="textStart" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxAmount"
|
||||
style="@style/MoneroText.Gray"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:textAlignment="textEnd"
|
||||
tools:text="143.008000000000" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="3">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxFeeLabel"
|
||||
style="@style/MoneroLabel.Gray"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/send_fee_label"
|
||||
android:textAlignment="textStart" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxFee"
|
||||
style="@style/MoneroText.Gray"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:textAlignment="textEnd"
|
||||
tools:text="0.006817000000" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="3">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxTotalLabel"
|
||||
style="@style/MoneroLabel.Caps.Black"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/send_total_label"
|
||||
android:textAlignment="textStart" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxTotal"
|
||||
style="@style/MoneroText.Black"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:textAlignment="textEnd"
|
||||
tools:text="143.014817000000" />
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/bSend"
|
||||
style="@style/MoneroButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="48dp"
|
||||
android:enabled="true"
|
||||
android:padding="8dp"
|
||||
android:text="@string/send_send_hint" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pbProgressSend"
|
||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:indeterminate="true"
|
||||
android:visibility="invisible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,71 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etDummy"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp" />
|
||||
|
||||
<com.m2049r.xmrwallet.layout.SpendViewPager
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/llNavBar"
|
||||
android:padding="8dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llNavBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_gravity="bottom"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/bPrev"
|
||||
style="@style/MoneroButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:drawableStart="@drawable/ic_navigate_prev_white_24dp"
|
||||
tools:text="Back" />
|
||||
|
||||
<com.m2049r.xmrwallet.widget.DotBar
|
||||
android:id="@+id/dotBar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/gradientOrange"
|
||||
app:activeColor="@color/white"
|
||||
app:activeDot="0"
|
||||
app:dotSize="12dp"
|
||||
app:inactiveColor="@color/dotGray"
|
||||
app:numberDots="4" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bNext"
|
||||
style="@style/MoneroButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:drawableEnd="@drawable/ic_navigate_next_white_24dp"
|
||||
tools:text="Next" />
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/bDone"
|
||||
style="@style/MoneroButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_gravity="bottom"
|
||||
android:text="@string/label_send_done"
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etDummy"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16sp"
|
||||
android:layout_marginTop="16sp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/MoneroLabel.Caps.Gray.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center|end"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:text="Advanced:"
|
||||
android:textAlignment="textEnd" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/sMixin"
|
||||
style="@style/MoneroSpinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_weight="1"
|
||||
android:entries="@array/mixin"
|
||||
android:textAlignment="center" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/sPriority"
|
||||
style="@style/MoneroSpinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:entries="@array/priority"
|
||||
android:textAlignment="center" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
style="@style/MoneroFab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start"
|
||||
android:gravity="center"
|
||||
android:drawablePadding="8dp"
|
||||
android:drawableStart="@drawable/ic_info_outline_gray_24dp"
|
||||
android:text="@string/label_send_info_fees" />
|
||||
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/etAddress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etNotes"
|
||||
style="@style/MoneroEdit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/send_notes_hint"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="textMultiLine"
|
||||
android:textAlignment="textStart" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,215 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="96dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="16dp"
|
||||
android:src="@drawable/ic_check_circle" />
|
||||
|
||||
<TextView
|
||||
style="@style/MoneroText.Sucess"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="@string/label_send_success" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/MoneroText.Confirm.Label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_send_txid"
|
||||
android:textAlignment="textStart" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/bCopyAddress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:enabled="false"
|
||||
android:src="@drawable/ic_content_nocopy_black_24dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxId"
|
||||
style="@style/MoneroText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textAlignment="textStart"
|
||||
tools:text="fcb12cbe9f43d4e8b9ee54f48d450a89a6937946db856506820df0539571801d" />
|
||||
|
||||
<TextView
|
||||
style="@style/MoneroText.Confirm.Label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_send_address"
|
||||
android:textAlignment="textStart" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxAddress"
|
||||
style="@style/MoneroText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textAlignment="textStart"
|
||||
tools:text="4AdkPJoxn7JCvAby9szgnt93MSEwdnxdhaASxbTBm6x5dCwmsDep2UYN4FhStDn5i11nsJbpU7oj59ahg8gXb1Mg3viqCuk" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/MoneroText.Confirm.Label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_send_payment_id"
|
||||
android:textAlignment="textStart" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxPaymentId"
|
||||
style="@style/MoneroText.Confirm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:textAlignment="textStart"
|
||||
tools:text="d666a38d4a28fb38" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/MoneroText.Confirm.Label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_send_notes"
|
||||
android:textAlignment="textStart" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxNotes"
|
||||
style="@style/MoneroText.Confirm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:textAlignment="textStart"
|
||||
tools:text="gunegugumobil" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@android:color/darker_gray" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxAmountLabel"
|
||||
style="@style/MoneroLabel.Gray"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/send_amount_label"
|
||||
android:textAlignment="textStart" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxAmount"
|
||||
style="@style/MoneroText.Gray"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:textAlignment="textEnd"
|
||||
tools:text="143.008000000000" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="3">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxFeeLabel"
|
||||
style="@style/MoneroLabel.Gray"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/send_fee_label"
|
||||
android:textAlignment="textStart" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxFee"
|
||||
style="@style/MoneroText.Gray"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:textAlignment="textEnd"
|
||||
tools:text="0.006817000000" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="3">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxTotalLabel"
|
||||
style="@style/MoneroLabel.Caps.Black"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/send_total_label"
|
||||
android:textAlignment="textStart" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxTotal"
|
||||
style="@style/MoneroText.Black"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:textAlignment="textEnd"
|
||||
tools:text="143.014817000000" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
|
@ -19,7 +19,7 @@
|
|||
android:gravity="center"
|
||||
android:textAlignment="center" />
|
||||
|
||||
<com.m2049r.xmrwallet.layout.CTextInputLayout
|
||||
<com.m2049r.xmrwallet.widget.CTextInputLayout
|
||||
android:id="@+id/etAmount"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -37,7 +37,7 @@
|
|||
android:inputType="numberDecimal"
|
||||
tools:text="87.00000" />
|
||||
|
||||
</com.m2049r.xmrwallet.layout.CTextInputLayout>
|
||||
</com.m2049r.xmrwallet.widget.CTextInputLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:showIn="LinearLayout">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/sCurrencyA"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:entries="@array/currency"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAmountA"
|
||||
style="@style/MoneroText.Balance.Orange"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center|start"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_weight="3"
|
||||
android:hint="@string/send_amount_hint"
|
||||
android:padding="4dp"
|
||||
android:singleLine="true"
|
||||
tools:text="87.00000" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/sCurrencyB"
|
||||
android:layout_width="56sp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:entries="@array/currency"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAmountB"
|
||||
style="@style/MoneroText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center|start"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_weight="3"
|
||||
android:hint="@string/send_amount_hint"
|
||||
android:padding="4dp"
|
||||
android:singleLine="true"
|
||||
tools:text="87.00000" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="0sp"
|
||||
android:layout_marginStart="8sp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/evExchange"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ic_statsup" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pbExchange"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:indeterminate="true"
|
||||
android:visibility="invisible" />
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</merge>
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:showIn="LinearLayout">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/numberPad1"
|
||||
style="@style/MoneroLabel.NumPad"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:tag="1"
|
||||
android:text="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/numberPad2"
|
||||
style="@style/MoneroLabel.NumPad"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:tag="2"
|
||||
android:text="2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/numberPad3"
|
||||
style="@style/MoneroLabel.NumPad"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:tag="3"
|
||||
android:text="3" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/numberPad4"
|
||||
style="@style/MoneroLabel.NumPad"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:tag="4"
|
||||
android:text="4" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/numberPad5"
|
||||
style="@style/MoneroLabel.NumPad"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:tag="5"
|
||||
android:text="5" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/numberPad6"
|
||||
style="@style/MoneroLabel.NumPad"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:tag="6"
|
||||
android:text="6" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/numberPad7"
|
||||
style="@style/MoneroLabel.NumPad"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:tag="7"
|
||||
android:text="7" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/numberPad8"
|
||||
style="@style/MoneroLabel.NumPad"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:tag="8"
|
||||
android:text="8" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/numberPad9"
|
||||
style="@style/MoneroLabel.NumPad"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:tag="9"
|
||||
android:text="9" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/numberPadPoint"
|
||||
style="@style/MoneroLabel.NumPad"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:text="." />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/numberPad0"
|
||||
style="@style/MoneroLabel.NumPad"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:tag="0"
|
||||
android:text="0" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/numberPadBackSpace"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/ic_backspace_black_36dp" />
|
||||
</LinearLayout>
|
||||
|
||||
</merge>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<declare-styleable name="DotBar">
|
||||
<attr name="inactiveColor" format="color" />
|
||||
<attr name="activeColor" format="color" />
|
||||
<attr name="dotSize" format="dimension" />
|
||||
<attr name="activeDot" format="integer" />
|
||||
<attr name="numberDots" format="integer" />
|
||||
</declare-styleable>
|
||||
</resources>
|
|
@ -18,6 +18,8 @@
|
|||
<color name="moneroBlack">#000000</color>
|
||||
<color name="moneroGray">#FD9B9B9B</color>
|
||||
|
||||
<color name="dotGray">#FF4A4A4A</color>
|
||||
|
||||
<color name="moneroFab">#61000000</color>
|
||||
<color name="moneroText">#FF616161</color>
|
||||
|
||||
|
|
|
@ -20,7 +20,18 @@
|
|||
<string name="label_close">Close</string>
|
||||
<string name="label_wallet_advanced_details">Touch for detailed information</string>
|
||||
|
||||
<string name="label_receive_gen_qr_code">Touch for QR Code</string>
|
||||
<string name="label_send_success">Success!</string>
|
||||
<string name="label_send_done">Done</string>
|
||||
|
||||
<string name="label_receive_info_gen_qr_code">Touch for QR Code</string>
|
||||
<string name="label_send_info_fees">Higher Priority = Higher Fees</string>
|
||||
|
||||
<string name="message_copy_txid">Transaction ID copied to clipboard!</string>
|
||||
|
||||
<string name="label_send_txid">Transaction ID</string>
|
||||
<string name="label_send_address">Destination Address</string>
|
||||
<string name="label_send_payment_id">Payment ID</string>
|
||||
<string name="label_send_notes">Notes</string>
|
||||
|
||||
<string name="backup_progress">Backup in progress</string>
|
||||
<string name="archive_progress">Archive in progress</string>
|
||||
|
@ -56,7 +67,7 @@
|
|||
<string name="status_wallet_disconnected">Disconnected</string>
|
||||
|
||||
<string name="status_transaction_sent">Transaction sent!</string>
|
||||
<string name="status_transaction_failed">Transaction failed!</string>
|
||||
<string name="status_transaction_failed">Transaction failed: %1$s</string>
|
||||
<string name="status_transaction_prepare_failed">Could not create transaction!</string>
|
||||
|
||||
<string name="service_busy">I am still busy with your last wallet …</string>
|
||||
|
@ -64,6 +75,7 @@
|
|||
<string name="prompt_rename">Rename %1$s</string>
|
||||
|
||||
<string name="prompt_password">Password for %1$s</string>
|
||||
<string name="prompt_send_password">Confirm Password</string>
|
||||
<string name="bad_password">Incorrect password!</string>
|
||||
<string name="bad_wallet">Wallet does not exist!</string>
|
||||
<string name="error_not_wallet">This is not a wallet!</string>
|
||||
|
@ -163,7 +175,7 @@
|
|||
|
||||
<string name="send_address_hint">Receiver\'s Address</string>
|
||||
<string name="send_paymentid_hint">Payment ID (optional)</string>
|
||||
<string name="send_amount_hint">Amount <![CDATA[(]]> XMR <![CDATA[)]]></string>
|
||||
<string name="send_amount_hint">0.00</string>
|
||||
<string name="send_notes_hint">Private Notes (optional)</string>
|
||||
<string name="send_priority_hint">Tx Priority</string>
|
||||
<string name="send_mixin_hint">Mixin</string>
|
||||
|
@ -178,6 +190,14 @@
|
|||
<string name="send_qr_address_invalid">Invalid Monero address</string>
|
||||
<string name="send_preparing_progress">Preparing transaction</string>
|
||||
<string name="send_title">Send</string>
|
||||
<string name="send_available">Available funds: %1$s XMR</string>
|
||||
<string name="send_address_title">Address</string>
|
||||
<string name="send_amount_title">Amount</string>
|
||||
<string name="send_settings_title">Settings</string>
|
||||
<string name="send_confirm_title">Confirm</string>
|
||||
<string name="send_success_title">Done</string>
|
||||
<string name="send_summary_heading">Summary</string>
|
||||
<string name="send_amount_too_large">Amount > Funds</string>
|
||||
|
||||
<string name="send_amount_label">Amount</string>
|
||||
<string name="send_fee_label">Fee</string>
|
||||
|
|
|
@ -44,6 +44,10 @@
|
|||
<item name="android:textSize">10sp</item>
|
||||
</style>
|
||||
|
||||
<style name="MoneroLabel.Gray">
|
||||
<item name="android:textColor">@color/moneroGray</item>
|
||||
</style>
|
||||
|
||||
<style name="MoneroLabel.Caps">
|
||||
<item name="android:textAllCaps">true</item>
|
||||
</style>
|
||||
|
@ -60,12 +64,25 @@
|
|||
<item name="android:textSize">12sp</item>
|
||||
</style>
|
||||
|
||||
<style name="MoneroText.Funds">
|
||||
<item name="android:textSize">16sp</item>
|
||||
<item name="android:textColor">@color/moneroFab</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="MoneroText.Balance">
|
||||
<item name="android:textSize">32sp</item>
|
||||
<item name="android:textColor">@color/moneroBlack</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
|
||||
<style name="MoneroText.Balance.Orange">
|
||||
<item name="android:textSize">32sp</item>
|
||||
<item name="android:textColor">@color/gradientOrange</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
|
||||
<style name="MoneroText.Unconfirmed">
|
||||
<item name="android:textSize">14sp</item>
|
||||
<item name="android:textColor">@color/moneroGray</item>
|
||||
|
@ -96,6 +113,12 @@
|
|||
<item name="android:textStyle">normal</item>
|
||||
</style>
|
||||
|
||||
<!-- textSize is in dp here to match the layout of the numpad-->
|
||||
<style name="MoneroLabel.NumPad">
|
||||
<item name="android:textSize">36dp</item>
|
||||
<item name="android:textColor">@color/moneroBlack</item>
|
||||
</style>
|
||||
|
||||
<style name="MoneroLabel.Title">
|
||||
<item name="android:textSize">20sp</item>
|
||||
<item name="android:textColor">@color/white</item>
|
||||
|
@ -151,6 +174,20 @@
|
|||
<item name="android:textSize">18dp</item>
|
||||
</style>
|
||||
|
||||
<style name="MoneroText.Confirm">
|
||||
<item name="android:textSize">16dp</item>
|
||||
</style>
|
||||
|
||||
<style name="MoneroText.Confirm.Label">
|
||||
<item name="android:textSize">16dp</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
|
||||
<style name="MoneroText.Label.Heading">
|
||||
<item name="android:textAllCaps">true</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
|
||||
<style name="MoneroText.Label.Medium">
|
||||
<item name="android:textSize">14dp</item>
|
||||
</style>
|
||||
|
@ -163,14 +200,25 @@
|
|||
<item name="android:textSize">12dp</item>
|
||||
</style>
|
||||
|
||||
<style name="MoneroText.Medium.Bold">
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
|
||||
<style name="MoneroText.Large">
|
||||
<item name="android:textSize">24dp</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="MoneroText.Sucess">
|
||||
<item name="android:textSize">40dp</item>
|
||||
<item name="android:textColor">@color/gradientOrange</item>
|
||||
</style>
|
||||
|
||||
<style name="MoneroText.Button" parent="@android:style/TextAppearance.DeviceDefault.Medium">
|
||||
<item name="android:textSize">14sp</item>
|
||||
<item name="android:textColor">@color/gradientOrange</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
<item name="android:textAllCaps">true</item>
|
||||
</style>
|
||||
|
||||
<style name="MoneroText.Button.Small">
|
||||
|
@ -193,8 +241,7 @@
|
|||
<item name="android:background">@color/gradientPink</item>
|
||||
</style>
|
||||
|
||||
<style name="MoneroButton.ReallySend">
|
||||
</style>
|
||||
<style name="MoneroButton.ReallySend"></style>
|
||||
|
||||
<style name="MoneroButton.Take">
|
||||
<item name="android:background">@color/take</item>
|
||||
|
@ -209,6 +256,13 @@
|
|||
<item name="android:backgroundTint">@color/gradientPink</item>
|
||||
</style>
|
||||
|
||||
<style name="MoneroEdit.Amount">
|
||||
<!--item name="android:textSize">32sp</item-->
|
||||
<item name="android:textColor">@color/gradientOrange</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="MoneroEdit.Medium" parent="MoneroText.Medium">
|
||||
<item name="android:textColor">?colorPrimary</item>
|
||||
<item name="android:backgroundTint">@color/gradientPink</item>
|
||||
|
|
|
@ -183,4 +183,4 @@ public class ExchangeRateTest {
|
|||
" }\n" +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ buildscript {
|
|||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.0.0'
|
||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||
classpath files('external-libs/gradle-witness.jar')
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
|
Loading…
Reference in New Issue