update commons to 3.12.5

This commit is contained in:
tibbi 2018-02-17 23:28:03 +01:00
parent 6e3470ced6
commit 8969043de2
4 changed files with 7 additions and 7 deletions

View File

@ -46,7 +46,7 @@ ext {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:3.11.2' implementation 'com.simplemobiletools:commons:3.12.5'
implementation 'joda-time:joda-time:2.9.9' implementation 'joda-time:joda-time:2.9.9'
implementation 'com.facebook.stetho:stetho:1.5.0' implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.android.support:multidex:1.0.2' implementation 'com.android.support:multidex:1.0.2'

View File

@ -8,9 +8,8 @@ import com.simplemobiletools.calendar.dialogs.CustomEventRepeatIntervalDialog
import com.simplemobiletools.calendar.helpers.* import com.simplemobiletools.calendar.helpers.*
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.getFilePublicUri
import com.simplemobiletools.commons.extensions.hideKeyboard import com.simplemobiletools.commons.extensions.hideKeyboard
import com.simplemobiletools.commons.extensions.shareUri import com.simplemobiletools.commons.extensions.sharePathIntent
import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.models.RadioItem
import java.io.File import java.io.File
@ -27,8 +26,7 @@ fun BaseSimpleActivity.shareEvents(ids: List<Int>) {
val events = dbHelper.getEventsWithIds(ids) val events = dbHelper.getEventsWithIds(ids)
IcsExporter().exportEvents(this, file, events) { IcsExporter().exportEvents(this, file, events) {
if (it == IcsExporter.ExportResult.EXPORT_OK) { if (it == IcsExporter.ExportResult.EXPORT_OK) {
val uri = getFilePublicUri(file, BuildConfig.APPLICATION_ID) sharePathIntent(file.absolutePath, BuildConfig.APPLICATION_ID)
shareUri(uri, BuildConfig.APPLICATION_ID)
} }
} }
} }

View File

@ -226,9 +226,9 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
} }
fun update(event: Event, updateAtCalDAV: Boolean, callback: (() -> Unit)? = null) { fun update(event: Event, updateAtCalDAV: Boolean, callback: (() -> Unit)? = null) {
val selectionArgs = arrayOf(event.id.toString())
val values = fillEventValues(event) val values = fillEventValues(event)
val selection = "$COL_ID = ?" val selection = "$COL_ID = ?"
val selectionArgs = arrayOf(event.id.toString())
mDb.update(MAIN_TABLE_NAME, values, selection, selectionArgs) mDb.update(MAIN_TABLE_NAME, values, selection, selectionArgs)
if (event.repeatInterval == 0) { if (event.repeatInterval == 0) {

View File

@ -6,6 +6,7 @@ import com.simplemobiletools.calendar.models.Event
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.getFileOutputStream import com.simplemobiletools.commons.extensions.getFileOutputStream
import com.simplemobiletools.commons.extensions.writeLn import com.simplemobiletools.commons.extensions.writeLn
import com.simplemobiletools.commons.models.FileDirItem
import java.io.BufferedWriter import java.io.BufferedWriter
import java.io.File import java.io.File
@ -18,7 +19,8 @@ class IcsExporter {
private var eventsFailed = 0 private var eventsFailed = 0
fun exportEvents(activity: BaseSimpleActivity, file: File, events: ArrayList<Event>, callback: (result: ExportResult) -> Unit) { fun exportEvents(activity: BaseSimpleActivity, file: File, events: ArrayList<Event>, callback: (result: ExportResult) -> Unit) {
activity.getFileOutputStream(file) { val fileDirItem = FileDirItem(file.absolutePath, file.name)
activity.getFileOutputStream(fileDirItem) {
if (it == null) { if (it == null) {
callback(EXPORT_FAIL) callback(EXPORT_FAIL)
return@getFileOutputStream return@getFileOutputStream