mirror of
https://github.com/nextcloud/android.git
synced 2024-12-22 00:34:31 +03:00
fix back button behaviour
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
12509aa30b
commit
5a4378dd88
2 changed files with 1 additions and 17 deletions
|
@ -10,7 +10,6 @@ package com.nextcloud.ui.composeActivity
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import androidx.activity.OnBackPressedCallback
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
@ -56,8 +55,6 @@ class ComposeActivity : DrawerActivity() {
|
||||||
openDrawer()
|
openDrawer()
|
||||||
}
|
}
|
||||||
|
|
||||||
handleOnBackPressed()
|
|
||||||
|
|
||||||
binding.composeView.setContent {
|
binding.composeView.setContent {
|
||||||
MaterialTheme(
|
MaterialTheme(
|
||||||
colorScheme = viewThemeUtils.getColorScheme(this),
|
colorScheme = viewThemeUtils.getColorScheme(this),
|
||||||
|
@ -68,20 +65,6 @@ class ComposeActivity : DrawerActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: show previous screen
|
|
||||||
private val onBackPressedCallback = object : OnBackPressedCallback(true) {
|
|
||||||
override fun handleOnBackPressed() {
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun handleOnBackPressed() {
|
|
||||||
onBackPressedDispatcher.addCallback(
|
|
||||||
this,
|
|
||||||
onBackPressedCallback
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
return when (item.itemId) {
|
return when (item.itemId) {
|
||||||
android.R.id.home -> {
|
android.R.id.home -> {
|
||||||
|
|
|
@ -262,6 +262,7 @@ 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 && !(this instanceof ComposeActivity)) {
|
} else if (menuItemId == R.id.nav_assistant && !(this instanceof ComposeActivity)) {
|
||||||
|
|
Loading…
Reference in a new issue