mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-21 11:00:06 +01:00
Use named parameter in lambda
This commit is contained in:
parent
36c4746829
commit
7d590f3f06
@ -904,7 +904,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun requestUnlockNotes(callback: (List<Long>) -> Unit) {
|
private fun requestUnlockNotes(callback: (unlockedNoteIds: List<Long>) -> Unit) {
|
||||||
val lockedNotes = mNotes.filter { it.isLocked() }
|
val lockedNotes = mNotes.filter { it.isLocked() }
|
||||||
if (lockedNotes.isNotEmpty()) {
|
if (lockedNotes.isNotEmpty()) {
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
@ -919,10 +919,10 @@ class MainActivity : SimpleActivity() {
|
|||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
NotesHelper(this).getNotes {
|
NotesHelper(this).getNotes {
|
||||||
mNotes = it
|
mNotes = it
|
||||||
requestUnlockNotes { unlockedIds ->
|
requestUnlockNotes { unlockedNoteIds ->
|
||||||
toast(R.string.exporting)
|
toast(R.string.exporting)
|
||||||
val notesExporter = NotesExporter(this)
|
val notesExporter = NotesExporter(this)
|
||||||
notesExporter.exportNotes(mNotes, unlockedIds, outputStream) { result ->
|
notesExporter.exportNotes(mNotes, unlockedNoteIds, outputStream) { result ->
|
||||||
val toastId = when (result) {
|
val toastId = when (result) {
|
||||||
NotesExporter.ExportResult.EXPORT_OK -> R.string.exporting_successful
|
NotesExporter.ExportResult.EXPORT_OK -> R.string.exporting_successful
|
||||||
else -> R.string.exporting_failed
|
else -> R.string.exporting_failed
|
||||||
@ -1030,7 +1030,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
NotesHelper(this).getNotes { notes ->
|
NotesHelper(this).getNotes { notes ->
|
||||||
mNotes = notes
|
mNotes = notes
|
||||||
requestUnlockNotes { unlockedIds ->
|
requestUnlockNotes { unlockedNoteIds ->
|
||||||
ExportFilesDialog(this, mNotes) { parent, extension ->
|
ExportFilesDialog(this, mNotes) { parent, extension ->
|
||||||
val items = arrayListOf(
|
val items = arrayListOf(
|
||||||
RadioItem(EXPORT_FILE_SYNC, getString(R.string.update_file_at_note)),
|
RadioItem(EXPORT_FILE_SYNC, getString(R.string.update_file_at_note)),
|
||||||
@ -1040,7 +1040,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
RadioGroupDialog(this, items) { any ->
|
RadioGroupDialog(this, items) { any ->
|
||||||
val syncFile = any as Int == EXPORT_FILE_SYNC
|
val syncFile = any as Int == EXPORT_FILE_SYNC
|
||||||
var failCount = 0
|
var failCount = 0
|
||||||
mNotes.filter { !it.isLocked() || it.id in unlockedIds }.forEachIndexed { index, note ->
|
mNotes.filter { !it.isLocked() || it.id in unlockedNoteIds }.forEachIndexed { index, note ->
|
||||||
val filename = if (extension.isEmpty()) note.title else "${note.title}.$extension"
|
val filename = if (extension.isEmpty()) note.title else "${note.title}.$extension"
|
||||||
val file = File(parent, filename)
|
val file = File(parent, filename)
|
||||||
if (!filename.isAValidFilename()) {
|
if (!filename.isAValidFilename()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user