diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2023-02-06 16:46:40 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2023-02-06 16:46:40 +0000 |
commit | e69f778de4be7a71057fa0464ec18a394dbf30bd (patch) | |
tree | b52cc0590160d18d41e00d2eb502fd788c6e23ce /app/src/main/java | |
parent | d0bf1aa19cd07f062809eccc3b8d452f539e96f5 (diff) | |
download | infinity-for-reddit-e69f778de4be7a71057fa0464ec18a394dbf30bd.tar infinity-for-reddit-e69f778de4be7a71057fa0464ec18a394dbf30bd.tar.gz infinity-for-reddit-e69f778de4be7a71057fa0464ec18a394dbf30bd.tar.bz2 infinity-for-reddit-e69f778de4be7a71057fa0464ec18a394dbf30bd.tar.lz infinity-for-reddit-e69f778de4be7a71057fa0464ec18a394dbf30bd.tar.xz infinity-for-reddit-e69f778de4be7a71057fa0464ec18a394dbf30bd.tar.zst infinity-for-reddit-e69f778de4be7a71057fa0464ec18a394dbf30bd.zip |
Revert bottom app bar style.
Diffstat (limited to 'app/src/main/java')
5 files changed, 133 insertions, 133 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 5744b707..4326a0a3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java @@ -5,7 +5,6 @@ import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES; import android.Manifest; import android.app.Activity; -import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; @@ -15,6 +14,7 @@ import android.os.Bundle; import android.os.Handler; import android.text.Editable; import android.text.TextWatcher; +import android.util.Log; import android.view.Gravity; import android.view.KeyEvent; import android.view.Menu; @@ -23,8 +23,6 @@ import android.view.View; import android.view.Window; import android.view.WindowManager; import android.view.inputmethod.EditorInfo; -import android.view.inputmethod.InputMethodManager; -import android.widget.LinearLayout; import android.widget.Toast; import androidx.activity.result.ActivityResultLauncher; @@ -33,10 +31,12 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.ActionBarDrawerToggle; import androidx.appcompat.app.AppCompatDelegate; -import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; +import androidx.core.view.OnApplyWindowInsetsListener; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; import androidx.drawerlayout.widget.DrawerLayout; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; @@ -54,7 +54,6 @@ import androidx.work.WorkManager; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.CollapsingToolbarLayout; import com.google.android.material.appbar.MaterialToolbar; -import com.google.android.material.bottomappbar.BottomAppBar; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.navigation.NavigationView; import com.google.android.material.tabs.TabLayout; @@ -255,7 +254,9 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb hideFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_FAB_IN_POST_FEED, false); showBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY, false); - navigationWrapper = new NavigationWrapper(findViewById(R.id.bottom_app_bar_bottom_app_bar), + navigationWrapper = new NavigationWrapper(findViewById(R.id.bottom_app_bar_bottom_app_bar), findViewById(R.id.linear_layout_bottom_app_bar), + findViewById(R.id.option_1_bottom_app_bar), findViewById(R.id.option_2_bottom_app_bar), + findViewById(R.id.option_3_bottom_app_bar), findViewById(R.id.option_4_bottom_app_bar), findViewById(R.id.fab_main_activity), findViewById(R.id.navigation_rail), showBottomAppBar); @@ -284,13 +285,12 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb if (navBarHeight > 0) { if (navigationWrapper.navigationRailView == null) { CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) navigationWrapper.floatingActionButton.getLayoutParams(); - params.bottomMargin += (int) (navBarHeight - Utils.convertDpToPixel(4, this)); + params.bottomMargin += navBarHeight; navigationWrapper.floatingActionButton.setLayoutParams(params); } if (navigationWrapper.bottomAppBar != null) { - CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) navigationWrapper.bottomAppBar.getLayoutParams(); - params.bottomMargin += navBarHeight; - navigationWrapper.bottomAppBar.setLayoutParams(params); + navigationWrapper.linearLayoutBottomAppBar.setPadding(navigationWrapper.linearLayoutBottomAppBar.getPaddingLeft(), + navigationWrapper.linearLayoutBottomAppBar.getPaddingTop(), navigationWrapper.linearLayoutBottomAppBar.getPaddingRight(), navBarHeight); } navDrawerRecyclerView.setPadding(0, 0, 0, navBarHeight); } @@ -591,16 +591,12 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb navigationWrapper.bindOptionDrawableResource(getBottomAppBarOptionDrawableResource(option1), getBottomAppBarOptionDrawableResource(option2)); if (navigationWrapper.navigationRailView == null) { - navigationWrapper.bottomAppBar.setOnMenuItemClickListener(item -> { - int itemId = item.getItemId(); - if (itemId == R.id.bottom_app_bar_option_1) { - bottomAppBarOptionAction(option1); - return true; - } else if (itemId == R.id.bottom_app_bar_option_2) { - bottomAppBarOptionAction(option2); - return true; - } - return false; + navigationWrapper.option2BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option1); + }); + + navigationWrapper.option4BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option2); }); } else { navigationWrapper.navigationRailView.setOnItemSelectedListener(item -> { @@ -624,22 +620,20 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb getBottomAppBarOptionDrawableResource(option4)); if (navigationWrapper.navigationRailView == null) { - navigationWrapper.bottomAppBar.setOnMenuItemClickListener(item -> { - int itemId = item.getItemId(); - if (itemId == R.id.bottom_app_bar_option_1) { - bottomAppBarOptionAction(option1); - return true; - } else if (itemId == R.id.bottom_app_bar_option_2) { - bottomAppBarOptionAction(option2); - return true; - } else if (itemId == R.id.bottom_app_bar_option_3) { - bottomAppBarOptionAction(option3); - return true; - } else if (itemId == R.id.bottom_app_bar_option_4) { - bottomAppBarOptionAction(option4); - return true; - } - return false; + navigationWrapper.option1BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option1); + }); + + navigationWrapper.option2BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option2); + }); + + navigationWrapper.option3BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option3); + }); + + navigationWrapper.option4BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option4); }); } else { navigationWrapper.navigationRailView.setOnItemSelectedListener(item -> { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewMultiRedditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewMultiRedditDetailActivity.java index 01264ace..4b7a044d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewMultiRedditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewMultiRedditDetailActivity.java @@ -161,7 +161,9 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT hideFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_FAB_IN_POST_FEED, false); showBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY, false); - navigationWrapper = new NavigationWrapper(findViewById(R.id.bottom_app_bar_bottom_app_bar), + navigationWrapper = new NavigationWrapper(findViewById(R.id.bottom_app_bar_bottom_app_bar), findViewById(R.id.linear_layout_bottom_app_bar), + findViewById(R.id.option_1_bottom_app_bar), findViewById(R.id.option_2_bottom_app_bar), + findViewById(R.id.option_3_bottom_app_bar), findViewById(R.id.option_4_bottom_app_bar), findViewById(R.id.fab_view_multi_reddit_detail_activity), findViewById(R.id.navigation_rail), showBottomAppBar); @@ -190,7 +192,7 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT if (navBarHeight > 0) { if (navigationWrapper.navigationRailView == null) { CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) navigationWrapper.floatingActionButton.getLayoutParams(); - params.bottomMargin += (int) (navBarHeight - Utils.convertDpToPixel(4, this)); + params.bottomMargin += navBarHeight; navigationWrapper.floatingActionButton.setLayoutParams(params); } } @@ -238,16 +240,12 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT navigationWrapper.bindOptionDrawableResource(getBottomAppBarOptionDrawableResource(option1), getBottomAppBarOptionDrawableResource(option2)); if (navigationWrapper.navigationRailView == null) { - navigationWrapper.bottomAppBar.setOnMenuItemClickListener(item -> { - int itemId = item.getItemId(); - if (itemId == R.id.bottom_app_bar_option_1) { - bottomAppBarOptionAction(option1); - return true; - } else if (itemId == R.id.bottom_app_bar_option_2) { - bottomAppBarOptionAction(option2); - return true; - } - return false; + navigationWrapper.option2BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option1); + }); + + navigationWrapper.option4BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option2); }); } else { navigationWrapper.navigationRailView.setOnItemSelectedListener(item -> { @@ -271,22 +269,20 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT getBottomAppBarOptionDrawableResource(option4)); if (navigationWrapper.navigationRailView == null) { - navigationWrapper.bottomAppBar.setOnMenuItemClickListener(item -> { - int itemId = item.getItemId(); - if (itemId == R.id.bottom_app_bar_option_1) { - bottomAppBarOptionAction(option1); - return true; - } else if (itemId == R.id.bottom_app_bar_option_2) { - bottomAppBarOptionAction(option2); - return true; - } else if (itemId == R.id.bottom_app_bar_option_3) { - bottomAppBarOptionAction(option3); - return true; - } else if (itemId == R.id.bottom_app_bar_option_4) { - bottomAppBarOptionAction(option4); - return true; - } - return false; + navigationWrapper.option1BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option1); + }); + + navigationWrapper.option2BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option2); + }); + + navigationWrapper.option3BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option3); + }); + + navigationWrapper.option4BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option4); }); } else { navigationWrapper.navigationRailView.setOnItemSelectedListener(item -> { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java index e531a84b..8caebf33 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java @@ -241,7 +241,9 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp hideFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_FAB_IN_POST_FEED, false); showBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY, false); - navigationWrapper = new NavigationWrapper(findViewById(R.id.bottom_app_bar_bottom_app_bar), + navigationWrapper = new NavigationWrapper(findViewById(R.id.bottom_app_bar_bottom_app_bar), findViewById(R.id.linear_layout_bottom_app_bar), + findViewById(R.id.option_1_bottom_app_bar), findViewById(R.id.option_2_bottom_app_bar), + findViewById(R.id.option_3_bottom_app_bar), findViewById(R.id.option_4_bottom_app_bar), findViewById(R.id.fab_view_subreddit_detail_activity), findViewById(R.id.navigation_rail), showBottomAppBar); @@ -268,7 +270,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp if (navBarHeight > 0) { if (navigationWrapper.navigationRailView == null) { CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) navigationWrapper.floatingActionButton.getLayoutParams(); - params.bottomMargin += (int) (navBarHeight - Utils.convertDpToPixel(4, this)); + params.bottomMargin += navBarHeight; navigationWrapper.floatingActionButton.setLayoutParams(params); } } @@ -759,16 +761,12 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp navigationWrapper.bindOptionDrawableResource(getBottomAppBarOptionDrawableResource(option1), getBottomAppBarOptionDrawableResource(option2)); if (navigationWrapper.navigationRailView == null) { - navigationWrapper.bottomAppBar.setOnMenuItemClickListener(item -> { - int itemId = item.getItemId(); - if (itemId == R.id.bottom_app_bar_option_1) { - bottomAppBarOptionAction(option1); - return true; - } else if (itemId == R.id.bottom_app_bar_option_2) { - bottomAppBarOptionAction(option2); - return true; - } - return false; + navigationWrapper.option2BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option1); + }); + + navigationWrapper.option4BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option2); }); } else { navigationWrapper.navigationRailView.setOnItemSelectedListener(item -> { @@ -792,22 +790,20 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp getBottomAppBarOptionDrawableResource(option4)); if (navigationWrapper.navigationRailView == null) { - navigationWrapper.bottomAppBar.setOnMenuItemClickListener(item -> { - int itemId = item.getItemId(); - if (itemId == R.id.bottom_app_bar_option_1) { - bottomAppBarOptionAction(option1); - return true; - } else if (itemId == R.id.bottom_app_bar_option_2) { - bottomAppBarOptionAction(option2); - return true; - } else if (itemId == R.id.bottom_app_bar_option_3) { - bottomAppBarOptionAction(option3); - return true; - } else if (itemId == R.id.bottom_app_bar_option_4) { - bottomAppBarOptionAction(option4); - return true; - } - return false; + navigationWrapper.option1BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option1); + }); + + navigationWrapper.option2BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option2); + }); + + navigationWrapper.option3BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option3); + }); + + navigationWrapper.option4BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option4); }); } else { navigationWrapper.navigationRailView.setOnItemSelectedListener(item -> { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java index 2daef67b..656a4885 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java @@ -244,7 +244,9 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele hideFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_FAB_IN_POST_FEED, false); showBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY, false); - navigationWrapper = new NavigationWrapper(findViewById(R.id.bottom_app_bar_bottom_app_bar), + navigationWrapper = new NavigationWrapper(findViewById(R.id.bottom_app_bar_bottom_app_bar), findViewById(R.id.linear_layout_bottom_app_bar), + findViewById(R.id.option_1_bottom_app_bar), findViewById(R.id.option_2_bottom_app_bar), + findViewById(R.id.option_3_bottom_app_bar), findViewById(R.id.option_4_bottom_app_bar), findViewById(R.id.fab_view_user_detail_activity), findViewById(R.id.navigation_rail), showBottomAppBar); @@ -305,7 +307,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele if (navBarHeight > 0) { if (navigationWrapper.navigationRailView == null) { CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) navigationWrapper.floatingActionButton.getLayoutParams(); - params.bottomMargin += (int) (navBarHeight - Utils.convertDpToPixel(4, this)); + params.bottomMargin += navBarHeight; navigationWrapper.floatingActionButton.setLayoutParams(params); } } @@ -724,16 +726,12 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele navigationWrapper.bindOptionDrawableResource(getBottomAppBarOptionDrawableResource(option1), getBottomAppBarOptionDrawableResource(option2)); if (navigationWrapper.navigationRailView == null) { - navigationWrapper.bottomAppBar.setOnMenuItemClickListener(item -> { - int itemId = item.getItemId(); - if (itemId == R.id.bottom_app_bar_option_1) { - bottomAppBarOptionAction(option1); - return true; - } else if (itemId == R.id.bottom_app_bar_option_2) { - bottomAppBarOptionAction(option2); - return true; - } - return false; + navigationWrapper.option2BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option1); + }); + + navigationWrapper.option4BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option2); }); } else { navigationWrapper.navigationRailView.setOnItemSelectedListener(item -> { @@ -757,22 +755,20 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele getBottomAppBarOptionDrawableResource(option4)); if (navigationWrapper.navigationRailView == null) { - navigationWrapper.bottomAppBar.setOnMenuItemClickListener(item -> { - int itemId = item.getItemId(); - if (itemId == R.id.bottom_app_bar_option_1) { - bottomAppBarOptionAction(option1); - return true; - } else if (itemId == R.id.bottom_app_bar_option_2) { - bottomAppBarOptionAction(option2); - return true; - } else if (itemId == R.id.bottom_app_bar_option_3) { - bottomAppBarOptionAction(option3); - return true; - } else if (itemId == R.id.bottom_app_bar_option_4) { - bottomAppBarOptionAction(option4); - return true; - } - return false; + navigationWrapper.option1BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option1); + }); + + navigationWrapper.option2BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option2); + }); + + navigationWrapper.option3BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option3); + }); + + navigationWrapper.option4BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option4); }); } else { navigationWrapper.navigationRailView.setOnItemSelectedListener(item -> { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/NavigationWrapper.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/NavigationWrapper.java index ff082f45..1d702c19 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/NavigationWrapper.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/NavigationWrapper.java @@ -5,6 +5,8 @@ import android.content.res.ColorStateList; import android.view.Menu; import android.view.MenuItem; import android.view.View; +import android.widget.ImageView; +import android.widget.LinearLayout; import androidx.appcompat.view.menu.MenuItemImpl; import androidx.core.view.MenuItemCompat; @@ -17,13 +19,26 @@ import ml.docilealligator.infinityforreddit.R; public class NavigationWrapper { public BottomAppBar bottomAppBar; + public LinearLayout linearLayoutBottomAppBar; + public ImageView option1BottomAppBar; + public ImageView option2BottomAppBar; + public ImageView option3BottomAppBar; + public ImageView option4BottomAppBar; public NavigationRailView navigationRailView; public FloatingActionButton floatingActionButton; - public NavigationWrapper(BottomAppBar bottomAppBar, FloatingActionButton floatingActionButton, - NavigationRailView navigationRailView, boolean showBottomAppBar) { + public NavigationWrapper(BottomAppBar bottomAppBar, LinearLayout linearLayoutBottomAppBar, + ImageView option1BottomAppBar, ImageView option2BottomAppBar, + ImageView option3BottomAppBar, ImageView option4BottomAppBar, + FloatingActionButton floatingActionButton, NavigationRailView navigationRailView, + boolean showBottomAppBar) { this.bottomAppBar = bottomAppBar; + this.linearLayoutBottomAppBar = linearLayoutBottomAppBar; + this.option1BottomAppBar = option1BottomAppBar; + this.option2BottomAppBar = option2BottomAppBar; + this.option3BottomAppBar = option3BottomAppBar; + this.option4BottomAppBar = option4BottomAppBar; this.navigationRailView = navigationRailView; if (navigationRailView != null) { if (showBottomAppBar) { @@ -39,8 +54,11 @@ public class NavigationWrapper { public void applyCustomTheme(int bottomAppBarIconColor, int bottomAppBarBackgroundColor) { if (navigationRailView == null) { + option1BottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + option2BottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + option3BottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + option4BottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); bottomAppBar.setBackgroundTint(ColorStateList.valueOf(bottomAppBarBackgroundColor)); - applyMenuItemTheme(bottomAppBar.getMenu(), bottomAppBarIconColor); } else { navigationRailView.setBackgroundColor(bottomAppBarBackgroundColor); applyMenuItemTheme(navigationRailView.getMenu(), bottomAppBarIconColor); @@ -66,11 +84,12 @@ public class NavigationWrapper { if (imageResources.length == 2) { if (navigationRailView == null) { - Menu menu = bottomAppBar.getMenu(); - menu.findItem(R.id.bottom_app_bar_option_1).setIcon(imageResources[0]); - menu.findItem(R.id.bottom_app_bar_option_2).setIcon(imageResources[1]); - menu.findItem(R.id.bottom_app_bar_option_3).setVisible(false); - menu.findItem(R.id.bottom_app_bar_option_4).setVisible(false); + linearLayoutBottomAppBar.setWeightSum(3); + option1BottomAppBar.setVisibility(View.GONE); + option3BottomAppBar.setVisibility(View.GONE); + + option2BottomAppBar.setImageResource(imageResources[0]); + option4BottomAppBar.setImageResource(imageResources[1]); } else { Menu menu = navigationRailView.getMenu(); menu.findItem(R.id.navigation_rail_option_1).setIcon(imageResources[0]); @@ -80,11 +99,10 @@ public class NavigationWrapper { } } else { if (navigationRailView == null) { - Menu menu = bottomAppBar.getMenu(); - menu.findItem(R.id.bottom_app_bar_option_1).setIcon(imageResources[0]); - menu.findItem(R.id.bottom_app_bar_option_2).setIcon(imageResources[1]); - menu.findItem(R.id.bottom_app_bar_option_3).setIcon(imageResources[2]); - menu.findItem(R.id.bottom_app_bar_option_4).setIcon(imageResources[3]); + option1BottomAppBar.setImageResource(imageResources[0]); + option2BottomAppBar.setImageResource(imageResources[1]); + option3BottomAppBar.setImageResource(imageResources[2]); + option4BottomAppBar.setImageResource(imageResources[3]); } else { Menu menu = navigationRailView.getMenu(); menu.findItem(R.id.navigation_rail_option_1).setIcon(imageResources[0]); |