diff --git a/app/build.gradle b/app/build.gradle index 7a70833f8..5674bd3bd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt index dae9991d6..5ef6e3fc7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt @@ -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 diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt index dda371dd2..b252f0066 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt @@ -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() { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/DayFragmentsHolder.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/DayFragmentsHolder.kt index 4dbdf9cb8..28e9bf45d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/DayFragmentsHolder.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/DayFragmentsHolder.kt @@ -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 diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/EventListFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/EventListFragment.kt index 7df1f88a5..b37f3f4aa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/EventListFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/EventListFragment.kt @@ -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!!) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/MonthFragmentsHolder.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/MonthFragmentsHolder.kt index b2d0fc1cc..22927353b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/MonthFragmentsHolder.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/MonthFragmentsHolder.kt @@ -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 diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/WeekFragmentsHolder.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/WeekFragmentsHolder.kt index ff1cf6fd0..a2e431d24 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/WeekFragmentsHolder.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/WeekFragmentsHolder.kt @@ -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() { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/YearFragmentsHolder.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/YearFragmentsHolder.kt index a606fd003..5388a1f0b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/YearFragmentsHolder.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/YearFragmentsHolder.kt @@ -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!!)