From 3c4b1de1df9e997fd8c91d03f87349bd445c27a2 Mon Sep 17 00:00:00 2001 From: pokkst Date: Mon, 12 Sep 2022 10:03:19 -0500 Subject: [PATCH] Update onboarding screen with styling --- .../onboarding/OnboardingFragment.java | 20 +++++++ .../onboarding/OnboardingViewModel.java | 9 +++ .../main/res/layout/fragment_onboarding.xml | 55 ++++++++++++++++--- .../layout/password_bottom_sheet_dialog.xml | 36 +++++++++--- app/src/main/res/values/strings.xml | 7 +++ 5 files changed, 112 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/m2049r/xmrwallet/fragment/onboarding/OnboardingFragment.java b/app/src/main/java/com/m2049r/xmrwallet/fragment/onboarding/OnboardingFragment.java index d965e7d..98f8f82 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/fragment/onboarding/OnboardingFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/fragment/onboarding/OnboardingFragment.java @@ -8,6 +8,8 @@ import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; +import android.widget.ImageView; +import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; @@ -15,6 +17,7 @@ import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; +import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProvider; import androidx.navigation.fragment.NavHostFragment; @@ -45,6 +48,11 @@ public class OnboardingFragment extends Fragment { EditText walletSeedEditText = view.findViewById(R.id.wallet_seed_edittext); EditText walletRestoreHeightEditText = view.findViewById(R.id.wallet_restore_height_edittext); Button createWalletButton = view.findViewById(R.id.create_wallet_button); + TextView moreOptionsDropdownTextView = view.findViewById(R.id.advanced_settings_dropdown_textview); + ImageView moreOptionsChevronImageView = view.findViewById(R.id.advanced_settings_chevron_imageview); + + moreOptionsDropdownTextView.setOnClickListener(view12 -> mViewModel.onMoreOptionsClicked()); + createWalletButton.setOnClickListener(view1 -> { String walletPassword = walletPasswordEditText.getText().toString(); if(!walletPassword.isEmpty()) { @@ -91,6 +99,18 @@ public class OnboardingFragment extends Fragment { } } }); + + mViewModel.showMoreOptions.observe(getViewLifecycleOwner(), show -> { + if(show) { + moreOptionsChevronImageView.setImageResource(R.drawable.ic_keyboard_arrow_up); + walletSeedEditText.setVisibility(View.VISIBLE); + walletRestoreHeightEditText.setVisibility(View.VISIBLE); + } else { + moreOptionsChevronImageView.setImageResource(R.drawable.ic_keyboard_arrow_down); + walletSeedEditText.setVisibility(View.GONE); + walletRestoreHeightEditText.setVisibility(View.GONE); + } + }); } private boolean checkMnemonic(String seed) { diff --git a/app/src/main/java/com/m2049r/xmrwallet/fragment/onboarding/OnboardingViewModel.java b/app/src/main/java/com/m2049r/xmrwallet/fragment/onboarding/OnboardingViewModel.java index 34a9260..cd43b3b 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/fragment/onboarding/OnboardingViewModel.java +++ b/app/src/main/java/com/m2049r/xmrwallet/fragment/onboarding/OnboardingViewModel.java @@ -1,7 +1,16 @@ package com.m2049r.xmrwallet.fragment.onboarding; +import androidx.lifecycle.LiveData; +import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModel; public class OnboardingViewModel extends ViewModel { + private MutableLiveData _showMoreOptions = new MutableLiveData<>(false); + public LiveData showMoreOptions = _showMoreOptions; + public void onMoreOptionsClicked() { + boolean currentValue = showMoreOptions.getValue() != null ? showMoreOptions.getValue() : false; + boolean newValue = !currentValue; + _showMoreOptions.setValue(newValue); + } } \ 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 b308e7a..031d848 100644 --- a/app/src/main/res/layout/fragment_onboarding.xml +++ b/app/src/main/res/layout/fragment_onboarding.xml @@ -4,8 +4,22 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".fragment.settings.SettingsFragment"> - + tools:context=".fragment.settings.SettingsFragment" + android:padding="16dp"> + + + \ No newline at end of file diff --git a/app/src/main/res/layout/password_bottom_sheet_dialog.xml b/app/src/main/res/layout/password_bottom_sheet_dialog.xml index ed97097..82f5ab8 100644 --- a/app/src/main/res/layout/password_bottom_sheet_dialog.xml +++ b/app/src/main/res/layout/password_bottom_sheet_dialog.xml @@ -12,28 +12,47 @@ - - + + app:layout_constraintEnd_toEndOf="parent"/>