cleanup to new base controller logic

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2021-06-10 00:38:36 +02:00
parent 73e0b4e719
commit ac986c61aa
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
3 changed files with 5 additions and 17 deletions

View file

@ -137,12 +137,6 @@ class GeocodingController(args: Bundle) :
searchView?.clearFocus() searchView?.clearFocus()
} }
override fun onPrepareOptionsMenu(menu: Menu) {
super.onPrepareOptionsMenu(menu)
showToolbar()
actionBar?.setIcon(ColorDrawable(resources!!.getColor(android.R.color.transparent)))
}
override fun onQueryTextSubmit(query: String?): Boolean { override fun onQueryTextSubmit(query: String?): Boolean {
this.query = query this.query = query
searchLocation() searchLocation()

View file

@ -155,11 +155,14 @@ class LocationPickerController(args: Bundle) :
override fun onPrepareOptionsMenu(menu: Menu) { override fun onPrepareOptionsMenu(menu: Menu) {
super.onPrepareOptionsMenu(menu) super.onPrepareOptionsMenu(menu)
showToolbar()
actionBar?.setIcon(ColorDrawable(resources!!.getColor(android.R.color.transparent)))
actionBar?.title = context!!.getString(R.string.nc_share_location) actionBar?.title = context!!.getString(R.string.nc_share_location)
} }
override val title: String
get() =
resources!!.getString(R.string.nc_share_location)
override fun onViewBound(view: View) { override fun onViewBound(view: View) {
setLocationDescription(false, receivedChosenGeocodingResult) setLocationDescription(false, receivedChosenGeocodingResult)
binding.shareLocation.isClickable = false binding.shareLocation.isClickable = false

View file

@ -172,15 +172,6 @@ abstract class NewBaseController(@LayoutRes var layoutRes: Int, args: Bundle? =
binding.searchToolbar.layoutParams = layoutParams binding.searchToolbar.layoutParams = layoutParams
} }
protected fun showToolbar() {
if (isValidActivity(activity)) {
val activity = activity as MainActivity
showToolbar(activity.binding)
colorizeStatusBar(false, activity, resources)
colorizeNavigationBar(activity, resources)
}
}
private fun showToolbar(binding: ActivityMainBinding) { private fun showToolbar(binding: ActivityMainBinding) {
val layoutParams = binding.searchToolbar.layoutParams as AppBarLayout.LayoutParams val layoutParams = binding.searchToolbar.layoutParams as AppBarLayout.LayoutParams
binding.searchToolbar.visibility = View.GONE binding.searchToolbar.visibility = View.GONE