show my tx (sub)address (#487)

merge-requests/3/head
m2049r 6 years ago committed by GitHub
parent 7e14572756
commit d2612a26e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -417,8 +417,8 @@ Java_com_m2049r_xmrwallet_model_WalletManager_verifyWalletPassword(JNIEnv *env,
//virtual int queryWalletHardware(const std::string &keys_file_name, const std::string &password) const = 0;
JNIEXPORT jint JNICALL
Java_com_m2049r_xmrwallet_model_WalletManager_queryWalletDeviceJ(JNIEnv *env, jobject instance,
jstring keys_file_name,
jstring password) {
jstring keys_file_name,
jstring password) {
const char *_keys_file_name = env->GetStringUTFChars(keys_file_name, NULL);
const char *_password = env->GetStringUTFChars(password, NULL);
Bitmonero::Wallet::Device device_type;
@ -1185,10 +1185,11 @@ jobject newTransferList(JNIEnv *env, Bitmonero::TransactionInfo *info) {
jobject newTransactionInfo(JNIEnv *env, Bitmonero::TransactionInfo *info) {
jmethodID c = env->GetMethodID(class_TransactionInfo, "<init>",
"(IZZJJJLjava/lang/String;JLjava/lang/String;IIJLjava/util/List;)V");
"(IZZJJJLjava/lang/String;JLjava/lang/String;IIJLjava/lang/String;Ljava/util/List;)V");
jobject transfers = newTransferList(env, info);
jstring _hash = env->NewStringUTF(info->hash().c_str());
jstring _paymentId = env->NewStringUTF(info->paymentId().c_str());
jstring _label = env->NewStringUTF(info->label().c_str());
uint32_t subaddrIndex = 0;
if (info->direction() == Bitmonero::TransactionInfo::Direction_In)
subaddrIndex = *(info->subaddrIndex().begin());
@ -1205,6 +1206,7 @@ jobject newTransactionInfo(JNIEnv *env, Bitmonero::TransactionInfo *info) {
info->subaddrAccount(),
subaddrIndex,
info->confirmations(),
_label,
transfers);
env->DeleteLocalRef(transfers);
env->DeleteLocalRef(_hash);
@ -1397,7 +1399,7 @@ Java_com_m2049r_xmrwallet_model_WalletManager_setLogLevel(JNIEnv *env, jclass cl
*
* @return length of received data in response or -1 if error
*/
int LedgerExchange(
int LedgerExchange(
unsigned char *command,
unsigned int cmd_len,
unsigned char *response,

@ -60,6 +60,7 @@ public class TxFragment extends Fragment {
}
private TextView tvAccount;
private TextView tvAddress;
private TextView tvTxTimestamp;
private TextView tvTxId;
private TextView tvTxKey;
@ -90,6 +91,7 @@ public class TxFragment extends Fragment {
tvTxAmountBtc = view.findViewById(R.id.tvTxAmountBtc);
tvAccount = view.findViewById(R.id.tvAccount);
tvAddress = view.findViewById(R.id.tvAddress);
tvTxTimestamp = view.findViewById(R.id.tvTxTimestamp);
tvTxId = view.findViewById(R.id.tvTxId);
tvTxKey = view.findViewById(R.id.tvTxKey);
@ -219,12 +221,16 @@ public class TxFragment extends Fragment {
if (info.txKey == null) {
info.txKey = activityCallback.getTxKey(info.hash);
}
if (info.address == null) {
info.address = activityCallback.getTxAddress(info.account, info.subaddress);
}
loadNotes(info);
activityCallback.setSubtitle(getString(R.string.tx_title));
activityCallback.setToolbarButton(Toolbar.BUTTON_BACK);
tvAccount.setText(getString(R.string.tx_account_formatted, info.account, info.subaddress));
tvAddress.setText(info.address);
tvTxTimestamp.setText(TS_FORMATTER.format(new Date(info.timestamp * 1000)));
tvTxId.setText(info.hash);
@ -331,6 +337,8 @@ public class TxFragment extends Fragment {
String getTxNotes(String hash);
String getTxAddress(int major, int minor);
void onSetNote(String txId, String notes);
void setToolbarButton(int type);

@ -168,6 +168,11 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
return getWallet().getUserNote(txId);
}
@Override
public String getTxAddress(int major, int minor) {
return getWallet().getSubaddress(major, minor);
}
@Override
protected void onStart() {
super.onStart();

@ -18,10 +18,8 @@ package com.m2049r.xmrwallet.model;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
import java.util.List;
import java.util.Random;
// this is not the TransactionInfo from the API as that is owned by the TransactionHistory
// this is a POJO for the TransactionInfoAdapter
@ -53,11 +51,6 @@ 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 boolean isPending;
public boolean isFailed;
@ -70,10 +63,12 @@ public class TransactionInfo implements Parcelable, Comparable<TransactionInfo>
public int account;
public int subaddress;
public long confirmations;
public String subaddressLabel;
public List<Transfer> transfers;
public String txKey = null;
public String notes = null;
public String address = null;
public TransactionInfo(
int direction,
@ -88,6 +83,7 @@ public class TransactionInfo implements Parcelable, Comparable<TransactionInfo>
int account,
int subaddress,
long confirmations,
String subaddressLabel,
List<Transfer> transfers) {
this.direction = Direction.values()[direction];
this.isPending = isPending;
@ -101,6 +97,7 @@ public class TransactionInfo implements Parcelable, Comparable<TransactionInfo>
this.account = account;
this.subaddress = subaddress;
this.confirmations = confirmations;
this.subaddressLabel = subaddressLabel;
this.transfers = transfers;
}
@ -122,9 +119,11 @@ public class TransactionInfo implements Parcelable, Comparable<TransactionInfo>
out.writeInt(account);
out.writeInt(subaddress);
out.writeLong(confirmations);
out.writeString(subaddressLabel);
out.writeList(transfers);
out.writeString(txKey);
out.writeString(notes);
out.writeString(address);
}
public static final Parcelable.Creator<TransactionInfo> CREATOR = new Parcelable.Creator<TransactionInfo>() {
@ -150,9 +149,11 @@ public class TransactionInfo implements Parcelable, Comparable<TransactionInfo>
account = in.readInt();
subaddress = in.readInt();
confirmations = in.readLong();
subaddressLabel = in.readString();
transfers = in.readArrayList(Transfer.class.getClassLoader());
txKey = in.readString();
notes = in.readString();
address = in.readString();
}
@Override

@ -79,8 +79,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawablePadding="8dp"
android:drawableStart="@drawable/ic_xmrto_32dp"
android:drawablePadding="8dp"
android:gravity="center"
android:text="@string/label_send_btc_xmrto_info" />
@ -152,10 +152,10 @@
android:background="@color/dotGray"
android:drawableEnd="@drawable/ic_content_copy_white_24dp"
android:drawablePadding="16dp"
android:paddingBottom="8dp"
android:paddingEnd="8dp"
android:paddingStart="24dp"
android:paddingTop="8dp"
android:paddingEnd="8dp"
android:paddingBottom="8dp"
android:textColor="@color/white"
tools:text="XMR.TO-d2KQ" />
</LinearLayout>
@ -189,6 +189,24 @@
android:textIsSelectable="true" />
</TableRow>
<TableRow>
<TextView
style="@style/MoneroLabel.Small"
android:layout_gravity="center_vertical"
android:gravity="end"
android:padding="8dp"
android:text="@string/tx_address" />
<TextView
android:id="@+id/tvAddress"
style="@style/MoneroText"
android:gravity="start"
android:padding="8dp"
android:selectAllOnFocus="true"
android:textIsSelectable="true" />
</TableRow>
<TableRow>
<TextView
@ -221,8 +239,8 @@
android:layout_alignParentEnd="true"
android:layout_centerInParent="true"
android:enabled="true"
android:paddingEnd="8dp"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:text="@string/tx_button_notes" />
</RelativeLayout>

@ -293,6 +293,7 @@
<string name="accounts_drawer_new">Konto erstellen</string>
<string name="accounts_new">Neues Konto #%1$d hinzugefügt</string>
<string name="tx_account">Konto #</string>
<string name="tx_address">Adresse</string>
<string name="send_sweepall">Versende ALLE(!) verfügbaren Gelder aus diesem Konto</string>
<string name="tx_subaddress">Subadresse #%1$d</string>

@ -293,6 +293,7 @@
<string name="accounts_drawer_new">Create Account</string>
<string name="accounts_new">Added new account #%1$d</string>
<string name="tx_account">Account #</string>
<string name="tx_address">Διεύθυνση</string>
<string name="send_sweepall">Send all confirmed funds in this account!</string>
<string name="tx_subaddress">Subaddress #%1$d</string>
<string name="generate_address_label_sub">Public Subaddress #%1$d</string>

@ -280,6 +280,7 @@
<string name="accounts_drawer_new">Crear Cuenta</string>
<string name="accounts_new">Nueva cuenta agregada #%1$d</string>
<string name="tx_account"># de cuenta</string>
<string name="tx_address">Dirección</string>
<string name="send_sweepall">Send all confirmed funds in this account!</string>
<string name="tx_subaddress">Subaddress #%1$d</string>

@ -298,6 +298,7 @@
<string name="accounts_drawer_new">Loo konto</string>
<string name="accounts_new">Uus konto lisatud #%1$d</string>
<string name="tx_account">Konto #</string>
<string name="tx_address">Aadress</string>
<string name="send_sweepall">Saada kõik selle konto kinnitatud vahendid!</string>
<string name="tx_subaddress">Alamaadress #%1$d</string>

@ -295,6 +295,7 @@
<string name="accounts_drawer_new">Créer un Compte</string>
<string name="accounts_new">Nouveau Compte #%1$d ajouté</string>
<string name="tx_account">Compte #</string>
<string name="tx_address">Adresse</string>
<string name="send_sweepall">Envoyer tous les fonds confirmés sur ce compte !</string>
<string name="tx_subaddress">Sous-adresse #%1$d</string>

@ -292,6 +292,7 @@
<string name="accounts_drawer_new">Számla létrehozása</string>
<string name="accounts_new">Új számla hozzáadva (#%1$d)</string>
<string name="tx_account">Számla #</string>
<string name="tx_address">Cím</string>
<string name="send_sweepall">Teljes megerősített egyenleg küldése!</string>
<string name="tx_subaddress">Alcím #%1$d</string>

@ -294,6 +294,7 @@
<string name="accounts_drawer_new">Crea Account</string>
<string name="accounts_new">Aggiunto nuovo account #%1$d</string>
<string name="tx_account">Account #</string>
<string name="tx_address">Indirizzo</string>
<string name="send_sweepall">Manda tutti i fondi confermati in questo account!</string>
<string name="tx_subaddress">Sottoindirizzo #%1$d</string>

@ -292,6 +292,7 @@
<string name="accounts_drawer_new">Create Account</string>
<string name="accounts_new">Added new account #%1$d</string>
<string name="tx_account">Account #</string>
<string name="tx_address">Adresse</string>
<string name="send_sweepall">Send all confirmed funds in this account!</string>
<string name="tx_subaddress">Subaddress #%1$d</string>

@ -290,6 +290,7 @@
<string name="accounts_drawer_new">Account maken</string>
<string name="accounts_new">Nieuw account #%1$d toegevoegd</string>
<string name="tx_account">Accountnr.</string>
<string name="tx_address">Adres</string>
<string name="send_sweepall">Al het bevestigde geld in dit account verzenden!</string>
<string name="tx_subaddress">Subadres #%1$d</string>

@ -292,6 +292,7 @@
<string name="accounts_drawer_new">Criar conta</string>
<string name="accounts_new">Conta adicionada #%1$d</string>
<string name="tx_account">Conta #</string>
<string name="tx_address">Endereço</string>
<string name="send_sweepall">Enviar todo o saldo disponível nesta conta!</string>
<string name="tx_subaddress">Subendereço #%1$d</string>

@ -294,6 +294,7 @@
<string name="accounts_drawer_new">Create Account</string>
<string name="accounts_new">Added new account #%1$d</string>
<string name="tx_account">Account #</string>
<string name="tx_address">Endereço</string>
<string name="send_sweepall">Send all confirmed funds in this account!</string>
<string name="tx_subaddress">Subaddress #%1$d</string>

@ -293,6 +293,7 @@
<string name="accounts_drawer_new">Create Account</string>
<string name="accounts_new">Added new account #%1$d</string>
<string name="tx_account">Account #</string>
<string name="tx_address">Adresă</string>
<string name="send_sweepall">Send all confirmed funds in this account!</string>
<string name="tx_subaddress">Subaddress #%1$d</string>
<string name="generate_address_label_sub">Public Subaddress #%1$d</string>

@ -293,6 +293,7 @@
<string name="accounts_drawer_new">Создать учетную запись</string>
<string name="accounts_new">Добавить новую учетную запись #%1$d</string>
<string name="tx_account">Учетная запись #</string>
<string name="tx_address">Адрес</string>
<string name="send_sweepall">Отправить все средства на этот счет!</string>
<string name="tx_subaddress">Субадрес #%1$d</string>

@ -290,6 +290,7 @@
<string name="accounts_drawer_new">Vytvor Účet</string>
<string name="accounts_new">Pridaný nový účet #%1$d</string>
<string name="tx_account">Účet #</string>
<string name="tx_address">Adresa</string>
<string name="send_sweepall">Pošli všetky potvrdené prostriedky na tomto účte!</string>
<string name="tx_subaddress">Podadresa #%1$d</string>

@ -276,6 +276,7 @@
<string name="accounts_drawer_new">Skapa konto</string>
<string name="accounts_new">Nytt konto skapat #%1$d</string>
<string name="tx_account">Konto #</string>
<string name="tx_address">Adress</string>
<string name="send_sweepall">Skicka alla bekräftade pengar i detta konto!</string>
<string name="tx_subaddress">Underadress #%1$d</string>

@ -290,6 +290,7 @@
<string name="accounts_drawer_new">开新户口</string>
<string name="accounts_new">已新增户口 #%1$d</string>
<string name="tx_account">户口 #</string>
<string name="tx_address">地址</string>
<string name="send_sweepall">发送这个户口的所有已确认款项!</string>
<string name="tx_subaddress">附属地址 #%1$d</string>

@ -291,6 +291,7 @@
<string name="accounts_drawer_new">新增帳戶</string>
<string name="accounts_new">已新增帳戶 #%1$d</string>
<string name="tx_account">帳戶 #</string>
<string name="tx_address">地址</string>
<string name="send_sweepall">發送這個帳戶的所有已確認款項!</string>
<string name="tx_subaddress">子地址 #%1$d</string>

@ -345,6 +345,7 @@
<string name="accounts_drawer_new">Create Account</string>
<string name="accounts_new">Added new account #%1$d</string>
<string name="tx_account">Account #</string>
<string name="tx_address">Address</string>
<string name="send_sweepall">Send all confirmed funds in this account!</string>
<string name="tx_subaddress">Subaddress #%1$d</string>

Loading…
Cancel
Save