diff --git a/app/src/main/java/com/f0x1d/logfox/extensions/views/widgets/ToolbarExtensions.kt b/app/src/main/java/com/f0x1d/logfox/extensions/views/widgets/ToolbarExtensions.kt index 0b8ce93b..b903ff81 100644 --- a/app/src/main/java/com/f0x1d/logfox/extensions/views/widgets/ToolbarExtensions.kt +++ b/app/src/main/java/com/f0x1d/logfox/extensions/views/widgets/ToolbarExtensions.kt @@ -2,7 +2,6 @@ package com.f0x1d.logfox.extensions.views.widgets import android.view.View import androidx.appcompat.widget.Toolbar -import androidx.fragment.app.FragmentActivity import androidx.navigation.findNavController import com.f0x1d.logfox.R @@ -16,10 +15,6 @@ fun Toolbar.setupBackButtonForNavController() = setupBackButton { findNavController().popBackStack() } -fun Toolbar.setupBackButtonForBackPressedDispatcher(activity: FragmentActivity) = setupBackButton { - activity.onBackPressedDispatcher.onBackPressed() -} - fun Toolbar.setupCloseButton() { setNavigationIcon(R.drawable.ic_clear) setNavigationContentDescription(R.string.close) diff --git a/app/src/main/java/com/f0x1d/logfox/ui/fragment/LogsFragment.kt b/app/src/main/java/com/f0x1d/logfox/ui/fragment/LogsFragment.kt index 381a88ea..79a6d9f8 100644 --- a/app/src/main/java/com/f0x1d/logfox/ui/fragment/LogsFragment.kt +++ b/app/src/main/java/com/f0x1d/logfox/ui/fragment/LogsFragment.kt @@ -21,7 +21,7 @@ import com.f0x1d.logfox.extensions.sendStopService import com.f0x1d.logfox.extensions.startLoggingService import com.f0x1d.logfox.extensions.views.widgets.invalidateNavigationButton import com.f0x1d.logfox.extensions.views.widgets.setClickListenerOn -import com.f0x1d.logfox.extensions.views.widgets.setupBackButtonForBackPressedDispatcher +import com.f0x1d.logfox.extensions.views.widgets.setupBackButtonForNavController import com.f0x1d.logfox.extensions.views.widgets.setupCloseButton import com.f0x1d.logfox.ui.fragment.base.BaseViewModelFragment import com.f0x1d.logfox.viewmodel.LogsViewModel @@ -207,8 +207,7 @@ class LogsFragment: BaseViewModelFragment(), } } } else if (viewModel.viewingFile) - // For new activities with opened files - setupBackButtonForBackPressedDispatcher(requireActivity()) + setupBackButtonForNavController() else invalidateNavigationButton() }