mirror of https://github.com/m2049r/xmrwallet.git
send gui + first successful send transaction!
This commit is contained in:
parent
d61198b47f
commit
b0efdca928
|
@ -389,7 +389,7 @@ Java_com_m2049r_xmrwallet_model_WalletManager_setDaemonAddressJ(JNIEnv *env, job
|
|||
// returns whether the daemon can be reached, and its version number
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_m2049r_xmrwallet_model_WalletManager_getDaemonVersion(JNIEnv *env,
|
||||
jobject instance) {
|
||||
jobject instance) {
|
||||
uint32_t version;
|
||||
bool isConnected =
|
||||
Bitmonero::WalletManagerFactory::getWalletManager()->connected(&version);
|
||||
|
@ -597,7 +597,7 @@ Java_com_m2049r_xmrwallet_model_Wallet_getFilename(JNIEnv *env, jobject instance
|
|||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_m2049r_xmrwallet_model_Wallet_initJ(JNIEnv *env, jobject instance,
|
||||
jstring daemon_address,
|
||||
long upper_transaction_size_limit) {
|
||||
jlong upper_transaction_size_limit) {
|
||||
// const std::string &daemon_username = "", const std::string &daemon_password = "") = 0;
|
||||
const char *_daemon_address = env->GetStringUTFChars(daemon_address, JNI_FALSE);
|
||||
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
||||
|
@ -757,16 +757,44 @@ Java_com_m2049r_xmrwallet_model_Wallet_refreshAsync(JNIEnv *env, jobject instanc
|
|||
//TODO virtual void setAutoRefreshInterval(int millis) = 0;
|
||||
//TODO virtual int autoRefreshInterval() const = 0;
|
||||
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_com_m2049r_xmrwallet_model_Wallet_createTransactionJ(JNIEnv *env, jobject instance,
|
||||
jstring dst_addr, jstring payment_id,
|
||||
jlong amount, jint mixin_count,
|
||||
jint priority) {
|
||||
|
||||
//virtual PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id,
|
||||
// optional<uint64_t> tvAmount, uint32_t mixin_count,
|
||||
// PendingTransaction::Priority = PendingTransaction::Priority_Low) = 0;
|
||||
const char *_dst_addr = env->GetStringUTFChars(dst_addr, JNI_FALSE);
|
||||
const char *_payment_id = env->GetStringUTFChars(payment_id, JNI_FALSE);
|
||||
Bitmonero::PendingTransaction::Priority _priority =
|
||||
static_cast<Bitmonero::PendingTransaction::Priority>(priority);
|
||||
|
||||
LOGD("Priority_Last is %i", static_cast<int>(Bitmonero::PendingTransaction::Priority_Last));
|
||||
|
||||
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
||||
|
||||
Bitmonero::PendingTransaction *tx = wallet->createTransaction(_dst_addr, _payment_id,
|
||||
amount, mixin_count,
|
||||
_priority);
|
||||
|
||||
env->ReleaseStringUTFChars(dst_addr, _dst_addr);
|
||||
env->ReleaseStringUTFChars(payment_id, _payment_id);
|
||||
return reinterpret_cast<jlong>(tx);
|
||||
}
|
||||
|
||||
//virtual PendingTransaction * createSweepUnmixableTransaction() = 0;
|
||||
|
||||
//virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) = 0;
|
||||
//virtual bool submitTransaction(const std::string &fileName) = 0;
|
||||
//virtual void disposeTransaction(PendingTransaction * t) = 0;
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_m2049r_xmrwallet_model_Wallet_disposeTransaction(JNIEnv *env, jobject instance,
|
||||
jobject pendingTransaction) {
|
||||
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
||||
Bitmonero::PendingTransaction *_pendingTransaction =
|
||||
getHandle<Bitmonero::PendingTransaction>(env, pendingTransaction);
|
||||
wallet->disposeTransaction(_pendingTransaction);
|
||||
}
|
||||
|
||||
//virtual bool exportKeyImages(const std::string &filename) = 0;
|
||||
//virtual bool importKeyImages(const std::string &filename) = 0;
|
||||
|
||||
|
@ -1002,6 +1030,64 @@ Java_com_m2049r_xmrwallet_model_TransactionInfo_getTransferCount(JNIEnv *env, jo
|
|||
}
|
||||
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_m2049r_xmrwallet_model_PendingTransaction_getStatusJ(JNIEnv *env, jobject instance) {
|
||||
Bitmonero::PendingTransaction *tx = getHandle<Bitmonero::PendingTransaction>(env, instance);
|
||||
return tx->status();
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_m2049r_xmrwallet_model_PendingTransaction_getErrorString(JNIEnv *env, jobject instance) {
|
||||
Bitmonero::PendingTransaction *tx = getHandle<Bitmonero::PendingTransaction>(env, instance);
|
||||
return env->NewStringUTF(tx->errorString().c_str());
|
||||
}
|
||||
|
||||
// commit transaction or save to file if filename is provided.
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_m2049r_xmrwallet_model_PendingTransaction_commit(JNIEnv *env, jobject instance,
|
||||
jstring filename, jboolean overwrite) {
|
||||
|
||||
const char *_filename = env->GetStringUTFChars(filename, JNI_FALSE);
|
||||
|
||||
Bitmonero::PendingTransaction *tx = getHandle<Bitmonero::PendingTransaction>(env, instance);
|
||||
bool success = tx->commit(_filename, overwrite);
|
||||
|
||||
env->ReleaseStringUTFChars(filename, _filename);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_com_m2049r_xmrwallet_model_PendingTransaction_getAmount(JNIEnv *env, jobject instance) {
|
||||
Bitmonero::PendingTransaction *tx = getHandle<Bitmonero::PendingTransaction>(env, instance);
|
||||
return tx->amount();
|
||||
}
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_com_m2049r_xmrwallet_model_PendingTransaction_getDust(JNIEnv *env, jobject instance) {
|
||||
Bitmonero::PendingTransaction *tx = getHandle<Bitmonero::PendingTransaction>(env, instance);
|
||||
return tx->dust();
|
||||
}
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_com_m2049r_xmrwallet_model_PendingTransaction_getFee(JNIEnv *env, jobject instance) {
|
||||
Bitmonero::PendingTransaction *tx = getHandle<Bitmonero::PendingTransaction>(env, instance);
|
||||
return tx->fee();
|
||||
}
|
||||
|
||||
/* this returns a vector of strings - deal with this later
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_m2049r_xmrwallet_model_PendingTransaction_getTxId(JNIEnv *env, jobject instance) {
|
||||
Bitmonero::PendingTransaction *tx = getHandle<Bitmonero::PendingTransaction>(env, instance);
|
||||
return env->NewStringUTF(tx->txid().c_str());
|
||||
}
|
||||
*/
|
||||
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_com_m2049r_xmrwallet_model_PendingTransaction_getTxCount(JNIEnv *env, jobject instance) {
|
||||
Bitmonero::PendingTransaction *tx = getHandle<Bitmonero::PendingTransaction>(env, instance);
|
||||
return tx->txCount();
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -20,6 +20,7 @@ import android.app.Fragment;
|
|||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.InputType;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -66,6 +67,11 @@ public class GenerateFragment extends Fragment {
|
|||
etWalletRestoreHeight = (EditText) view.findViewById(R.id.etWalletRestoreHeight);
|
||||
bGenerate = (Button) view.findViewById(R.id.bGenerate);
|
||||
|
||||
etWalletMnemonic.setRawInputType(InputType.TYPE_CLASS_TEXT);
|
||||
etWalletAddress.setRawInputType(InputType.TYPE_CLASS_TEXT);
|
||||
etWalletViewKey.setRawInputType(InputType.TYPE_CLASS_TEXT);
|
||||
etWalletSpendKey.setRawInputType(InputType.TYPE_CLASS_TEXT);
|
||||
|
||||
boolean testnet = WalletManager.getInstance().isTestNet();
|
||||
etWalletMnemonic.setTextIsSelectable(testnet);
|
||||
|
||||
|
@ -318,6 +324,7 @@ public class GenerateFragment extends Fragment {
|
|||
|
||||
private boolean addressOk() {
|
||||
String address = etWalletAddress.getText().toString();
|
||||
// TODO only accept address from the correct net
|
||||
return ((address.length() == 95) && ("49A".indexOf(address.charAt(0)) >= 0));
|
||||
}
|
||||
|
||||
|
|
|
@ -283,6 +283,10 @@ public class LoginActivity extends AppCompatActivity
|
|||
transaction.commit();
|
||||
}
|
||||
|
||||
void popFragmentStack(String name) {
|
||||
getFragmentManager().popBackStack(name, FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
// GenerateFragment.Listener
|
||||
//////////////////////////////////////////
|
||||
|
@ -393,8 +397,7 @@ public class LoginActivity extends AppCompatActivity
|
|||
&&
|
||||
(testWallet(walletPath, password) == Wallet.Status.Status_Ok);
|
||||
if (rc) {
|
||||
getFragmentManager().popBackStack("gen",
|
||||
FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||
popFragmentStack("gen");
|
||||
Toast.makeText(LoginActivity.this,
|
||||
getString(R.string.generate_wallet_created), Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
|
|
|
@ -0,0 +1,241 @@
|
|||
/*
|
||||
* Copyright (c) 2017 m2049r
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.m2049r.xmrwallet;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputType;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.m2049r.xmrwallet.model.PendingTransaction;
|
||||
import com.m2049r.xmrwallet.model.Wallet;
|
||||
import com.m2049r.xmrwallet.model.WalletManager;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
import com.m2049r.xmrwallet.util.TxData;
|
||||
|
||||
public class SendFragment extends Fragment {
|
||||
static final String TAG = "GenerateFragment";
|
||||
|
||||
static final public String ARG_WALLETID = "walletId";
|
||||
|
||||
EditText etAddress;
|
||||
EditText etPaymentId;
|
||||
EditText etAmount;
|
||||
Button bSweep;
|
||||
Spinner sMixin;
|
||||
Spinner sPriority;
|
||||
Button bPrepareSend;
|
||||
LinearLayout llConfirmSend;
|
||||
TextView tvTxAmount;
|
||||
TextView tvTxFee;
|
||||
TextView tvTxDust;
|
||||
Button bSend;
|
||||
|
||||
final static int Mixins[] = {4, 6, 8, 10, 13}; // must macth the layout
|
||||
final static PendingTransaction.Priority Priorities[] =
|
||||
{PendingTransaction.Priority.Priority_Low,
|
||||
PendingTransaction.Priority.Priority_Medium,
|
||||
PendingTransaction.Priority.Priority_High}; // must macth the layout
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
View view = inflater.inflate(R.layout.send_fragment, container, false);
|
||||
|
||||
sMixin = (Spinner) view.findViewById(R.id.sMixin);
|
||||
sPriority = (Spinner) view.findViewById(R.id.sPriority);
|
||||
etAddress = (EditText) view.findViewById(R.id.etAddress);
|
||||
etPaymentId = (EditText) view.findViewById(R.id.etPaymentId);
|
||||
etAmount = (EditText) view.findViewById(R.id.etAmount);
|
||||
bSweep = (Button) view.findViewById(R.id.bSweep);
|
||||
bPrepareSend = (Button) view.findViewById(R.id.bPrepareSend);
|
||||
|
||||
llConfirmSend = (LinearLayout) view.findViewById(R.id.llConfirmSend);
|
||||
tvTxAmount = (TextView) view.findViewById(R.id.tvTxAmount);
|
||||
tvTxFee = (TextView) view.findViewById(R.id.tvTxFee);
|
||||
tvTxDust = (TextView) view.findViewById(R.id.tvTxDust);
|
||||
bSend = (Button) view.findViewById(R.id.bSend);
|
||||
|
||||
etAddress.setRawInputType(InputType.TYPE_CLASS_TEXT);
|
||||
etPaymentId.setRawInputType(InputType.TYPE_CLASS_TEXT);
|
||||
|
||||
etAddress.setText("9tDC52GsMjTNt4dpnRCwAF7ekVBkbkgkXGaMKTcSTpBhGpqkPX56jCNRydLq9oGjbbAQBsZhLfgmTKsntmxRd3TaJFYM2f8");
|
||||
boolean testnet = WalletManager.getInstance().isTestNet();
|
||||
// TODO die if NOT testnet
|
||||
Helper.showKeyboard(getActivity());
|
||||
etAddress.requestFocus();
|
||||
etAddress.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
Log.d(TAG, actionId + "/" + (event == null ? null : event.toString()));
|
||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_NEXT)) {
|
||||
if (addressOk()) {
|
||||
etPaymentId.requestFocus();
|
||||
} // otherwise ignore
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
etPaymentId.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Helper.showKeyboard(getActivity());
|
||||
}
|
||||
});
|
||||
etPaymentId.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_NEXT)) {
|
||||
if (paymentIdOk()) {
|
||||
etAmount.requestFocus();
|
||||
} // otherwise ignore
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
etAmount.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
|
||||
if (amountOk()) {
|
||||
Helper.hideKeyboard(getActivity());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
bPrepareSend.setEnabled(true); // TODO need clever logic here
|
||||
bPrepareSend.setOnClickListener(new View.OnClickListener()
|
||||
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Helper.hideKeyboard(getActivity());
|
||||
prepareSend();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
bSend.setOnClickListener(new View.OnClickListener()
|
||||
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
send();
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
private boolean addressOk() {
|
||||
String address = etAddress.getText().toString();
|
||||
// TODO only accept address from the correct net
|
||||
return ((address.length() == 95) && ("49A".indexOf(address.charAt(0)) >= 0));
|
||||
}
|
||||
|
||||
private boolean amountOk() {
|
||||
String amount = etAmount.getText().toString();
|
||||
// TODO decimal separator
|
||||
return ((amount.length() > 0) && (amount.matches("^[0-9]+([,.][0-9]+)?$")));
|
||||
}
|
||||
|
||||
private boolean paymentIdOk() {
|
||||
String spendKey = etPaymentId.getText().toString();
|
||||
return ((spendKey.length() == 0) || ((spendKey.length() == 64) && (spendKey.matches("^[0-9a-fA-F]+$"))));
|
||||
}
|
||||
|
||||
private void prepareSend() {
|
||||
String dst_addr = etAddress.getText().toString();
|
||||
String paymentId = etPaymentId.getText().toString();
|
||||
long amount = Wallet.getAmountFromString(etAmount.getText().toString());
|
||||
int mixin = Mixins[sMixin.getSelectedItemPosition()];
|
||||
int priorityIndex = sPriority.getSelectedItemPosition();
|
||||
PendingTransaction.Priority priority = Priorities[priorityIndex];
|
||||
Log.d(TAG, dst_addr + "/" + paymentId + "/" + amount + "/" + mixin + "/" + priority.toString());
|
||||
TxData txData = new TxData(
|
||||
dst_addr,
|
||||
paymentId,
|
||||
amount,
|
||||
mixin,
|
||||
priority);
|
||||
|
||||
sMixin.setEnabled(false);
|
||||
sPriority.setEnabled(false);
|
||||
etAddress.setEnabled(false);
|
||||
etPaymentId.setEnabled(false);
|
||||
etAmount.setEnabled(false);
|
||||
bSweep.setEnabled(false);
|
||||
bPrepareSend.setEnabled(false);
|
||||
|
||||
activityCallback.onPrepareSend(txData);
|
||||
}
|
||||
private void send() {
|
||||
activityCallback.onSend();
|
||||
}
|
||||
|
||||
SendFragment.Listener activityCallback;
|
||||
|
||||
public interface Listener {
|
||||
void onPrepareSend(TxData data);
|
||||
|
||||
void onSend();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
if (context instanceof SendFragment.Listener) {
|
||||
this.activityCallback = (SendFragment.Listener) context;
|
||||
} else {
|
||||
throw new ClassCastException(context.toString()
|
||||
+ " must implement Listener");
|
||||
}
|
||||
}
|
||||
|
||||
public void onCreatedTransaction(PendingTransaction pendingTransaction) {
|
||||
PendingTransaction.Status status = pendingTransaction.getStatus();
|
||||
if (status != PendingTransaction.Status.Status_Ok) {
|
||||
Log.d(TAG, "Wallet store failed: " + pendingTransaction.getErrorString());
|
||||
}
|
||||
Log.d(TAG, "transaction amount " + pendingTransaction.getAmount());
|
||||
Log.d(TAG, "transaction fee " + pendingTransaction.getFee());
|
||||
Log.d(TAG, "transaction dust " + pendingTransaction.getDust());
|
||||
Log.d(TAG, "transactions " + pendingTransaction.getTxCount());
|
||||
|
||||
llConfirmSend.setVisibility(View.VISIBLE);
|
||||
tvTxAmount.setText(Wallet.getDisplayAmount(pendingTransaction.getAmount()));
|
||||
tvTxFee.setText(Wallet.getDisplayAmount(pendingTransaction.getFee()));
|
||||
tvTxDust.setText(Wallet.getDisplayAmount(pendingTransaction.getDust()));
|
||||
bSend.setEnabled(true);
|
||||
}
|
||||
}
|
|
@ -18,6 +18,8 @@ package com.m2049r.xmrwallet;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
@ -29,11 +31,13 @@ import android.support.v7.app.AppCompatActivity;
|
|||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.m2049r.xmrwallet.model.PendingTransaction;
|
||||
import com.m2049r.xmrwallet.model.Wallet;
|
||||
import com.m2049r.xmrwallet.service.WalletService;
|
||||
import com.m2049r.xmrwallet.util.TxData;
|
||||
|
||||
public class WalletActivity extends AppCompatActivity implements WalletFragment.Listener,
|
||||
WalletService.Observer {
|
||||
WalletService.Observer, SendFragment.Listener {
|
||||
private static final String TAG = "WalletActivity";
|
||||
|
||||
static final int MIN_DAEMON_VERSION = 65544;
|
||||
|
@ -101,7 +105,7 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
|
|||
}
|
||||
|
||||
|
||||
Wallet getWallet() {
|
||||
public Wallet getWallet() {
|
||||
if (mBoundService == null) throw new IllegalStateException("WalletService not bound.");
|
||||
return mBoundService.getWallet();
|
||||
}
|
||||
|
@ -120,7 +124,7 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
|
|||
//Log.d(TAG, "setting observer of " + mBoundService);
|
||||
mBoundService.setObserver(WalletActivity.this);
|
||||
updateProgress();
|
||||
//TODO show current progress (eg. if the service is already busy saving last wallet)
|
||||
//TODO show current pbProgress (eg. if the service is already busy saving last wallet)
|
||||
Log.d(TAG, "CONNECTED");
|
||||
}
|
||||
|
||||
|
@ -231,6 +235,20 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
|
|||
super.setTitle(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSendRequest() {
|
||||
replaceFragment(new SendFragment(), null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceUpdate() {
|
||||
try {
|
||||
onRefreshed(getWallet(), true);
|
||||
} catch (IllegalStateException ex) {
|
||||
Log.e(TAG, ex.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
// WalletService.Observer
|
||||
///////////////////////////
|
||||
|
@ -260,6 +278,7 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
|
|||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
if (success) {
|
||||
// TODO signal so we can show/enable send button
|
||||
Toast.makeText(WalletActivity.this, getString(R.string.status_wallet_unloaded), Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(WalletActivity.this, getString(R.string.status_wallet_unload_failed), Toast.LENGTH_LONG).show();
|
||||
|
@ -268,6 +287,32 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreatedTransaction(final PendingTransaction pendingTransaction) {
|
||||
// TODO check which fragment is loaded
|
||||
final SendFragment sendFragment = (SendFragment)
|
||||
getFragmentManager().findFragmentById(R.id.fragment_container);
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
sendFragment.onCreatedTransaction(pendingTransaction);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSentTransaction(final boolean success) {
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
if (success) {
|
||||
Toast.makeText(WalletActivity.this, getString(R.string.status_transaction_sent), Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(WalletActivity.this, getString(R.string.status_transaction_failed), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
popFragmentStack(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgress(final String text) {
|
||||
//Log.d(TAG, "PROGRESS: " + text);
|
||||
|
@ -300,4 +345,52 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
|
|||
onProgress(mBoundService.getProgressValue());
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
// SendFragment.Listener
|
||||
///////////////////////////
|
||||
|
||||
@Override
|
||||
public void onSend() {
|
||||
if (mIsBound) { // no point in talking to unbound service
|
||||
Intent intent = new Intent(getApplicationContext(), WalletService.class);
|
||||
intent.putExtra(WalletService.REQUEST, WalletService.REQUEST_CMD_SEND);
|
||||
startService(intent);
|
||||
Log.d(TAG, "SEND TX request sent");
|
||||
} else {
|
||||
Log.e(TAG, "Service not bound");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrepareSend(TxData txData) {
|
||||
if (mIsBound) { // no point in talking to unbound service
|
||||
Intent intent = new Intent(getApplicationContext(), WalletService.class);
|
||||
intent.putExtra(WalletService.REQUEST, WalletService.REQUEST_CMD_TX);
|
||||
intent.putExtra(WalletService.REQUEST_CMD_TX_DATA, txData);
|
||||
startService(intent);
|
||||
Log.d(TAG, "CREATE TX request sent");
|
||||
} else {
|
||||
Log.e(TAG, "Service not bound");
|
||||
}
|
||||
}
|
||||
|
||||
void popFragmentStack(String name) {
|
||||
if (name == null) {
|
||||
getFragmentManager().popBackStack();
|
||||
} else {
|
||||
getFragmentManager().popBackStack(name, FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||
}
|
||||
}
|
||||
|
||||
void replaceFragment(Fragment newFragment, String name, Bundle extras) {
|
||||
if (extras != null) {
|
||||
newFragment.setArguments(extras);
|
||||
}
|
||||
FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
||||
transaction.replace(R.id.fragment_container, newFragment);
|
||||
transaction.addToBackStack(name);
|
||||
transaction.commit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import android.util.Log;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
@ -45,12 +46,28 @@ public class WalletFragment extends Fragment implements TransactionInfoAdapter.O
|
|||
private TransactionInfoAdapter adapter;
|
||||
private NumberFormat formatter = NumberFormat.getInstance();
|
||||
|
||||
TextView tvBalance;
|
||||
TextView tvUnlockedBalance;
|
||||
TextView tvBlockHeightProgress;
|
||||
TextView tvConnectionStatus;
|
||||
LinearLayout llProgress;
|
||||
TextView tvProgress;
|
||||
ProgressBar pbProgress;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
View view = inflater.inflate(R.layout.wallet_fragment, container, false);
|
||||
|
||||
tvProgress = (TextView) view.findViewById(R.id.tvProgress);
|
||||
pbProgress = (ProgressBar) view.findViewById(R.id.pbProgress);
|
||||
llProgress = (LinearLayout) view.findViewById(R.id.llProgress);
|
||||
tvBalance = (TextView) view.findViewById(R.id.tvBalance);
|
||||
tvUnlockedBalance = (TextView) view.findViewById(R.id.tvUnlockedBalance);
|
||||
tvBlockHeightProgress = (TextView) view.findViewById(R.id.tvBlockHeightProgress);
|
||||
tvConnectionStatus = (TextView) view.findViewById(R.id.tvConnectionStatus);
|
||||
Button bSend = (Button) view.findViewById(R.id.bSend);
|
||||
|
||||
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.list);
|
||||
RecyclerView.ItemDecoration itemDecoration = new
|
||||
DividerItemDecoration(recyclerView.getContext(), DividerItemDecoration.VERTICAL);
|
||||
|
@ -59,8 +76,19 @@ public class WalletFragment extends Fragment implements TransactionInfoAdapter.O
|
|||
this.adapter = new TransactionInfoAdapter(this);
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
bSend.setOnClickListener(new View.OnClickListener()
|
||||
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
activityCallback.onSendRequest();
|
||||
}
|
||||
});
|
||||
|
||||
activityCallback.setTitle(getString(R.string.status_wallet_loading));
|
||||
|
||||
activityCallback.forceUpdate();
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -106,34 +134,30 @@ public class WalletFragment extends Fragment implements TransactionInfoAdapter.O
|
|||
}
|
||||
|
||||
public void onProgress(final String text) {
|
||||
TextView progressText = (TextView) getView().findViewById(R.id.tvProgress);
|
||||
if (text != null) {
|
||||
progressText.setText(text);
|
||||
tvProgress.setText(text);
|
||||
showProgress(); //TODO optimize this
|
||||
} else {
|
||||
hideProgress();
|
||||
progressText.setText(getString(R.string.status_working));
|
||||
tvProgress.setText(getString(R.string.status_working));
|
||||
onProgress(-1);
|
||||
}
|
||||
}
|
||||
|
||||
public void onProgress(final int n) {
|
||||
ProgressBar progress = (ProgressBar) getView().findViewById(R.id.pbProgress);
|
||||
if (n >= 0) {
|
||||
progress.setIndeterminate(false);
|
||||
progress.setProgress(n);
|
||||
pbProgress.setIndeterminate(false);
|
||||
pbProgress.setProgress(n);
|
||||
} else {
|
||||
progress.setIndeterminate(true);
|
||||
pbProgress.setIndeterminate(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void showProgress() {
|
||||
LinearLayout llProgress = (LinearLayout) getView().findViewById(R.id.llProgress);
|
||||
llProgress.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
public void hideProgress() {
|
||||
LinearLayout llProgress = (LinearLayout) getView().findViewById(R.id.llProgress);
|
||||
llProgress.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
@ -149,7 +173,6 @@ public class WalletFragment extends Fragment implements TransactionInfoAdapter.O
|
|||
return title;
|
||||
}
|
||||
|
||||
|
||||
private long firstBlock = 0;
|
||||
private String walletTitle = null;
|
||||
|
||||
|
@ -159,12 +182,8 @@ public class WalletFragment extends Fragment implements TransactionInfoAdapter.O
|
|||
walletTitle = setActivityTitle(wallet);
|
||||
onProgress(100); // of loading
|
||||
}
|
||||
final TextView balanceView = (TextView) getView().findViewById(R.id.tvBalance);
|
||||
final TextView unlockedView = (TextView) getView().findViewById(R.id.tvUnlockedBalance);
|
||||
final TextView syncProgressView = (TextView) getView().findViewById(R.id.tvBlockHeightProgress);
|
||||
final TextView connectionStatusView = (TextView) getView().findViewById(R.id.tvConnectionStatus);
|
||||
balanceView.setText(Wallet.getDisplayAmount(wallet.getBalance()));
|
||||
unlockedView.setText(Wallet.getDisplayAmount(wallet.getUnlockedBalance()));
|
||||
tvBalance.setText(Wallet.getDisplayAmount(wallet.getBalance()));
|
||||
tvUnlockedBalance.setText(Wallet.getDisplayAmount(wallet.getUnlockedBalance()));
|
||||
String sync = "";
|
||||
if (!activityCallback.hasBoundService())
|
||||
throw new IllegalStateException("WalletService not bound.");
|
||||
|
@ -186,8 +205,8 @@ public class WalletFragment extends Fragment implements TransactionInfoAdapter.O
|
|||
}
|
||||
}
|
||||
String net = (wallet.isTestNet() ? getString(R.string.connect_testnet) : getString(R.string.connect_mainnet));
|
||||
syncProgressView.setText(sync);
|
||||
connectionStatusView.setText(net + " " + daemonConnected.toString().substring(17));
|
||||
tvBlockHeightProgress.setText(sync);
|
||||
tvConnectionStatus.setText(net + " " + daemonConnected.toString().substring(17));
|
||||
}
|
||||
|
||||
Listener activityCallback;
|
||||
|
@ -196,12 +215,16 @@ public class WalletFragment extends Fragment implements TransactionInfoAdapter.O
|
|||
public interface Listener {
|
||||
boolean hasBoundService();
|
||||
|
||||
void forceUpdate();
|
||||
|
||||
Wallet.ConnectionStatus getConnectionStatus();
|
||||
|
||||
long getDaemonHeight(); //mBoundService.getDaemonHeight();
|
||||
|
||||
void setTitle(String title);
|
||||
|
||||
void onSendRequest();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright (c) 2017 m2049r
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.m2049r.xmrwallet.model;
|
||||
|
||||
public class PendingTransaction {
|
||||
static {
|
||||
System.loadLibrary("monerujo");
|
||||
}
|
||||
|
||||
public long handle;
|
||||
|
||||
PendingTransaction(long handle) {
|
||||
this.handle = handle;
|
||||
}
|
||||
|
||||
public enum Status {
|
||||
Status_Ok,
|
||||
Status_Error,
|
||||
Status_Critical
|
||||
}
|
||||
|
||||
public enum Priority {
|
||||
Priority_Low(1),
|
||||
Priority_Medium(2),
|
||||
Priority_High(3),
|
||||
Priority_Last(4); // TODO is this true?
|
||||
|
||||
private int value;
|
||||
|
||||
Priority(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static Priority fromInteger(int n) {
|
||||
switch (n) {
|
||||
case 1:
|
||||
return Priority_Low;
|
||||
case 2:
|
||||
return Priority_Medium;
|
||||
case 3:
|
||||
return Priority_High;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Status getStatus() {
|
||||
return Status.values()[getStatusJ()];
|
||||
}
|
||||
|
||||
public native int getStatusJ();
|
||||
|
||||
public native String getErrorString();
|
||||
|
||||
// commit transaction or save to file if filename is provided.
|
||||
public native boolean commit(String filename, boolean overwrite);
|
||||
|
||||
public native long getAmount();
|
||||
|
||||
public native long getDust();
|
||||
|
||||
public native long getFee();
|
||||
|
||||
//public native String getTxId();
|
||||
|
||||
public native long getTxCount();
|
||||
|
||||
}
|
|
@ -88,6 +88,7 @@ public class Wallet {
|
|||
public native boolean store(String path);
|
||||
|
||||
public boolean close() {
|
||||
disposePendingTransaction();
|
||||
return WalletManager.getInstance().close(this);
|
||||
}
|
||||
|
||||
|
@ -161,15 +162,40 @@ public class Wallet {
|
|||
//TODO virtual int autoRefreshInterval() const = 0;
|
||||
|
||||
|
||||
//virtual PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id,
|
||||
// optional<uint64_t> tvAmount, uint32_t mixin_count,
|
||||
// PendingTransaction::Priority = PendingTransaction::Priority_Low) = 0;
|
||||
// TODO - good place to keep this ?
|
||||
private PendingTransaction pendingTransaction = null;
|
||||
|
||||
public PendingTransaction getPendingTransaction() {
|
||||
return pendingTransaction;
|
||||
}
|
||||
|
||||
public void disposePendingTransaction() {
|
||||
if (pendingTransaction != null) {
|
||||
disposeTransaction(pendingTransaction);
|
||||
pendingTransaction = null;
|
||||
}
|
||||
}
|
||||
|
||||
public PendingTransaction createTransaction(String dst_addr, String payment_id,
|
||||
long amount, int mixin_count,
|
||||
PendingTransaction.Priority priority) {
|
||||
disposePendingTransaction();
|
||||
long txHandle = createTransactionJ(dst_addr, payment_id, amount, mixin_count, priority);
|
||||
pendingTransaction = new PendingTransaction(txHandle);
|
||||
return pendingTransaction;
|
||||
}
|
||||
|
||||
private native long createTransactionJ(String dst_addr, String payment_id,
|
||||
long mount, int mixin_count,
|
||||
PendingTransaction.Priority priority);
|
||||
|
||||
//virtual PendingTransaction * createSweepUnmixableTransaction() = 0;
|
||||
|
||||
//virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) = 0;
|
||||
//virtual bool submitTransaction(const std::string &fileName) = 0;
|
||||
//virtual void disposeTransaction(PendingTransaction * t) = 0;
|
||||
|
||||
public native void disposeTransaction(PendingTransaction pendingTransaction);
|
||||
|
||||
//virtual bool exportKeyImages(const std::string &filename) = 0;
|
||||
//virtual bool importKeyImages(const std::string &filename) = 0;
|
||||
|
||||
|
|
|
@ -28,21 +28,30 @@ import android.os.Process;
|
|||
import android.util.Log;
|
||||
|
||||
import com.m2049r.xmrwallet.R;
|
||||
import com.m2049r.xmrwallet.model.PendingTransaction;
|
||||
import com.m2049r.xmrwallet.model.TransactionHistory;
|
||||
import com.m2049r.xmrwallet.model.Wallet;
|
||||
import com.m2049r.xmrwallet.model.WalletListener;
|
||||
import com.m2049r.xmrwallet.model.WalletManager;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
import com.m2049r.xmrwallet.util.TxData;
|
||||
|
||||
public class WalletService extends Service {
|
||||
final static String TAG = "WalletService";
|
||||
|
||||
public static final String REQUEST_WALLET = "wallet";
|
||||
public static final String REQUEST = "request";
|
||||
|
||||
public static final String REQUEST_CMD_LOAD = "load";
|
||||
public static final String REQUEST_CMD_LOAD_PW = "walletPassword";
|
||||
|
||||
public static final String REQUEST_CMD_STORE = "store";
|
||||
|
||||
public static final String REQUEST_CMD_TX = "createTX";
|
||||
public static final String REQUEST_CMD_TX_DATA = "data";
|
||||
|
||||
public static final String REQUEST_CMD_SEND = "send";
|
||||
|
||||
public static final int START_SERVICE = 1;
|
||||
public static final int STOP_SERVICE = 2;
|
||||
|
||||
|
@ -194,6 +203,10 @@ public class WalletService extends Service {
|
|||
void onProgress(int n);
|
||||
|
||||
void onWalletStored(boolean success);
|
||||
|
||||
void onCreatedTransaction(PendingTransaction pendingTransaction);
|
||||
|
||||
void onSentTransaction(boolean success);
|
||||
}
|
||||
|
||||
String progressText = null;
|
||||
|
@ -264,6 +277,33 @@ public class WalletService extends Service {
|
|||
Log.d(TAG, "Wallet store failed: " + myWallet.getErrorString());
|
||||
}
|
||||
if (observer != null) observer.onWalletStored(rc);
|
||||
} else if (cmd.equals(REQUEST_CMD_TX)) {
|
||||
Wallet myWallet = getWallet();
|
||||
Log.d(TAG, "creating tx for wallet: " + myWallet.getName());
|
||||
TxData txData = extras.getParcelable(REQUEST_CMD_TX_DATA);
|
||||
PendingTransaction pendingTransaction = myWallet.createTransaction(
|
||||
txData.dst_addr, txData.paymentId, txData.amount, txData.mixin, txData.priority);
|
||||
PendingTransaction.Status status = pendingTransaction.getStatus();
|
||||
Log.d(TAG, "transaction status " + status);
|
||||
Log.d(TAG, "transaction amount " + pendingTransaction.getAmount());
|
||||
Log.d(TAG, "transaction fee " + pendingTransaction.getFee());
|
||||
if (status != PendingTransaction.Status.Status_Ok) {
|
||||
Log.d(TAG, "Create Transaction failed: " + pendingTransaction.getErrorString());
|
||||
}
|
||||
// TODO myWallet.disposeTransaction(pendingTransaction); later
|
||||
if (observer != null) observer.onCreatedTransaction(pendingTransaction);
|
||||
} else if (cmd.equals(REQUEST_CMD_SEND)) {
|
||||
Wallet myWallet = getWallet();
|
||||
Log.d(TAG, "send tx for wallet: " + myWallet.getName());
|
||||
PendingTransaction pendingTransaction = myWallet.getPendingTransaction();
|
||||
if (pendingTransaction.getStatus() != PendingTransaction.Status.Status_Ok) {
|
||||
Log.e(TAG, "PendingTransaction is " + pendingTransaction.getStatus());
|
||||
myWallet.disposePendingTransaction(); // it's broken anyway
|
||||
return;
|
||||
}
|
||||
boolean success = pendingTransaction.commit("", true);
|
||||
myWallet.disposePendingTransaction();
|
||||
if (observer != null) observer.onSentTransaction(success);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright (c) 2017 m2049r
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.m2049r.xmrwallet.util;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.m2049r.xmrwallet.model.PendingTransaction;
|
||||
|
||||
// https://stackoverflow.com/questions/2139134/how-to-send-an-object-from-one-android-activity-to-another-using-intents
|
||||
public class TxData implements Parcelable {
|
||||
public TxData(String dst_addr,
|
||||
String paymentId,
|
||||
long amount,
|
||||
int mixin,
|
||||
PendingTransaction.Priority priority) {
|
||||
this.dst_addr = dst_addr;
|
||||
this.paymentId = paymentId;
|
||||
this.amount = amount;
|
||||
this.mixin = mixin;
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
public String dst_addr;
|
||||
public String paymentId;
|
||||
public long amount;
|
||||
public int mixin;
|
||||
public PendingTransaction.Priority priority;
|
||||
|
||||
// 99.9% of the time you can just ignore this
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// write your object's data to the passed-in Parcel
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
out.writeString(dst_addr);
|
||||
out.writeString(paymentId);
|
||||
out.writeLong(amount);
|
||||
out.writeInt(mixin);
|
||||
out.writeInt(priority.getValue());
|
||||
}
|
||||
|
||||
// this is used to regenerate your object. All Parcelables must have a CREATOR that implements these two methods
|
||||
public static final Parcelable.Creator<TxData> CREATOR = new Parcelable.Creator<TxData>() {
|
||||
public TxData createFromParcel(Parcel in) {
|
||||
return new TxData(in);
|
||||
}
|
||||
|
||||
public TxData[] newArray(int size) {
|
||||
return new TxData[size];
|
||||
}
|
||||
};
|
||||
|
||||
// example constructor that takes a Parcel and gives you an object populated with it's values
|
||||
private TxData(Parcel in) {
|
||||
dst_addr = in.readString();
|
||||
paymentId = in.readString();
|
||||
amount = in.readLong();
|
||||
mixin = in.readInt();
|
||||
priority = PendingTransaction.Priority.fromInteger(in.readInt());
|
||||
|
||||
}
|
||||
}
|
|
@ -40,7 +40,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:hint="@string/generate_mnemonic_hint"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="text"
|
||||
android:inputType="textMultiLine"
|
||||
android:textAlignment="center"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:hint="@string/generate_address_hint"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="text"
|
||||
android:inputType="textMultiLine"
|
||||
android:textAlignment="center"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
@ -68,7 +68,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:hint="@string/generate_viewkey_hint"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="text"
|
||||
android:inputType="textMultiLine"
|
||||
android:textAlignment="center"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
@ -78,7 +78,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:hint="@string/generate_spendkey_hint"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="text"
|
||||
android:inputType="textMultiLine"
|
||||
android:textAlignment="center"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
|
|
@ -0,0 +1,210 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="2">
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/sMixin"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:entries="@array/mixin"
|
||||
android:textAlignment="center" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/sPriority"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:entries="@array/priority"
|
||||
android:textAlignment="center" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etAddress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/send_address_hint"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="textMultiLine"
|
||||
android:textAlignment="center"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="10">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etPaymentId"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="8"
|
||||
android:hint="@string/send_paymentid_hint"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="textMultiLine"
|
||||
android:textAlignment="center"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bPaymentId"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_weight="2"
|
||||
android:background="@color/colorPrimary"
|
||||
android:enabled="false"
|
||||
android:text="@string/send_generate_paymentid_hint" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="10">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etAmount"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="8"
|
||||
android:hint="@string/send_amount_hint"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="numberDecimal"
|
||||
android:textAlignment="center"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bSweep"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_weight="2"
|
||||
android:background="@color/colorPrimary"
|
||||
android:enabled="false"
|
||||
android:text="@string/send_sweep_hint" />
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/bPrepareSend"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@color/colorPrimary"
|
||||
android:enabled="false"
|
||||
android:text="@string/send_send_hint" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llConfirmSend"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="3">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxAmountLabel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginRight="8dp"
|
||||
android:text="@string/send_amount_label"
|
||||
android:textAlignment="textEnd"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxAmount"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:text="@string/big_amount"
|
||||
android:textAlignment="textEnd"
|
||||
android:textSize="20sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="3">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxFeeLabel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginRight="8dp"
|
||||
android:text="@string/send_fee_label"
|
||||
android:textAlignment="textEnd"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxFee"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:text="@string/big_amount"
|
||||
android:textAlignment="textEnd"
|
||||
android:textSize="20sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="3">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxDustLabel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginRight="8dp"
|
||||
android:text="@string/send_dust_label"
|
||||
android:textAlignment="textEnd"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="20sp" />
|
||||
c
|
||||
<TextView
|
||||
android:id="@+id/tvTxDust"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:text="@string/big_amount"
|
||||
android:textAlignment="textEnd"
|
||||
android:textSize="20sp" />
|
||||
</LinearLayout>
|
||||
<Button
|
||||
android:id="@+id/bSend"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@color/colorPrimary"
|
||||
android:enabled="false"
|
||||
android:text="@string/send_send_hint" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,22 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvBalanceLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="10sp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:text="@string/label_balance"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/tvBalance"
|
||||
app:layout_constraintRight_toLeftOf="@+id/tvBalance" />
|
||||
|
||||
|
@ -24,7 +27,7 @@
|
|||
android:id="@+id/tvBalance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="00000000.000000000000"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
|
@ -34,9 +37,9 @@
|
|||
android:id="@+id/tvUnlockedBalanceLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="10sp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:text="@string/label_unlockedBalance"
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/tvUnlockedBalance"
|
||||
app:layout_constraintRight_toLeftOf="@+id/tvUnlockedBalance" />
|
||||
|
||||
|
@ -53,10 +56,10 @@
|
|||
android:id="@+id/tvConnectionStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="10sp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:text="Loading..."
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
@ -64,10 +67,10 @@
|
|||
android:id="@+id/tvBlockHeightProgress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="10sp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:text="Loading..."
|
||||
android:textSize="10sp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvConnectionStatus" />
|
||||
|
||||
|
@ -77,37 +80,56 @@
|
|||
android:id="@+id/llProgress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone" >
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvProgress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:text="Loading..." />
|
||||
android:text="Loading..."
|
||||
android:textSize="16sp" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pbProgress"
|
||||
style="@android:style/Widget.ProgressBar.Horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:progress="0"/>
|
||||
android:progress="0" />
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="0dp"
|
||||
android:layout_marginRight="0dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layoutManager="LinearLayoutManager"
|
||||
tools:listitem="@layout/transaction_item" />
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/list"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layoutManager="LinearLayoutManager"
|
||||
app:layout_constraintBottom_toTopOf="@+id/bSend"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:listitem="@layout/transaction_item" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bSend"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="@color/colorPrimary"
|
||||
android:enabled="true"
|
||||
android:text="@string/wallet_send_hint"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
</LinearLayout>
|
|
@ -3,7 +3,6 @@
|
|||
<string name="login_activity_name">Select Wallet</string>
|
||||
<string name="wallet_activity_name">Wallet</string>
|
||||
|
||||
<!-- Strings related to login -->
|
||||
<string name="prompt_daemon">Daemon Address</string>
|
||||
<string name="prompt_mainnet">Net Selection</string>
|
||||
<string name="connect_testnet">TestNet</string>
|
||||
|
@ -16,6 +15,9 @@
|
|||
<string name="status_wallet_connecting">Connecting …</string>
|
||||
<string name="status_working">Working on it …</string>
|
||||
|
||||
<string name="status_transaction_sent">Transaction sent!</string>
|
||||
<string name="status_transaction_failed">Transaction failed!</string>
|
||||
|
||||
<string name="prompt_password">Password for</string>
|
||||
<string name="bad_password">Bad password!</string>
|
||||
<string name="bad_wallet">Wallet does not exists!</string>
|
||||
|
@ -25,6 +27,8 @@
|
|||
<string name="warn_daemon_unavailable">Cannot connect to daemon! Try again.</string>
|
||||
<string name="panic">Something\'s wrong!</string>
|
||||
|
||||
<string name="wallet_send_hint">Send some</string>
|
||||
|
||||
<string name="title_amount">Amount</string>
|
||||
<string name="title_date">Date</string>
|
||||
<string name="label_balance">Balance</string>
|
||||
|
@ -88,4 +92,32 @@
|
|||
<string name="generate_check_mnemonic">Check your mnemonic seed!</string>
|
||||
<string name="generate_check_something">Check your entry!</string>
|
||||
|
||||
<string name="send_address_hint">Receiver\'s Address</string>
|
||||
<string name="send_paymentid_hint">Payment ID (optional)</string>
|
||||
<string name="send_amount_hint">Amount</string>
|
||||
<string name="send_notes_hint">Private Notes (optional)</string>
|
||||
<string name="send_priority_hint">Tx Priority</string>
|
||||
<string name="send_mixin_hint">Mixin</string>
|
||||
<string name="send_sweep_hint">Sweep</string>
|
||||
<string name="send_generate_paymentid_hint">Generate</string>
|
||||
<string name="send_send_hint">Get rid of my monero!</string>
|
||||
|
||||
<string name="send_amount_label">Amount</string>
|
||||
<string name="send_fee_label">Fee</string>
|
||||
<string name="send_dust_label">Dust</string>
|
||||
<string name="big_amount">999999.999999999999</string>
|
||||
|
||||
<string-array name="mixin">
|
||||
<item>Mixin 4</item>
|
||||
<item>Mixin 6</item>
|
||||
<item>Mixin 8</item>
|
||||
<item>Mixin 10</item>
|
||||
<item>Mixin 13</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="priority">
|
||||
<item>Low Priority</item>
|
||||
<item>Medium Priority</item>
|
||||
<item>High Priority</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue