Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed old reminders not being removed when moving events ([#486])
- Fixed drag and drop copying events instead of moving them ([#706])
- Fixed crash when editing events with attendees ([#34])
- Fixed event edits being silently discarded when using navigation arrow ([#803])

## [1.6.1] - 2025-09-01
### Changed
Expand Down Expand Up @@ -146,6 +147,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#729]: https://github.com/FossifyOrg/Calendar/issues/729
[#732]: https://github.com/FossifyOrg/Calendar/issues/732
[#761]: http://github.com/FossifyOrg/Calendar/issues/761
[#803]: https://github.com/FossifyOrg/Calendar/issues/803

[Unreleased]: https://github.com/FossifyOrg/Calendar/compare/1.6.1...HEAD
[1.6.1]: https://github.com/FossifyOrg/Calendar/compare/1.6.0...1.6.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,26 @@ class EventActivity : SimpleActivity() {

override fun onResume() {
super.onResume()
setupToolbar()
}

private fun setupToolbar() {
setupToolbar(binding.eventToolbar, NavigationIcon.Arrow)
binding.eventToolbar.setNavigationOnClickListener {
maybeShowUnsavedChangesDialog {
hideKeyboard()
finish()
}
}
}

override fun onBackPressed() {
maybeShowUnsavedChangesDialog {
super.onBackPressed()
}
}

private fun maybeShowUnsavedChangesDialog(discard: () -> Unit) {
val now = System.currentTimeMillis()
if (now - mLastSavePromptTS > SAVE_DISCARD_PROMPT_INTERVAL && isEventChanged()) {
mLastSavePromptTS = now
Expand All @@ -271,11 +287,11 @@ class EventActivity : SimpleActivity() {
if (it) {
saveCurrentEvent()
} else {
super.onBackPressed()
discard()
}
}
} else {
super.onBackPressed()
discard()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,17 @@ class TaskActivity : SimpleActivity() {

override fun onResume() {
super.onResume()
setupToolbar()
}

private fun setupToolbar() {
setupToolbar(binding.taskToolbar, NavigationIcon.Arrow)
binding.taskToolbar.setNavigationOnClickListener {
maybeShowUnsavedChangesDialog {
hideKeyboard()
finish()
}
}
}

private fun refreshMenuItems() {
Expand Down Expand Up @@ -137,6 +147,12 @@ class TaskActivity : SimpleActivity() {
}

override fun onBackPressed() {
maybeShowUnsavedChangesDialog {
super.onBackPressed()
}
}

private fun maybeShowUnsavedChangesDialog(discard: () -> Unit) {
if (System.currentTimeMillis() - mLastSavePromptTS > SAVE_DISCARD_PROMPT_INTERVAL && isTaskChanged()) {
mLastSavePromptTS = System.currentTimeMillis()
ConfirmationAdvancedDialog(
Expand All @@ -149,11 +165,11 @@ class TaskActivity : SimpleActivity() {
if (it) {
saveCurrentTask()
} else {
super.onBackPressed()
discard()
}
}
} else {
super.onBackPressed()
discard()
}
}

Expand Down
Loading