aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-10-13 01:18:32 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-10-13 01:18:32 +0000
commit230f49ae184ddea9ce8185981599cf11457b5140 (patch)
treef469d30c5d8bb4fe169f888e2377986bd85f3f34 /app/src/main/java
parenta60c9360a1fb4189d2887b6cfb9d83dc524f7766 (diff)
downloadinfinity-for-reddit-230f49ae184ddea9ce8185981599cf11457b5140.tar
infinity-for-reddit-230f49ae184ddea9ce8185981599cf11457b5140.tar.gz
infinity-for-reddit-230f49ae184ddea9ce8185981599cf11457b5140.tar.bz2
infinity-for-reddit-230f49ae184ddea9ce8185981599cf11457b5140.tar.lz
infinity-for-reddit-230f49ae184ddea9ce8185981599cf11457b5140.tar.xz
infinity-for-reddit-230f49ae184ddea9ce8185981599cf11457b5140.tar.zst
infinity-for-reddit-230f49ae184ddea9ce8185981599cf11457b5140.zip
Fix wrong values in customize bottom navigation bar settings page in anonymous mode.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeBottomAppBarFragment.java29
1 files changed, 24 insertions, 5 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeBottomAppBarFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeBottomAppBarFragment.java
index 5690521f..2736bcb6 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeBottomAppBarFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeBottomAppBarFragment.java
@@ -16,6 +16,9 @@ import androidx.fragment.app.Fragment;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+import java.util.ArrayList;
+import java.util.Arrays;
+
import javax.inject.Inject;
import javax.inject.Named;
@@ -124,11 +127,6 @@ public class CustomizeBottomAppBarFragment extends Fragment {
String[] mainActivityOptionAnonymous = resources.getStringArray(R.array.settings_main_activity_bottom_app_bar_options_anonymous);
String[] mainActivityOptionAnonymousValues = resources.getStringArray(R.array.settings_main_activity_bottom_app_bar_options_anonymous_values);
String[] fabOptions;
- if (accountName == null) {
- fabOptions = resources.getStringArray(R.array.settings_bottom_app_bar_fab_options_anonymous);
- } else {
- fabOptions = resources.getStringArray(R.array.settings_bottom_app_bar_fab_options);
- }
mainActivityOptionCount = sharedPreferences.getInt((accountName == null ? "-" : "") + SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_COUNT, 4);
mainActivityOption1 = sharedPreferences.getInt((accountName == null ? "-" : "") + SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_1, 0);
mainActivityOption2 = sharedPreferences.getInt((accountName == null ? "-" : "") + SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_2, 1);
@@ -141,6 +139,18 @@ public class CustomizeBottomAppBarFragment extends Fragment {
mainActivityOption2TextView.setText(mainActivityOptions[mainActivityOption2]);
mainActivityOption3TextView.setText(mainActivityOptions[mainActivityOption3]);
mainActivityOption4TextView.setText(mainActivityOptions[mainActivityOption4]);
+
+ if (accountName == null) {
+ fabOptions = resources.getStringArray(R.array.settings_bottom_app_bar_fab_options_anonymous);
+ ArrayList<String> mainActivityOptionAnonymousValuesList = new ArrayList<>(Arrays.asList(mainActivityOptionAnonymousValues));
+ mainActivityOption1 = mainActivityOptionAnonymousValuesList.indexOf(Integer.toString(mainActivityOption1));
+ mainActivityOption2 = mainActivityOptionAnonymousValuesList.indexOf(Integer.toString(mainActivityOption2));
+ mainActivityOption3 = mainActivityOptionAnonymousValuesList.indexOf(Integer.toString(mainActivityOption3));
+ mainActivityOption4 = mainActivityOptionAnonymousValuesList.indexOf(Integer.toString(mainActivityOption4));
+ } else {
+ fabOptions = resources.getStringArray(R.array.settings_bottom_app_bar_fab_options);
+ }
+
mainActivityFABTextView.setText(fabOptions[mainActivityFAB]);
mainActivityOptionCountLinearLayout.setOnClickListener(view -> {
@@ -244,6 +254,15 @@ public class CustomizeBottomAppBarFragment extends Fragment {
otherActivitiesOption2TextView.setText(otherActivitiesOptions[otherActivitiesOption2]);
otherActivitiesOption3TextView.setText(otherActivitiesOptions[otherActivitiesOption3]);
otherActivitiesOption4TextView.setText(otherActivitiesOptions[otherActivitiesOption4]);
+
+ if (accountName == null) {
+ ArrayList<String> otherActivitiesOptionAnonymousValuesList = new ArrayList<>(Arrays.asList(otherActivitiesOptionAnonymousValues));
+ otherActivitiesOption1 = otherActivitiesOptionAnonymousValuesList.indexOf(Integer.toString(otherActivitiesOption1));
+ otherActivitiesOption2 = otherActivitiesOptionAnonymousValuesList.indexOf(Integer.toString(otherActivitiesOption2));
+ otherActivitiesOption3 = otherActivitiesOptionAnonymousValuesList.indexOf(Integer.toString(otherActivitiesOption3));
+ otherActivitiesOption4 = otherActivitiesOptionAnonymousValuesList.indexOf(Integer.toString(otherActivitiesOption4));
+ }
+
otherActivitiesFABTextView.setText(fabOptions[otherActivitiesFAB]);
otherActivitiesOptionCountLinearLayout.setOnClickListener(view -> {