diff options
author | Alex Ning <chineseperson5@gmail.com> | 2021-10-12 11:35:50 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2021-10-12 11:35:50 +0000 |
commit | 0f7b10fa14af39eb591eb37c786037c88ea65837 (patch) | |
tree | 7fb822c69f0bbff56cfda9a3e2fbf3f9dfeb2756 | |
parent | 9054cd659013bdaead579b62dbcf4f9719f748d9 (diff) | |
download | infinity-for-reddit-0f7b10fa14af39eb591eb37c786037c88ea65837.tar infinity-for-reddit-0f7b10fa14af39eb591eb37c786037c88ea65837.tar.gz infinity-for-reddit-0f7b10fa14af39eb591eb37c786037c88ea65837.tar.bz2 infinity-for-reddit-0f7b10fa14af39eb591eb37c786037c88ea65837.tar.lz infinity-for-reddit-0f7b10fa14af39eb591eb37c786037c88ea65837.tar.xz infinity-for-reddit-0f7b10fa14af39eb591eb37c786037c88ea65837.tar.zst infinity-for-reddit-0f7b10fa14af39eb591eb37c786037c88ea65837.zip |
Change flotaing action button options in anonymous mode.
3 files changed, 37 insertions, 6 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java index 7e7fd30c..12616a96 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java @@ -1591,7 +1591,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb if (position == 1) { postType = mMainActivityTabsSharedPreferences.getInt((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_2_POST_TYPE, SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_POPULAR); name = mMainActivityTabsSharedPreferences.getString((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_2_NAME, ""); - Toast.makeText(MainActivity.this, postType + " s", Toast.LENGTH_SHORT).show(); } else { postType = mMainActivityTabsSharedPreferences.getInt((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_3_POST_TYPE, SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_ALL); name = mMainActivityTabsSharedPreferences.getString((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_3_NAME, ""); 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 fd768282..d80442eb 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeBottomAppBarFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeBottomAppBarFragment.java @@ -121,13 +121,18 @@ public class CustomizeBottomAppBarFragment extends Fragment { Resources resources = activity.getResources(); String[] mainActivityOptions = resources.getStringArray(R.array.settings_main_activity_bottom_app_bar_options); - String[] fabOptions = resources.getStringArray(R.array.settings_bottom_app_bar_fab_options); + 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(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_COUNT, 4); mainActivityOption1 = sharedPreferences.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_1, 0); mainActivityOption2 = sharedPreferences.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_2, 1); mainActivityOption3 = sharedPreferences.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_3, 2); mainActivityOption4 = sharedPreferences.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_4, 3); - mainActivityFAB = sharedPreferences.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB, 0); + mainActivityFAB = sharedPreferences.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB, accountName == null ? 7: 0); mainActivityOptionCountTextView.setText(Integer.toString(mainActivityOptionCount)); mainActivityOption1TextView.setText(mainActivityOptions[mainActivityOption1]); @@ -200,7 +205,15 @@ public class CustomizeBottomAppBarFragment extends Fragment { new MaterialAlertDialogBuilder(activity, R.style.MaterialAlertDialogTheme) .setTitle(R.string.settings_bottom_app_bar_fab) .setSingleChoiceItems(fabOptions, mainActivityFAB, (dialogInterface, i) -> { - mainActivityFAB = i; + if (accountName == null) { + if (i == 7) { + mainActivityFAB = 9; + } else { + mainActivityFAB = i + 1; + } + } else { + mainActivityFAB = i; + } sharedPreferences.edit().putInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB, mainActivityFAB).apply(); mainActivityFABTextView.setText(fabOptions[mainActivityFAB]); dialogInterface.dismiss(); @@ -214,7 +227,7 @@ public class CustomizeBottomAppBarFragment extends Fragment { otherActivitiesOption2 = sharedPreferences.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_2, 1); otherActivitiesOption3 = sharedPreferences.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_3, 2); otherActivitiesOption4 = sharedPreferences.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_4, 3); - otherActivitiesFAB = sharedPreferences.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB, 0); + otherActivitiesFAB = sharedPreferences.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB, accountName == null ? 7: 0); otherActivitiesOptionCountTextView.setText(Integer.toString(otherActivitiesOptionCount)); otherActivitiesOption1TextView.setText(otherActivitiesOptions[otherActivitiesOption1]); @@ -287,7 +300,15 @@ public class CustomizeBottomAppBarFragment extends Fragment { new MaterialAlertDialogBuilder(activity, R.style.MaterialAlertDialogTheme) .setTitle(R.string.settings_bottom_app_bar_fab) .setSingleChoiceItems(fabOptions, otherActivitiesFAB, (dialogInterface, i) -> { - otherActivitiesFAB = i; + if (accountName == null) { + if (i == 7) { + otherActivitiesFAB = 9; + } else { + otherActivitiesFAB = i + 1; + } + } else { + otherActivitiesFAB = i; + } sharedPreferences.edit().putInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB, otherActivitiesFAB).apply(); otherActivitiesFABTextView.setText(fabOptions[otherActivitiesFAB]); dialogInterface.dismiss(); diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index b32e3310..b375ec21 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -332,6 +332,17 @@ <item>@string/filter_posts</item> </string-array> + <string-array name="settings_bottom_app_bar_fab_options_anonymous"> + <item>@string/refresh</item> + <item>@string/change_sort_type</item> + <item>@string/change_post_layout</item> + <item>@string/search</item> + <item>@string/go_to_subreddit</item> + <item>@string/go_to_user</item> + <item>@string/random</item> + <item>@string/filter_posts</item> + </string-array> + <string-array name="settings_swipe_action_threshold"> <item>0.1</item> <item>0.2</item> |