mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-28 06:20:07 +01:00
export notes into txt files
This commit is contained in:
parent
3ea30cc72b
commit
15763d8c1a
@ -878,6 +878,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun tryExportNotes() {
|
private fun tryExportNotes() {
|
||||||
|
hideKeyboard()
|
||||||
val fileName = "${getString(R.string.notes)}_${getCurrentFormattedDateTime()}"
|
val fileName = "${getString(R.string.notes)}_${getCurrentFormattedDateTime()}"
|
||||||
Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
|
Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
|
||||||
type = EXPORT_MIME_TYPE
|
type = EXPORT_MIME_TYPE
|
||||||
@ -910,6 +911,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun tryImportNotes() {
|
private fun tryImportNotes() {
|
||||||
|
hideKeyboard()
|
||||||
Intent(Intent.ACTION_GET_CONTENT).apply {
|
Intent(Intent.ACTION_GET_CONTENT).apply {
|
||||||
addCategory(Intent.CATEGORY_OPENABLE)
|
addCategory(Intent.CATEGORY_OPENABLE)
|
||||||
type = EXPORT_MIME_TYPE
|
type = EXPORT_MIME_TYPE
|
||||||
|
@ -36,7 +36,7 @@ const val USE_INCOGNITO_MODE = "use_incognito_mode"
|
|||||||
const val LAST_CREATED_NOTE_TYPE = "last_created_note_type"
|
const val LAST_CREATED_NOTE_TYPE = "last_created_note_type"
|
||||||
const val MOVE_DONE_CHECKLIST_ITEMS = "move_undone_checklist_items" // it has been replaced from moving undone items at the top to moving done to bottom
|
const val MOVE_DONE_CHECKLIST_ITEMS = "move_undone_checklist_items" // it has been replaced from moving undone items at the top to moving done to bottom
|
||||||
const val FONT_SIZE_PERCENTAGE = "font_size_percentage"
|
const val FONT_SIZE_PERCENTAGE = "font_size_percentage"
|
||||||
const val EXPORT_MIME_TYPE = "application/json"
|
const val EXPORT_MIME_TYPE = "text/plain"
|
||||||
|
|
||||||
// gravity
|
// gravity
|
||||||
const val GRAVITY_LEFT = 0
|
const val GRAVITY_LEFT = 0
|
||||||
|
@ -29,7 +29,7 @@ class NotesExporter(private val context: Context) {
|
|||||||
writer.beginArray()
|
writer.beginArray()
|
||||||
val notes = context.notesDB.getNotes() as ArrayList<Note>
|
val notes = context.notesDB.getNotes() as ArrayList<Note>
|
||||||
for (note in notes) {
|
for (note in notes) {
|
||||||
if (note.protectionType === PROTECTION_NONE) {
|
if (note.protectionType == PROTECTION_NONE) {
|
||||||
val noteToSave = getNoteToExport(note)
|
val noteToSave = getNoteToExport(note)
|
||||||
writer.jsonValue(gson.toJson(noteToSave))
|
writer.jsonValue(gson.toJson(noteToSave))
|
||||||
written++
|
written++
|
||||||
|
Loading…
x
Reference in New Issue
Block a user