update commons to 2.19.6

This commit is contained in:
tibbi 2017-06-14 21:59:27 +02:00
parent a1baea3130
commit fddf164932
9 changed files with 15 additions and 15 deletions

@ -32,7 +32,7 @@ android {
} }
dependencies { dependencies {
compile 'com.simplemobiletools:commons:2.16.9' compile 'com.simplemobiletools:commons:2.19.6'
compile 'com.facebook.stetho:stetho:1.4.1' compile 'com.facebook.stetho:stetho:1.4.1'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }

@ -59,7 +59,7 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
val itemIndex = getNoteIndexWithId(wantedNoteId) val itemIndex = getNoteIndexWithId(wantedNoteId)
mAdapter = NotesPagerAdapter(supportFragmentManager, mNotes, applicationContext) mAdapter = NotesPagerAdapter(supportFragmentManager, mNotes, this)
view_pager.apply { view_pager.apply {
adapter = mAdapter adapter = mAdapter
currentItem = itemIndex currentItem = itemIndex

@ -1,6 +1,6 @@
package com.simplemobiletools.notes.adapters package com.simplemobiletools.notes.adapters
import android.content.Context import android.app.Activity
import android.os.Bundle import android.os.Bundle
import android.support.v4.app.Fragment import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager 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.helpers.NOTE_ID
import com.simplemobiletools.notes.models.Note import com.simplemobiletools.notes.models.Note
class NotesPagerAdapter(fm: FragmentManager, val notes: List<Note>, val context: Context) : FragmentStatePagerAdapter(fm) { class NotesPagerAdapter(fm: FragmentManager, val notes: List<Note>, val activity: Activity) : FragmentStatePagerAdapter(fm) {
var fragments: SparseArray<NoteFragment> = SparseArray(5) var fragments: SparseArray<NoteFragment> = SparseArray(5)
override fun getCount() = notes.size override fun getCount() = notes.size
@ -44,7 +44,7 @@ class NotesPagerAdapter(fm: FragmentManager, val notes: List<Note>, val context:
try { try {
super.finishUpdate(container) super.finishUpdate(container)
} catch (e: Exception) { } catch (e: Exception) {
context.toast(R.string.unknown_error_occurred) activity.toast(R.string.unknown_error_occurred)
} }
} }
} }

@ -31,7 +31,7 @@ class DeleteNoteDialog(val activity: SimpleActivity, val note: Note, val callbac
} }
private fun dialogConfirmed(deleteFile: Boolean) { private fun dialogConfirmed(deleteFile: Boolean) {
callback.invoke(deleteFile && note.path.isNotEmpty()) callback(deleteFile && note.path.isNotEmpty())
dialog?.dismiss() dialog?.dismiss()
} }
} }

@ -38,17 +38,17 @@ class ExportAsDialog(val activity: SimpleActivity, val note: Note, val callback:
val filename = view.file_name.value val filename = view.file_name.value
if (filename.isEmpty()) { if (filename.isEmpty()) {
context.toast(R.string.filename_cannot_be_empty) activity.toast(R.string.filename_cannot_be_empty)
return@setOnClickListener return@setOnClickListener
} }
val newFile = File(realPath, filename) val newFile = File(realPath, filename)
if (!newFile.name.isAValidFilename()) { if (!newFile.name.isAValidFilename()) {
context.toast(R.string.filename_invalid_characters) activity.toast(R.string.filename_invalid_characters)
return@setOnClickListener return@setOnClickListener
} }
callback.invoke(newFile.absolutePath) callback(newFile.absolutePath)
dismiss() dismiss()
}) })
} }

@ -28,7 +28,7 @@ class NewNoteDialog(val activity: Activity, val db: DBHelper, callback: (title:
} else if (db.doesTitleExist(title)) { } else if (db.doesTitleExist(title)) {
activity.toast(R.string.title_taken) activity.toast(R.string.title_taken)
} else { } else {
callback.invoke(title) callback(title)
dismiss() dismiss()
} }
} }

@ -46,7 +46,7 @@ class OpenFileDialog(val activity: SimpleActivity, val path: String, val callbac
private fun saveNote(storeContent: String, storePath: String) { private fun saveNote(storeContent: String, storePath: String) {
val filename = path.getFilenameFromPath() val filename = path.getFilenameFromPath()
val note = Note(0, filename, storeContent, TYPE_NOTE, storePath) val note = Note(0, filename, storeContent, TYPE_NOTE, storePath)
callback.invoke(note) callback(note)
dialog.dismiss() dialog.dismiss()
} }
} }

@ -31,7 +31,7 @@ class OpenNoteDialog(val activity: Activity, val callback: (checkedId: Int) -> U
id = note.id id = note.id
setOnClickListener { setOnClickListener {
callback.invoke(id) callback(id)
dialog.dismiss() dialog.dismiss()
} }
} }

@ -34,14 +34,14 @@ class RenameNoteDialog(val activity: SimpleActivity, val db: DBHelper, val note:
val path = note.path val path = note.path
if (path.isNotEmpty()) { if (path.isNotEmpty()) {
if (title.isEmpty()) { if (title.isEmpty()) {
context.toast(R.string.filename_cannot_be_empty) activity.toast(R.string.filename_cannot_be_empty)
return@setOnClickListener return@setOnClickListener
} }
val file = File(path) val file = File(path)
val newFile = File(file.parent, title) val newFile = File(file.parent, title)
if (!newFile.name.isAValidFilename()) { if (!newFile.name.isAValidFilename()) {
context.toast(R.string.invalid_name) activity.toast(R.string.invalid_name)
return@setOnClickListener return@setOnClickListener
} }
@ -57,7 +57,7 @@ class RenameNoteDialog(val activity: SimpleActivity, val db: DBHelper, val note:
} }
db.updateNoteTitle(note) db.updateNoteTitle(note)
dismiss() dismiss()
callback.invoke(note) callback(note)
} }
}) })
} }