From f52acd1169a58e2f011e6645751be6871885bc35 Mon Sep 17 00:00:00 2001 From: pokkst Date: Thu, 22 Sep 2022 17:40:54 -0500 Subject: [PATCH] Display pub key in CoinsInfo adapter --- app/src/main/cpp/monerujo.cpp | 7 +++++-- .../java/net/mynero/wallet/adapter/CoinsInfoAdapter.java | 4 ++-- app/src/main/java/net/mynero/wallet/model/CoinsInfo.java | 8 +++++++- app/src/main/res/layout/utxo_selection_item.xml | 4 ++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/src/main/cpp/monerujo.cpp b/app/src/main/cpp/monerujo.cpp index 980a049..9c0e482 100644 --- a/app/src/main/cpp/monerujo.cpp +++ b/app/src/main/cpp/monerujo.cpp @@ -1083,17 +1083,20 @@ Java_net_mynero_wallet_model_Wallet_getCoinsJ(JNIEnv *env, jobject instance) { jobject newCoinsInfo(JNIEnv *env, Monero::CoinsInfo *info) { jmethodID c = env->GetMethodID(class_CoinsInfo, "", - "(JZLjava/lang/String;JLjava/lang/String;)V"); + "(JZLjava/lang/String;JLjava/lang/String;Ljava/lang/String;)V"); jstring _key_image = env->NewStringUTF(info->keyImage().c_str()); + jstring _pub_key = env->NewStringUTF(info->pubKey().c_str()); jstring _hash = env->NewStringUTF(info->hash().c_str()); jobject result = env->NewObject(class_CoinsInfo, c, static_cast (info->globalOutputIndex()), info->spent(), _key_image, static_cast (info->amount()), - _hash); + _hash, + _pub_key); env->DeleteLocalRef(_key_image); env->DeleteLocalRef(_hash); + env->DeleteLocalRef(_pub_key); return result; } diff --git a/app/src/main/java/net/mynero/wallet/adapter/CoinsInfoAdapter.java b/app/src/main/java/net/mynero/wallet/adapter/CoinsInfoAdapter.java index 8f4add4..65d3384 100644 --- a/app/src/main/java/net/mynero/wallet/adapter/CoinsInfoAdapter.java +++ b/app/src/main/java/net/mynero/wallet/adapter/CoinsInfoAdapter.java @@ -97,10 +97,10 @@ public class CoinsInfoAdapter extends RecyclerView.Adapter selectedUtxos) { boolean selected = selectedUtxos.contains(coinsInfo.getKeyImage()); - TextView keyImageTextView = itemView.findViewById(R.id.utxo_key_image_textview); + TextView pubKeyTextView = itemView.findViewById(R.id.utxo_pub_key_textview); TextView amountTextView = itemView.findViewById(R.id.utxo_amount_textview); amountTextView.setText(Wallet.getDisplayAmount(coinsInfo.getAmount())); - keyImageTextView.setText(coinsInfo.getKeyImage()); + pubKeyTextView.setText(coinsInfo.getPubKey()); itemView.setOnLongClickListener(view -> { listener.onUtxoSelected(coinsInfo); return true; diff --git a/app/src/main/java/net/mynero/wallet/model/CoinsInfo.java b/app/src/main/java/net/mynero/wallet/model/CoinsInfo.java index 31a528e..e99e66e 100644 --- a/app/src/main/java/net/mynero/wallet/model/CoinsInfo.java +++ b/app/src/main/java/net/mynero/wallet/model/CoinsInfo.java @@ -34,13 +34,15 @@ public class CoinsInfo implements Parcelable { String keyImage; long amount; String hash; + String pubKey; - public CoinsInfo(long globalOutputIndex, boolean spent, String keyImage, long amount, String hash) { + public CoinsInfo(long globalOutputIndex, boolean spent, String keyImage, long amount, String hash, String pubKey) { this.globalOutputIndex = globalOutputIndex; this.spent = spent; this.keyImage = keyImage; this.amount = amount; this.hash = hash; + this.pubKey = pubKey; } protected CoinsInfo(Parcel in) { @@ -79,6 +81,10 @@ public class CoinsInfo implements Parcelable { return amount; } + public String getPubKey() { + return pubKey; + } + @Override public int describeContents() { return 0; diff --git a/app/src/main/res/layout/utxo_selection_item.xml b/app/src/main/res/layout/utxo_selection_item.xml index 63309bd..5185636 100644 --- a/app/src/main/res/layout/utxo_selection_item.xml +++ b/app/src/main/res/layout/utxo_selection_item.xml @@ -7,7 +7,7 @@ android:padding="8dp" android:layout_marginBottom="8dp">