aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-09-25 08:46:24 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-09-25 08:46:24 +0000
commit8764852f6e2c0b7896df9613200086af56f180ab (patch)
tree476de5848edacb5725e65c6720089b022b3d7c0c /app/src/main/java/ml
parentf33d4dbc61ef2f7967f9bf3ee80b2644eaf54aad (diff)
downloadinfinity-for-reddit-8764852f6e2c0b7896df9613200086af56f180ab.tar
infinity-for-reddit-8764852f6e2c0b7896df9613200086af56f180ab.tar.gz
infinity-for-reddit-8764852f6e2c0b7896df9613200086af56f180ab.tar.bz2
infinity-for-reddit-8764852f6e2c0b7896df9613200086af56f180ab.tar.lz
infinity-for-reddit-8764852f6e2c0b7896df9613200086af56f180ab.tar.xz
infinity-for-reddit-8764852f6e2c0b7896df9613200086af56f180ab.tar.zst
infinity-for-reddit-8764852f6e2c0b7896df9613200086af56f180ab.zip
Changing option count of the bottom app bar in MainActivity is available.
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java54
1 files changed, 36 insertions, 18 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java
index 858437ba..4103ee15 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java
@@ -499,31 +499,49 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
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 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);
- option1BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option1));
- option2BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option2));
- option3BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option3));
- option4BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option4));
+ if (optionCount == 2) {
+ linearLayoutBottomAppBar.setWeightSum(3);
+ option1BottomAppBar.setVisibility(View.GONE);
+ option3BottomAppBar.setVisibility(View.GONE);
- option1BottomAppBar.setOnClickListener(view -> {
- bottomAppBarOptionAction(option1);
- });
+ option2BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option1));
+ option4BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option2));
- option2BottomAppBar.setOnClickListener(view -> {
- bottomAppBarOptionAction(option2);
- });
+ option2BottomAppBar.setOnClickListener(view -> {
+ bottomAppBarOptionAction(option1);
+ });
- option3BottomAppBar.setOnClickListener(view -> {
- bottomAppBarOptionAction(option3);
- });
+ 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);
- option4BottomAppBar.setOnClickListener(view -> {
- bottomAppBarOptionAction(option4);
- });
+ option1BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option1));
+ option2BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option2));
+ option3BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option3));
+ option4BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option4));
+
+ option1BottomAppBar.setOnClickListener(view -> {
+ bottomAppBarOptionAction(option1);
+ });
+
+ option2BottomAppBar.setOnClickListener(view -> {
+ bottomAppBarOptionAction(option2);
+ });
+
+ option3BottomAppBar.setOnClickListener(view -> {
+ bottomAppBarOptionAction(option3);
+ });
+
+ option4BottomAppBar.setOnClickListener(view -> {
+ bottomAppBarOptionAction(option4);
+ });
+ }
} else {
CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
lp.setAnchorId(View.NO_ID);