Onboarding UI changes

This commit is contained in:
pokkst 2023-12-05 14:46:52 -06:00
parent 5893c52c27
commit 9d678e3ea6
No known key found for this signature in database
GPG key ID: EC4FAAA66859FAA4
17 changed files with 187 additions and 140 deletions

View file

@ -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()));

View file

@ -5,5 +5,5 @@
android:left="8dp"
android:right="8dp" />
<solid android:color="@color/button_disabled_bg_color" />
<corners android:radius="64dp" />
<corners android:radius="16dp" />
</shape>

View file

@ -5,6 +5,6 @@
android:left="8dp"
android:right="8dp" />
<solid android:color="@color/button_disabled_bg_color" />
<corners android:topLeftRadius="64dp"
android:bottomLeftRadius="64dp"/>
<corners android:topLeftRadius="16dp"
android:bottomLeftRadius="16dp"/>
</shape>

View file

@ -5,6 +5,6 @@
android:left="8dp"
android:right="8dp" />
<solid android:color="@color/button_disabled_bg_color" />
<corners android:topRightRadius="64dp"
android:bottomRightRadius="64dp"/>
<corners android:topRightRadius="16dp"
android:bottomRightRadius="16dp"/>
</shape>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<padding
android:left="8dp"
android:right="8dp" />
<solid android:color="@color/button_disabled_bg_color" />
<corners android:radius="10dp" />
</shape>

View file

@ -5,5 +5,5 @@
android:left="8dp"
android:right="8dp" />
<solid android:color="@color/oled_colorSecondary" />
<corners android:radius="64dp" />
<corners android:radius="16dp" />
</shape>

View file

@ -5,6 +5,6 @@
android:left="8dp"
android:right="8dp" />
<solid android:color="@color/oled_colorSecondary" />
<corners android:topLeftRadius="64dp"
android:bottomLeftRadius="64dp"/>
<corners android:topLeftRadius="48dp"
android:bottomLeftRadius="48dp"/>
</shape>

View file

@ -5,6 +5,6 @@
android:left="8dp"
android:right="8dp" />
<solid android:color="@color/oled_colorSecondary" />
<corners android:topRightRadius="64dp"
android:bottomRightRadius="64dp"/>
<corners android:topRightRadius="16dp"
android:bottomRightRadius="16dp"/>
</shape>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<padding
android:left="8dp"
android:right="8dp" />
<solid android:color="@color/oled_colorSecondary" />
<corners android:radius="10dp" />
</shape>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Color when the row is selected -->
<item android:drawable="@drawable/button_bg_enabled_small" android:state_enabled="true" />
<!-- Standard background color -->
<item android:drawable="@drawable/button_bg_disabled_small" />
</selector>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Standard background color -->
<item android:drawable="@drawable/card_bg" />
</selector>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<padding
android:left="12dp"
android:right="12dp"
android:bottom="12dp"
android:top="12dp"/>
<solid android:color="@color/oled_dialogBackgroundColor" />
<corners android:radius="16dp" />
</shape>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<padding
android:left="12dp"
android:right="12dp"
android:bottom="12dp"/>
<solid android:color="@color/oled_dialogBackgroundColor" />
<corners android:radius="16dp" />
</shape>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Standard background color -->
<item android:drawable="@drawable/card_bg_no_top" />
</selector>

View file

@ -95,7 +95,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/more_options_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/advanced_settings_dropdown_textview">
@ -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" />
<TextView
android:id="@+id/seed_type_label_textview"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Seed version"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/seed_type_name_textview"
app:layout_constraintTop_toBottomOf="@id/select_node_button"
app:layout_constraintBottom_toTopOf="@id/seed_type_name_textview"/>
<TextView
android:id="@+id/seed_type_name_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="POLYSEED"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/seed_type_label_textview"
app:layout_constraintBottom_toBottomOf="@id/seed_type_label_textview"/>
<TextView
android:id="@+id/seed_type_desc_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/oled_addressListColor"
android:paddingBottom="16dp"
android:paddingTop="8dp"
android:text="16 words instead of 25; just as secure."
app:layout_constraintTop_toBottomOf="@id/seed_type_label_textview"
app:layout_constraintBottom_toTopOf="@id/wallet_seed_edittext"/>
<EditText
android:id="@+id/wallet_seed_edittext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:background="@drawable/edittext_bg"
android:hint="@string/recovery_phrase_optional"
android:minHeight="48dp"
app:layout_constraintBottom_toTopOf="@id/wallet_restore_height_edittext"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/seed_type_desc_textview" />
<EditText
android:id="@+id/wallet_restore_height_edittext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/edittext_bg"
android:hint="@string/restore_height_optional"
android:inputType="number"
android:minHeight="48dp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/seed_offset_checkbox"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/wallet_seed_edittext" />
<CheckBox
android:id="@+id/seed_offset_checkbox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="48dp"
android:text="@string/use_password_as_seed_offset"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toTopOf="@id/tor_onboarding_switch"
app:layout_constraintTop_toBottomOf="@id/wallet_restore_height_edittext"/>
<TextView
android:id="@+id/tor_onboarding_switch_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/tor_switch_label"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@id/tor_onboarding_switch"
app:layout_constraintEnd_toStartOf="@id/tor_onboarding_switch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/tor_onboarding_switch" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/tor_onboarding_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="48dp"
android:minWidth="48dp"
android:layout_marginTop="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/seed_offset_checkbox" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/wallet_proxy_settings_layout"
android:id="@+id/wallet_seed_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@id/tor_onboarding_switch"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:visibility="visible">
android:background="@drawable/card"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@id/select_node_button"
app:layout_constraintBottom_toTopOf="@id/wallet_proxy_layout">
<Button
android:id="@+id/seed_type_button"
android:layout_width="wrap_content"
android:layout_height="32dp"
android:text="POLYSEED"
android:textSize="12sp"
android:background="@drawable/button_bg_small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/seed_type_desc_textview"/>
<TextView
android:id="@+id/seed_type_label_textview"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Seed version"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/seed_type_button"
app:layout_constraintTop_toTopOf="@id/seed_type_button"
app:layout_constraintBottom_toBottomOf="@id/seed_type_button"/>
<TextView
android:id="@+id/seed_type_desc_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/oled_addressListColor"
android:paddingBottom="16dp"
android:paddingTop="8dp"
android:text="16 words instead of 25; just as secure."
app:layout_constraintTop_toBottomOf="@id/seed_type_button"
app:layout_constraintBottom_toTopOf="@id/wallet_seed_edittext"/>
<EditText
android:id="@+id/wallet_seed_edittext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/edittext_bg"
android:hint="@string/recovery_phrase_optional"
android:minHeight="48dp"
app:layout_constraintBottom_toTopOf="@id/wallet_restore_height_edittext"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/seed_type_desc_textview" />
<EditText
android:id="@+id/wallet_restore_height_edittext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/edittext_bg"
android:hint="@string/restore_height_optional"
android:inputType="number"
android:minHeight="48dp"
android:visibility="gone"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toTopOf="@id/seed_offset_checkbox"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/wallet_seed_edittext" />
<CheckBox
android:id="@+id/seed_offset_checkbox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="48dp"
android:text="@string/use_password_as_seed_offset"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/wallet_restore_height_edittext"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/wallet_proxy_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="@drawable/card_no_top"
app:layout_constraintTop_toBottomOf="@id/wallet_seed_layout">
<TextView
android:id="@+id/tor_onboarding_switch_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/tor_switch_label"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/tor_onboarding_switch"
app:layout_constraintEnd_toStartOf="@id/tor_onboarding_switch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/tor_onboarding_switch" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/tor_onboarding_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="48dp"
android:minWidth="48dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/wallet_proxy_address_edittext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:background="@drawable/edittext_bg"
android:hint="@string/wallet_proxy_address_hint"
android:minHeight="48dp"
app:layout_constraintBottom_toTopOf="@id/wallet_proxy_port_edittext"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toBottomOf="@id/tor_onboarding_switch" />
<EditText
android:id="@+id/wallet_proxy_port_edittext"
@ -256,6 +261,7 @@
android:layout_height="wrap_content"
android:background="@drawable/edittext_bg"
android:hint="@string/wallet_proxy_port_hint"
android:layout_marginTop="8dp"
android:inputType="number"
android:minHeight="48dp"
app:layout_constraintBottom_toBottomOf="parent"

View file

@ -121,6 +121,7 @@
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:minHeight="48dp"
android:minWidth="48dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/transaction_settings_textview" />
@ -156,6 +157,7 @@
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:minHeight="48dp"
android:minWidth="48dp"
android:layout_marginTop="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/appearance_settings_textview" />
@ -178,6 +180,7 @@
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:minHeight="48dp"
android:minWidth="48dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/street_mode_switch" />
@ -233,6 +236,7 @@
android:layout_marginTop="16dp"
android:layout_marginEnd="24dp"
android:minHeight="48dp"
android:minWidth="48dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/select_node_button" />
@ -248,12 +252,12 @@
android:id="@+id/wallet_proxy_address_edittext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="24dp"
android:layout_marginStart="24dp"
android:background="@drawable/edittext_bg"
android:hint="@string/wallet_proxy_address_hint"
android:minHeight="48dp"
app:layout_constraintBottom_toTopOf="@id/wallet_proxy_port_edittext"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@ -267,7 +271,9 @@
android:hint="@string/wallet_proxy_port_hint"
android:layout_marginEnd="24dp"
android:layout_marginStart="24dp"
android:layout_marginTop="8dp"
android:inputType="number"
android:minHeight="48dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

View file

@ -38,7 +38,7 @@
<string name="option_donate_per_tx">Add occasional donation</string>
<string name="option_donate_per_tx_desc">Randomly adds a 0.5%-1.5% Mysu donation to Txns. It\'s random so Txns don\'t have a consistently uncommon fingerprint, and the % is random so Mysu doesn\'t know the exact Txn amount.</string>
<string name="display_recovery_phrase">Display wallet keys</string>
<string name="tor_switch_label">Connect to proxy</string>
<string name="tor_switch_label">SOCKS Proxy</string>
<string name="connection_failed">Connection failed</string>
<string name="address">87MRtZPrWUCVUgcFHdsVb5MoZUcLtqfD3FvQVGwftFb8eSdMnE39JhAJcbuSW8X2vRaRsB9RQfuCpFciybJFHaz3QYPhCLw</string>
<string name="amount">0.00</string>