mirror of
https://github.com/m2049r/xmrwallet
synced 2025-09-07 11:35:59 +02:00
Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
091538752b | ||
![]() |
d5b95dd976 | ||
![]() |
008f06959c | ||
![]() |
817816cd34 | ||
![]() |
9d41d5da52 | ||
![]() |
ad76a7ffc1 | ||
![]() |
475542c4f3 | ||
![]() |
b5d0659ca9 | ||
![]() |
781bfbc78b | ||
![]() |
8985511209 | ||
![]() |
3c8a4ce967 | ||
![]() |
fcfedbcfae | ||
![]() |
74279b135a | ||
![]() |
d6d2de8312 | ||
![]() |
af0ecb2894 | ||
![]() |
975cc4f43c | ||
![]() |
74ba36de26 | ||
![]() |
7627e15a48 | ||
![]() |
37244cb9e0 | ||
![]() |
843566b820 | ||
![]() |
0bcf156929 |
@@ -7,8 +7,8 @@ android {
|
|||||||
applicationId "com.m2049r.xmrwallet"
|
applicationId "com.m2049r.xmrwallet"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 25
|
targetSdkVersion 25
|
||||||
versionCode 94
|
versionCode 97
|
||||||
versionName "1.5.4 'CrAzY Nacho'"
|
versionName "1.5.7 'Maximum Nacho'"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
|
@@ -551,9 +551,10 @@ Java_com_m2049r_xmrwallet_model_Wallet_setPassword(JNIEnv *env, jobject instance
|
|||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
Java_com_m2049r_xmrwallet_model_Wallet_getAddressJ(JNIEnv *env, jobject instance) {
|
Java_com_m2049r_xmrwallet_model_Wallet_getAddressJ(JNIEnv *env, jobject instance,
|
||||||
|
jint accountIndex) {
|
||||||
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
||||||
return env->NewStringUTF(wallet->address().c_str());
|
return env->NewStringUTF(wallet->address((uint32_t) accountIndex).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
@@ -646,15 +647,29 @@ Java_com_m2049r_xmrwallet_model_Wallet_getConnectionStatusJ(JNIEnv *env, jobject
|
|||||||
//TODO virtual bool trustedDaemon() const = 0;
|
//TODO virtual bool trustedDaemon() const = 0;
|
||||||
|
|
||||||
JNIEXPORT jlong JNICALL
|
JNIEXPORT jlong JNICALL
|
||||||
Java_com_m2049r_xmrwallet_model_Wallet_getBalance(JNIEnv *env, jobject instance) {
|
Java_com_m2049r_xmrwallet_model_Wallet_getBalance(JNIEnv *env, jobject instance,
|
||||||
|
jint accountIndex) {
|
||||||
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
||||||
return wallet->balance();
|
return wallet->balance((uint32_t) accountIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jlong JNICALL
|
JNIEXPORT jlong JNICALL
|
||||||
Java_com_m2049r_xmrwallet_model_Wallet_getUnlockedBalance(JNIEnv *env, jobject instance) {
|
Java_com_m2049r_xmrwallet_model_Wallet_getBalanceAll(JNIEnv *env, jobject instance) {
|
||||||
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
||||||
return wallet->unlockedBalance();
|
return wallet->balanceAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_m2049r_xmrwallet_model_Wallet_getUnlockedBalance(JNIEnv *env, jobject instance,
|
||||||
|
jint accountIndex) {
|
||||||
|
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
||||||
|
return wallet->unlockedBalance((uint32_t) accountIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_m2049r_xmrwallet_model_Wallet_getUnlockedBalanceAll(JNIEnv *env, jobject instance) {
|
||||||
|
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
||||||
|
return wallet->unlockedBalanceAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL
|
JNIEXPORT jboolean JNICALL
|
||||||
@@ -814,7 +829,8 @@ JNIEXPORT jlong JNICALL
|
|||||||
Java_com_m2049r_xmrwallet_model_Wallet_createTransactionJ(JNIEnv *env, jobject instance,
|
Java_com_m2049r_xmrwallet_model_Wallet_createTransactionJ(JNIEnv *env, jobject instance,
|
||||||
jstring dst_addr, jstring payment_id,
|
jstring dst_addr, jstring payment_id,
|
||||||
jlong amount, jint mixin_count,
|
jlong amount, jint mixin_count,
|
||||||
jint priority) {
|
jint priority,
|
||||||
|
jint accountIndex) {
|
||||||
|
|
||||||
const char *_dst_addr = env->GetStringUTFChars(dst_addr, NULL);
|
const char *_dst_addr = env->GetStringUTFChars(dst_addr, NULL);
|
||||||
const char *_payment_id = env->GetStringUTFChars(payment_id, NULL);
|
const char *_payment_id = env->GetStringUTFChars(payment_id, NULL);
|
||||||
@@ -823,8 +839,34 @@ Java_com_m2049r_xmrwallet_model_Wallet_createTransactionJ(JNIEnv *env, jobject i
|
|||||||
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
||||||
|
|
||||||
Bitmonero::PendingTransaction *tx = wallet->createTransaction(_dst_addr, _payment_id,
|
Bitmonero::PendingTransaction *tx = wallet->createTransaction(_dst_addr, _payment_id,
|
||||||
amount, mixin_count,
|
amount, (uint32_t) mixin_count,
|
||||||
_priority);
|
_priority,
|
||||||
|
(uint32_t) accountIndex);
|
||||||
|
|
||||||
|
env->ReleaseStringUTFChars(dst_addr, _dst_addr);
|
||||||
|
env->ReleaseStringUTFChars(payment_id, _payment_id);
|
||||||
|
return reinterpret_cast<jlong>(tx);
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jlong JNICALL
|
||||||
|
Java_com_m2049r_xmrwallet_model_Wallet_createSweepTransaction(JNIEnv *env, jobject instance,
|
||||||
|
jstring dst_addr, jstring payment_id,
|
||||||
|
jint mixin_count,
|
||||||
|
jint priority,
|
||||||
|
jint accountIndex) {
|
||||||
|
|
||||||
|
const char *_dst_addr = env->GetStringUTFChars(dst_addr, NULL);
|
||||||
|
const char *_payment_id = env->GetStringUTFChars(payment_id, NULL);
|
||||||
|
Bitmonero::PendingTransaction::Priority _priority =
|
||||||
|
static_cast<Bitmonero::PendingTransaction::Priority>(priority);
|
||||||
|
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
||||||
|
|
||||||
|
Monero::optional<uint64_t> empty;
|
||||||
|
|
||||||
|
Bitmonero::PendingTransaction *tx = wallet->createTransaction(_dst_addr, _payment_id,
|
||||||
|
empty, (uint32_t) mixin_count,
|
||||||
|
_priority,
|
||||||
|
(uint32_t) accountIndex);
|
||||||
|
|
||||||
env->ReleaseStringUTFChars(dst_addr, _dst_addr);
|
env->ReleaseStringUTFChars(dst_addr, _dst_addr);
|
||||||
env->ReleaseStringUTFChars(payment_id, _payment_id);
|
env->ReleaseStringUTFChars(payment_id, _payment_id);
|
||||||
@@ -943,6 +985,54 @@ Java_com_m2049r_xmrwallet_model_Wallet_getTxKey(JNIEnv *env, jobject instance,
|
|||||||
return env->NewStringUTF(txKey.c_str());
|
return env->NewStringUTF(txKey.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//virtual void addSubaddressAccount(const std::string& label) = 0;
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_m2049r_xmrwallet_model_Wallet_addAccount(JNIEnv *env, jobject instance,
|
||||||
|
jstring label) {
|
||||||
|
|
||||||
|
const char *_label = env->GetStringUTFChars(label, NULL);
|
||||||
|
|
||||||
|
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
||||||
|
wallet->addSubaddressAccount(_label);
|
||||||
|
|
||||||
|
env->ReleaseStringUTFChars(label, _label);
|
||||||
|
}
|
||||||
|
|
||||||
|
//virtual std::string getSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex) const = 0;
|
||||||
|
JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_m2049r_xmrwallet_model_Wallet_getSubaddressLabel(JNIEnv *env, jobject instance,
|
||||||
|
jint accountIndex, jint addressIndex) {
|
||||||
|
|
||||||
|
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
||||||
|
|
||||||
|
std::string label = wallet->getSubaddressLabel((uint32_t) accountIndex,
|
||||||
|
(uint32_t) addressIndex);
|
||||||
|
|
||||||
|
return env->NewStringUTF(label.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
//virtual void setSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label) = 0;
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_m2049r_xmrwallet_model_Wallet_setSubaddressLabel(JNIEnv *env, jobject instance,
|
||||||
|
jint accountIndex, jint addressIndex,
|
||||||
|
jstring label) {
|
||||||
|
|
||||||
|
const char *_label = env->GetStringUTFChars(label, NULL);
|
||||||
|
|
||||||
|
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
||||||
|
wallet->setSubaddressLabel(accountIndex, addressIndex, _label);
|
||||||
|
|
||||||
|
env->ReleaseStringUTFChars(label, _label);
|
||||||
|
}
|
||||||
|
|
||||||
|
// virtual size_t numSubaddressAccounts() const = 0;
|
||||||
|
JNIEXPORT jint JNICALL
|
||||||
|
Java_com_m2049r_xmrwallet_model_Wallet_numSubaddressAccounts(JNIEnv *env, jobject instance) {
|
||||||
|
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
||||||
|
return wallet->numSubaddressAccounts();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//virtual std::string signMessage(const std::string &message) = 0;
|
//virtual std::string signMessage(const std::string &message) = 0;
|
||||||
//virtual bool verifySignedMessage(const std::string &message, const std::string &addres, const std::string &signature) const = 0;
|
//virtual bool verifySignedMessage(const std::string &message, const std::string &addres, const std::string &signature) const = 0;
|
||||||
@@ -989,7 +1079,7 @@ jobject newTransferList(JNIEnv *env, Bitmonero::TransactionInfo *info) {
|
|||||||
|
|
||||||
jobject newTransactionInfo(JNIEnv *env, Bitmonero::TransactionInfo *info) {
|
jobject newTransactionInfo(JNIEnv *env, Bitmonero::TransactionInfo *info) {
|
||||||
jmethodID c = env->GetMethodID(class_TransactionInfo, "<init>",
|
jmethodID c = env->GetMethodID(class_TransactionInfo, "<init>",
|
||||||
"(IZZJJJLjava/lang/String;JLjava/lang/String;JLjava/util/List;)V");
|
"(IZZJJJLjava/lang/String;JLjava/lang/String;IJLjava/util/List;)V");
|
||||||
jobject transfers = newTransferList(env, info);
|
jobject transfers = newTransferList(env, info);
|
||||||
jstring _hash = env->NewStringUTF(info->hash().c_str());
|
jstring _hash = env->NewStringUTF(info->hash().c_str());
|
||||||
jstring _paymentId = env->NewStringUTF(info->paymentId().c_str());
|
jstring _paymentId = env->NewStringUTF(info->paymentId().c_str());
|
||||||
@@ -1003,6 +1093,7 @@ jobject newTransactionInfo(JNIEnv *env, Bitmonero::TransactionInfo *info) {
|
|||||||
_hash,
|
_hash,
|
||||||
static_cast<jlong> (info->timestamp()),
|
static_cast<jlong> (info->timestamp()),
|
||||||
_paymentId,
|
_paymentId,
|
||||||
|
info->subaddrAccount(),
|
||||||
info->confirmations(),
|
info->confirmations(),
|
||||||
transfers);
|
transfers);
|
||||||
env->DeleteLocalRef(transfers);
|
env->DeleteLocalRef(transfers);
|
||||||
@@ -1178,7 +1269,6 @@ Java_com_m2049r_xmrwallet_model_WalletManager_setLogLevel(JNIEnv *env, jobject i
|
|||||||
Bitmonero::WalletManagerFactory::setLogLevel(level);
|
Bitmonero::WalletManagerFactory::setLogLevel(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -372,7 +372,7 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter
|
|||||||
"node.moneroworld.com:18089;node.xmrbackb.one;node.xmr.be";
|
"node.moneroworld.com:18089;node.xmrbackb.one;node.xmr.be";
|
||||||
|
|
||||||
private static final String PREF_DAEMONLIST_STAGENET =
|
private static final String PREF_DAEMONLIST_STAGENET =
|
||||||
"stagenet.xmr-tw.org";
|
"stagenet.monerujo.io;stagenet.xmr-tw.org";
|
||||||
|
|
||||||
private NodeList daemonStageNet;
|
private NodeList daemonStageNet;
|
||||||
private NodeList daemonMainNet;
|
private NodeList daemonMainNet;
|
||||||
|
@@ -59,6 +59,7 @@ public class TxFragment extends Fragment {
|
|||||||
TS_FORMATTER.setTimeZone(tz);
|
TS_FORMATTER.setTimeZone(tz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private TextView tvAccount;
|
||||||
private TextView tvTxTimestamp;
|
private TextView tvTxTimestamp;
|
||||||
private TextView tvTxId;
|
private TextView tvTxId;
|
||||||
private TextView tvTxKey;
|
private TextView tvTxKey;
|
||||||
@@ -88,6 +89,7 @@ public class TxFragment extends Fragment {
|
|||||||
tvDestinationBtc = (TextView) view.findViewById(R.id.tvDestinationBtc);
|
tvDestinationBtc = (TextView) view.findViewById(R.id.tvDestinationBtc);
|
||||||
tvTxAmountBtc = (TextView) view.findViewById(R.id.tvTxAmountBtc);
|
tvTxAmountBtc = (TextView) view.findViewById(R.id.tvTxAmountBtc);
|
||||||
|
|
||||||
|
tvAccount = (TextView) view.findViewById(R.id.tvAccount);
|
||||||
tvTxTimestamp = (TextView) view.findViewById(R.id.tvTxTimestamp);
|
tvTxTimestamp = (TextView) view.findViewById(R.id.tvTxTimestamp);
|
||||||
tvTxId = (TextView) view.findViewById(R.id.tvTxId);
|
tvTxId = (TextView) view.findViewById(R.id.tvTxId);
|
||||||
tvTxKey = (TextView) view.findViewById(R.id.tvTxKey);
|
tvTxKey = (TextView) view.findViewById(R.id.tvTxKey);
|
||||||
@@ -222,6 +224,8 @@ public class TxFragment extends Fragment {
|
|||||||
activityCallback.setSubtitle(getString(R.string.tx_title));
|
activityCallback.setSubtitle(getString(R.string.tx_title));
|
||||||
activityCallback.setToolbarButton(Toolbar.BUTTON_BACK);
|
activityCallback.setToolbarButton(Toolbar.BUTTON_BACK);
|
||||||
|
|
||||||
|
tvAccount.setText("" + info.subaddrAccount);
|
||||||
|
|
||||||
tvTxTimestamp.setText(TS_FORMATTER.format(new Date(info.timestamp * 1000)));
|
tvTxTimestamp.setText(TS_FORMATTER.format(new Date(info.timestamp * 1000)));
|
||||||
tvTxId.setText(info.hash);
|
tvTxId.setText(info.hash);
|
||||||
tvTxKey.setText(info.txKey.isEmpty() ? "-" : info.txKey);
|
tvTxKey.setText(info.txKey.isEmpty() ? "-" : info.txKey);
|
||||||
@@ -236,9 +240,6 @@ public class TxFragment extends Fragment {
|
|||||||
String sign = (info.direction == TransactionInfo.Direction.Direction_In ? "+" : "-");
|
String sign = (info.direction == TransactionInfo.Direction.Direction_In ? "+" : "-");
|
||||||
|
|
||||||
long realAmount = info.amount;
|
long realAmount = info.amount;
|
||||||
if (info.isPending) {
|
|
||||||
realAmount = realAmount - info.fee;
|
|
||||||
}
|
|
||||||
tvTxAmount.setText(sign + Wallet.getDisplayAmount(realAmount));
|
tvTxAmount.setText(sign + Wallet.getDisplayAmount(realAmount));
|
||||||
|
|
||||||
if ((info.fee > 0)) {
|
if ((info.fee > 0)) {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -43,9 +43,7 @@ import com.m2049r.xmrwallet.model.Wallet;
|
|||||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeApi;
|
import com.m2049r.xmrwallet.service.exchange.api.ExchangeApi;
|
||||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeCallback;
|
import com.m2049r.xmrwallet.service.exchange.api.ExchangeCallback;
|
||||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeRate;
|
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.Helper;
|
||||||
import com.m2049r.xmrwallet.util.OkHttpClientSingleton;
|
|
||||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||||
|
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
@@ -101,7 +99,9 @@ public class WalletFragment extends Fragment
|
|||||||
ivSynced = (ImageView) view.findViewById(R.id.ivSynced);
|
ivSynced = (ImageView) view.findViewById(R.id.ivSynced);
|
||||||
|
|
||||||
sCurrency = (Spinner) view.findViewById(R.id.sCurrency);
|
sCurrency = (Spinner) view.findViewById(R.id.sCurrency);
|
||||||
sCurrency.setAdapter(ArrayAdapter.createFromResource(getContext(), R.array.currency, R.layout.item_spinner_balance));
|
ArrayAdapter currencyAdapter = ArrayAdapter.createFromResource(getContext(), R.array.currency, R.layout.item_spinner_balance);
|
||||||
|
currencyAdapter.setDropDownViewResource(R.layout.item_spinner_dropdown_item);
|
||||||
|
sCurrency.setAdapter(currencyAdapter);
|
||||||
|
|
||||||
bSend = (Button) view.findViewById(R.id.bSend);
|
bSend = (Button) view.findViewById(R.id.bSend);
|
||||||
bReceive = (Button) view.findViewById(R.id.bReceive);
|
bReceive = (Button) view.findViewById(R.id.bReceive);
|
||||||
@@ -150,7 +150,7 @@ public class WalletFragment extends Fragment
|
|||||||
// at this point selection is XMR in case of error
|
// at this point selection is XMR in case of error
|
||||||
String displayB;
|
String displayB;
|
||||||
double amountA = Double.parseDouble(Wallet.getDisplayAmount(unlockedBalance)); // crash if this fails!
|
double amountA = Double.parseDouble(Wallet.getDisplayAmount(unlockedBalance)); // crash if this fails!
|
||||||
if (!"XMR".equals(balanceCurrency)) { // not XMR
|
if (!Helper.CRYPTO.equals(balanceCurrency)) { // not XMR
|
||||||
double amountB = amountA * balanceRate;
|
double amountB = amountA * balanceRate;
|
||||||
displayB = Helper.getFormattedAmount(amountB, false);
|
displayB = Helper.getFormattedAmount(amountB, false);
|
||||||
} else { // XMR
|
} else { // XMR
|
||||||
@@ -159,10 +159,10 @@ public class WalletFragment extends Fragment
|
|||||||
tvBalance.setText(displayB);
|
tvBalance.setText(displayB);
|
||||||
}
|
}
|
||||||
|
|
||||||
String balanceCurrency = "XMR";
|
String balanceCurrency = Helper.CRYPTO;
|
||||||
double balanceRate = 1.0;
|
double balanceRate = 1.0;
|
||||||
|
|
||||||
private final ExchangeApi exchangeApi = new ExchangeApiImpl(OkHttpClientSingleton.getOkHttpClient());
|
private final ExchangeApi exchangeApi = Helper.getExchangeApi();
|
||||||
|
|
||||||
void refreshBalance() {
|
void refreshBalance() {
|
||||||
if (sCurrency.getSelectedItemPosition() == 0) { // XMR
|
if (sCurrency.getSelectedItemPosition() == 0) { // XMR
|
||||||
@@ -170,9 +170,10 @@ public class WalletFragment extends Fragment
|
|||||||
tvBalance.setText(Helper.getFormattedAmount(amountXmr, true));
|
tvBalance.setText(Helper.getFormattedAmount(amountXmr, true));
|
||||||
} else { // not XMR
|
} else { // not XMR
|
||||||
String currency = (String) sCurrency.getSelectedItem();
|
String currency = (String) sCurrency.getSelectedItem();
|
||||||
|
Timber.d(currency);
|
||||||
if (!currency.equals(balanceCurrency) || (balanceRate <= 0)) {
|
if (!currency.equals(balanceCurrency) || (balanceRate <= 0)) {
|
||||||
showExchanging();
|
showExchanging();
|
||||||
exchangeApi.queryExchangeRate("XMR", currency,
|
exchangeApi.queryExchangeRate(Helper.CRYPTO, currency,
|
||||||
new ExchangeCallback() {
|
new ExchangeCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(final ExchangeRate exchangeRate) {
|
public void onSuccess(final ExchangeRate exchangeRate) {
|
||||||
@@ -228,10 +229,10 @@ public class WalletFragment extends Fragment
|
|||||||
|
|
||||||
public void exchange(final ExchangeRate exchangeRate) {
|
public void exchange(final ExchangeRate exchangeRate) {
|
||||||
hideExchanging();
|
hideExchanging();
|
||||||
if (!"XMR".equals(exchangeRate.getBaseCurrency())) {
|
if (!Helper.CRYPTO.equals(exchangeRate.getBaseCurrency())) {
|
||||||
Timber.e("Not XMR");
|
Timber.e("Not XMR");
|
||||||
sCurrency.setSelection(0, true);
|
sCurrency.setSelection(0, true);
|
||||||
balanceCurrency = "XMR";
|
balanceCurrency = Helper.CRYPTO;
|
||||||
balanceRate = 1.0;
|
balanceRate = 1.0;
|
||||||
} else {
|
} else {
|
||||||
int spinnerPosition = ((ArrayAdapter) sCurrency.getAdapter()).getPosition(exchangeRate.getQuoteCurrency());
|
int spinnerPosition = ((ArrayAdapter) sCurrency.getAdapter()).getPosition(exchangeRate.getQuoteCurrency());
|
||||||
@@ -256,7 +257,7 @@ public class WalletFragment extends Fragment
|
|||||||
// called from activity
|
// called from activity
|
||||||
|
|
||||||
public void onRefreshed(final Wallet wallet, final boolean full) {
|
public void onRefreshed(final Wallet wallet, final boolean full) {
|
||||||
Timber.d("onRefreshed()");
|
Timber.d("onRefreshed(%b)", full);
|
||||||
if (full) {
|
if (full) {
|
||||||
List<TransactionInfo> list = wallet.getHistory().getAll();
|
List<TransactionInfo> list = wallet.getHistory().getAll();
|
||||||
adapter.setInfos(list);
|
adapter.setInfos(list);
|
||||||
@@ -270,6 +271,7 @@ public class WalletFragment extends Fragment
|
|||||||
bSend.setVisibility(View.VISIBLE);
|
bSend.setVisibility(View.VISIBLE);
|
||||||
bSend.setEnabled(true);
|
bSend.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
enableAccountsList(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean walletLoaded = false;
|
boolean walletLoaded = false;
|
||||||
@@ -313,7 +315,7 @@ public class WalletFragment extends Fragment
|
|||||||
if (wallet == null) return;
|
if (wallet == null) return;
|
||||||
walletTitle = wallet.getName();
|
walletTitle = wallet.getName();
|
||||||
String watchOnly = (wallet.isWatchOnly() ? getString(R.string.label_watchonly) : "");
|
String watchOnly = (wallet.isWatchOnly() ? getString(R.string.label_watchonly) : "");
|
||||||
walletSubtitle = wallet.getAddress().substring(0, 10) + "…" + watchOnly;
|
walletSubtitle = wallet.getAccountLabel();
|
||||||
activityCallback.setTitle(walletTitle, walletSubtitle);
|
activityCallback.setTitle(walletTitle, walletSubtitle);
|
||||||
Timber.d("wallet title is %s", walletTitle);
|
Timber.d("wallet title is %s", walletTitle);
|
||||||
}
|
}
|
||||||
@@ -323,10 +325,13 @@ public class WalletFragment extends Fragment
|
|||||||
private String walletSubtitle = null;
|
private String walletSubtitle = null;
|
||||||
private long unlockedBalance = 0;
|
private long unlockedBalance = 0;
|
||||||
|
|
||||||
|
private int accountIdx = -1;
|
||||||
|
|
||||||
private void updateStatus(Wallet wallet) {
|
private void updateStatus(Wallet wallet) {
|
||||||
if (!isAdded()) return;
|
if (!isAdded()) return;
|
||||||
Timber.d("updateStatus()");
|
Timber.d("updateStatus()");
|
||||||
if (walletTitle == null) {
|
if ((walletTitle == null) || (accountIdx != wallet.getAccountIndex())) {
|
||||||
|
accountIdx = wallet.getAccountIndex();
|
||||||
setActivityTitle(wallet);
|
setActivityTitle(wallet);
|
||||||
}
|
}
|
||||||
long balance = wallet.getBalance();
|
long balance = wallet.getBalance();
|
||||||
@@ -412,9 +417,28 @@ public class WalletFragment extends Fragment
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
Timber.d("onResume()");
|
Timber.d("onResume()");
|
||||||
activityCallback.setTitle(walletTitle, walletSubtitle);
|
activityCallback.setTitle(walletTitle, walletSubtitle);
|
||||||
activityCallback.setToolbarButton(Toolbar.BUTTON_CLOSE);
|
//activityCallback.setToolbarButton(Toolbar.BUTTON_CLOSE); // TODO: Close button somewhere else
|
||||||
|
activityCallback.setToolbarButton(Toolbar.BUTTON_NONE);
|
||||||
setProgress(syncProgress);
|
setProgress(syncProgress);
|
||||||
setProgress(syncText);
|
setProgress(syncText);
|
||||||
showReceive();
|
showReceive();
|
||||||
|
if (activityCallback.isSynced()) enableAccountsList(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
enableAccountsList(false);
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface DrawerLocker {
|
||||||
|
void setDrawerEnabled(boolean enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void enableAccountsList(boolean enable) {
|
||||||
|
if (activityCallback instanceof DrawerLocker) {
|
||||||
|
((DrawerLocker) activityCallback).setDrawerEnabled(enable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -20,6 +20,9 @@ import android.os.Bundle;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.m2049r.xmrwallet.R;
|
import com.m2049r.xmrwallet.R;
|
||||||
@@ -57,8 +60,9 @@ public class SendAmountWizardFragment extends SendWizardFragment {
|
|||||||
|
|
||||||
private TextView tvFunds;
|
private TextView tvFunds;
|
||||||
private ExchangeTextView evAmount;
|
private ExchangeTextView evAmount;
|
||||||
//private Button bSendAll;
|
private View llAmount;
|
||||||
private NumberPadView numberPad;
|
private View rlSweep;
|
||||||
|
private ImageButton ibSweep;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
@@ -73,37 +77,64 @@ public class SendAmountWizardFragment extends SendWizardFragment {
|
|||||||
tvFunds = (TextView) view.findViewById(R.id.tvFunds);
|
tvFunds = (TextView) view.findViewById(R.id.tvFunds);
|
||||||
|
|
||||||
evAmount = (ExchangeTextView) view.findViewById(R.id.evAmount);
|
evAmount = (ExchangeTextView) view.findViewById(R.id.evAmount);
|
||||||
numberPad = (NumberPadView) view.findViewById(R.id.numberPad);
|
((NumberPadView) view.findViewById(R.id.numberPad)).setListener(evAmount);
|
||||||
numberPad.setListener(evAmount);
|
|
||||||
|
|
||||||
/*
|
rlSweep = view.findViewById(R.id.rlSweep);
|
||||||
bSendAll = (Button) view.findViewById(R.id.bSendAll);
|
llAmount = view.findViewById(R.id.llAmount);
|
||||||
bSendAll.setOnClickListener(new View.OnClickListener() {
|
view.findViewById(R.id.ivSweep).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
// TODO: send all - figure out how to display this
|
sweepAll(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ibSweep = (ImageButton) view.findViewById(R.id.ibSweep);
|
||||||
|
|
||||||
|
ibSweep.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
sweepAll(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
|
|
||||||
Helper.hideKeyboard(getActivity());
|
Helper.hideKeyboard(getActivity());
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean spendAllMode = false;
|
||||||
|
|
||||||
|
private void sweepAll(boolean spendAllMode) {
|
||||||
|
if (spendAllMode) {
|
||||||
|
ibSweep.setVisibility(View.INVISIBLE);
|
||||||
|
llAmount.setVisibility(View.GONE);
|
||||||
|
rlSweep.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
ibSweep.setVisibility(View.VISIBLE);
|
||||||
|
llAmount.setVisibility(View.VISIBLE);
|
||||||
|
rlSweep.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
this.spendAllMode = spendAllMode;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onValidateFields() {
|
public boolean onValidateFields() {
|
||||||
if (!evAmount.validate(maxFunds)) {
|
if (spendAllMode) {
|
||||||
return false;
|
if (sendListener != null) {
|
||||||
}
|
sendListener.getTxData().setAmount(Wallet.SWEEP_ALL);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!evAmount.validate(maxFunds)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (sendListener != null) {
|
if (sendListener != null) {
|
||||||
String xmr = evAmount.getAmount();
|
String xmr = evAmount.getAmount();
|
||||||
if (xmr != null) {
|
if (xmr != null) {
|
||||||
sendListener.getTxData().setAmount(Wallet.getAmountFromString(xmr));
|
sendListener.getTxData().setAmount(Wallet.getAmountFromString(xmr));
|
||||||
} else {
|
} else {
|
||||||
sendListener.getTxData().setAmount(0L);
|
sendListener.getTxData().setAmount(0L);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@@ -36,6 +36,7 @@ import com.m2049r.xmrwallet.util.UserNotes;
|
|||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
public class SendSettingsWizardFragment extends SendWizardFragment {
|
public class SendSettingsWizardFragment extends SendWizardFragment {
|
||||||
|
final static public int MIXIN = 6;
|
||||||
|
|
||||||
public static SendSettingsWizardFragment newInstance(Listener listener) {
|
public static SendSettingsWizardFragment newInstance(Listener listener) {
|
||||||
SendSettingsWizardFragment instance = new SendSettingsWizardFragment();
|
SendSettingsWizardFragment instance = new SendSettingsWizardFragment();
|
||||||
@@ -54,15 +55,12 @@ public class SendSettingsWizardFragment extends SendWizardFragment {
|
|||||||
TxData getTxData();
|
TxData getTxData();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mixin = Ringsize - 1
|
|
||||||
final static int Mixins[] = {6, 9, 12, 25}; // must match the layout XML / "@array/mixin"
|
|
||||||
final static PendingTransaction.Priority Priorities[] =
|
final static PendingTransaction.Priority Priorities[] =
|
||||||
{PendingTransaction.Priority.Priority_Default,
|
{PendingTransaction.Priority.Priority_Default,
|
||||||
PendingTransaction.Priority.Priority_Low,
|
PendingTransaction.Priority.Priority_Low,
|
||||||
PendingTransaction.Priority.Priority_Medium,
|
PendingTransaction.Priority.Priority_Medium,
|
||||||
PendingTransaction.Priority.Priority_High}; // must match the layout XML
|
PendingTransaction.Priority.Priority_High}; // must match the layout XML
|
||||||
|
|
||||||
private Spinner sMixin;
|
|
||||||
private Spinner sPriority;
|
private Spinner sPriority;
|
||||||
private EditText etNotes;
|
private EditText etNotes;
|
||||||
private EditText etDummy;
|
private EditText etDummy;
|
||||||
@@ -77,7 +75,6 @@ public class SendSettingsWizardFragment extends SendWizardFragment {
|
|||||||
View view = inflater.inflate(
|
View view = inflater.inflate(
|
||||||
R.layout.fragment_send_settings, container, false);
|
R.layout.fragment_send_settings, container, false);
|
||||||
|
|
||||||
sMixin = (Spinner) view.findViewById(R.id.sMixin);
|
|
||||||
sPriority = (Spinner) view.findViewById(R.id.sPriority);
|
sPriority = (Spinner) view.findViewById(R.id.sPriority);
|
||||||
|
|
||||||
etNotes = (EditText) view.findViewById(R.id.etNotes);
|
etNotes = (EditText) view.findViewById(R.id.etNotes);
|
||||||
@@ -104,7 +101,7 @@ public class SendSettingsWizardFragment extends SendWizardFragment {
|
|||||||
if (sendListener != null) {
|
if (sendListener != null) {
|
||||||
TxData txData = sendListener.getTxData();
|
TxData txData = sendListener.getTxData();
|
||||||
txData.setPriority(Priorities[sPriority.getSelectedItemPosition()]);
|
txData.setPriority(Priorities[sPriority.getSelectedItemPosition()]);
|
||||||
txData.setMixin(Mixins[sMixin.getSelectedItemPosition()]);
|
txData.setMixin(MIXIN);
|
||||||
txData.setUserNotes(new UserNotes(etNotes.getText().toString()));
|
txData.setUserNotes(new UserNotes(etNotes.getText().toString()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@@ -17,8 +17,11 @@
|
|||||||
package com.m2049r.xmrwallet.model;
|
package com.m2049r.xmrwallet.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
public class TransactionHistory {
|
public class TransactionHistory {
|
||||||
static {
|
static {
|
||||||
System.loadLibrary("monerujo");
|
System.loadLibrary("monerujo");
|
||||||
@@ -26,8 +29,18 @@ public class TransactionHistory {
|
|||||||
|
|
||||||
private long handle;
|
private long handle;
|
||||||
|
|
||||||
public TransactionHistory(long handle) {
|
int accountIndex;
|
||||||
|
|
||||||
|
public void setAccountFor(Wallet wallet) {
|
||||||
|
if (accountIndex != wallet.getAccountIndex()) {
|
||||||
|
this.accountIndex = wallet.getAccountIndex();
|
||||||
|
refreshWithNotes(wallet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TransactionHistory(long handle, int accountIndex) {
|
||||||
this.handle = handle;
|
this.handle = handle;
|
||||||
|
this.accountIndex = accountIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadNotes(Wallet wallet) {
|
public void loadNotes(Wallet wallet) {
|
||||||
@@ -36,7 +49,7 @@ public class TransactionHistory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public native int getCount();
|
public native int getCount(); // over all accounts/subaddresses
|
||||||
|
|
||||||
//private native long getTransactionByIndexJ(int i);
|
//private native long getTransactionByIndexJ(int i);
|
||||||
|
|
||||||
@@ -53,8 +66,23 @@ public class TransactionHistory {
|
|||||||
loadNotes(wallet);
|
loadNotes(wallet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public void refresh() {
|
||||||
|
// transactions = refreshJ();
|
||||||
|
// }
|
||||||
|
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
transactions = refreshJ();
|
List<TransactionInfo> t = refreshJ();
|
||||||
|
Timber.d("refreshed %d", t.size());
|
||||||
|
for (Iterator<TransactionInfo> iterator = t.iterator(); iterator.hasNext(); ) {
|
||||||
|
TransactionInfo info = iterator.next();
|
||||||
|
if (info.subaddrAccount != accountIndex) {
|
||||||
|
iterator.remove();
|
||||||
|
Timber.d("removed %s", info.hash);
|
||||||
|
} else {
|
||||||
|
Timber.d("kept %s", info.hash);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
transactions = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
private native List<TransactionInfo> refreshJ();
|
private native List<TransactionInfo> refreshJ();
|
||||||
|
@@ -53,6 +53,11 @@ public class TransactionInfo implements Parcelable, Comparable<TransactionInfo>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// virtual std::set<uint32_t> subaddrIndex() const = 0;
|
||||||
|
// virtual uint32_t subaddrAccount() const = 0;
|
||||||
|
// virtual std::string label() const = 0;
|
||||||
|
// virtual uint64_t confirmations() const = 0;
|
||||||
|
|
||||||
public Direction direction;
|
public Direction direction;
|
||||||
public boolean isPending;
|
public boolean isPending;
|
||||||
public boolean isFailed;
|
public boolean isFailed;
|
||||||
@@ -62,6 +67,7 @@ public class TransactionInfo implements Parcelable, Comparable<TransactionInfo>
|
|||||||
public String hash;
|
public String hash;
|
||||||
public long timestamp;
|
public long timestamp;
|
||||||
public String paymentId;
|
public String paymentId;
|
||||||
|
public int subaddrAccount;
|
||||||
public long confirmations;
|
public long confirmations;
|
||||||
public List<Transfer> transfers;
|
public List<Transfer> transfers;
|
||||||
|
|
||||||
@@ -78,6 +84,7 @@ public class TransactionInfo implements Parcelable, Comparable<TransactionInfo>
|
|||||||
String hash,
|
String hash,
|
||||||
long timestamp,
|
long timestamp,
|
||||||
String paymentId,
|
String paymentId,
|
||||||
|
int subaddrAccount,
|
||||||
long confirmations,
|
long confirmations,
|
||||||
List<Transfer> transfers) {
|
List<Transfer> transfers) {
|
||||||
this.direction = Direction.values()[direction];
|
this.direction = Direction.values()[direction];
|
||||||
@@ -89,6 +96,7 @@ public class TransactionInfo implements Parcelable, Comparable<TransactionInfo>
|
|||||||
this.hash = hash;
|
this.hash = hash;
|
||||||
this.timestamp = timestamp;
|
this.timestamp = timestamp;
|
||||||
this.paymentId = paymentId;
|
this.paymentId = paymentId;
|
||||||
|
this.subaddrAccount = subaddrAccount;
|
||||||
this.confirmations = confirmations;
|
this.confirmations = confirmations;
|
||||||
this.transfers = transfers;
|
this.transfers = transfers;
|
||||||
}
|
}
|
||||||
@@ -108,6 +116,7 @@ public class TransactionInfo implements Parcelable, Comparable<TransactionInfo>
|
|||||||
out.writeString(hash);
|
out.writeString(hash);
|
||||||
out.writeLong(timestamp);
|
out.writeLong(timestamp);
|
||||||
out.writeString(paymentId);
|
out.writeString(paymentId);
|
||||||
|
out.writeInt(subaddrAccount);
|
||||||
out.writeLong(confirmations);
|
out.writeLong(confirmations);
|
||||||
out.writeList(transfers);
|
out.writeList(transfers);
|
||||||
out.writeString(txKey);
|
out.writeString(txKey);
|
||||||
@@ -134,6 +143,7 @@ public class TransactionInfo implements Parcelable, Comparable<TransactionInfo>
|
|||||||
hash = in.readString();
|
hash = in.readString();
|
||||||
timestamp = in.readLong();
|
timestamp = in.readLong();
|
||||||
paymentId = in.readString();
|
paymentId = in.readString();
|
||||||
|
subaddrAccount = in.readInt();
|
||||||
confirmations = in.readLong();
|
confirmations = in.readLong();
|
||||||
transfers = in.readArrayList(Transfer.class.getClassLoader());
|
transfers = in.readArrayList(Transfer.class.getClassLoader());
|
||||||
txKey = in.readString();
|
txKey = in.readString();
|
||||||
|
@@ -20,12 +20,26 @@ import com.m2049r.xmrwallet.data.TxData;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
public class Wallet {
|
public class Wallet {
|
||||||
|
final static public long SWEEP_ALL = Long.MAX_VALUE;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
System.loadLibrary("monerujo");
|
System.loadLibrary("monerujo");
|
||||||
}
|
}
|
||||||
|
|
||||||
static final String TAG = "Wallet";
|
private int accountIndex = 0;
|
||||||
|
|
||||||
|
public int getAccountIndex() {
|
||||||
|
return accountIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccountIndex(int accountIndex) {
|
||||||
|
Timber.d("setAccountIndex(%d)", accountIndex);
|
||||||
|
this.accountIndex = accountIndex;
|
||||||
|
getHistory().setAccountFor(this);
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return new File(getPath()).getName();
|
return new File(getPath()).getName();
|
||||||
@@ -38,6 +52,11 @@ public class Wallet {
|
|||||||
this.handle = handle;
|
this.handle = handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Wallet(long handle, int accountIndex) {
|
||||||
|
this.handle = handle;
|
||||||
|
this.accountIndex = accountIndex;
|
||||||
|
}
|
||||||
|
|
||||||
public enum Status {
|
public enum Status {
|
||||||
Status_Ok,
|
Status_Ok,
|
||||||
Status_Error,
|
Status_Error,
|
||||||
@@ -66,16 +85,11 @@ public class Wallet {
|
|||||||
|
|
||||||
public native boolean setPassword(String password);
|
public native boolean setPassword(String password);
|
||||||
|
|
||||||
private String address = null;
|
|
||||||
|
|
||||||
public String getAddress() {
|
public String getAddress() {
|
||||||
if (address == null) {
|
return getAddressJ(accountIndex);
|
||||||
address = getAddressJ();
|
|
||||||
}
|
|
||||||
return address;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private native String getAddressJ();
|
private native String getAddressJ(int accountIndex);
|
||||||
|
|
||||||
public native String getPath();
|
public native String getPath();
|
||||||
|
|
||||||
@@ -132,9 +146,21 @@ public class Wallet {
|
|||||||
//TODO virtual void setTrustedDaemon(bool arg) = 0;
|
//TODO virtual void setTrustedDaemon(bool arg) = 0;
|
||||||
//TODO virtual bool trustedDaemon() const = 0;
|
//TODO virtual bool trustedDaemon() const = 0;
|
||||||
|
|
||||||
public native long getBalance();
|
public long getBalance() {
|
||||||
|
return getBalance(accountIndex);
|
||||||
|
}
|
||||||
|
|
||||||
public native long getUnlockedBalance();
|
public native long getBalance(int accountIndex);
|
||||||
|
|
||||||
|
public native long getBalanceAll();
|
||||||
|
|
||||||
|
public long getUnlockedBalance() {
|
||||||
|
return getUnlockedBalance(accountIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public native long getUnlockedBalanceAll();
|
||||||
|
|
||||||
|
public native long getUnlockedBalance(int accountIndex);
|
||||||
|
|
||||||
public native boolean isWatchOnly();
|
public native boolean isWatchOnly();
|
||||||
|
|
||||||
@@ -207,14 +233,23 @@ public class Wallet {
|
|||||||
PendingTransaction.Priority priority) {
|
PendingTransaction.Priority priority) {
|
||||||
disposePendingTransaction();
|
disposePendingTransaction();
|
||||||
int _priority = priority.getValue();
|
int _priority = priority.getValue();
|
||||||
long txHandle = createTransactionJ(dst_addr, payment_id, amount, mixin_count, _priority);
|
long txHandle =
|
||||||
|
(amount == SWEEP_ALL ?
|
||||||
|
createSweepTransaction(dst_addr, payment_id, mixin_count, _priority,
|
||||||
|
accountIndex) :
|
||||||
|
createTransactionJ(dst_addr, payment_id, amount, mixin_count, _priority,
|
||||||
|
accountIndex));
|
||||||
pendingTransaction = new PendingTransaction(txHandle);
|
pendingTransaction = new PendingTransaction(txHandle);
|
||||||
return pendingTransaction;
|
return pendingTransaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
private native long createTransactionJ(String dst_addr, String payment_id,
|
private native long createTransactionJ(String dst_addr, String payment_id,
|
||||||
long amount, int mixin_count,
|
long amount, int mixin_count,
|
||||||
int priority);
|
int priority, int accountIndex);
|
||||||
|
|
||||||
|
private native long createSweepTransaction(String dst_addr, String payment_id,
|
||||||
|
int mixin_count,
|
||||||
|
int priority, int accountIndex);
|
||||||
|
|
||||||
|
|
||||||
public PendingTransaction createSweepUnmixableTransaction() {
|
public PendingTransaction createSweepUnmixableTransaction() {
|
||||||
@@ -241,7 +276,7 @@ public class Wallet {
|
|||||||
|
|
||||||
public TransactionHistory getHistory() {
|
public TransactionHistory getHistory() {
|
||||||
if (history == null) {
|
if (history == null) {
|
||||||
history = new TransactionHistory(getHistoryJ());
|
history = new TransactionHistory(getHistoryJ(), accountIndex);
|
||||||
}
|
}
|
||||||
return history;
|
return history;
|
||||||
}
|
}
|
||||||
@@ -273,4 +308,43 @@ public class Wallet {
|
|||||||
//virtual bool parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &tvAmount, std::string &tx_description, std::string &recipient_name, std::vector<std::string> &unknown_parameters, std::string &error) = 0;
|
//virtual bool parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &tvAmount, std::string &tx_description, std::string &recipient_name, std::vector<std::string> &unknown_parameters, std::string &error) = 0;
|
||||||
//virtual bool rescanSpent() = 0;
|
//virtual bool rescanSpent() = 0;
|
||||||
|
|
||||||
|
private static final String NEW_ACCOUNT_NAME = "Untitled account"; // src/wallet/wallet2.cpp:941
|
||||||
|
|
||||||
|
public void addAccount() {
|
||||||
|
addAccount(NEW_ACCOUNT_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public native void addAccount(String label);
|
||||||
|
|
||||||
|
public String getAccountLabel() {
|
||||||
|
return getAccountLabel(accountIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccountLabel(int accountIndex) {
|
||||||
|
String label = getSubaddressLabel(accountIndex, 0);
|
||||||
|
if (label.equals(NEW_ACCOUNT_NAME)) {
|
||||||
|
String address = getAddressJ(accountIndex);
|
||||||
|
int len = address.length();
|
||||||
|
return address.substring(0, 6) +
|
||||||
|
"\u2026" + address.substring(len - 6, len);
|
||||||
|
} else return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public native String getSubaddressLabel(int accountIndex, int addressIndex);
|
||||||
|
|
||||||
|
public void setAccountLabel(String label) {
|
||||||
|
setSubaddressLabel(accountIndex, 0, label);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccountLabel(int accountIndex, String label) {
|
||||||
|
setSubaddressLabel(accountIndex, 0, label);
|
||||||
|
}
|
||||||
|
|
||||||
|
public native void setSubaddressLabel(int accountIndex, int addressIndex, String label);
|
||||||
|
|
||||||
|
public int numAccounts() {
|
||||||
|
return numSubaddressAccounts();
|
||||||
|
}
|
||||||
|
|
||||||
|
public native int numSubaddressAccounts();
|
||||||
}
|
}
|
||||||
|
@@ -80,6 +80,13 @@ public class WalletManager {
|
|||||||
|
|
||||||
private native long createWalletJ(String path, String password, String language, int networkType);
|
private native long createWalletJ(String path, String password, String language, int networkType);
|
||||||
|
|
||||||
|
public Wallet openAccount(String path, int accountIndex, String password) {
|
||||||
|
long walletHandle = openWalletJ(path, password, getNetworkType().getValue());
|
||||||
|
Wallet wallet = new Wallet(walletHandle, accountIndex);
|
||||||
|
manageWallet(wallet);
|
||||||
|
return wallet;
|
||||||
|
}
|
||||||
|
|
||||||
public Wallet openWallet(String path, String password) {
|
public Wallet openWallet(String path, String password) {
|
||||||
long walletHandle = openWalletJ(path, password, getNetworkType().getValue());
|
long walletHandle = openWalletJ(path, password, getNetworkType().getValue());
|
||||||
Wallet wallet = new Wallet(walletHandle);
|
Wallet wallet = new Wallet(walletHandle);
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017 m2049r et al.
|
* Copyright (c) 2017-2018 m2049r et al.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.m2049r.xmrwallet.service.exchange.kraken;
|
package com.m2049r.xmrwallet.service.exchange.coinmarketcap;
|
||||||
|
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.VisibleForTesting;
|
import android.support.annotation.VisibleForTesting;
|
||||||
@@ -23,6 +23,7 @@ import com.m2049r.xmrwallet.service.exchange.api.ExchangeApi;
|
|||||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeCallback;
|
import com.m2049r.xmrwallet.service.exchange.api.ExchangeCallback;
|
||||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeException;
|
import com.m2049r.xmrwallet.service.exchange.api.ExchangeException;
|
||||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeRate;
|
import com.m2049r.xmrwallet.service.exchange.api.ExchangeRate;
|
||||||
|
import com.m2049r.xmrwallet.util.Helper;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
@@ -37,6 +38,7 @@ import okhttp3.Request;
|
|||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
|
|
||||||
public class ExchangeApiImpl implements ExchangeApi {
|
public class ExchangeApiImpl implements ExchangeApi {
|
||||||
|
static final String CRYPTO_ID = "328";
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private final OkHttpClient okHttpClient;
|
private final OkHttpClient okHttpClient;
|
||||||
@@ -52,7 +54,7 @@ public class ExchangeApiImpl implements ExchangeApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ExchangeApiImpl(@NonNull final OkHttpClient okHttpClient) {
|
public ExchangeApiImpl(@NonNull final OkHttpClient okHttpClient) {
|
||||||
this(okHttpClient, HttpUrl.parse("https://api.kraken.com/0/public/Ticker"));
|
this(okHttpClient, HttpUrl.parse("https://api.coinmarketcap.com/v2/ticker/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -67,12 +69,12 @@ public class ExchangeApiImpl implements ExchangeApi {
|
|||||||
boolean inverse = false;
|
boolean inverse = false;
|
||||||
String fiat = null;
|
String fiat = null;
|
||||||
|
|
||||||
if (baseCurrency.equals("XMR")) {
|
if (baseCurrency.equals(Helper.CRYPTO)) {
|
||||||
fiat = quoteCurrency;
|
fiat = quoteCurrency;
|
||||||
inverse = false;
|
inverse = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (quoteCurrency.equals("XMR")) {
|
if (quoteCurrency.equals(Helper.CRYPTO)) {
|
||||||
fiat = baseCurrency;
|
fiat = baseCurrency;
|
||||||
inverse = true;
|
inverse = true;
|
||||||
}
|
}
|
||||||
@@ -85,7 +87,8 @@ public class ExchangeApiImpl implements ExchangeApi {
|
|||||||
final boolean swapAssets = inverse;
|
final boolean swapAssets = inverse;
|
||||||
|
|
||||||
final HttpUrl url = baseUrl.newBuilder()
|
final HttpUrl url = baseUrl.newBuilder()
|
||||||
.addQueryParameter("pair", "XMR" + fiat)
|
.addEncodedPathSegments(CRYPTO_ID + "/")
|
||||||
|
.addQueryParameter("convert", fiat)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
final Request httpRequest = createHttpRequest(url);
|
final Request httpRequest = createHttpRequest(url);
|
||||||
@@ -101,12 +104,12 @@ public class ExchangeApiImpl implements ExchangeApi {
|
|||||||
if (response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
try {
|
try {
|
||||||
final JSONObject json = new JSONObject(response.body().string());
|
final JSONObject json = new JSONObject(response.body().string());
|
||||||
final JSONArray jsonError = json.getJSONArray("error");
|
final JSONObject metadata = json.getJSONObject("metadata");
|
||||||
if (jsonError.length() > 0) {
|
if (!metadata.isNull("error")) {
|
||||||
final String errorMsg = jsonError.getString(0);
|
final String errorMsg = metadata.getString("error");
|
||||||
callback.onError(new ExchangeException(response.code(), errorMsg));
|
callback.onError(new ExchangeException(response.code(), (String) errorMsg));
|
||||||
} else {
|
} else {
|
||||||
final JSONObject jsonResult = json.getJSONObject("result");
|
final JSONObject jsonResult = json.getJSONObject("data");
|
||||||
reportSuccess(jsonResult, swapAssets, callback);
|
reportSuccess(jsonResult, swapAssets, callback);
|
||||||
}
|
}
|
||||||
} catch (JSONException ex) {
|
} catch (JSONException ex) {
|
||||||
@@ -130,7 +133,6 @@ public class ExchangeApiImpl implements ExchangeApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Request createHttpRequest(final HttpUrl url) {
|
private Request createHttpRequest(final HttpUrl url) {
|
||||||
return new Request.Builder()
|
return new Request.Builder()
|
||||||
.url(url)
|
.url(url)
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017 m2049r et al.
|
* Copyright (c) 2017-2018 m2049r et al.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.m2049r.xmrwallet.service.exchange.kraken;
|
package com.m2049r.xmrwallet.service.exchange.coinmarketcap;
|
||||||
|
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
@@ -25,6 +25,7 @@ import org.json.JSONArray;
|
|||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@@ -37,7 +38,7 @@ class ExchangeRateImpl implements ExchangeRate {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getServiceName() {
|
public String getServiceName() {
|
||||||
return "kraken.com";
|
return "coinmarketcap.com";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -64,29 +65,21 @@ class ExchangeRateImpl implements ExchangeRate {
|
|||||||
|
|
||||||
ExchangeRateImpl(final JSONObject jsonObject, final boolean swapAssets) throws JSONException, ExchangeException {
|
ExchangeRateImpl(final JSONObject jsonObject, final boolean swapAssets) throws JSONException, ExchangeException {
|
||||||
try {
|
try {
|
||||||
final String key = jsonObject.keys().next(); // we expect only one
|
final String baseC = jsonObject.getString("symbol");
|
||||||
Pattern pattern = Pattern.compile("^X(.*?)Z(.*?)$");
|
final JSONObject quotes = jsonObject.getJSONObject("quotes");
|
||||||
Matcher matcher = pattern.matcher(key);
|
final Iterator<String> keys = quotes.keys();
|
||||||
if (matcher.find()) {
|
String key = null;
|
||||||
this.baseCurrency = swapAssets ? matcher.group(2) : matcher.group(1);
|
// get key which is not USD unless it is the only one
|
||||||
this.quoteCurrency = swapAssets ? matcher.group(1) : matcher.group(2);
|
while (keys.hasNext()) {
|
||||||
} else {
|
key = keys.next();
|
||||||
throw new ExchangeException("no pair returned!");
|
if (!key.equals("USD")) break;
|
||||||
}
|
|
||||||
|
|
||||||
JSONObject pair = jsonObject.getJSONObject(key);
|
|
||||||
JSONArray close = pair.getJSONArray("c");
|
|
||||||
String closePrice = close.getString(0);
|
|
||||||
if (closePrice != null) {
|
|
||||||
try {
|
|
||||||
double rate = Double.parseDouble(closePrice);
|
|
||||||
this.rate = swapAssets ? (1 / rate) : rate;
|
|
||||||
} catch (NumberFormatException ex) {
|
|
||||||
throw new ExchangeException(ex.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new ExchangeException("no close price returned!");
|
|
||||||
}
|
}
|
||||||
|
final String quoteC = key;
|
||||||
|
baseCurrency = swapAssets ? quoteC : baseC;
|
||||||
|
quoteCurrency = swapAssets ? baseC : quoteC;
|
||||||
|
JSONObject quote = quotes.getJSONObject(key);
|
||||||
|
double price = quote.getDouble("price");
|
||||||
|
this.rate = swapAssets ? (1d / price) : price;
|
||||||
} catch (NoSuchElementException ex) {
|
} catch (NoSuchElementException ex) {
|
||||||
throw new ExchangeException(ex.getLocalizedMessage());
|
throw new ExchangeException(ex.getLocalizedMessage());
|
||||||
}
|
}
|
@@ -66,6 +66,8 @@ public class BitcoinAddressValidator {
|
|||||||
|
|
||||||
byte[] result = new byte[25];
|
byte[] result = new byte[25];
|
||||||
byte[] numBytes = num.toByteArray();
|
byte[] numBytes = num.toByteArray();
|
||||||
|
if (num.bitLength() > 200) return null;
|
||||||
|
|
||||||
if (num.bitLength() == 200) {
|
if (num.bitLength() == 200) {
|
||||||
System.arraycopy(numBytes, 1, result, 0, 25);
|
System.arraycopy(numBytes, 1, result, 0, 25);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -2,18 +2,21 @@ package com.m2049r.xmrwallet.util;
|
|||||||
|
|
||||||
import android.app.KeyguardManager;
|
import android.app.KeyguardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.v4.hardware.fingerprint.FingerprintManagerCompat;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
import android.support.v4.os.CancellationSignal;
|
import android.os.Build;
|
||||||
|
import android.os.CancellationSignal;
|
||||||
import timber.log.Timber;
|
|
||||||
|
|
||||||
public class FingerprintHelper {
|
public class FingerprintHelper {
|
||||||
|
|
||||||
public static boolean isDeviceSupported(Context context) {
|
public static boolean isDeviceSupported(Context context) {
|
||||||
FingerprintManagerCompat fingerprintManager = FingerprintManagerCompat.from(context);
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||||
KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return keyguardManager != null &&
|
FingerprintManager fingerprintManager = context.getSystemService(FingerprintManager.class);
|
||||||
|
KeyguardManager keyguardManager = context.getSystemService(KeyguardManager.class);
|
||||||
|
|
||||||
|
return (keyguardManager != null) && (fingerprintManager != null) &&
|
||||||
keyguardManager.isKeyguardSecure() &&
|
keyguardManager.isKeyguardSecure() &&
|
||||||
fingerprintManager.isHardwareDetected() &&
|
fingerprintManager.isHardwareDetected() &&
|
||||||
fingerprintManager.hasEnrolledFingerprints();
|
fingerprintManager.hasEnrolledFingerprints();
|
||||||
@@ -29,8 +32,14 @@ public class FingerprintHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void authenticate(Context context, CancellationSignal cancelSignal,
|
public static void authenticate(Context context, CancellationSignal cancelSignal,
|
||||||
FingerprintManagerCompat.AuthenticationCallback callback) {
|
FingerprintManager.AuthenticationCallback callback) {
|
||||||
FingerprintManagerCompat manager = FingerprintManagerCompat.from(context);
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||||
manager.authenticate(null, 0, cancelSignal, callback, null);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FingerprintManager manager = context.getSystemService(FingerprintManager.class);
|
||||||
|
if (manager != null) {
|
||||||
|
manager.authenticate(null, cancelSignal, 0, callback, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,11 +31,13 @@ import android.graphics.Canvas;
|
|||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.drawable.VectorDrawable;
|
import android.graphics.drawable.VectorDrawable;
|
||||||
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.CancellationSignal;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.support.design.widget.TextInputLayout;
|
import android.support.design.widget.TextInputLayout;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.hardware.fingerprint.FingerprintManagerCompat;
|
|
||||||
import android.support.v4.os.CancellationSignal;
|
|
||||||
import android.system.ErrnoException;
|
import android.system.ErrnoException;
|
||||||
import android.system.Os;
|
import android.system.Os;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
@@ -56,6 +58,7 @@ import com.m2049r.xmrwallet.R;
|
|||||||
import com.m2049r.xmrwallet.model.NetworkType;
|
import com.m2049r.xmrwallet.model.NetworkType;
|
||||||
import com.m2049r.xmrwallet.model.Wallet;
|
import com.m2049r.xmrwallet.model.Wallet;
|
||||||
import com.m2049r.xmrwallet.model.WalletManager;
|
import com.m2049r.xmrwallet.model.WalletManager;
|
||||||
|
import com.m2049r.xmrwallet.service.exchange.api.ExchangeApi;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -65,6 +68,7 @@ import java.net.MalformedURLException;
|
|||||||
import java.net.SocketTimeoutException;
|
import java.net.SocketTimeoutException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
|
||||||
@@ -72,6 +76,8 @@ import okhttp3.HttpUrl;
|
|||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
public class Helper {
|
public class Helper {
|
||||||
|
static public final String CRYPTO = "XMR";
|
||||||
|
|
||||||
static private final String WALLET_DIR = "monerujo" + (BuildConfig.DEBUG ? "-debug" : "");
|
static private final String WALLET_DIR = "monerujo" + (BuildConfig.DEBUG ? "-debug" : "");
|
||||||
static private final String HOME_DIR = "monero" + (BuildConfig.DEBUG ? "-debug" : "");
|
static private final String HOME_DIR = "monero" + (BuildConfig.DEBUG ? "-debug" : "");
|
||||||
|
|
||||||
@@ -377,6 +383,7 @@ public class Helper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static AlertDialog openDialog = null; // for preventing opening of multiple dialogs
|
static AlertDialog openDialog = null; // for preventing opening of multiple dialogs
|
||||||
|
static AsyncTask<Void, Void, Boolean> loginTask = null;
|
||||||
|
|
||||||
static public void promptPassword(final Context context, final String wallet, boolean fingerprintDisabled, final PasswordAction action) {
|
static public void promptPassword(final Context context, final String wallet, boolean fingerprintDisabled, final PasswordAction action) {
|
||||||
if (openDialog != null) return; // we are already asking for password
|
if (openDialog != null) return; // we are already asking for password
|
||||||
@@ -389,13 +396,66 @@ public class Helper {
|
|||||||
final TextInputLayout etPassword = (TextInputLayout) promptsView.findViewById(R.id.etPassword);
|
final TextInputLayout etPassword = (TextInputLayout) promptsView.findViewById(R.id.etPassword);
|
||||||
etPassword.setHint(context.getString(R.string.prompt_password, wallet));
|
etPassword.setHint(context.getString(R.string.prompt_password, wallet));
|
||||||
|
|
||||||
|
final TextView tvOpenPrompt = (TextView) promptsView.findViewById(R.id.tvOpenPrompt);
|
||||||
|
final Drawable icFingerprint = context.getDrawable(R.drawable.ic_fingerprint);
|
||||||
|
final Drawable icError = context.getDrawable(R.drawable.ic_error_red_36dp);
|
||||||
|
final Drawable icInfo = context.getDrawable(R.drawable.ic_info_green_36dp);
|
||||||
|
|
||||||
final boolean fingerprintAuthCheck = FingerprintHelper.isFingerPassValid(context, wallet);
|
final boolean fingerprintAuthCheck = FingerprintHelper.isFingerPassValid(context, wallet);
|
||||||
|
|
||||||
final boolean fingerprintAuthAllowed = !fingerprintDisabled && fingerprintAuthCheck;
|
final boolean fingerprintAuthAllowed = !fingerprintDisabled && fingerprintAuthCheck;
|
||||||
final CancellationSignal cancelSignal = new CancellationSignal();
|
final CancellationSignal cancelSignal = new CancellationSignal();
|
||||||
|
|
||||||
if (fingerprintAuthAllowed) {
|
final AtomicBoolean incorrectSavedPass = new AtomicBoolean(false);
|
||||||
promptsView.findViewById(R.id.txtFingerprintAuth).setVisibility(View.VISIBLE);
|
class LoginWalletTask extends AsyncTask<Void, Void, Boolean> {
|
||||||
|
private String pass;
|
||||||
|
private boolean fingerprintUsed;
|
||||||
|
|
||||||
|
LoginWalletTask(String pass, boolean fingerprintUsed) {
|
||||||
|
this.pass = pass;
|
||||||
|
this.fingerprintUsed = fingerprintUsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPreExecute() {
|
||||||
|
tvOpenPrompt.setCompoundDrawablesRelativeWithIntrinsicBounds(icInfo, null, null, null);
|
||||||
|
tvOpenPrompt.setText(context.getText(R.string.prompt_open_wallet));
|
||||||
|
tvOpenPrompt.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Boolean doInBackground(Void... unused) {
|
||||||
|
return processPasswordEntry(context, wallet, pass, fingerprintUsed, action);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(Boolean result) {
|
||||||
|
if (result) {
|
||||||
|
Helper.hideKeyboardAlways((Activity) context);
|
||||||
|
cancelSignal.cancel();
|
||||||
|
openDialog.dismiss();
|
||||||
|
openDialog = null;
|
||||||
|
} else {
|
||||||
|
if (fingerprintUsed) {
|
||||||
|
incorrectSavedPass.set(true);
|
||||||
|
tvOpenPrompt.setCompoundDrawablesRelativeWithIntrinsicBounds(icError, null, null, null);
|
||||||
|
tvOpenPrompt.setText(context.getText(R.string.bad_saved_password));
|
||||||
|
} else {
|
||||||
|
if (!fingerprintAuthAllowed) {
|
||||||
|
tvOpenPrompt.setVisibility(View.GONE);
|
||||||
|
} else if (incorrectSavedPass.get()) {
|
||||||
|
tvOpenPrompt.setCompoundDrawablesRelativeWithIntrinsicBounds(icError, null, null, null);
|
||||||
|
tvOpenPrompt.setText(context.getText(R.string.bad_password));
|
||||||
|
} else {
|
||||||
|
tvOpenPrompt.setCompoundDrawablesRelativeWithIntrinsicBounds(icFingerprint, null, null, null);
|
||||||
|
tvOpenPrompt.setText(context.getText(R.string.prompt_fingerprint_auth));
|
||||||
|
}
|
||||||
|
etPassword.setError(context.getString(R.string.bad_password));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
loginTask = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
etPassword.getEditText().addTextChangedListener(new TextWatcher() {
|
etPassword.getEditText().addTextChangedListener(new TextWatcher() {
|
||||||
@@ -427,46 +487,56 @@ public class Helper {
|
|||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
Helper.hideKeyboardAlways((Activity) context);
|
Helper.hideKeyboardAlways((Activity) context);
|
||||||
cancelSignal.cancel();
|
cancelSignal.cancel();
|
||||||
|
if (loginTask != null) {
|
||||||
|
loginTask.cancel(true);
|
||||||
|
loginTask = null;
|
||||||
|
}
|
||||||
dialog.cancel();
|
dialog.cancel();
|
||||||
openDialog = null;
|
openDialog = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
openDialog = alertDialogBuilder.create();
|
openDialog = alertDialogBuilder.create();
|
||||||
|
|
||||||
final FingerprintManagerCompat.AuthenticationCallback fingerprintAuthCallback = new FingerprintManagerCompat.AuthenticationCallback() {
|
final FingerprintManager.AuthenticationCallback fingerprintAuthCallback;
|
||||||
@Override
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||||
public void onAuthenticationError(int errMsgId, CharSequence errString) {
|
fingerprintAuthCallback = null;
|
||||||
((TextView) promptsView.findViewById(R.id.txtFingerprintAuth)).setText(errString);
|
} else {
|
||||||
}
|
fingerprintAuthCallback = new FingerprintManager.AuthenticationCallback() {
|
||||||
|
@Override
|
||||||
@Override
|
public void onAuthenticationError(int errMsgId, CharSequence errString) {
|
||||||
public void onAuthenticationSucceeded(FingerprintManagerCompat.AuthenticationResult result) {
|
tvOpenPrompt.setCompoundDrawablesRelativeWithIntrinsicBounds(icError, null, null, null);
|
||||||
try {
|
tvOpenPrompt.setText(errString);
|
||||||
String userPass = KeyStoreHelper.loadWalletUserPass(context, wallet);
|
|
||||||
if (Helper.processPasswordEntry(context, wallet, userPass, true, action)) {
|
|
||||||
Helper.hideKeyboardAlways((Activity) context);
|
|
||||||
openDialog.dismiss();
|
|
||||||
openDialog = null;
|
|
||||||
} else {
|
|
||||||
etPassword.setError(context.getString(R.string.bad_password));
|
|
||||||
}
|
|
||||||
} catch (KeyStoreHelper.BrokenPasswordStoreException ex) {
|
|
||||||
etPassword.setError(context.getString(R.string.bad_password));
|
|
||||||
// TODO: better errror message here - what would it be?
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAuthenticationFailed() {
|
public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult result) {
|
||||||
((TextView) promptsView.findViewById(R.id.txtFingerprintAuth))
|
try {
|
||||||
.setText(context.getString(R.string.bad_fingerprint));
|
String userPass = KeyStoreHelper.loadWalletUserPass(context, wallet);
|
||||||
}
|
if (loginTask == null) {
|
||||||
};
|
loginTask = new LoginWalletTask(userPass, true);
|
||||||
|
loginTask.execute();
|
||||||
|
}
|
||||||
|
} catch (KeyStoreHelper.BrokenPasswordStoreException ex) {
|
||||||
|
etPassword.setError(context.getString(R.string.bad_password));
|
||||||
|
// TODO: better error message here - what would it be?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAuthenticationFailed() {
|
||||||
|
tvOpenPrompt.setCompoundDrawablesRelativeWithIntrinsicBounds(icError, null, null, null);
|
||||||
|
tvOpenPrompt.setText(context.getString(R.string.bad_fingerprint));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
openDialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
openDialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onShow(DialogInterface dialog) {
|
public void onShow(DialogInterface dialog) {
|
||||||
if (fingerprintAuthAllowed) {
|
if (fingerprintAuthAllowed && fingerprintAuthCallback != null) {
|
||||||
|
tvOpenPrompt.setCompoundDrawablesRelativeWithIntrinsicBounds(icFingerprint, null, null, null);
|
||||||
|
tvOpenPrompt.setText(context.getText(R.string.prompt_fingerprint_auth));
|
||||||
|
tvOpenPrompt.setVisibility(View.VISIBLE);
|
||||||
FingerprintHelper.authenticate(context, cancelSignal, fingerprintAuthCallback);
|
FingerprintHelper.authenticate(context, cancelSignal, fingerprintAuthCallback);
|
||||||
}
|
}
|
||||||
Button button = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE);
|
Button button = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE);
|
||||||
@@ -474,13 +544,9 @@ public class Helper {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
String pass = etPassword.getEditText().getText().toString();
|
String pass = etPassword.getEditText().getText().toString();
|
||||||
if (processPasswordEntry(context, wallet, pass, false, action)) {
|
if (loginTask == null) {
|
||||||
Helper.hideKeyboardAlways((Activity) context);
|
loginTask = new LoginWalletTask(pass, false);
|
||||||
cancelSignal.cancel();
|
loginTask.execute();
|
||||||
openDialog.dismiss();
|
|
||||||
openDialog = null;
|
|
||||||
} else {
|
|
||||||
etPassword.setError(context.getString(R.string.bad_password));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -492,13 +558,9 @@ public class Helper {
|
|||||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
|
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
|
||||||
String pass = etPassword.getEditText().getText().toString();
|
String pass = etPassword.getEditText().getText().toString();
|
||||||
if (processPasswordEntry(context, wallet, pass, false, action)) {
|
if (loginTask == null) {
|
||||||
Helper.hideKeyboardAlways((Activity) context);
|
loginTask = new LoginWalletTask(pass, false);
|
||||||
cancelSignal.cancel();
|
loginTask.execute();
|
||||||
openDialog.dismiss();
|
|
||||||
openDialog = null;
|
|
||||||
} else {
|
|
||||||
etPassword.setError(context.getString(R.string.bad_password));
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -523,4 +585,9 @@ public class Helper {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public ExchangeApi getExchangeApi() {
|
||||||
|
return new com.m2049r.xmrwallet.service.exchange.coinmarketcap.ExchangeApiImpl(OkHttpClientSingleton.getOkHttpClient());
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -284,7 +284,9 @@ public class KeyStoreHelper {
|
|||||||
|
|
||||||
private static byte[] decrypt(String alias, byte[] data) {
|
private static byte[] decrypt(String alias, byte[] data) {
|
||||||
try {
|
try {
|
||||||
PrivateKey privateKey = getPrivateKeyEntry(alias).getPrivateKey();
|
KeyStore.PrivateKeyEntry pke = getPrivateKeyEntry(alias);
|
||||||
|
if (pke == null) return null;
|
||||||
|
PrivateKey privateKey = pke.getPrivateKey();
|
||||||
Cipher cipher = Cipher.getInstance(SecurityConstants.CIPHER_RSA_ECB_PKCS1);
|
Cipher cipher = Cipher.getInstance(SecurityConstants.CIPHER_RSA_ECB_PKCS1);
|
||||||
|
|
||||||
cipher.init(Cipher.DECRYPT_MODE, privateKey);
|
cipher.init(Cipher.DECRYPT_MODE, privateKey);
|
||||||
@@ -305,7 +307,8 @@ public class KeyStoreHelper {
|
|||||||
*/
|
*/
|
||||||
private static byte[] signData(String alias, byte[] data) throws NoSuchAlgorithmException,
|
private static byte[] signData(String alias, byte[] data) throws NoSuchAlgorithmException,
|
||||||
InvalidKeyException, SignatureException {
|
InvalidKeyException, SignatureException {
|
||||||
|
KeyStore.PrivateKeyEntry pke = getPrivateKeyEntry(alias);
|
||||||
|
if (pke == null) return null;
|
||||||
PrivateKey privateKey = getPrivateKeyEntry(alias).getPrivateKey();
|
PrivateKey privateKey = getPrivateKeyEntry(alias).getPrivateKey();
|
||||||
Signature s = Signature.getInstance(SecurityConstants.SIGNATURE_SHA256withRSA);
|
Signature s = Signature.getInstance(SecurityConstants.SIGNATURE_SHA256withRSA);
|
||||||
s.initSign(privateKey);
|
s.initSign(privateKey);
|
||||||
|
@@ -25,6 +25,7 @@ import android.util.AttributeSet;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
@@ -36,9 +37,7 @@ import com.m2049r.xmrwallet.model.Wallet;
|
|||||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeApi;
|
import com.m2049r.xmrwallet.service.exchange.api.ExchangeApi;
|
||||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeCallback;
|
import com.m2049r.xmrwallet.service.exchange.api.ExchangeCallback;
|
||||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeRate;
|
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.Helper;
|
||||||
import com.m2049r.xmrwallet.util.OkHttpClientSingleton;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@@ -47,6 +46,8 @@ import timber.log.Timber;
|
|||||||
public class ExchangeTextView extends LinearLayout
|
public class ExchangeTextView extends LinearLayout
|
||||||
implements NumberPadView.NumberPadListener {
|
implements NumberPadView.NumberPadListener {
|
||||||
|
|
||||||
|
private static String MAX = "\u221E";
|
||||||
|
|
||||||
String xmrAmount = null;
|
String xmrAmount = null;
|
||||||
String notXmrAmount = null;
|
String notXmrAmount = null;
|
||||||
|
|
||||||
@@ -70,7 +71,7 @@ public class ExchangeTextView extends LinearLayout
|
|||||||
if (amount > max) {
|
if (amount > max) {
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
if (amount <= 0) {
|
if (amount <= 0) { /////////////////////////////
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
@@ -250,7 +251,7 @@ public class ExchangeTextView extends LinearLayout
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ExchangeApi exchangeApi = new ExchangeApiImpl(OkHttpClientSingleton.getOkHttpClient());
|
private final ExchangeApi exchangeApi = Helper.getExchangeApi();
|
||||||
|
|
||||||
void startExchange() {
|
void startExchange() {
|
||||||
showProgress();
|
showProgress();
|
||||||
@@ -458,4 +459,4 @@ public class ExchangeTextView extends LinearLayout
|
|||||||
tvAmountA.setText(null);
|
tvAmountA.setText(null);
|
||||||
doExchange();
|
doExchange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,6 +30,7 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
@@ -41,9 +42,7 @@ import com.m2049r.xmrwallet.model.Wallet;
|
|||||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeApi;
|
import com.m2049r.xmrwallet.service.exchange.api.ExchangeApi;
|
||||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeCallback;
|
import com.m2049r.xmrwallet.service.exchange.api.ExchangeCallback;
|
||||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeRate;
|
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.Helper;
|
||||||
import com.m2049r.xmrwallet.util.OkHttpClientSingleton;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@@ -166,7 +165,11 @@ public class ExchangeView extends LinearLayout
|
|||||||
etAmount = (TextInputLayout) findViewById(R.id.etAmount);
|
etAmount = (TextInputLayout) findViewById(R.id.etAmount);
|
||||||
tvAmountB = (TextView) findViewById(R.id.tvAmountB);
|
tvAmountB = (TextView) findViewById(R.id.tvAmountB);
|
||||||
sCurrencyA = (Spinner) findViewById(R.id.sCurrencyA);
|
sCurrencyA = (Spinner) findViewById(R.id.sCurrencyA);
|
||||||
|
ArrayAdapter adapter = ArrayAdapter.createFromResource(getContext(), R.array.currency, R.layout.item_spinner);
|
||||||
|
adapter.setDropDownViewResource(R.layout.item_spinner_dropdown_item);
|
||||||
|
sCurrencyA.setAdapter(adapter);
|
||||||
sCurrencyB = (Spinner) findViewById(R.id.sCurrencyB);
|
sCurrencyB = (Spinner) findViewById(R.id.sCurrencyB);
|
||||||
|
sCurrencyB.setAdapter(adapter);
|
||||||
evExchange = (ImageView) findViewById(R.id.evExchange);
|
evExchange = (ImageView) findViewById(R.id.evExchange);
|
||||||
pbExchange = (ProgressBar) findViewById(R.id.pbExchange);
|
pbExchange = (ProgressBar) findViewById(R.id.pbExchange);
|
||||||
|
|
||||||
@@ -310,12 +313,13 @@ public class ExchangeView extends LinearLayout
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ExchangeApi exchangeApi = new ExchangeApiImpl(OkHttpClientSingleton.getOkHttpClient());
|
private final ExchangeApi exchangeApi = Helper.getExchangeApi();
|
||||||
|
|
||||||
void startExchange() {
|
void startExchange() {
|
||||||
showProgress();
|
showProgress();
|
||||||
String currencyA = (String) sCurrencyA.getSelectedItem();
|
String currencyA = (String) sCurrencyA.getSelectedItem();
|
||||||
String currencyB = (String) sCurrencyB.getSelectedItem();
|
String currencyB = (String) sCurrencyB.getSelectedItem();
|
||||||
|
|
||||||
exchangeApi.queryExchangeRate(currencyA, currencyB,
|
exchangeApi.queryExchangeRate(currencyA, currencyB,
|
||||||
new ExchangeCallback() {
|
new ExchangeCallback() {
|
||||||
@Override
|
@Override
|
||||||
|
@@ -0,0 +1,5 @@
|
|||||||
|
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||||
|
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="M21,18v1c0,1.1 -0.9,2 -2,2L5,21c-1.11,0 -2,-0.9 -2,-2L3,5c0,-1.1 0.89,-2 2,-2h14c1.1,0 2,0.9 2,2v1h-9c-1.11,0 -2,0.9 -2,2v8c0,1.1 0.89,2 2,2h9zM12,16h10L22,8L12,8v8zM16,13.5c-0.83,0 -1.5,-0.67 -1.5,-1.5s0.67,-1.5 1.5,-1.5 1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5z"/>
|
||||||
|
</vector>
|
9
app/src/main/res/drawable/ic_add_circle_white.xml
Normal file
9
app/src/main/res/drawable/ic_add_circle_white.xml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportHeight="20.0"
|
||||||
|
android:viewportWidth="20.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/moneroWhite"
|
||||||
|
android:pathData="M11,5L9,5L9,9L5,9L5,11L9,11L9,15L11,15L11,11L15,11L15,9L11,9L11,5L11,5ZM10,0C4.5,0 0,4.5 0,10C0,15.5 4.5,20 10,20C15.5,20 20,15.5 20,10C20,4.5 15.5,0 10,0L10,0ZM10,18C5.6,18 2,14.4 2,10C2,5.6 5.6,2 10,2C14.4,2 18,5.6 18,10C18,14.4 14.4,18 10,18L10,18Z" />
|
||||||
|
</vector>
|
9
app/src/main/res/drawable/ic_all_inclusive_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_all_inclusive_24dp.xml
Normal file
File diff suppressed because one or more lines are too long
5
app/src/main/res/drawable/ic_edit_white_24dp.xml
Normal file
5
app/src/main/res/drawable/ic_edit_white_24dp.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||||
|
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
|
||||||
|
</vector>
|
27
app/src/main/res/drawable/ic_error_red_36dp.xml
Normal file
27
app/src/main/res/drawable/ic_error_red_36dp.xml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<!--
|
||||||
|
~ Copyright (C) 2015 The Android Open Source Project
|
||||||
|
~
|
||||||
|
~ 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
|
||||||
|
-->
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="36dp"
|
||||||
|
android:height="36dp"
|
||||||
|
android:viewportWidth="36"
|
||||||
|
android:viewportHeight="36" >
|
||||||
|
<path
|
||||||
|
android:fillColor="#f4511e"
|
||||||
|
android:pathData="M18,18m -18, 0a 18, 18 0 1, 0 36, 0a 18, 18 0 1, 0 -36, 0" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#ffffffff"
|
||||||
|
android:pathData="m16.665,24.915001l2.67,0l0,2.67l-2.67,0l0,-2.67zm0,-16.5l2.67,0l0,12.67l-2.67,0l0,-12.67z" />
|
||||||
|
</vector>
|
File diff suppressed because one or more lines are too long
27
app/src/main/res/drawable/ic_info_green_36dp.xml
Normal file
27
app/src/main/res/drawable/ic_info_green_36dp.xml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<!--
|
||||||
|
~ Copyright (C) 2015 The Android Open Source Project
|
||||||
|
~
|
||||||
|
~ 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
|
||||||
|
-->
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="36dp"
|
||||||
|
android:height="36dp"
|
||||||
|
android:viewportWidth="36"
|
||||||
|
android:viewportHeight="36" >
|
||||||
|
<path
|
||||||
|
android:fillColor="#009688"
|
||||||
|
android:pathData="M18,18m -18, 0a 18, 18 0 1, 0 36, 0a 18, 18 0 1, 0 -36, 0" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#ffffff"
|
||||||
|
android:pathData="m16.665,8.415001l2.67,0l0,2.67l-2.67,0l0,-2.67zm0,6.5l2.67,0l0,12.67l-2.67,0l0,-12.67z" />
|
||||||
|
</vector>
|
@@ -1,22 +1,41 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/drawer_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@drawable/backgound_all"
|
android:fitsSystemWindows="true">
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<com.m2049r.xmrwallet.widget.Toolbar
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/toolbar"
|
|
||||||
style="@style/ToolBarStyle.Event"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="match_parent"
|
||||||
android:background="@drawable/backgound_toolbar_mainnet"
|
android:background="@drawable/backgound_all"
|
||||||
android:minHeight="?attr/actionBarSize" />
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<com.m2049r.xmrwallet.widget.Toolbar
|
||||||
android:id="@+id/fragment_container"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
style="@style/ToolBarStyle.Event"
|
||||||
android:layout_height="match_parent" />
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?android:attr/actionBarSize"
|
||||||
|
android:background="@drawable/backgound_toolbar_mainnet"
|
||||||
|
android:minHeight="?android:attr/actionBarSize" />
|
||||||
|
|
||||||
</LinearLayout>
|
<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>
|
||||||
|
|
||||||
|
<!-- Container for contents of drawer - use NavigationView to make configuration easier -->
|
||||||
|
<android.support.design.widget.NavigationView
|
||||||
|
android:id="@+id/accounts_nav"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
app:headerLayout="@layout/nav_header"
|
||||||
|
app:menu="@menu/drawer_view" />
|
||||||
|
|
||||||
|
</android.support.v4.widget.DrawerLayout>
|
@@ -1,30 +1,85 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<RelativeLayout
|
||||||
android:id="@+id/tvFunds"
|
|
||||||
style="@style/MoneroText.Funds"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:gravity="center" />
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<com.m2049r.xmrwallet.widget.ExchangeTextView
|
<TextView
|
||||||
android:id="@+id/evAmount"
|
android:id="@+id/tvFunds"
|
||||||
android:layout_width="match_parent"
|
style="@style/MoneroText.Funds"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_alignParentStart="true"
|
||||||
android:orientation="vertical" />
|
android:layout_toStartOf="@id/ibSweep"
|
||||||
|
android:gravity="center"
|
||||||
|
tools:text="Balance: 70.198276354123 XMR" />
|
||||||
|
|
||||||
<com.m2049r.xmrwallet.widget.NumberPadView
|
<ImageButton
|
||||||
android:id="@+id/numberPad"
|
android:id="@+id/ibSweep"
|
||||||
|
style="@style/MoneroLabel.NumPad"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:paddingEnd="12dp"
|
||||||
|
android:paddingStart="12dp"
|
||||||
|
android:src="@drawable/ic_all_inclusive_24dp"
|
||||||
|
android:visibility="visible" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/llAmount"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/white"
|
android:orientation="vertical"
|
||||||
android:gravity="center" />
|
android:visibility="visible">
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/rlSweep"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/ivSweep"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_above="@id/tvSweep"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:src="@drawable/ic_all_inclusive_24dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvSweep"
|
||||||
|
style="@style/MoneroLabel.Heading.Donation"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/send_sweepall" />
|
||||||
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@@ -27,20 +27,10 @@
|
|||||||
android:text="@string/label_send_settings_advanced"
|
android:text="@string/label_send_settings_advanced"
|
||||||
android:textAlignment="textEnd" />
|
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
|
<Spinner
|
||||||
android:id="@+id/sPriority"
|
android:id="@+id/sPriority"
|
||||||
style="@style/MoneroSpinner"
|
style="@style/MoneroSpinner"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:entries="@array/priority"
|
android:entries="@array/priority"
|
||||||
|
@@ -171,6 +171,24 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:shrinkColumns="1">
|
android:shrinkColumns="1">
|
||||||
|
|
||||||
|
<TableRow>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/MoneroLabel.Small"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:gravity="end"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:text="@string/tx_account" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvAccount"
|
||||||
|
style="@style/MoneroText"
|
||||||
|
android:gravity="start"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:textIsSelectable="true" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@@ -57,6 +57,7 @@
|
|||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
android:entries="@array/currency"
|
android:entries="@array/currency"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:minWidth="80dp"
|
||||||
android:paddingBottom="2dp"
|
android:paddingBottom="2dp"
|
||||||
android:paddingEnd="4dp"
|
android:paddingEnd="4dp"
|
||||||
android:paddingStart="4dp"
|
android:paddingStart="4dp"
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user