From 8c4b4a6c6d0d6a8afd6e722201463fecce20fa09 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Sep 2016 20:52:38 +0200 Subject: [PATCH] recheck daily events more frequently, at every resume --- .../calendar/activities/EventActivity.java | 1 - .../calendar/fragments/DayFragment.kt | 20 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/simplemobiletools/calendar/activities/EventActivity.java b/app/src/main/java/com/simplemobiletools/calendar/activities/EventActivity.java index 351502115..c2d6b4d8e 100644 --- a/app/src/main/java/com/simplemobiletools/calendar/activities/EventActivity.java +++ b/app/src/main/java/com/simplemobiletools/calendar/activities/EventActivity.java @@ -381,7 +381,6 @@ public class EventActivity extends SimpleActivity implements DBHelper.DBOperatio public void eventUpdated(Event event) { Utils.scheduleNotification(getApplicationContext(), event); Utils.showToast(getApplicationContext(), R.string.event_updated); - setResult(RESULT_OK); finish(); } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/DayFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/DayFragment.kt index 50eaa5d78..658b47a8d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/DayFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/DayFragment.kt @@ -59,6 +59,10 @@ class DayFragment : Fragment(), DBHelper.DBOperationsListener, AdapterView.OnIte override fun onViewCreated(view: View?, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) mToBeDeleted = ArrayList() + } + + override fun onResume() { + super.onResume() checkEvents() } @@ -134,16 +138,12 @@ class DayFragment : Fragment(), DBHelper.DBOperationsListener, AdapterView.OnIte } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - if (requestCode == EDIT_EVENT && resultCode == Activity.RESULT_OK) { - if (data == null) { - checkEvents() - } else { - val deletedId = data.getIntExtra(DELETED_ID, -1) - if (deletedId != -1) { - mToBeDeleted.clear() - mToBeDeleted.add(deletedId) - notifyDeletion() - } + if (requestCode == EDIT_EVENT && resultCode == Activity.RESULT_OK && data != null) { + val deletedId = data.getIntExtra(DELETED_ID, -1) + if (deletedId != -1) { + mToBeDeleted.clear() + mToBeDeleted.add(deletedId) + notifyDeletion() } } }