Merge pull request #14196 from nextcloud/feature/add-bottom-bar-to-assistant-screen

Feature - Add Bottom Nav Bar To The Assistant Screen
This commit is contained in:
Alper Öztürk 2024-12-20 08:58:34 +01:00 committed by GitHub
commit cd6ec5ff7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 6 deletions

View file

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

View file

@ -262,9 +262,10 @@ public abstract class DrawerActivity extends ToolbarActivity
if (this instanceof FileDisplayActivity fda) { if (this instanceof FileDisplayActivity fda) {
fda.browseToRoot(); fda.browseToRoot();
} }
EventBus.getDefault().post(new ChangeMenuEvent());
} else if (menuItemId == R.id.nav_favorites) { } else if (menuItemId == R.id.nav_favorites) {
handleSearchEvents(new SearchEvent("", SearchRemoteOperation.SearchType.FAVORITE_SEARCH), menuItemId); handleSearchEvents(new SearchEvent("", SearchRemoteOperation.SearchType.FAVORITE_SEARCH), menuItemId);
} else if (menuItemId == R.id.nav_assistant) { } else if (menuItemId == R.id.nav_assistant && !(this instanceof ComposeActivity)) {
startComposeActivity(ComposeDestination.AssistantScreen, R.string.assistant_screen_top_bar_title); startComposeActivity(ComposeDestination.AssistantScreen, R.string.assistant_screen_top_bar_title);
} else if (menuItemId == R.id.nav_gallery) { } else if (menuItemId == R.id.nav_gallery) {
startPhotoSearch(menuItem.getItemId()); startPhotoSearch(menuItem.getItemId());
@ -949,7 +950,7 @@ public abstract class DrawerActivity extends ToolbarActivity
if (bottomNavigationView != null) { if (bottomNavigationView != null) {
MenuItem menuItem = bottomNavigationView.getMenu().findItem(menuItemId); 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) { if (menuItem != null && !menuItem.isChecked() && menuItem.getItemId() != R.id.nav_assistant) {
menuItem.setChecked(true); menuItem.setChecked(true);
} }

View file

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