properly update actionbar title, with properly set text color
This commit is contained in:
parent
5cb87c1f91
commit
b8e53b6b87
|
@ -46,7 +46,7 @@ ext {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:4.4.13'
|
||||
implementation 'com.simplemobiletools:commons:4.4.16'
|
||||
implementation 'joda-time:joda-time:2.9.9'
|
||||
implementation 'com.facebook.stetho:stetho:1.5.0'
|
||||
implementation 'com.android.support:multidex:1.0.3'
|
||||
|
|
|
@ -151,7 +151,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)
|
||||
supportActionBar?.title = resources.getString(R.string.edit_event)
|
||||
updateActionBarTitle(getString(R.string.edit_event))
|
||||
mEventStartDateTime = Formatter.getDateTimeFromTS(realStart)
|
||||
mEventEndDateTime = Formatter.getDateTimeFromTS(realStart + duration)
|
||||
event_title.setText(mEvent.title)
|
||||
|
@ -174,7 +174,7 @@ class EventActivity : SimpleActivity() {
|
|||
|
||||
private fun setupNewEvent() {
|
||||
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE)
|
||||
supportActionBar?.title = resources.getString(R.string.new_event)
|
||||
updateActionBarTitle(getString(R.string.new_event))
|
||||
val isLastCaldavCalendarOK = config.caldavSync && config.getSyncedCalendarIdsAsList().contains(config.lastUsedCaldavCalendarId.toString())
|
||||
mEventCalendarId = if (isLastCaldavCalendarOK) config.lastUsedCaldavCalendarId else STORED_LOCALLY_ONLY
|
||||
|
||||
|
|
|
@ -328,8 +328,8 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||
}
|
||||
|
||||
private fun resetActionBarTitle() {
|
||||
supportActionBar?.title = getString(R.string.app_launcher_name)
|
||||
supportActionBar?.subtitle = ""
|
||||
updateActionBarTitle(getString(R.string.app_launcher_name))
|
||||
updateActionBarSubtitle("")
|
||||
}
|
||||
|
||||
private fun showFilterDialog() {
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.simplemobiletools.calendar.extensions.config
|
|||
import com.simplemobiletools.calendar.helpers.DAY_CODE
|
||||
import com.simplemobiletools.calendar.helpers.Formatter
|
||||
import com.simplemobiletools.calendar.interfaces.NavigationListener
|
||||
import com.simplemobiletools.commons.extensions.updateActionBarTitle
|
||||
import com.simplemobiletools.commons.views.MyViewPager
|
||||
import kotlinx.android.synthetic.main.fragment_days_holder.view.*
|
||||
import org.joda.time.DateTime
|
||||
|
@ -105,7 +106,7 @@ class DayFragmentsHolder : MyFragmentHolder(), NavigationListener {
|
|||
override fun shouldGoToTodayBeVisible() = currentDayCode != todayDayCode
|
||||
|
||||
override fun updateActionBarTitle() {
|
||||
(activity as MainActivity).supportActionBar?.title = getString(R.string.app_launcher_name)
|
||||
(activity as MainActivity).updateActionBarTitle(getString(R.string.app_launcher_name))
|
||||
}
|
||||
|
||||
override fun getNewEventDayCode() = currentDayCode
|
||||
|
|
|
@ -17,10 +17,7 @@ import com.simplemobiletools.calendar.helpers.EVENT_OCCURRENCE_TS
|
|||
import com.simplemobiletools.calendar.helpers.Formatter
|
||||
import com.simplemobiletools.calendar.models.Event
|
||||
import com.simplemobiletools.calendar.models.ListEvent
|
||||
import com.simplemobiletools.commons.extensions.beGoneIf
|
||||
import com.simplemobiletools.commons.extensions.beVisibleIf
|
||||
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
|
||||
import com.simplemobiletools.commons.extensions.underlineText
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.MONTH_SECONDS
|
||||
import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener
|
||||
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||
|
@ -182,7 +179,7 @@ class EventListFragment : MyFragmentHolder(), RefreshRecyclerViewListener {
|
|||
override fun shouldGoToTodayBeVisible() = false
|
||||
|
||||
override fun updateActionBarTitle() {
|
||||
(activity as MainActivity).supportActionBar?.title = getString(R.string.app_launcher_name)
|
||||
(activity as? MainActivity)?.updateActionBarTitle(getString(R.string.app_launcher_name))
|
||||
}
|
||||
|
||||
override fun getNewEventDayCode() = Formatter.getTodayCode(context!!)
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.simplemobiletools.calendar.extensions.getMonthCode
|
|||
import com.simplemobiletools.calendar.helpers.DAY_CODE
|
||||
import com.simplemobiletools.calendar.helpers.Formatter
|
||||
import com.simplemobiletools.calendar.interfaces.NavigationListener
|
||||
import com.simplemobiletools.commons.extensions.updateActionBarTitle
|
||||
import com.simplemobiletools.commons.views.MyViewPager
|
||||
import kotlinx.android.synthetic.main.fragment_months_holder.view.*
|
||||
import org.joda.time.DateTime
|
||||
|
@ -105,7 +106,7 @@ class MonthFragmentsHolder : MyFragmentHolder(), NavigationListener {
|
|||
override fun shouldGoToTodayBeVisible() = currentDayCode.getMonthCode() != todayDayCode.getMonthCode()
|
||||
|
||||
override fun updateActionBarTitle() {
|
||||
(activity as MainActivity).supportActionBar?.title = getString(R.string.app_launcher_name)
|
||||
(activity as? MainActivity)?.updateActionBarTitle(getString(R.string.app_launcher_name))
|
||||
}
|
||||
|
||||
override fun getNewEventDayCode() = if (shouldGoToTodayBeVisible()) currentDayCode else todayDayCode
|
||||
|
|
|
@ -16,6 +16,8 @@ import com.simplemobiletools.calendar.helpers.Formatter
|
|||
import com.simplemobiletools.calendar.helpers.WEEK_START_DATE_TIME
|
||||
import com.simplemobiletools.calendar.interfaces.WeekFragmentListener
|
||||
import com.simplemobiletools.calendar.views.MyScrollView
|
||||
import com.simplemobiletools.commons.extensions.updateActionBarSubtitle
|
||||
import com.simplemobiletools.commons.extensions.updateActionBarTitle
|
||||
import com.simplemobiletools.commons.helpers.WEEK_SECONDS
|
||||
import kotlinx.android.synthetic.main.fragment_week_holder.*
|
||||
import kotlinx.android.synthetic.main.fragment_week_holder.view.*
|
||||
|
@ -112,12 +114,12 @@ class WeekFragmentsHolder : MyFragmentHolder(), WeekFragmentListener {
|
|||
if (startDateTime.year != DateTime().year) {
|
||||
newTitle += " - ${startDateTime.year}"
|
||||
}
|
||||
(activity as? MainActivity)?.supportActionBar?.title = newTitle
|
||||
(activity as MainActivity).updateActionBarTitle(newTitle)
|
||||
} else {
|
||||
val endMonthName = Formatter.getMonthName(context!!, endDateTime.monthOfYear)
|
||||
(activity as? MainActivity)?.supportActionBar?.title = "$startMonthName - $endMonthName"
|
||||
(activity as MainActivity).updateActionBarTitle("$startMonthName - $endMonthName")
|
||||
}
|
||||
(activity as? MainActivity)?.supportActionBar?.subtitle = "${getString(R.string.week)} ${startDateTime.plusDays(3).weekOfWeekyear}"
|
||||
(activity as MainActivity).updateActionBarSubtitle("${getString(R.string.week)} ${startDateTime.plusDays(3).weekOfWeekyear}")
|
||||
}
|
||||
|
||||
override fun goToToday() {
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.simplemobiletools.calendar.activities.MainActivity
|
|||
import com.simplemobiletools.calendar.adapters.MyYearPagerAdapter
|
||||
import com.simplemobiletools.calendar.extensions.config
|
||||
import com.simplemobiletools.calendar.helpers.Formatter
|
||||
import com.simplemobiletools.commons.extensions.updateActionBarTitle
|
||||
import com.simplemobiletools.commons.views.MyViewPager
|
||||
import kotlinx.android.synthetic.main.fragment_years_holder.view.*
|
||||
import org.joda.time.DateTime
|
||||
|
@ -62,7 +63,7 @@ class YearFragmentsHolder : MyFragmentHolder() {
|
|||
}
|
||||
|
||||
if (position < years.size) {
|
||||
(activity as? MainActivity)?.supportActionBar?.title = "${getString(R.string.app_launcher_name)} - ${years[position]}"
|
||||
(activity as? MainActivity)?.updateActionBarTitle("${getString(R.string.app_launcher_name)} - ${years[position]}")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -89,7 +90,7 @@ class YearFragmentsHolder : MyFragmentHolder() {
|
|||
override fun shouldGoToTodayBeVisible() = currentYear != todayYear
|
||||
|
||||
override fun updateActionBarTitle() {
|
||||
(activity as? MainActivity)?.supportActionBar?.title = "${getString(R.string.app_launcher_name)} - $currentYear"
|
||||
(activity as? MainActivity)?.updateActionBarTitle("${getString(R.string.app_launcher_name)} - $currentYear")
|
||||
}
|
||||
|
||||
override fun getNewEventDayCode() = Formatter.getTodayCode(context!!)
|
||||
|
|
Loading…
Reference in New Issue