mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-01-30 14:04:48 +01:00
update commons to 2.19.6
This commit is contained in:
parent
a1baea3130
commit
fddf164932
@ -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"
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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<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)
|
||||
|
||||
override fun getCount() = notes.size
|
||||
@ -44,7 +44,7 @@ class NotesPagerAdapter(fm: FragmentManager, val notes: List<Note>, val context:
|
||||
try {
|
||||
super.finishUpdate(container)
|
||||
} 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) {
|
||||
callback.invoke(deleteFile && note.path.isNotEmpty())
|
||||
callback(deleteFile && note.path.isNotEmpty())
|
||||
dialog?.dismiss()
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
})
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user