mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-06 10:47:27 +01:00
Revert bottom app bar style.
This commit is contained in:
parent
d0bf1aa19c
commit
e69f778de4
@ -80,7 +80,7 @@ dependencies {
|
||||
implementation "androidx.room:room-guava:$roomVersion"
|
||||
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01'
|
||||
implementation 'androidx.work:work-runtime:2.7.1'
|
||||
implementation 'com.google.android.material:material:1.8.0-beta01'
|
||||
implementation 'com.google.android.material:material:1.8.0'
|
||||
|
||||
/** ExoPlayer **/
|
||||
def exoplayerVersion = "2.18.2"
|
||||
|
@ -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 -> {
|
||||
|
@ -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 -> {
|
||||
|
@ -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 -> {
|
||||
|
@ -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 -> {
|
||||
|
@ -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]);
|
||||
|
@ -3,10 +3,64 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/bottom_app_bar_bottom_app_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_height="48dp"
|
||||
android:visibility="gone"
|
||||
style="@style/Widget.Material3.BottomAppBar"
|
||||
app:hideOnScroll="true"
|
||||
app:fabAlignmentMode="end"
|
||||
app:menu="@menu/bottom_app_bar" />
|
||||
app:fabAlignmentMode="center">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linear_layout_bottom_app_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="6dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:weightSum="5">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/option_1_bottom_app_bar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/option_2_bottom_app_bar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@android:color/transparent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/option_3_bottom_app_bar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/option_4_bottom_app_bar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:gravity="center"
|
||||
android:background="?attr/selectableItemBackgroundBorderless" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.bottomappbar.BottomAppBar>
|
Loading…
Reference in New Issue
Block a user