mirror of
				https://github.com/SimpleMobileTools/Simple-Calendar.git
				synced 2025-06-05 21:59:17 +02:00 
			
		
		
		
	close search on pressing back + removing some supportactionbar references
This commit is contained in:
		| @@ -70,7 +70,7 @@ android { | |||||||
| } | } | ||||||
|  |  | ||||||
| dependencies { | dependencies { | ||||||
|     implementation 'com.github.SimpleMobileTools:Simple-Commons:8f22bc5532' |     implementation 'com.github.SimpleMobileTools:Simple-Commons:92fd18b221' | ||||||
|     implementation 'androidx.multidex:multidex:2.0.1' |     implementation 'androidx.multidex:multidex:2.0.1' | ||||||
|     implementation 'androidx.constraintlayout:constraintlayout:2.1.4' |     implementation 'androidx.constraintlayout:constraintlayout:2.1.4' | ||||||
|     implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' |     implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' | ||||||
|   | |||||||
| @@ -255,7 +255,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { | |||||||
|                 R.id.export_events -> tryExportEvents() |                 R.id.export_events -> tryExportEvents() | ||||||
|                 R.id.settings -> launchSettings() |                 R.id.settings -> launchSettings() | ||||||
|                 R.id.about -> launchAbout() |                 R.id.about -> launchAbout() | ||||||
|                 android.R.id.home -> onBackPressed() |  | ||||||
|                 else -> return@setOnMenuItemClickListener false |                 else -> return@setOnMenuItemClickListener false | ||||||
|             } |             } | ||||||
|             return@setOnMenuItemClickListener true |             return@setOnMenuItemClickListener true | ||||||
| @@ -263,6 +262,9 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     override fun onBackPressed() { |     override fun onBackPressed() { | ||||||
|  |         if (mIsSearchOpen) { | ||||||
|  |             closeSearch() | ||||||
|  |         } else { | ||||||
|             swipe_refresh_layout.isRefreshing = false |             swipe_refresh_layout.isRefreshing = false | ||||||
|             checkSwipeRefreshAvailability() |             checkSwipeRefreshAvailability() | ||||||
|             when { |             when { | ||||||
| @@ -271,6 +273,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { | |||||||
|                 else -> super.onBackPressed() |                 else -> super.onBackPressed() | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|     override fun onNewIntent(intent: Intent?) { |     override fun onNewIntent(intent: Intent?) { | ||||||
|         super.onNewIntent(intent) |         super.onNewIntent(intent) | ||||||
| @@ -929,7 +932,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { | |||||||
|  |  | ||||||
|         fragment.arguments = bundle |         fragment.arguments = bundle | ||||||
|         supportFragmentManager.beginTransaction().add(R.id.fragments_holder, fragment).commitNow() |         supportFragmentManager.beginTransaction().add(R.id.fragments_holder, fragment).commitNow() | ||||||
|         supportActionBar?.setDisplayHomeAsUpEnabled(false) |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private fun fixDayCode(dayCode: String? = null): String? = when { |     private fun fixDayCode(dayCode: String? = null): String? = when { | ||||||
| @@ -989,7 +991,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { | |||||||
|         supportFragmentManager.beginTransaction().add(R.id.fragments_holder, fragment).commitNow() |         supportFragmentManager.beginTransaction().add(R.id.fragments_holder, fragment).commitNow() | ||||||
|         resetActionBarTitle() |         resetActionBarTitle() | ||||||
|         calendar_fab.beVisible() |         calendar_fab.beVisible() | ||||||
|         supportActionBar?.setDisplayHomeAsUpEnabled(true) |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     fun openDayFromMonthly(dateTime: DateTime) { |     fun openDayFromMonthly(dateTime: DateTime) { | ||||||
| @@ -1004,7 +1005,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { | |||||||
|         fragment.arguments = bundle |         fragment.arguments = bundle | ||||||
|         try { |         try { | ||||||
|             supportFragmentManager.beginTransaction().add(R.id.fragments_holder, fragment).commitNow() |             supportFragmentManager.beginTransaction().add(R.id.fragments_holder, fragment).commitNow() | ||||||
|             supportActionBar?.setDisplayHomeAsUpEnabled(true) |  | ||||||
|         } catch (e: Exception) { |         } catch (e: Exception) { | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -1027,7 +1027,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { | |||||||
|             updateActionBarTitle() |             updateActionBarTitle() | ||||||
|         } |         } | ||||||
|         calendar_fab.beGoneIf(currentFragments.size == 1 && config.storedView == YEARLY_VIEW) |         calendar_fab.beGoneIf(currentFragments.size == 1 && config.storedView == YEARLY_VIEW) | ||||||
|         supportActionBar?.setDisplayHomeAsUpEnabled(currentFragments.size > 1) |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private fun refreshViewPager() { |     private fun refreshViewPager() { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user