From 9d678e3ea6a0dc923b1f853c80a8c47ebf84adcb Mon Sep 17 00:00:00 2001 From: pokkst Date: Tue, 5 Dec 2023 14:46:52 -0600 Subject: [PATCH] Onboarding UI changes --- .../onboarding/OnboardingFragment.java | 33 +-- .../main/res/drawable/button_bg_disabled.xml | 2 +- .../res/drawable/button_bg_disabled_left.xml | 4 +- .../res/drawable/button_bg_disabled_right.xml | 4 +- .../res/drawable/button_bg_disabled_small.xml | 9 + .../main/res/drawable/button_bg_enabled.xml | 2 +- .../res/drawable/button_bg_enabled_left.xml | 4 +- .../res/drawable/button_bg_enabled_right.xml | 4 +- .../res/drawable/button_bg_enabled_small.xml | 9 + app/src/main/res/drawable/button_bg_small.xml | 7 + app/src/main/res/drawable/card.xml | 5 + app/src/main/res/drawable/card_bg.xml | 11 + app/src/main/res/drawable/card_bg_no_top.xml | 10 + app/src/main/res/drawable/card_no_top.xml | 5 + .../main/res/layout/fragment_onboarding.xml | 208 +++++++++--------- app/src/main/res/layout/fragment_settings.xml | 8 +- app/src/main/res/values/strings.xml | 2 +- 17 files changed, 187 insertions(+), 140 deletions(-) create mode 100644 app/src/main/res/drawable/button_bg_disabled_small.xml create mode 100644 app/src/main/res/drawable/button_bg_enabled_small.xml create mode 100644 app/src/main/res/drawable/button_bg_small.xml create mode 100644 app/src/main/res/drawable/card.xml create mode 100644 app/src/main/res/drawable/card_bg.xml create mode 100644 app/src/main/res/drawable/card_bg_no_top.xml create mode 100644 app/src/main/res/drawable/card_no_top.xml diff --git a/app/src/main/java/net/mynero/wallet/fragment/onboarding/OnboardingFragment.java b/app/src/main/java/net/mynero/wallet/fragment/onboarding/OnboardingFragment.java index fe6d901..f1eb22e 100644 --- a/app/src/main/java/net/mynero/wallet/fragment/onboarding/OnboardingFragment.java +++ b/app/src/main/java/net/mynero/wallet/fragment/onboarding/OnboardingFragment.java @@ -13,7 +13,6 @@ import android.widget.CheckBox; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; -import android.widget.Toast; import androidx.activity.OnBackPressedCallback; import androidx.annotation.NonNull; @@ -24,22 +23,13 @@ import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; import androidx.lifecycle.ViewModelProvider; -import net.mynero.wallet.MainActivity; import net.mynero.wallet.MoneroApplication; import net.mynero.wallet.R; import net.mynero.wallet.data.Node; import net.mynero.wallet.fragment.dialog.AddNodeBottomSheetDialog; import net.mynero.wallet.fragment.dialog.NodeSelectionBottomSheetDialog; -import net.mynero.wallet.model.Wallet; -import net.mynero.wallet.model.WalletManager; import net.mynero.wallet.service.PrefService; import net.mynero.wallet.util.Constants; -import net.mynero.wallet.util.RestoreHeight; - -import org.json.JSONObject; - -import java.io.File; -import java.util.Calendar; public class OnboardingFragment extends Fragment implements NodeSelectionBottomSheetDialog.NodeSelectionDialogListener, AddNodeBottomSheetDialog.AddNodeListener { private boolean useOffset = true; @@ -87,15 +77,13 @@ public class OnboardingFragment extends Fragment implements NodeSelectionBottomS private Button createWalletButton; private TextView moreOptionsDropdownTextView; private SwitchCompat torSwitch; - private ConstraintLayout proxySettingsLayout; private ConstraintLayout advancedOptionsLayout; private ImageView moreOptionsChevronImageView; private CheckBox seedOffsetCheckbox; private Button selectNodeButton; private SwitchCompat showXmrchanSwitch; private ImageView xmrchanOnboardingImage; - private TextView seedTypeLabelTextView; - private TextView seedTypeTextView; + private Button seedTypeButton; private TextView seedTypeDescTextView; @Override @@ -117,16 +105,13 @@ public class OnboardingFragment extends Fragment implements NodeSelectionBottomS moreOptionsDropdownTextView = view.findViewById(R.id.advanced_settings_dropdown_textview); moreOptionsChevronImageView = view.findViewById(R.id.advanced_settings_chevron_imageview); torSwitch = view.findViewById(R.id.tor_onboarding_switch); - proxySettingsLayout = view.findViewById(R.id.wallet_proxy_settings_layout); seedOffsetCheckbox = view.findViewById(R.id.seed_offset_checkbox); walletProxyAddressEditText = view.findViewById(R.id.wallet_proxy_address_edittext); walletProxyPortEditText = view.findViewById(R.id.wallet_proxy_port_edittext); - seedOffsetCheckbox.setChecked(useOffset); advancedOptionsLayout = view.findViewById(R.id.more_options_layout); showXmrchanSwitch = view.findViewById(R.id.show_xmrchan_switch); xmrchanOnboardingImage = view.findViewById(R.id.xmrchan_onboarding_imageview); - seedTypeLabelTextView = view.findViewById(R.id.seed_type_label_textview); - seedTypeTextView = view.findViewById(R.id.seed_type_name_textview); + seedTypeButton = view.findViewById(R.id.seed_type_button); seedTypeDescTextView = view.findViewById(R.id.seed_type_desc_textview); bindListeners(); @@ -149,7 +134,7 @@ public class OnboardingFragment extends Fragment implements NodeSelectionBottomS }); mViewModel.seedType.observe(getViewLifecycleOwner(), seedType -> { - seedTypeTextView.setText(seedType.toString()); + seedTypeButton.setText(seedType.toString()); seedTypeDescTextView.setText(getText(seedType.getDescResId())); if(seedType == OnboardingViewModel.SeedType.LEGACY) { seedOffsetCheckbox.setVisibility(View.VISIBLE); @@ -164,6 +149,7 @@ public class OnboardingFragment extends Fragment implements NodeSelectionBottomS } private void bindListeners() { + seedOffsetCheckbox.setChecked(useOffset); // Disable onBack click OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(true) { @Override public void handleOnBackPressed() { } }; FragmentActivity activity = getActivity(); @@ -227,15 +213,12 @@ public class OnboardingFragment extends Fragment implements NodeSelectionBottomS } }); - seedTypeLabelTextView.setOnClickListener(v -> toggleSeedType()); - seedTypeTextView.setOnClickListener(v -> toggleSeedType()); - seedTypeDescTextView.setOnClickListener(v -> toggleSeedType()); + seedTypeButton.setOnClickListener(v -> toggleSeedType()); torSwitch.setOnCheckedChangeListener((compoundButton, b) -> { PrefService.getInstance().edit().putBoolean(Constants.PREF_USES_TOR, b).apply(); + removeProxyTextListeners(); if (b) { - removeProxyTextListeners(); - if (PrefService.getInstance().hasProxySet()) { String proxyAddress = PrefService.getInstance().getProxyAddress(); String proxyPort = PrefService.getInstance().getProxyPort(); @@ -244,10 +227,6 @@ public class OnboardingFragment extends Fragment implements NodeSelectionBottomS initProxyStuff("127.0.0.1", "9050"); } addProxyTextListeners(); - - proxySettingsLayout.setVisibility(View.VISIBLE); - } else { - proxySettingsLayout.setVisibility(View.GONE); } mViewModel.updateProxy(((MoneroApplication)getActivity().getApplication())); diff --git a/app/src/main/res/drawable/button_bg_disabled.xml b/app/src/main/res/drawable/button_bg_disabled.xml index 2cb456d..c3f6f13 100644 --- a/app/src/main/res/drawable/button_bg_disabled.xml +++ b/app/src/main/res/drawable/button_bg_disabled.xml @@ -5,5 +5,5 @@ android:left="8dp" android:right="8dp" /> - + diff --git a/app/src/main/res/drawable/button_bg_disabled_left.xml b/app/src/main/res/drawable/button_bg_disabled_left.xml index 9430bf2..ca8b60c 100644 --- a/app/src/main/res/drawable/button_bg_disabled_left.xml +++ b/app/src/main/res/drawable/button_bg_disabled_left.xml @@ -5,6 +5,6 @@ android:left="8dp" android:right="8dp" /> - + diff --git a/app/src/main/res/drawable/button_bg_disabled_right.xml b/app/src/main/res/drawable/button_bg_disabled_right.xml index e21d405..ff22811 100644 --- a/app/src/main/res/drawable/button_bg_disabled_right.xml +++ b/app/src/main/res/drawable/button_bg_disabled_right.xml @@ -5,6 +5,6 @@ android:left="8dp" android:right="8dp" /> - + diff --git a/app/src/main/res/drawable/button_bg_disabled_small.xml b/app/src/main/res/drawable/button_bg_disabled_small.xml new file mode 100644 index 0000000..71521d3 --- /dev/null +++ b/app/src/main/res/drawable/button_bg_disabled_small.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/app/src/main/res/drawable/button_bg_enabled.xml b/app/src/main/res/drawable/button_bg_enabled.xml index 89538d3..dce9809 100644 --- a/app/src/main/res/drawable/button_bg_enabled.xml +++ b/app/src/main/res/drawable/button_bg_enabled.xml @@ -5,5 +5,5 @@ android:left="8dp" android:right="8dp" /> - + diff --git a/app/src/main/res/drawable/button_bg_enabled_left.xml b/app/src/main/res/drawable/button_bg_enabled_left.xml index f58bdc7..e3cb9e9 100644 --- a/app/src/main/res/drawable/button_bg_enabled_left.xml +++ b/app/src/main/res/drawable/button_bg_enabled_left.xml @@ -5,6 +5,6 @@ android:left="8dp" android:right="8dp" /> - + diff --git a/app/src/main/res/drawable/button_bg_enabled_right.xml b/app/src/main/res/drawable/button_bg_enabled_right.xml index e0848b5..62f9073 100644 --- a/app/src/main/res/drawable/button_bg_enabled_right.xml +++ b/app/src/main/res/drawable/button_bg_enabled_right.xml @@ -5,6 +5,6 @@ android:left="8dp" android:right="8dp" /> - + diff --git a/app/src/main/res/drawable/button_bg_enabled_small.xml b/app/src/main/res/drawable/button_bg_enabled_small.xml new file mode 100644 index 0000000..80098da --- /dev/null +++ b/app/src/main/res/drawable/button_bg_enabled_small.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/app/src/main/res/drawable/button_bg_small.xml b/app/src/main/res/drawable/button_bg_small.xml new file mode 100644 index 0000000..948a2ad --- /dev/null +++ b/app/src/main/res/drawable/button_bg_small.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/card.xml b/app/src/main/res/drawable/card.xml new file mode 100644 index 0000000..5918507 --- /dev/null +++ b/app/src/main/res/drawable/card.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/card_bg.xml b/app/src/main/res/drawable/card_bg.xml new file mode 100644 index 0000000..783f1f6 --- /dev/null +++ b/app/src/main/res/drawable/card_bg.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/app/src/main/res/drawable/card_bg_no_top.xml b/app/src/main/res/drawable/card_bg_no_top.xml new file mode 100644 index 0000000..d2b2c79 --- /dev/null +++ b/app/src/main/res/drawable/card_bg_no_top.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/app/src/main/res/drawable/card_no_top.xml b/app/src/main/res/drawable/card_no_top.xml new file mode 100644 index 0000000..84389cd --- /dev/null +++ b/app/src/main/res/drawable/card_no_top.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_onboarding.xml b/app/src/main/res/layout/fragment_onboarding.xml index 47a5181..7007de0 100644 --- a/app/src/main/res/layout/fragment_onboarding.xml +++ b/app/src/main/res/layout/fragment_onboarding.xml @@ -95,7 +95,7 @@ @@ -124,7 +124,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" - android:layout_marginBottom="16dp" android:paddingStart="16dp" android:paddingEnd="16dp" tools:text="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" @@ -134,121 +133,127 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintBottom_toTopOf="@id/seed_type_label_textview" + app:layout_constraintBottom_toTopOf="@id/wallet_seed_layout" app:layout_constraintTop_toBottomOf="@id/show_xmrchan_switch" tools:ignore="SpeakableTextPresentCheck" /> - - - - - - - - - - - - - - + android:background="@drawable/card" + android:layout_marginTop="16dp" + app:layout_constraintTop_toBottomOf="@id/select_node_button" + app:layout_constraintBottom_toTopOf="@id/wallet_proxy_layout"> +