Display pub key in CoinsInfo adapter

This commit is contained in:
pokkst 2022-09-22 17:40:54 -05:00
parent 95d5b78542
commit f52acd1169
No known key found for this signature in database
GPG Key ID: 90C2ED85E67A50FF
4 changed files with 16 additions and 7 deletions

View File

@ -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, "<init>",
"(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<jlong> (info->globalOutputIndex()),
info->spent(),
_key_image,
static_cast<jlong> (info->amount()),
_hash);
_hash,
_pub_key);
env->DeleteLocalRef(_key_image);
env->DeleteLocalRef(_hash);
env->DeleteLocalRef(_pub_key);
return result;
}

View File

@ -97,10 +97,10 @@ public class CoinsInfoAdapter extends RecyclerView.Adapter<CoinsInfoAdapter.View
public void bind(CoinsInfo coinsInfo, List<String> 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;

View File

@ -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;

View File

@ -7,7 +7,7 @@
android:padding="8dp"
android:layout_marginBottom="8dp">
<TextView
android:id="@+id/utxo_key_image_textview"
android:id="@+id/utxo_pub_key_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Key Image"
@ -23,7 +23,7 @@
android:layout_height="wrap_content"
android:text="Amount"
android:ellipsize="middle"
app:layout_constraintTop_toBottomOf="@id/utxo_key_image_textview"
app:layout_constraintTop_toBottomOf="@id/utxo_pub_key_textview"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"