fix #132, refresh the main screen if the date changed since last run
This commit is contained in:
parent
b0b7b4eb2c
commit
183ef15de2
|
@ -53,6 +53,7 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
|||
private var mStoredTextColor = 0
|
||||
private var mStoredBackgroundColor = 0
|
||||
private var mStoredPrimaryColor = 0
|
||||
private var mStoredDayCode = ""
|
||||
private var mStoredIsSundayFirst = false
|
||||
private var mStoredUse24HourFormat = false
|
||||
private var mShouldFilterBeVisible = false
|
||||
|
@ -78,12 +79,16 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
|||
if (intent?.action == Intent.ACTION_VIEW && intent.data != null) {
|
||||
tryImportEventsFromFile(intent.data)
|
||||
}
|
||||
storeStateVariables()
|
||||
updateViewPager()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (mStoredTextColor != config.textColor || mStoredBackgroundColor != config.backgroundColor || mStoredPrimaryColor != config.primaryColor)
|
||||
if (mStoredTextColor != config.textColor || mStoredBackgroundColor != config.backgroundColor || mStoredPrimaryColor != config.primaryColor
|
||||
|| mStoredDayCode != getCurrentDayCode()) {
|
||||
updateViewPager()
|
||||
}
|
||||
|
||||
dbHelper.getEventTypes {
|
||||
eventTypeColors.clear()
|
||||
|
@ -91,10 +96,8 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
|||
mShouldFilterBeVisible = eventTypeColors.size() > 1 || config.displayEventTypes.isEmpty()
|
||||
invalidateOptionsMenu()
|
||||
}
|
||||
mStoredTextColor = config.textColor
|
||||
mStoredPrimaryColor = config.primaryColor
|
||||
mStoredBackgroundColor = config.backgroundColor
|
||||
|
||||
storeStateVariables()
|
||||
if (config.storedView == WEEKLY_VIEW) {
|
||||
if (mStoredIsSundayFirst != config.isSundayFirst || mStoredUse24HourFormat != config.use24hourFormat) {
|
||||
fillWeeklyViewPager()
|
||||
|
@ -144,6 +147,15 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
|||
}
|
||||
}
|
||||
|
||||
private fun storeStateVariables() {
|
||||
mStoredTextColor = config.textColor
|
||||
mStoredPrimaryColor = config.primaryColor
|
||||
mStoredBackgroundColor = config.backgroundColor
|
||||
mStoredDayCode = getCurrentDayCode()
|
||||
}
|
||||
|
||||
private fun getCurrentDayCode() = Formatter.getDayCodeFromTS((System.currentTimeMillis() / 1000).toInt())
|
||||
|
||||
private fun showViewDialog() {
|
||||
val res = resources
|
||||
val items = arrayListOf(
|
||||
|
|
Loading…
Reference in New Issue