mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-30 21:07:11 +01:00
Change flotaing action button options in anonymous mode.
This commit is contained in:
parent
9054cd6590
commit
0f7b10fa14
@ -1591,7 +1591,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
if (position == 1) {
|
if (position == 1) {
|
||||||
postType = mMainActivityTabsSharedPreferences.getInt((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_2_POST_TYPE, SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_POPULAR);
|
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, "");
|
name = mMainActivityTabsSharedPreferences.getString((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_2_NAME, "");
|
||||||
Toast.makeText(MainActivity.this, postType + " s", Toast.LENGTH_SHORT).show();
|
|
||||||
} else {
|
} else {
|
||||||
postType = mMainActivityTabsSharedPreferences.getInt((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_3_POST_TYPE, SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_ALL);
|
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, "");
|
name = mMainActivityTabsSharedPreferences.getString((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_3_NAME, "");
|
||||||
|
@ -121,13 +121,18 @@ public class CustomizeBottomAppBarFragment extends Fragment {
|
|||||||
|
|
||||||
Resources resources = activity.getResources();
|
Resources resources = activity.getResources();
|
||||||
String[] mainActivityOptions = resources.getStringArray(R.array.settings_main_activity_bottom_app_bar_options);
|
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);
|
mainActivityOptionCount = sharedPreferences.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_COUNT, 4);
|
||||||
mainActivityOption1 = sharedPreferences.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_1, 0);
|
mainActivityOption1 = sharedPreferences.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_1, 0);
|
||||||
mainActivityOption2 = sharedPreferences.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_2, 1);
|
mainActivityOption2 = sharedPreferences.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_2, 1);
|
||||||
mainActivityOption3 = sharedPreferences.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_3, 2);
|
mainActivityOption3 = sharedPreferences.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_3, 2);
|
||||||
mainActivityOption4 = sharedPreferences.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_4, 3);
|
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));
|
mainActivityOptionCountTextView.setText(Integer.toString(mainActivityOptionCount));
|
||||||
mainActivityOption1TextView.setText(mainActivityOptions[mainActivityOption1]);
|
mainActivityOption1TextView.setText(mainActivityOptions[mainActivityOption1]);
|
||||||
@ -200,7 +205,15 @@ public class CustomizeBottomAppBarFragment extends Fragment {
|
|||||||
new MaterialAlertDialogBuilder(activity, R.style.MaterialAlertDialogTheme)
|
new MaterialAlertDialogBuilder(activity, R.style.MaterialAlertDialogTheme)
|
||||||
.setTitle(R.string.settings_bottom_app_bar_fab)
|
.setTitle(R.string.settings_bottom_app_bar_fab)
|
||||||
.setSingleChoiceItems(fabOptions, mainActivityFAB, (dialogInterface, i) -> {
|
.setSingleChoiceItems(fabOptions, mainActivityFAB, (dialogInterface, i) -> {
|
||||||
|
if (accountName == null) {
|
||||||
|
if (i == 7) {
|
||||||
|
mainActivityFAB = 9;
|
||||||
|
} else {
|
||||||
|
mainActivityFAB = i + 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
mainActivityFAB = i;
|
mainActivityFAB = i;
|
||||||
|
}
|
||||||
sharedPreferences.edit().putInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB, mainActivityFAB).apply();
|
sharedPreferences.edit().putInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB, mainActivityFAB).apply();
|
||||||
mainActivityFABTextView.setText(fabOptions[mainActivityFAB]);
|
mainActivityFABTextView.setText(fabOptions[mainActivityFAB]);
|
||||||
dialogInterface.dismiss();
|
dialogInterface.dismiss();
|
||||||
@ -214,7 +227,7 @@ public class CustomizeBottomAppBarFragment extends Fragment {
|
|||||||
otherActivitiesOption2 = sharedPreferences.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_2, 1);
|
otherActivitiesOption2 = sharedPreferences.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_2, 1);
|
||||||
otherActivitiesOption3 = sharedPreferences.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_3, 2);
|
otherActivitiesOption3 = sharedPreferences.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_3, 2);
|
||||||
otherActivitiesOption4 = sharedPreferences.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_4, 3);
|
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));
|
otherActivitiesOptionCountTextView.setText(Integer.toString(otherActivitiesOptionCount));
|
||||||
otherActivitiesOption1TextView.setText(otherActivitiesOptions[otherActivitiesOption1]);
|
otherActivitiesOption1TextView.setText(otherActivitiesOptions[otherActivitiesOption1]);
|
||||||
@ -287,7 +300,15 @@ public class CustomizeBottomAppBarFragment extends Fragment {
|
|||||||
new MaterialAlertDialogBuilder(activity, R.style.MaterialAlertDialogTheme)
|
new MaterialAlertDialogBuilder(activity, R.style.MaterialAlertDialogTheme)
|
||||||
.setTitle(R.string.settings_bottom_app_bar_fab)
|
.setTitle(R.string.settings_bottom_app_bar_fab)
|
||||||
.setSingleChoiceItems(fabOptions, otherActivitiesFAB, (dialogInterface, i) -> {
|
.setSingleChoiceItems(fabOptions, otherActivitiesFAB, (dialogInterface, i) -> {
|
||||||
|
if (accountName == null) {
|
||||||
|
if (i == 7) {
|
||||||
|
otherActivitiesFAB = 9;
|
||||||
|
} else {
|
||||||
|
otherActivitiesFAB = i + 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
otherActivitiesFAB = i;
|
otherActivitiesFAB = i;
|
||||||
|
}
|
||||||
sharedPreferences.edit().putInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB, otherActivitiesFAB).apply();
|
sharedPreferences.edit().putInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB, otherActivitiesFAB).apply();
|
||||||
otherActivitiesFABTextView.setText(fabOptions[otherActivitiesFAB]);
|
otherActivitiesFABTextView.setText(fabOptions[otherActivitiesFAB]);
|
||||||
dialogInterface.dismiss();
|
dialogInterface.dismiss();
|
||||||
|
@ -332,6 +332,17 @@
|
|||||||
<item>@string/filter_posts</item>
|
<item>@string/filter_posts</item>
|
||||||
</string-array>
|
</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">
|
<string-array name="settings_swipe_action_threshold">
|
||||||
<item>0.1</item>
|
<item>0.1</item>
|
||||||
<item>0.2</item>
|
<item>0.2</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user