fix #330, show a Back button on the actionmenu at opening a subview

This commit is contained in:
tibbi 2018-02-01 12:30:42 +01:00
parent e0b070b6dc
commit 7a3e0a2e98
2 changed files with 7 additions and 2 deletions

View File

@ -179,6 +179,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
R.id.export_events -> tryExportEvents()
R.id.settings -> launchSettings()
R.id.about -> launchAbout()
android.R.id.home -> onBackPressed()
else -> return super.onOptionsItemSelected(item)
}
return true
@ -523,6 +524,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
supportFragmentManager.beginTransaction().add(R.id.fragments_holder, fragment).commit()
resetActionBarTitle()
calendar_fab.beVisible()
supportActionBar?.setDisplayHomeAsUpEnabled(true)
}
fun openDayFromMonthly(dateTime: DateTime) {
@ -532,6 +534,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
bundle.putString(DAY_CODE, Formatter.getDayCodeFromDateTime(dateTime))
fragment.arguments = bundle
supportFragmentManager.beginTransaction().add(R.id.fragments_holder, fragment).commit()
supportActionBar?.setDisplayHomeAsUpEnabled(true)
}
private fun getThisWeekDateTime(): String {
@ -559,6 +562,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
updateActionBarTitle()
}
calendar_fab.beGoneIf(currentFragments.size == 1 && config.storedView == YEARLY_VIEW)
supportActionBar?.setDisplayHomeAsUpEnabled(currentFragments.size > 1)
}
private fun refreshViewPager() {

View File

@ -334,10 +334,11 @@ class SettingsActivity : SimpleActivity() {
}
private fun getDisplayPastEventsText(displayPastEvents: Int): String {
return if (displayPastEvents == 0)
return if (displayPastEvents == 0) {
getString(R.string.never)
else
} else {
getFormattedMinutes(displayPastEvents, false)
}
}
private fun setupFontSize() {