fix #328, show FAB when opening a day from the widget

This commit is contained in:
tibbi 2018-01-27 14:48:26 +01:00
parent 8e838a295c
commit c6060760f0
1 changed files with 4 additions and 4 deletions

View File

@ -71,6 +71,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
appLaunched() appLaunched()
checkWhatsNewDialog() checkWhatsNewDialog()
calendar_fab.beVisibleIf(config.storedView != YEARLY_VIEW)
if (resources.getBoolean(R.bool.portrait_only)) { if (resources.getBoolean(R.bool.portrait_only)) {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
@ -106,7 +107,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
calendar_fab.setOnClickListener { calendar_fab.setOnClickListener {
launchNewEventIntent(currentFragments.last().getNewEventDayCode()) launchNewEventIntent(currentFragments.last().getNewEventDayCode())
} }
calendar_fab.beVisibleIf(config.storedView != YEARLY_VIEW)
checkOpenIntents() checkOpenIntents()
} }
@ -250,7 +250,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
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)
if (dayCodeToOpen.isNotEmpty()) { if (dayCodeToOpen.isNotEmpty()) {
calendar_fab.beGone() 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
@ -485,7 +485,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
} }
private fun updateView(view: Int) { private fun updateView(view: Int) {
calendar_fab.beGoneIf(view == YEARLY_VIEW) calendar_fab.beVisibleIf(view != YEARLY_VIEW)
config.storedView = view config.storedView = view
updateViewPager() updateViewPager()
if (goToTodayButton?.isVisible == true) { if (goToTodayButton?.isVisible == true) {
@ -686,7 +686,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
private fun openDayAt(timestamp: Long) { private fun openDayAt(timestamp: Long) {
val dayCode = Formatter.getDayCodeFromTS((timestamp / 1000).toInt()) val dayCode = Formatter.getDayCodeFromTS((timestamp / 1000).toInt())
calendar_fab.beGone() calendar_fab.beVisible()
config.storedView = DAILY_VIEW config.storedView = DAILY_VIEW
updateViewPager(dayCode) updateViewPager(dayCode)
} }