mirror of
https://codeberg.org/r4v3r23/mysu.git
synced 2024-11-29 17:13:15 +00:00
Update onboarding screen with styling
This commit is contained in:
parent
074b608b5d
commit
3c4b1de1df
5 changed files with 112 additions and 15 deletions
|
@ -8,6 +8,8 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
@ -15,6 +17,7 @@ import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.lifecycle.Observer;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.navigation.fragment.NavHostFragment;
|
import androidx.navigation.fragment.NavHostFragment;
|
||||||
|
|
||||||
|
@ -45,6 +48,11 @@ public class OnboardingFragment extends Fragment {
|
||||||
EditText walletSeedEditText = view.findViewById(R.id.wallet_seed_edittext);
|
EditText walletSeedEditText = view.findViewById(R.id.wallet_seed_edittext);
|
||||||
EditText walletRestoreHeightEditText = view.findViewById(R.id.wallet_restore_height_edittext);
|
EditText walletRestoreHeightEditText = view.findViewById(R.id.wallet_restore_height_edittext);
|
||||||
Button createWalletButton = view.findViewById(R.id.create_wallet_button);
|
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 -> {
|
createWalletButton.setOnClickListener(view1 -> {
|
||||||
String walletPassword = walletPasswordEditText.getText().toString();
|
String walletPassword = walletPasswordEditText.getText().toString();
|
||||||
if(!walletPassword.isEmpty()) {
|
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) {
|
private boolean checkMnemonic(String seed) {
|
||||||
|
|
|
@ -1,7 +1,16 @@
|
||||||
package com.m2049r.xmrwallet.fragment.onboarding;
|
package com.m2049r.xmrwallet.fragment.onboarding;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
import androidx.lifecycle.ViewModel;
|
import androidx.lifecycle.ViewModel;
|
||||||
|
|
||||||
public class OnboardingViewModel extends ViewModel {
|
public class OnboardingViewModel extends ViewModel {
|
||||||
|
private MutableLiveData<Boolean> _showMoreOptions = new MutableLiveData<>(false);
|
||||||
|
public LiveData<Boolean> showMoreOptions = _showMoreOptions;
|
||||||
|
|
||||||
|
public void onMoreOptionsClicked() {
|
||||||
|
boolean currentValue = showMoreOptions.getValue() != null ? showMoreOptions.getValue() : false;
|
||||||
|
boolean newValue = !currentValue;
|
||||||
|
_showMoreOptions.setValue(newValue);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -4,8 +4,22 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".fragment.settings.SettingsFragment">
|
tools:context=".fragment.settings.SettingsFragment"
|
||||||
|
android:padding="16dp">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/create_wallet_textview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/create_wallet"
|
||||||
|
android:layout_marginStart="24dp"
|
||||||
|
android:layout_marginEnd="24dp"
|
||||||
|
android:layout_marginBottom="32dp"
|
||||||
|
android:textSize="24sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/wallet_password_edittext"/>
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/wallet_password_edittext"
|
android:id="@+id/wallet_password_edittext"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -14,13 +28,35 @@
|
||||||
android:layout_marginEnd="12dp"
|
android:layout_marginEnd="12dp"
|
||||||
android:layout_marginBottom="32dp"
|
android:layout_marginBottom="32dp"
|
||||||
android:background="@drawable/edittext_bg"
|
android:background="@drawable/edittext_bg"
|
||||||
android:hint="Password (optional)"
|
android:hint="@string/password_optional"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toBottomOf="@id/create_wallet_textview"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintBottom_toTopOf="@id/wallet_seed_edittext"
|
app:layout_constraintBottom_toTopOf="@id/advanced_settings_dropdown_textview"
|
||||||
tools:visibility="visible"/>
|
tools:visibility="visible"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/advanced_settings_dropdown_textview"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/more_options"
|
||||||
|
android:layout_marginStart="24dp"
|
||||||
|
android:layout_marginEnd="24dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/wallet_password_edittext"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/wallet_seed_edittext"/>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/advanced_settings_chevron_imageview"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/ic_keyboard_arrow_down"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/advanced_settings_dropdown_textview"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/advanced_settings_dropdown_textview"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/advanced_settings_dropdown_textview"/>
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/wallet_seed_edittext"
|
android:id="@+id/wallet_seed_edittext"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -29,7 +65,9 @@
|
||||||
android:layout_marginEnd="12dp"
|
android:layout_marginEnd="12dp"
|
||||||
android:layout_marginBottom="32dp"
|
android:layout_marginBottom="32dp"
|
||||||
android:background="@drawable/edittext_bg"
|
android:background="@drawable/edittext_bg"
|
||||||
android:hint="Recovery phrase (optional)"
|
android:hint="@string/recovery_phrase_optional"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/advanced_settings_dropdown_textview"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintBottom_toTopOf="@id/wallet_restore_height_edittext"
|
app:layout_constraintBottom_toTopOf="@id/wallet_restore_height_edittext"
|
||||||
|
@ -40,9 +78,11 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="24dp"
|
android:layout_marginStart="24dp"
|
||||||
android:layout_marginEnd="12dp"
|
android:layout_marginEnd="12dp"
|
||||||
android:hint="Restore height (optional)"
|
android:hint="@string/restore_height_optional"
|
||||||
android:background="@drawable/edittext_bg"
|
android:background="@drawable/edittext_bg"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/wallet_seed_edittext"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintBottom_toTopOf="@id/create_wallet_button"
|
app:layout_constraintBottom_toTopOf="@id/create_wallet_button"
|
||||||
|
@ -56,6 +96,7 @@
|
||||||
android:layout_marginTop="32dp"
|
android:layout_marginTop="32dp"
|
||||||
android:background="@drawable/button_bg"
|
android:background="@drawable/button_bg"
|
||||||
android:text="@string/create_wallet"
|
android:text="@string/create_wallet"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/wallet_restore_height_edittext"
|
app:layout_constraintTop_toBottomOf="@id/wallet_restore_height_edittext"
|
||||||
app:layout_constraintStart_toStartOf="parent"/>
|
app:layout_constraintStart_toStartOf="parent"/>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -12,28 +12,47 @@
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
<TextView
|
||||||
<EditText
|
android:id="@+id/enter_password_textview"
|
||||||
android:id="@+id/wallet_password_edittext"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/enter_password"
|
||||||
android:layout_marginStart="24dp"
|
android:layout_marginStart="24dp"
|
||||||
android:layout_marginEnd="24dp"
|
android:layout_marginEnd="24dp"
|
||||||
android:layout_marginBottom="32dp"
|
android:layout_marginBottom="32dp"
|
||||||
android:hint="Password"
|
android:textSize="24sp"
|
||||||
android:inputType="textPassword"
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/wallet_password_edittext"/>
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/wallet_password_edittext"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="24dp"
|
||||||
|
android:layout_marginBottom="32dp"
|
||||||
|
android:hint="@string/password"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:background="@drawable/edittext_bg"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/paste_password_imagebutton"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/enter_password_textview"
|
||||||
app:layout_constraintBottom_toTopOf="@id/unlock_wallet_button"/>
|
app:layout_constraintBottom_toTopOf="@id/unlock_wallet_button"/>
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/paste_password_imagebutton"
|
android:id="@+id/paste_password_imagebutton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:padding="8dp"
|
|
||||||
android:src="@drawable/ic_content_paste_24dp"
|
android:src="@drawable/ic_content_paste_24dp"
|
||||||
|
android:layout_marginEnd="24dp"
|
||||||
|
android:minWidth="48dp"
|
||||||
|
android:minHeight="48dp"
|
||||||
|
android:padding="8dp"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/wallet_password_edittext"
|
||||||
app:layout_constraintTop_toTopOf="@id/wallet_password_edittext"
|
app:layout_constraintTop_toTopOf="@id/wallet_password_edittext"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/wallet_password_edittext"
|
app:layout_constraintBottom_toBottomOf="@id/wallet_password_edittext"
|
||||||
app:layout_constraintEnd_toEndOf="@id/wallet_password_edittext"/>
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/unlock_wallet_button"
|
android:id="@+id/unlock_wallet_button"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -41,7 +60,8 @@
|
||||||
android:layout_marginStart="24dp"
|
android:layout_marginStart="24dp"
|
||||||
android:layout_marginEnd="24dp"
|
android:layout_marginEnd="24dp"
|
||||||
android:layout_marginTop="32dp"
|
android:layout_marginTop="32dp"
|
||||||
android:text="Unlock"
|
android:background="@drawable/button_bg"
|
||||||
|
android:text="@string/unlock"
|
||||||
app:layout_constraintTop_toBottomOf="@id/wallet_password_edittext"
|
app:layout_constraintTop_toBottomOf="@id/wallet_password_edittext"
|
||||||
app:layout_constraintStart_toStartOf="parent"/>
|
app:layout_constraintStart_toStartOf="parent"/>
|
||||||
|
|
||||||
|
|
|
@ -555,4 +555,11 @@
|
||||||
<string name="send">Send</string>
|
<string name="send">Send</string>
|
||||||
<string name="send_monero">Send Monero</string>
|
<string name="send_monero">Send Monero</string>
|
||||||
<string name="recv_monero">Receive Monero</string>
|
<string name="recv_monero">Receive Monero</string>
|
||||||
|
<string name="more_options">More options</string>
|
||||||
|
<string name="recovery_phrase_optional">Recovery phrase (optional)</string>
|
||||||
|
<string name="restore_height_optional">Restore height (optional)</string>
|
||||||
|
<string name="password_optional">Password (optional)</string>
|
||||||
|
<string name="password">Password</string>
|
||||||
|
<string name="unlock">Unlock</string>
|
||||||
|
<string name="enter_password">Enter password</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue