fix back button behaviour

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2024-12-18 10:33:57 +01:00 committed by Alper Öztürk
parent 12509aa30b
commit 5a4378dd88
2 changed files with 1 additions and 17 deletions

View file

@ -10,7 +10,6 @@ package com.nextcloud.ui.composeActivity
import android.content.Context
import android.os.Bundle
import android.view.MenuItem
import androidx.activity.OnBackPressedCallback
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@ -56,8 +55,6 @@ class ComposeActivity : DrawerActivity() {
openDrawer()
}
handleOnBackPressed()
binding.composeView.setContent {
MaterialTheme(
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 {
return when (item.itemId) {
android.R.id.home -> {

View file

@ -262,6 +262,7 @@ public abstract class DrawerActivity extends ToolbarActivity
if (this instanceof FileDisplayActivity fda) {
fda.browseToRoot();
}
EventBus.getDefault().post(new ChangeMenuEvent());
} else if (menuItemId == R.id.nav_favorites) {
handleSearchEvents(new SearchEvent("", SearchRemoteOperation.SearchType.FAVORITE_SEARCH), menuItemId);
} else if (menuItemId == R.id.nav_assistant && !(this instanceof ComposeActivity)) {