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

View File

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