diff --git a/app/src/main/java/com/nextcloud/ui/composeActivity/ComposeActivity.kt b/app/src/main/java/com/nextcloud/ui/composeActivity/ComposeActivity.kt
index c57b39a203..cfedceeabf 100644
--- a/app/src/main/java/com/nextcloud/ui/composeActivity/ComposeActivity.kt
+++ b/app/src/main/java/com/nextcloud/ui/composeActivity/ComposeActivity.kt
@@ -53,11 +53,14 @@ class ComposeActivity : DrawerActivity() {
val titleId = intent.getIntExtra(TITLE, R.string.empty)
menuItemId = intent.getIntExtra(MENU_ITEM, -1)
- setupToolbar()
- updateActionBarTitleAndHomeButtonByString(getString(titleId))
-
if (menuItemId != -1) {
setupDrawer(menuItemId!!)
+ } else {
+ setupDrawer()
+ }
+
+ setupToolbarShowOnlyMenuButtonAndTitle(getString(titleId)) {
+ toggleDrawer()
}
binding.composeView.setContent {
@@ -80,7 +83,7 @@ class ComposeActivity : DrawerActivity() {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
android.R.id.home -> {
- if (isDrawerOpen) closeDrawer() else openDrawer()
+ toggleDrawer()
true
}
else -> super.onOptionsItemSelected(item)
diff --git a/app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java
index a217021eee..dd34c36d00 100644
--- a/app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java
+++ b/app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java
@@ -506,6 +506,8 @@ public abstract class DrawerActivity extends ToolbarActivity
intent.putExtra(FileDisplayActivity.DRAWER_MENU_ID, menuItem.getItemId());
startActivity(intent);
}
+
+ closeDrawer();
} else if (itemId == R.id.nav_favorites) {
handleSearchEvents(new SearchEvent("", SearchRemoteOperation.SearchType.FAVORITE_SEARCH),
menuItem.getItemId());
@@ -681,6 +683,14 @@ public abstract class DrawerActivity extends ToolbarActivity
return mDrawerLayout != null && mDrawerLayout.isDrawerOpen(GravityCompat.START);
}
+ public void toggleDrawer() {
+ if (isDrawerOpen()) {
+ closeDrawer();
+ } else {
+ openDrawer();
+ }
+ }
+
/**
* closes the drawer.
*/
diff --git a/app/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java
index 5e6dec41f0..b018647ed0 100644
--- a/app/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java
+++ b/app/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java
@@ -104,6 +104,22 @@ public abstract class ToolbarActivity extends BaseActivity implements Injectable
viewThemeUtils.material.colorMaterialTextButton(mSwitchAccountButton);
}
+ public void setupToolbarShowOnlyMenuButtonAndTitle(String title, View.OnClickListener toggleDrawer) {
+ setupToolbar(false, false);
+
+ ActionBar actionBar = getSupportActionBar();
+ if (actionBar != null) {
+ actionBar.setDisplayShowTitleEnabled(false);
+ }
+
+ LinearLayout toolbar = findViewById(R.id.toolbar_linear_layout);
+ MaterialButton menuButton = findViewById(R.id.toolbar_menu_button);
+ MaterialTextView titleTextView = findViewById(R.id.toolbar_title);
+ titleTextView.setText(title);
+ toolbar.setVisibility(View.VISIBLE);
+ menuButton.setOnClickListener(toggleDrawer);
+ }
+
public void setupToolbar() {
setupToolbar(false, false);
}
@@ -278,7 +294,7 @@ public abstract class ToolbarActivity extends BaseActivity implements Injectable
public void clearToolbarSubtitle() {
ActionBar actionBar = getSupportActionBar();
- if(actionBar != null){
+ if (actionBar != null) {
actionBar.setSubtitle(null);
}
}
diff --git a/app/src/main/res/layout/toolbar_standard.xml b/app/src/main/res/layout/toolbar_standard.xml
index 41b3049813..c499ef9a97 100644
--- a/app/src/main/res/layout/toolbar_standard.xml
+++ b/app/src/main/res/layout/toolbar_standard.xml
@@ -114,6 +114,42 @@
+
+
+
+
+
+
+
+
+