mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-30 19:34:45 +01:00
Changing option count of the bottom app bar in MainActivity is available.
This commit is contained in:
parent
f33d4dbc61
commit
8764852f6e
@ -499,11 +499,28 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
int optionCount = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_COUNT, 4);
|
int optionCount = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_COUNT, 4);
|
||||||
int option1 = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_1, SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SUBSCRIPTIONS);
|
int option1 = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_1, SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SUBSCRIPTIONS);
|
||||||
int option2 = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_2, SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_MULTIREDDITS);
|
int option2 = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_2, SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_MULTIREDDITS);
|
||||||
int option3 = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_3, SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_INBOX);
|
|
||||||
int option4 = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_4, SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_PROFILE);
|
|
||||||
|
|
||||||
bottomAppBar.setVisibility(View.VISIBLE);
|
bottomAppBar.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
if (optionCount == 2) {
|
||||||
|
linearLayoutBottomAppBar.setWeightSum(3);
|
||||||
|
option1BottomAppBar.setVisibility(View.GONE);
|
||||||
|
option3BottomAppBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
option2BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option1));
|
||||||
|
option4BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option2));
|
||||||
|
|
||||||
|
option2BottomAppBar.setOnClickListener(view -> {
|
||||||
|
bottomAppBarOptionAction(option1);
|
||||||
|
});
|
||||||
|
|
||||||
|
option4BottomAppBar.setOnClickListener(view -> {
|
||||||
|
bottomAppBarOptionAction(option2);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
int option3 = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_3, SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_INBOX);
|
||||||
|
int option4 = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_4, SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_PROFILE);
|
||||||
|
|
||||||
option1BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option1));
|
option1BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option1));
|
||||||
option2BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option2));
|
option2BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option2));
|
||||||
option3BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option3));
|
option3BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option3));
|
||||||
@ -524,6 +541,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
option4BottomAppBar.setOnClickListener(view -> {
|
option4BottomAppBar.setOnClickListener(view -> {
|
||||||
bottomAppBarOptionAction(option4);
|
bottomAppBarOptionAction(option4);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
|
CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
|
||||||
lp.setAnchorId(View.NO_ID);
|
lp.setAnchorId(View.NO_ID);
|
||||||
|
@ -125,6 +125,7 @@
|
|||||||
android:background="?attr/selectableItemBackgroundBorderless" />
|
android:background="?attr/selectableItemBackgroundBorderless" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</com.google.android.material.bottomappbar.BottomAppBar>
|
</com.google.android.material.bottomappbar.BottomAppBar>
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
|
Loading…
x
Reference in New Issue
Block a user