reference the supportactionbar for changing the title
This commit is contained in:
parent
68f4287427
commit
4cb647e84b
|
@ -108,7 +108,7 @@ class EventActivity : SimpleActivity() {
|
||||||
val realStart = if (mEventOccurrenceTS == 0) mEvent.startTS else mEventOccurrenceTS
|
val realStart = if (mEventOccurrenceTS == 0) mEvent.startTS else mEventOccurrenceTS
|
||||||
val duration = mEvent.endTS - mEvent.startTS
|
val duration = mEvent.endTS - mEvent.startTS
|
||||||
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN)
|
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)
|
mEventStartDateTime = Formatter.getDateTimeFromTS(realStart)
|
||||||
mEventEndDateTime = Formatter.getDateTimeFromTS(realStart + duration)
|
mEventEndDateTime = Formatter.getDateTimeFromTS(realStart + duration)
|
||||||
event_title.setText(mEvent.title)
|
event_title.setText(mEvent.title)
|
||||||
|
@ -129,7 +129,7 @@ class EventActivity : SimpleActivity() {
|
||||||
|
|
||||||
private fun setupNewEvent(dateTime: DateTime) {
|
private fun setupNewEvent(dateTime: DateTime) {
|
||||||
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE)
|
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
|
mEventStartDateTime = dateTime
|
||||||
|
|
||||||
val addHours = if (intent.getBooleanExtra(NEW_EVENT_SET_HOUR_DURATION, false)) 1 else 0
|
val addHours = if (intent.getBooleanExtra(NEW_EVENT_SET_HOUR_DURATION, false)) 1 else 0
|
||||||
|
|
|
@ -570,7 +570,7 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun resetTitle() {
|
private fun resetTitle() {
|
||||||
title = getString(R.string.app_launcher_name)
|
supportActionBar?.title = getString(R.string.app_launcher_name)
|
||||||
supportActionBar?.subtitle = ""
|
supportActionBar?.subtitle = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -595,7 +595,7 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
if (config.storedView == YEARLY_VIEW) {
|
if (config.storedView == YEARLY_VIEW) {
|
||||||
val dateTime = Formatter.getDateTimeFromCode(codes[position])
|
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)
|
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) {
|
fun updateHoursTopMargin(margin: Int) {
|
||||||
|
@ -689,10 +689,10 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
||||||
var newTitle = startMonthName
|
var newTitle = startMonthName
|
||||||
if (startDateTime.year != DateTime().year)
|
if (startDateTime.year != DateTime().year)
|
||||||
newTitle += " - ${startDateTime.year}"
|
newTitle += " - ${startDateTime.year}"
|
||||||
title = newTitle
|
supportActionBar?.title = newTitle
|
||||||
} else {
|
} else {
|
||||||
val endMonthName = Formatter.getMonthName(applicationContext, endDateTime.monthOfYear)
|
val endMonthName = Formatter.getMonthName(applicationContext, endDateTime.monthOfYear)
|
||||||
title = "$startMonthName - $endMonthName"
|
supportActionBar?.title = "$startMonthName - $endMonthName"
|
||||||
}
|
}
|
||||||
supportActionBar?.subtitle = "${getString(R.string.week)} ${startDateTime.plusDays(3).weekOfWeekyear}"
|
supportActionBar?.subtitle = "${getString(R.string.week)} ${startDateTime.plusDays(3).weekOfWeekyear}"
|
||||||
}
|
}
|
||||||
|
@ -716,14 +716,15 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
||||||
|
|
||||||
override fun onPageSelected(position: Int) {
|
override fun onPageSelected(position: Int) {
|
||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
if (position < years.size)
|
if (position < years.size) {
|
||||||
title = "${getString(R.string.app_launcher_name)} - ${years[position]}"
|
supportActionBar?.title = "${getString(R.string.app_launcher_name)} - ${years[position]}"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
currentItem = mDefaultYearlyPage
|
currentItem = mDefaultYearlyPage
|
||||||
beVisible()
|
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()
|
calendar_event_list_holder.beGone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue