From 2e5177c20d83c772d5d30def481de7daf145819b Mon Sep 17 00:00:00 2001 From: pokkst Date: Sun, 9 Jul 2023 22:43:51 -0500 Subject: [PATCH] UI fixes (0.4.4.1) --- app/build.gradle | 4 +- .../wallet/adapter/CoinsInfoAdapter.java | 24 +++- .../wallet/fragment/utxos/UtxosFragment.java | 13 +- .../main/res/layout/utxo_selection_item.xml | 121 +++++++++++++----- app/src/main/res/values/strings.xml | 4 +- 5 files changed, 120 insertions(+), 46 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 5a77de5..3fcb1b0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "net.mynero.wallet" minSdkVersion 21 targetSdkVersion 34 - versionCode 40400 - versionName "0.4.4 'Fluorine Fermi'" + versionCode 40401 + versionName "0.4.4.1 'Fluorine Fermi'" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" externalNativeBuild { cmake { 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 cd6546d..a1a14b2 100644 --- a/app/src/main/java/net/mynero/wallet/adapter/CoinsInfoAdapter.java +++ b/app/src/main/java/net/mynero/wallet/adapter/CoinsInfoAdapter.java @@ -100,6 +100,7 @@ public class CoinsInfoAdapter extends RecyclerView.Adapter selectedUtxos) { + boolean alreadyEditing = selectedUtxos.size() > 0; boolean selected = false; for(CoinsInfo selectedUtxo : selectedUtxos) { if (Objects.equals(selectedUtxo.getKeyImage(), coinsInfo.getKeyImage())) { @@ -118,13 +119,22 @@ public class CoinsInfoAdapter extends RecyclerView.Adapter { - boolean unlocked = coinsInfo.isUnlocked(); - if (unlocked) { - listener.onUtxoSelected(coinsInfo); - } - return unlocked; - }); + if(alreadyEditing) { + itemView.setOnClickListener(view -> { + boolean unlocked = coinsInfo.isUnlocked(); + if (unlocked) { + listener.onUtxoSelected(coinsInfo); + } + }); + } else { + itemView.setOnLongClickListener(view -> { + boolean unlocked = coinsInfo.isUnlocked(); + if (unlocked) { + listener.onUtxoSelected(coinsInfo); + } + return unlocked; + }); + } if (selected) { itemView.setBackgroundColor(ContextCompat.getColor(itemView.getContext(), R.color.oled_colorSecondary)); diff --git a/app/src/main/java/net/mynero/wallet/fragment/utxos/UtxosFragment.java b/app/src/main/java/net/mynero/wallet/fragment/utxos/UtxosFragment.java index 0acdb51..d356c42 100644 --- a/app/src/main/java/net/mynero/wallet/fragment/utxos/UtxosFragment.java +++ b/app/src/main/java/net/mynero/wallet/fragment/utxos/UtxosFragment.java @@ -40,7 +40,6 @@ public class UtxosFragment extends Fragment implements CoinsInfoAdapter.CoinsInf UNFREEZE, TOGGLE_FREEZE } - private FreezeActionType freezeActionType = FreezeActionType.FREEZE; @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @@ -147,10 +146,14 @@ public class UtxosFragment extends Fragment implements CoinsInfoAdapter.CoinsInf sendUtxosButton.setVisibility(View.GONE); churnUtxosButton.setVisibility(View.GONE); freezeUtxosButton.setVisibility(View.GONE); - freezeActionType = FreezeActionType.FREEZE; } else { - sendUtxosButton.setVisibility(View.VISIBLE); - churnUtxosButton.setVisibility(View.VISIBLE); + if(frozenExists) { + sendUtxosButton.setVisibility(View.GONE); + churnUtxosButton.setVisibility(View.GONE); + } else { + sendUtxosButton.setVisibility(View.VISIBLE); + churnUtxosButton.setVisibility(View.VISIBLE); + } freezeUtxosButton.setVisibility(View.VISIBLE); } @@ -167,7 +170,9 @@ public class UtxosFragment extends Fragment implements CoinsInfoAdapter.CoinsInf @Override public void onSentTransaction() { + selectedUtxos.clear(); churnUtxosButton.setVisibility(View.GONE); sendUtxosButton.setVisibility(View.GONE); + freezeUtxosButton.setVisibility(View.GONE); } } \ No newline at end of file diff --git a/app/src/main/res/layout/utxo_selection_item.xml b/app/src/main/res/layout/utxo_selection_item.xml index 089f271..96de12f 100644 --- a/app/src/main/res/layout/utxo_selection_item.xml +++ b/app/src/main/res/layout/utxo_selection_item.xml @@ -7,49 +7,108 @@ android:padding="8dp" android:layout_marginBottom="8dp"> - - + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b526700..e0d7f08 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -97,8 +97,8 @@ View UTXOs Selected value: %1$s XMR Selected value: %1$s XMR\n\nThe anonymity benefits of churning are still being researched. Only proceed if you know what you are doing. - Global Idx: %1$d - Outpoint: %1$s + %1$d + %1$s Create wallet failed: %1$s Churn Freeze