mirror of
https://codeberg.org/r4v3r23/mysu.git
synced 2024-11-09 20:53:47 +01:00
Prevent locked UTXOs from being selected
This commit is contained in:
parent
9187b9d8a4
commit
9b4cd9860a
@ -1083,7 +1083,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;)V");
|
||||
"(JZLjava/lang/String;JLjava/lang/String;Ljava/lang/String;Z)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());
|
||||
@ -1093,7 +1093,8 @@ jobject newCoinsInfo(JNIEnv *env, Monero::CoinsInfo *info) {
|
||||
_key_image,
|
||||
static_cast<jlong> (info->amount()),
|
||||
_hash,
|
||||
_pub_key);
|
||||
_pub_key,
|
||||
info->unlocked());
|
||||
env->DeleteLocalRef(_key_image);
|
||||
env->DeleteLocalRef(_hash);
|
||||
env->DeleteLocalRef(_pub_key);
|
||||
|
@ -103,11 +103,16 @@ public class CoinsInfoAdapter extends RecyclerView.Adapter<CoinsInfoAdapter.View
|
||||
amountTextView.setText(Wallet.getDisplayAmount(coinsInfo.getAmount()));
|
||||
pubKeyTextView.setText(coinsInfo.getPubKey());
|
||||
itemView.setOnLongClickListener(view -> {
|
||||
boolean unlocked = coinsInfo.isUnlocked();
|
||||
if(unlocked) {
|
||||
listener.onUtxoSelected(coinsInfo);
|
||||
return true;
|
||||
}
|
||||
return unlocked;
|
||||
});
|
||||
|
||||
if(selected) {
|
||||
if(!coinsInfo.isUnlocked()) {
|
||||
itemView.setBackgroundColor(ContextCompat.getColor(itemView.getContext(), R.color.oled_locked_utxo));
|
||||
} else if(selected) {
|
||||
itemView.setBackgroundColor(ContextCompat.getColor(itemView.getContext(), R.color.oled_negativeColor));
|
||||
} else {
|
||||
itemView.setBackgroundColor(ContextCompat.getColor(itemView.getContext(), android.R.color.transparent));
|
||||
|
@ -35,14 +35,16 @@ public class CoinsInfo implements Parcelable, Comparable<CoinsInfo> {
|
||||
long amount;
|
||||
String hash;
|
||||
String pubKey;
|
||||
boolean unlocked;
|
||||
|
||||
public CoinsInfo(long globalOutputIndex, boolean spent, String keyImage, long amount, String hash, String pubKey) {
|
||||
public CoinsInfo(long globalOutputIndex, boolean spent, String keyImage, long amount, String hash, String pubKey, boolean unlocked) {
|
||||
this.globalOutputIndex = globalOutputIndex;
|
||||
this.spent = spent;
|
||||
this.keyImage = keyImage;
|
||||
this.amount = amount;
|
||||
this.hash = hash;
|
||||
this.pubKey = pubKey;
|
||||
this.unlocked = unlocked;
|
||||
}
|
||||
|
||||
protected CoinsInfo(Parcel in) {
|
||||
@ -85,6 +87,10 @@ public class CoinsInfo implements Parcelable, Comparable<CoinsInfo> {
|
||||
return pubKey;
|
||||
}
|
||||
|
||||
public boolean isUnlocked() {
|
||||
return unlocked;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
|
@ -29,6 +29,7 @@
|
||||
<color name="oled_colorError">@color/oled_favouriteColor</color>
|
||||
<color name="oled_colorOnError">#ffffff</color>
|
||||
<color name="edittext_bg_color">#202020</color>
|
||||
<color name="oled_locked_utxo">#956E43</color>
|
||||
|
||||
<!-- CLASSIC -->
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
<color name="oled_colorOnError">@color/oled_colorBackground</color>
|
||||
<color name="edittext_bg_color">#CCCCCC</color>
|
||||
<color name="button_disabled_bg_color">#454545</color>
|
||||
<color name="oled_locked_utxo">#B5895A</color>
|
||||
|
||||
<!-- CLASSIC -->
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user