Fix settings screen issue

This commit is contained in:
pokkst 2022-09-07 23:08:50 -05:00
parent 528bc7c7c5
commit 8d4cf11779
No known key found for this signature in database
GPG key ID: 90C2ED85E67A50FF
3 changed files with 56 additions and 41 deletions

View file

@ -54,17 +54,13 @@ public class HomeFragment extends Fragment implements TransactionInfoAdapter.TxI
super.onViewCreated(view, savedInstanceState);
MainActivity mainActivity = (MainActivity)getActivity();
mViewModel = new ViewModelProvider(this).get(HomeViewModel.class);
bindObservers(view);
bindListeners(view);
boolean usesPassword = PrefService.getInstance().getBoolean(Constants.PREF_USES_PASSWORD, false);
if(!usesPassword) {
mainActivity.restartEvents.observe(getViewLifecycleOwner(), o -> {
bindObservers(view);
bindListeners(view);
} else {
mainActivity.restartEvents.observe(getViewLifecycleOwner(), o -> {
bindObservers(view);
bindListeners(view);
});
}
});
}
private void bindListeners(View view) {

View file

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragment.settings.SettingsFragment">
<EditText
android:id="@+id/wallet_password_edittext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="32dp"
android:hint="Password (optional)"
android:inputType="textPassword"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/wallet_seed_edittext"
tools:visibility="visible"/>
<EditText
android:id="@+id/wallet_seed_edittext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="12dp"
android:hint="Recovery phrase (optional)"
android:inputType="textPassword"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/create_wallet_button"
tools:visibility="visible"/>
<Button
android:id="@+id/create_wallet_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:layout_marginTop="32dp"
android:text="@string/create_wallet"
app:layout_constraintTop_toBottomOf="@id/wallet_seed_edittext"
app:layout_constraintStart_toStartOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -6,40 +6,14 @@
android:layout_height="match_parent"
tools:context=".fragment.settings.SettingsFragment">
<EditText
android:id="@+id/wallet_password_edittext"
android:layout_width="0dp"
<ImageView
android:id="@+id/monero_logo_imageview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="32dp"
android:hint="Password (optional)"
android:inputType="textPassword"
android:src="@drawable/ic_monero_qr"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/wallet_seed_edittext"
tools:visibility="visible"/>
<EditText
android:id="@+id/wallet_seed_edittext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="12dp"
android:hint="Recovery phrase (optional)"
android:inputType="textPassword"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/create_wallet_button"
tools:visibility="visible"/>
<Button
android:id="@+id/create_wallet_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:layout_marginTop="32dp"
android:text="@string/create_wallet"
app:layout_constraintTop_toBottomOf="@id/wallet_seed_edittext"
app:layout_constraintStart_toStartOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>