fix some glitches with blank screens at opening the app through widgets

This commit is contained in:
tibbi 2018-02-05 14:44:20 +01:00
parent 6f93c21702
commit 5eb3fa6b91

View File

@ -97,7 +97,9 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
} }
} }
if (!checkOpenIntents()) {
updateViewPager() updateViewPager()
}
if (!hasPermission(PERMISSION_WRITE_CALENDAR) || !hasPermission(PERMISSION_READ_CALENDAR)) { if (!hasPermission(PERMISSION_WRITE_CALENDAR) || !hasPermission(PERMISSION_READ_CALENDAR)) {
config.caldavSync = false config.caldavSync = false
@ -106,8 +108,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
if (config.caldavSync) { if (config.caldavSync) {
refreshCalDAVCalendars(false) refreshCalDAVCalendars(false)
} }
checkOpenIntents()
} }
override fun onResume() { override fun onResume() {
@ -245,7 +245,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
mSearchMenuItem?.collapseActionView() mSearchMenuItem?.collapseActionView()
} }
private fun checkOpenIntents() { private fun checkOpenIntents(): Boolean {
val dayCodeToOpen = intent.getStringExtra(DAY_CODE) ?: "" val dayCodeToOpen = intent.getStringExtra(DAY_CODE) ?: ""
val openMonth = intent.getBooleanExtra(OPEN_MONTH, false) val openMonth = intent.getBooleanExtra(OPEN_MONTH, false)
intent.removeExtra(OPEN_MONTH) intent.removeExtra(OPEN_MONTH)
@ -254,7 +254,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
calendar_fab.beVisible() calendar_fab.beVisible()
config.storedView = if (openMonth) MONTHLY_VIEW else DAILY_VIEW config.storedView = if (openMonth) MONTHLY_VIEW else DAILY_VIEW
updateViewPager(dayCodeToOpen) updateViewPager(dayCodeToOpen)
return return true
} }
val eventIdToOpen = intent.getIntExtra(EVENT_ID, 0) val eventIdToOpen = intent.getIntExtra(EVENT_ID, 0)
@ -267,7 +267,10 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
putExtra(EVENT_OCCURRENCE_TS, eventOccurrenceToOpen) putExtra(EVENT_OCCURRENCE_TS, eventOccurrenceToOpen)
startActivity(this) startActivity(this)
} }
return false
} }
return false
} }
private fun showViewDialog() { private fun showViewDialog() {