add bottom nav bar to the assistant screen

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2024-12-17 16:53:39 +01:00 committed by Alper Öztürk
parent 63cea252c5
commit 84ec717a57
3 changed files with 26 additions and 6 deletions

View file

@ -84,6 +84,9 @@ class ComposeActivity : DrawerActivity() {
}
if (destination == ComposeDestination.AssistantScreen) {
val assistantMenuItem = binding.bottomNavigation.menu.findItem(R.id.nav_assistant)
assistantMenuItem.setChecked(true)
nextcloudClient?.let { client ->
AssistantScreen(
viewModel = AssistantViewModel(

View file

@ -255,7 +255,14 @@ public abstract class DrawerActivity extends ToolbarActivity
@SuppressFBWarnings("RV")
private void handleBottomNavigationViewClicks() {
bottomNavigationView.setOnItemSelectedListener(menuItem -> {
menuItemId = menuItem.getItemId();
int previousMenuItemId = menuItemId;
int newMenuItemId = menuItem.getItemId();
if (previousMenuItemId == newMenuItemId) {
return false;
}
menuItemId = newMenuItemId;
if (menuItemId == R.id.nav_all_files) {
showFiles(false,false);
@ -949,7 +956,7 @@ public abstract class DrawerActivity extends ToolbarActivity
if (bottomNavigationView != null) {
MenuItem menuItem = bottomNavigationView.getMenu().findItem(menuItemId);
// Don't highlight assistant bottom navigation item because Assistant screen doesn't have bottom navigation bar
// Don't highlight assistant bottom navigation item because Assistant screen doesn't have same bottom navigation bar
if (menuItem != null && !menuItem.isChecked() && menuItem.getItemId() != R.id.nav_assistant) {
menuItem.setChecked(true);
}

View file

@ -6,13 +6,13 @@
~ SPDX-FileCopyrightText: 2024 Nextcloud GmbH
~ SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
-->
<androidx.drawerlayout.widget.DrawerLayout
android:id="@+id/drawer_layout"
<androidx.drawerlayout.widget.DrawerLayout android:id="@+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true">
android:focusable="true"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="match_parent"
@ -23,8 +23,18 @@
<androidx.compose.ui.platform.ComposeView
android:id="@+id/compose_view"
android:layout_weight="9"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="0dp"/>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_weight="1"
app:labelVisibilityMode="labeled"
android:layout_width="match_parent"
android:layout_height="0dp"
app:menu="@menu/bottom_navigation_menu"
app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior" />
</LinearLayout>