From e4e9a87ae6064f67c0a4dded8bd8cb88b35ba144 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Sep 2016 21:51:17 +0200 Subject: [PATCH] fix a crash at deleting events --- .../simplemobiletools/calendar/fragments/DayFragment.kt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) 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 09e1fc7f6..3d7f92c7b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/DayFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/DayFragment.kt @@ -171,12 +171,7 @@ class DayFragment : Fragment(), DBHelper.DBOperationsListener, AdapterView.OnIte } fun deleteEvents() { - val cnt = mToBeDeleted.size - val eventIDs = arrayOf() - for (i in 0..cnt - 1) { - eventIDs[i] = mToBeDeleted[i].toString() - } - + val eventIDs = Array(mToBeDeleted.size, { i -> (mToBeDeleted[i].toString()) }) DBHelper.newInstance(activity.applicationContext, this).deleteEvents(eventIDs) } @@ -201,7 +196,6 @@ class DayFragment : Fragment(), DBHelper.DBOperationsListener, AdapterView.OnIte } override fun onCreateActionMode(mode: ActionMode, menu: Menu): Boolean { - //checkDeleteEvents() val inflater = mode.menuInflater inflater.inflate(R.menu.menu_day_cab, menu) return true @@ -230,7 +224,6 @@ class DayFragment : Fragment(), DBHelper.DBOperationsListener, AdapterView.OnIte } override fun eventUpdated(event: Event) { - } override fun eventsDeleted(cnt: Int) {