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