reference the supportactionbar for changing the title

This commit is contained in:
tibbi 2017-12-05 18:58:46 +01:00
parent 68f4287427
commit 4cb647e84b
2 changed files with 11 additions and 10 deletions

View File

@ -108,7 +108,7 @@ class EventActivity : SimpleActivity() {
val realStart = if (mEventOccurrenceTS == 0) mEvent.startTS else mEventOccurrenceTS
val duration = mEvent.endTS - mEvent.startTS
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN)
title = resources.getString(R.string.edit_event)
supportActionBar?.title = resources.getString(R.string.edit_event)
mEventStartDateTime = Formatter.getDateTimeFromTS(realStart)
mEventEndDateTime = Formatter.getDateTimeFromTS(realStart + duration)
event_title.setText(mEvent.title)
@ -129,7 +129,7 @@ class EventActivity : SimpleActivity() {
private fun setupNewEvent(dateTime: DateTime) {
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE)
title = resources.getString(R.string.new_event)
supportActionBar?.title = resources.getString(R.string.new_event)
mEventStartDateTime = dateTime
val addHours = if (intent.getBooleanExtra(NEW_EVENT_SET_HOUR_DURATION, false)) 1 else 0

View File

@ -570,7 +570,7 @@ class MainActivity : SimpleActivity(), NavigationListener {
}
private fun resetTitle() {
title = getString(R.string.app_launcher_name)
supportActionBar?.title = getString(R.string.app_launcher_name)
supportActionBar?.subtitle = ""
}
@ -595,7 +595,7 @@ class MainActivity : SimpleActivity(), NavigationListener {
invalidateOptionsMenu()
if (config.storedView == YEARLY_VIEW) {
val dateTime = Formatter.getDateTimeFromCode(codes[position])
title = "${getString(R.string.app_launcher_name)} - ${Formatter.getYear(dateTime)}"
supportActionBar?.title = "${getString(R.string.app_launcher_name)} - ${Formatter.getYear(dateTime)}"
}
}
})
@ -665,7 +665,7 @@ class MainActivity : SimpleActivity(), NavigationListener {
weeklyAdapter.updateScrollY(week_view_view_pager.currentItem, y)
}
})
week_view_hours_scrollview.setOnTouchListener{ view, motionEvent -> true }
week_view_hours_scrollview.setOnTouchListener { view, motionEvent -> true }
}
fun updateHoursTopMargin(margin: Int) {
@ -689,10 +689,10 @@ class MainActivity : SimpleActivity(), NavigationListener {
var newTitle = startMonthName
if (startDateTime.year != DateTime().year)
newTitle += " - ${startDateTime.year}"
title = newTitle
supportActionBar?.title = newTitle
} else {
val endMonthName = Formatter.getMonthName(applicationContext, endDateTime.monthOfYear)
title = "$startMonthName - $endMonthName"
supportActionBar?.title = "$startMonthName - $endMonthName"
}
supportActionBar?.subtitle = "${getString(R.string.week)} ${startDateTime.plusDays(3).weekOfWeekyear}"
}
@ -716,14 +716,15 @@ class MainActivity : SimpleActivity(), NavigationListener {
override fun onPageSelected(position: Int) {
invalidateOptionsMenu()
if (position < years.size)
title = "${getString(R.string.app_launcher_name)} - ${years[position]}"
if (position < years.size) {
supportActionBar?.title = "${getString(R.string.app_launcher_name)} - ${years[position]}"
}
}
})
currentItem = mDefaultYearlyPage
beVisible()
}
title = "${getString(R.string.app_launcher_name)} - ${years[years.size / 2]}"
supportActionBar?.title = "${getString(R.string.app_launcher_name)} - ${years[years.size / 2]}"
calendar_event_list_holder.beGone()
}