Skip to content

Commit

Permalink
[refactor]: removed unused Toolbar extension
Browse files Browse the repository at this point in the history
  • Loading branch information
F0x1d committed Oct 29, 2023
1 parent 069cd74 commit 6a22c70
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -207,8 +207,7 @@ class LogsFragment: BaseViewModelFragment<LogsViewModel, FragmentLogsBinding>(),
}
}
} else if (viewModel.viewingFile)
// For new activities with opened files
setupBackButtonForBackPressedDispatcher(requireActivity())
setupBackButtonForNavController()

else invalidateNavigationButton()
}
Expand Down

0 comments on commit 6a22c70

Please sign in to comment.