Add more information to utxo cell

This commit is contained in:
pokkst 2022-09-24 14:10:36 -05:00
parent d4a7ce92a1
commit f02d56ef1c
No known key found for this signature in database
GPG key ID: 90C2ED85E67A50FF
5 changed files with 43 additions and 4 deletions

View file

@ -1124,7 +1124,7 @@ 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;Ljava/lang/String;Z)V");
"(JZLjava/lang/String;JLjava/lang/String;Ljava/lang/String;ZJ)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());
@ -1135,7 +1135,8 @@ jobject newCoinsInfo(JNIEnv *env, Monero::CoinsInfo *info) {
static_cast<jlong> (info->amount()),
_hash,
_pub_key,
info->unlocked());
info->unlocked(),
static_cast<jlong> (info->internalOutputIndex()));
env->DeleteLocalRef(_key_image);
env->DeleteLocalRef(_hash);
env->DeleteLocalRef(_pub_key);

View file

@ -100,8 +100,14 @@ public class CoinsInfoAdapter extends RecyclerView.Adapter<CoinsInfoAdapter.View
boolean selected = selectedUtxos.contains(coinsInfo.getKeyImage());
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()));
TextView globalIdxTextView = itemView.findViewById(R.id.utxo_global_index_textview);
TextView outpointTextView = itemView.findViewById(R.id.utxo_outpoint_textview);
amountTextView.setText(itemView.getResources().getString(R.string.tx_amount_no_prefix, Wallet.getDisplayAmount(coinsInfo.getAmount())));
pubKeyTextView.setText(coinsInfo.getPubKey());
globalIdxTextView.setText(itemView.getResources().getString(R.string.global_index_text, coinsInfo.getGlobalOutputIndex()));
outpointTextView.setText(itemView.getResources().getString(R.string.outpoint_text, coinsInfo.getHash()+":"+coinsInfo.getLocalOutputIndex()));
itemView.setOnLongClickListener(view -> {
boolean unlocked = coinsInfo.isUnlocked();
if(unlocked) {

View file

@ -36,8 +36,9 @@ public class CoinsInfo implements Parcelable, Comparable<CoinsInfo> {
String hash;
String pubKey;
boolean unlocked;
long localOutputIndex;
public CoinsInfo(long globalOutputIndex, boolean spent, String keyImage, long amount, String hash, String pubKey, boolean unlocked) {
public CoinsInfo(long globalOutputIndex, boolean spent, String keyImage, long amount, String hash, String pubKey, boolean unlocked, long localOutputIndex) {
this.globalOutputIndex = globalOutputIndex;
this.spent = spent;
this.keyImage = keyImage;
@ -45,6 +46,7 @@ public class CoinsInfo implements Parcelable, Comparable<CoinsInfo> {
this.hash = hash;
this.pubKey = pubKey;
this.unlocked = unlocked;
this.localOutputIndex = localOutputIndex;
}
protected CoinsInfo(Parcel in) {
@ -91,6 +93,10 @@ public class CoinsInfo implements Parcelable, Comparable<CoinsInfo> {
return unlocked;
}
public long getLocalOutputIndex() {
return localOutputIndex;
}
@Override
public int describeContents() {
return 0;

View file

@ -22,8 +22,32 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Amount"
android:textStyle="bold"
android:ellipsize="middle"
app:layout_constraintTop_toBottomOf="@id/utxo_pub_key_textview"
app:layout_constraintBottom_toTopOf="@id/utxo_outpoint_textview"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/utxo_global_index_textview"
android:singleLine="true" />
<TextView
android:id="@+id/utxo_global_index_textview"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Global Idx"
android:ellipsize="middle"
android:gravity="end"
app:layout_constraintTop_toBottomOf="@id/utxo_pub_key_textview"
app:layout_constraintBottom_toTopOf="@id/utxo_outpoint_textview"
app:layout_constraintStart_toEndOf="@id/utxo_amount_textview"
app:layout_constraintEnd_toEndOf="parent"
android:singleLine="true" />
<TextView
android:id="@+id/utxo_outpoint_textview"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Outpoint"
android:ellipsize="middle"
app:layout_constraintTop_toBottomOf="@id/utxo_amount_textview"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"

View file

@ -94,4 +94,6 @@
<string name="high">High</string>
<string name="view_utxos">View UTXOs</string>
<string name="selected_utxos_value">Selected value: %1$s XMR</string>
<string name="global_index_text">Global Idx: %1$d</string>
<string name="outpoint_text">Outpoint: %1$s</string>
</resources>