From fddf164932bb944e158b28ce501c101ee1f4adaa Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 14 Jun 2017 21:59:27 +0200 Subject: [PATCH] update commons to 2.19.6 --- app/build.gradle | 2 +- .../com/simplemobiletools/notes/activities/MainActivity.kt | 2 +- .../simplemobiletools/notes/adapters/NotesPagerAdapter.kt | 6 +++--- .../com/simplemobiletools/notes/dialogs/DeleteNoteDialog.kt | 2 +- .../com/simplemobiletools/notes/dialogs/ExportAsDialog.kt | 6 +++--- .../com/simplemobiletools/notes/dialogs/NewNoteDialog.kt | 2 +- .../com/simplemobiletools/notes/dialogs/OpenFileDialog.kt | 2 +- .../com/simplemobiletools/notes/dialogs/OpenNoteDialog.kt | 2 +- .../com/simplemobiletools/notes/dialogs/RenameNoteDialog.kt | 6 +++--- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 8991136f..73a9a8d2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,7 +32,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.16.9' + compile 'com.simplemobiletools:commons:2.19.6' compile 'com.facebook.stetho:stetho:1.4.1' compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } diff --git a/app/src/main/kotlin/com/simplemobiletools/notes/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/notes/activities/MainActivity.kt index 01d59cfe..787bcc7a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/notes/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/notes/activities/MainActivity.kt @@ -59,7 +59,7 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener { val itemIndex = getNoteIndexWithId(wantedNoteId) - mAdapter = NotesPagerAdapter(supportFragmentManager, mNotes, applicationContext) + mAdapter = NotesPagerAdapter(supportFragmentManager, mNotes, this) view_pager.apply { adapter = mAdapter currentItem = itemIndex diff --git a/app/src/main/kotlin/com/simplemobiletools/notes/adapters/NotesPagerAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/notes/adapters/NotesPagerAdapter.kt index 26d5a4d2..02af0b6e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/notes/adapters/NotesPagerAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/notes/adapters/NotesPagerAdapter.kt @@ -1,6 +1,6 @@ package com.simplemobiletools.notes.adapters -import android.content.Context +import android.app.Activity import android.os.Bundle import android.support.v4.app.Fragment import android.support.v4.app.FragmentManager @@ -13,7 +13,7 @@ import com.simplemobiletools.notes.fragments.NoteFragment import com.simplemobiletools.notes.helpers.NOTE_ID import com.simplemobiletools.notes.models.Note -class NotesPagerAdapter(fm: FragmentManager, val notes: List, val context: Context) : FragmentStatePagerAdapter(fm) { +class NotesPagerAdapter(fm: FragmentManager, val notes: List, val activity: Activity) : FragmentStatePagerAdapter(fm) { var fragments: SparseArray = SparseArray(5) override fun getCount() = notes.size @@ -44,7 +44,7 @@ class NotesPagerAdapter(fm: FragmentManager, val notes: List, val context: try { super.finishUpdate(container) } catch (e: Exception) { - context.toast(R.string.unknown_error_occurred) + activity.toast(R.string.unknown_error_occurred) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/DeleteNoteDialog.kt b/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/DeleteNoteDialog.kt index d4f38262..a4b591dc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/DeleteNoteDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/DeleteNoteDialog.kt @@ -31,7 +31,7 @@ class DeleteNoteDialog(val activity: SimpleActivity, val note: Note, val callbac } private fun dialogConfirmed(deleteFile: Boolean) { - callback.invoke(deleteFile && note.path.isNotEmpty()) + callback(deleteFile && note.path.isNotEmpty()) dialog?.dismiss() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/ExportAsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/ExportAsDialog.kt index 85a82b81..b77f7ea5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/ExportAsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/ExportAsDialog.kt @@ -38,17 +38,17 @@ class ExportAsDialog(val activity: SimpleActivity, val note: Note, val callback: val filename = view.file_name.value if (filename.isEmpty()) { - context.toast(R.string.filename_cannot_be_empty) + activity.toast(R.string.filename_cannot_be_empty) return@setOnClickListener } val newFile = File(realPath, filename) if (!newFile.name.isAValidFilename()) { - context.toast(R.string.filename_invalid_characters) + activity.toast(R.string.filename_invalid_characters) return@setOnClickListener } - callback.invoke(newFile.absolutePath) + callback(newFile.absolutePath) dismiss() }) } diff --git a/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/NewNoteDialog.kt b/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/NewNoteDialog.kt index 34eeace2..06ace06f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/NewNoteDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/NewNoteDialog.kt @@ -28,7 +28,7 @@ class NewNoteDialog(val activity: Activity, val db: DBHelper, callback: (title: } else if (db.doesTitleExist(title)) { activity.toast(R.string.title_taken) } else { - callback.invoke(title) + callback(title) dismiss() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/OpenFileDialog.kt b/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/OpenFileDialog.kt index 91c36f6e..e233340f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/OpenFileDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/OpenFileDialog.kt @@ -46,7 +46,7 @@ class OpenFileDialog(val activity: SimpleActivity, val path: String, val callbac private fun saveNote(storeContent: String, storePath: String) { val filename = path.getFilenameFromPath() val note = Note(0, filename, storeContent, TYPE_NOTE, storePath) - callback.invoke(note) + callback(note) dialog.dismiss() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/OpenNoteDialog.kt b/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/OpenNoteDialog.kt index 2b76cc9d..b28a22f4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/OpenNoteDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/OpenNoteDialog.kt @@ -31,7 +31,7 @@ class OpenNoteDialog(val activity: Activity, val callback: (checkedId: Int) -> U id = note.id setOnClickListener { - callback.invoke(id) + callback(id) dialog.dismiss() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/RenameNoteDialog.kt b/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/RenameNoteDialog.kt index 9abf83d3..699a19a7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/RenameNoteDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/RenameNoteDialog.kt @@ -34,14 +34,14 @@ class RenameNoteDialog(val activity: SimpleActivity, val db: DBHelper, val note: val path = note.path if (path.isNotEmpty()) { if (title.isEmpty()) { - context.toast(R.string.filename_cannot_be_empty) + activity.toast(R.string.filename_cannot_be_empty) return@setOnClickListener } val file = File(path) val newFile = File(file.parent, title) if (!newFile.name.isAValidFilename()) { - context.toast(R.string.invalid_name) + activity.toast(R.string.invalid_name) return@setOnClickListener } @@ -57,7 +57,7 @@ class RenameNoteDialog(val activity: SimpleActivity, val db: DBHelper, val note: } db.updateNoteTitle(note) dismiss() - callback.invoke(note) + callback(note) } }) }