Settings screen UI update, and other changes

This commit is contained in:
pokkst 2022-09-13 02:19:58 -05:00
parent 4f580cbda8
commit e3252b5762
No known key found for this signature in database
GPG key ID: 90C2ED85E67A50FF
9 changed files with 62 additions and 38 deletions

View file

@ -40,20 +40,10 @@ public class SettingsFragment extends Fragment implements PasswordBottomSheetDia
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
mViewModel = new ViewModelProvider(this).get(SettingsViewModel.class); mViewModel = new ViewModelProvider(this).get(SettingsViewModel.class);
Wallet wallet = WalletManager.getInstance().getWallet();
Button displaySeedButton = view.findViewById(R.id.display_seed_button); Button displaySeedButton = view.findViewById(R.id.display_seed_button);
TextView walletInfoTextView = view.findViewById(R.id.wallet_info_textview);
SwitchCompat nightModeSwitch = view.findViewById(R.id.day_night_switch); SwitchCompat nightModeSwitch = view.findViewById(R.id.day_night_switch);
SwitchCompat torSwitch = view.findViewById(R.id.tor_switch); SwitchCompat torSwitch = view.findViewById(R.id.tor_switch);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Private view-key: " + wallet.getSecretViewKey()+"\n\n");
stringBuilder.append("Restore height: " + wallet.getRestoreHeight() + "\n\n");
stringBuilder.append("Wallet height: " + wallet.getBlockChainHeight() + "\n\n");
stringBuilder.append("Daemon height: " + BlockchainService.getInstance().getDaemonHeight() + "\n\n");
walletInfoTextView.setText(stringBuilder.toString());
nightModeSwitch.setChecked(NightmodeHelper.getPreferredNightmode() == DayNightMode.NIGHT); nightModeSwitch.setChecked(NightmodeHelper.getPreferredNightmode() == DayNightMode.NIGHT);
nightModeSwitch.setOnCheckedChangeListener((compoundButton, b) -> { nightModeSwitch.setOnCheckedChangeListener((compoundButton, b) -> {
if(b) { if(b) {
@ -67,6 +57,7 @@ public class SettingsFragment extends Fragment implements PasswordBottomSheetDia
torSwitch.setOnCheckedChangeListener((compoundButton, b) -> { torSwitch.setOnCheckedChangeListener((compoundButton, b) -> {
PrefService.getInstance().edit().putBoolean(Constants.PREF_USES_TOR, b).apply(); PrefService.getInstance().edit().putBoolean(Constants.PREF_USES_TOR, b).apply();
// TODO display "Advanced" settings mode when enabled to configure specific proxy address and port
String proxy = b ? "127.0.0.1:9050" : ""; String proxy = b ? "127.0.0.1:9050" : "";
WalletManager.getInstance().setProxy(proxy); WalletManager.getInstance().setProxy(proxy);
WalletManager.getInstance().getWallet().setProxy(proxy); WalletManager.getInstance().getWallet().setProxy(proxy);

View file

@ -41,7 +41,7 @@
tools:text="+ 100.000000000000 confirming" tools:text="+ 100.000000000000 confirming"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/balance_unlocked_textview" /> app:layout_constraintTop_toBottomOf="@id/settings_imageview" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/transaction_history_recyclerview" android:id="@+id/transaction_history_recyclerview"
@ -107,6 +107,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/ic_settings" android:src="@drawable/ic_settings"
android:layout_marginEnd="24dp" android:layout_marginEnd="24dp"
android:padding="8dp"
android:minHeight="24dp"
android:minWidth="24dp"
app:layout_constraintTop_toTopOf="@id/balance_unlocked_textview" app:layout_constraintTop_toTopOf="@id/balance_unlocked_textview"
app:layout_constraintBottom_toBottomOf="@id/balance_unlocked_textview" app:layout_constraintBottom_toBottomOf="@id/balance_unlocked_textview"
app:layout_constraintEnd_toEndOf="parent"/> app:layout_constraintEnd_toEndOf="parent"/>

View file

@ -12,7 +12,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/create_wallet" android:text="@string/create_wallet"
android:layout_marginBottom="32dp" android:layout_marginBottom="32dp"
android:textSize="24sp" android:textSize="32sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View file

@ -11,40 +11,58 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/settings" android:text="@string/settings"
android:layout_marginBottom="32dp" android:textSize="32sp"
android:textSize="24sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/display_seed_button"/> app:layout_constraintBottom_toTopOf="@id/wallet_settings_textview"/>
<ImageView <TextView
android:id="@+id/monero_logo_imageview" android:id="@+id/wallet_settings_textview"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/ic_monero_qr" android:text="@string/wallet"
app:layout_constraintBottom_toBottomOf="parent" android:textSize="24sp"
android:textStyle="bold"
android:layout_marginTop="32dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toBottomOf="@id/settings_textview"
app:layout_constraintStart_toStartOf="parent"/> app:layout_constraintBottom_toTopOf="@id/display_seed_button"/>
<Button <Button
android:id="@+id/display_seed_button" android:id="@+id/display_seed_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/display_recovery_phrase" android:text="@string/display_recovery_phrase"
android:background="@drawable/button_bg"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:background="@drawable/button_bg"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/settings_textview" /> app:layout_constraintBottom_toTopOf="@id/appearance_settings_textview"
app:layout_constraintTop_toBottomOf="@id/wallet_settings_textview" />
<TextView
android:id="@+id/appearance_settings_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/appearance"
android:textSize="24sp"
android:textStyle="bold"
android:layout_marginTop="32dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/display_seed_button"
app:layout_constraintBottom_toTopOf="@id/day_night_switch"/>
<TextView <TextView
android:id="@+id/day_night_textview" android:id="@+id/day_night_textview"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/night_mode" android:text="@string/night_mode"
android:textSize="16sp"
app:layout_constraintTop_toTopOf="@id/day_night_switch" app:layout_constraintTop_toTopOf="@id/day_night_switch"
app:layout_constraintBottom_toBottomOf="@id/day_night_switch" app:layout_constraintBottom_toBottomOf="@id/day_night_switch"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@ -54,14 +72,30 @@
android:id="@+id/day_night_switch" android:id="@+id/day_night_switch"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/display_seed_button" android:layout_marginTop="16dp"
app:layout_constraintBottom_toTopOf="@id/network_settings_textview"
app:layout_constraintTop_toBottomOf="@id/appearance_settings_textview"
app:layout_constraintEnd_toEndOf="parent"/> app:layout_constraintEnd_toEndOf="parent"/>
<TextView
android:id="@+id/network_settings_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/network"
android:textSize="24sp"
android:textStyle="bold"
android:layout_marginTop="32dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/day_night_switch"
app:layout_constraintBottom_toTopOf="@id/tor_switch"/>
<TextView <TextView
android:id="@+id/tor_textview" android:id="@+id/tor_textview"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/tor_switch_label" android:text="@string/tor_switch_label"
android:textSize="16sp"
app:layout_constraintTop_toTopOf="@id/tor_switch" app:layout_constraintTop_toTopOf="@id/tor_switch"
app:layout_constraintBottom_toBottomOf="@id/tor_switch" app:layout_constraintBottom_toBottomOf="@id/tor_switch"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@ -72,14 +106,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@id/day_night_switch" app:layout_constraintTop_toBottomOf="@id/network_settings_textview"
app:layout_constraintEnd_toEndOf="parent"/>
<TextView
android:id="@+id/wallet_info_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tor_switch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/> app:layout_constraintEnd_toEndOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -18,7 +18,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/enter_password" android:text="@string/enter_password"
android:layout_marginBottom="32dp" android:layout_marginBottom="32dp"
android:textSize="24sp" android:textSize="32sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View file

@ -18,7 +18,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/recv_monero" android:text="@string/recv_monero"
android:layout_marginBottom="32dp" android:layout_marginBottom="32dp"
android:textSize="24sp" android:textSize="32sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View file

@ -19,7 +19,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/send_monero" android:text="@string/send_monero"
android:layout_marginBottom="32dp" android:layout_marginBottom="32dp"
android:textSize="24sp" android:textSize="32sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View file

@ -548,7 +548,7 @@
<string name="copied_to_clipboard">Copied to clipboard</string> <string name="copied_to_clipboard">Copied to clipboard</string>
<string name="night_mode">Night mode</string> <string name="night_mode">Night mode</string>
<string name="display_recovery_phrase">Display recovery phrase</string> <string name="display_recovery_phrase">Display recovery phrase</string>
<string name="tor_switch_label">Enable Tor (requires Orbot or similar app)</string> <string name="tor_switch_label">Enable proxy</string>
<string name="connection_failed">Connection failed</string> <string name="connection_failed">Connection failed</string>
<string name="address">87MRtZPrWUCVUgcFHdsVb5MoZUcLtqfD3FvQVGwftFb8eSdMnE39JhAJcbuSW8X2vRaRsB9RQfuCpFciybJFHaz3QYPhCLw</string> <string name="address">87MRtZPrWUCVUgcFHdsVb5MoZUcLtqfD3FvQVGwftFb8eSdMnE39JhAJcbuSW8X2vRaRsB9RQfuCpFciybJFHaz3QYPhCLw</string>
<string name="amount">0.00</string> <string name="amount">0.00</string>
@ -573,4 +573,7 @@
<string name="sent_tx">Sent transaction!</string> <string name="sent_tx">Sent transaction!</string>
<string name="no_camera_permission">No camera permission</string> <string name="no_camera_permission">No camera permission</string>
<string name="settings">Settings</string> <string name="settings">Settings</string>
<string name="wallet">Wallet</string>
<string name="appearance">Appearance</string>
<string name="network">Network</string>
</resources> </resources>

View file

@ -36,6 +36,7 @@
<item name="android:textColorPrimary">@color/oled_textColorPrimary</item> <item name="android:textColorPrimary">@color/oled_textColorPrimary</item>
<item name="android:textColorSecondary">@color/oled_textColorSecondary</item> <item name="android:textColorSecondary">@color/oled_textColorSecondary</item>
<item name="bottomSheetDialogTheme">@style/BottomSheetDialog_Rounded</item> <item name="bottomSheetDialogTheme">@style/BottomSheetDialog_Rounded</item>
<item name="colorControlActivated">@color/oled_colorSecondary</item>
</style> </style>
<!-- BottomSheet Dialog--> <!-- BottomSheet Dialog-->