@@ -158,20 +158,13 @@ class MainActivity : SimpleActivity() {
158158 private val binding by viewBinding(ActivityMainBinding ::inflate)
159159
160160 override fun onCreate (savedInstanceState : Bundle ? ) {
161- isMaterialActivity = true
162161 super .onCreate(savedInstanceState)
163162 setContentView(binding.root)
164163 appLaunched(BuildConfig .APPLICATION_ID )
165164 setupOptionsMenu()
166165 refreshMenuItems()
167166
168- updateMaterialActivityViews(
169- mainCoordinatorLayout = binding.mainCoordinator,
170- nestedView = null ,
171- useTransparentNavigation = false ,
172- useTopSearchMenu = false
173- )
174-
167+ setupEdgeToEdge(padBottomImeAndSystem = listOf (binding.viewPager))
175168 searchQueryET = findViewById(org.fossify.commons.R .id.search_query)
176169 searchPrevBtn = findViewById(org.fossify.commons.R .id.search_previous)
177170 searchNextBtn = findViewById(org.fossify.commons.R .id.search_next)
@@ -204,7 +197,7 @@ class MainActivity : SimpleActivity() {
204197
205198 override fun onResume () {
206199 super .onResume()
207- setupToolbar (binding.mainToolbar )
200+ setupTopAppBar (binding.mainAppbar )
208201 if (storedEnableLineWrap != config.enableLineWrap) {
209202 initViewPager()
210203 }
@@ -236,7 +229,7 @@ class MainActivity : SimpleActivity() {
236229 it.applyColorFilter(contrastColor)
237230 }
238231
239- updateTopBarColors(binding.mainToolbar , getProperBackgroundColor())
232+ updateTopBarColors(binding.mainAppbar , getProperBackgroundColor())
240233 }
241234
242235 override fun onPause () {
@@ -348,8 +341,8 @@ class MainActivity : SimpleActivity() {
348341 }
349342 }
350343
351- override fun onBackPressed () {
352- if (! config.autosaveNotes && mAdapter?.anyHasUnsavedChanges() == true ) {
344+ override fun onBackPressedCompat (): Boolean {
345+ return if (! config.autosaveNotes && mAdapter?.anyHasUnsavedChanges() == true ) {
353346 ConfirmationAdvancedDialog (
354347 activity = this ,
355348 message = " " ,
@@ -361,13 +354,15 @@ class MainActivity : SimpleActivity() {
361354 mAdapter?.saveAllFragmentTexts()
362355 }
363356 appLockManager.lock()
364- super .onBackPressed ()
357+ performDefaultBack ()
365358 }
359+ true
366360 } else if (isSearchActive) {
367361 closeSearch()
362+ true
368363 } else {
369364 appLockManager.lock()
370- super .onBackPressed()
365+ false
371366 }
372367 }
373368
0 commit comments