mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-09 05:01:09 +02:00
adding some crashfixes
This commit is contained in:
parent
bf3f02461d
commit
a66d5c0e89
@ -412,6 +412,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
private fun openPath(path: String) {
|
private fun openPath(path: String) {
|
||||||
openFile(path, false) {
|
openFile(path, false) {
|
||||||
val title = path.getFilenameFromPath()
|
val title = path.getFilenameFromPath()
|
||||||
|
try {
|
||||||
val fileText = it.readText().trim()
|
val fileText = it.readText().trim()
|
||||||
val checklistItems = fileText.parseChecklistItems()
|
val checklistItems = fileText.parseChecklistItems()
|
||||||
val note = if (checklistItems != null) {
|
val note = if (checklistItems != null) {
|
||||||
@ -425,6 +426,9 @@ class MainActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addNewNote(note)
|
addNewNote(note)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
showErrorToast(e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,9 @@ class NotesPagerAdapter(fm: FragmentManager, val notes: List<Note>, val activity
|
|||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
val note = notes[position]
|
val note = notes[position]
|
||||||
val id = note.id
|
val id = note.id
|
||||||
bundle.putLong(NOTE_ID, id!!)
|
if (id != null) {
|
||||||
|
bundle.putLong(NOTE_ID, id)
|
||||||
|
}
|
||||||
|
|
||||||
if (fragments.containsKey(position)) {
|
if (fragments.containsKey(position)) {
|
||||||
return fragments[position]!!
|
return fragments[position]!!
|
||||||
|
@ -31,7 +31,7 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener {
|
|||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
view = inflater.inflate(R.layout.fragment_checklist, container, false) as ViewGroup
|
view = inflater.inflate(R.layout.fragment_checklist, container, false) as ViewGroup
|
||||||
noteId = arguments!!.getLong(NOTE_ID)
|
noteId = arguments!!.getLong(NOTE_ID, 0L)
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class TextFragment : NoteFragment() {
|
|||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
view = inflater.inflate(R.layout.fragment_text, container, false) as ViewGroup
|
view = inflater.inflate(R.layout.fragment_text, container, false) as ViewGroup
|
||||||
noteId = arguments!!.getLong(NOTE_ID)
|
noteId = arguments!!.getLong(NOTE_ID, 0L)
|
||||||
retainInstance = true
|
retainInstance = true
|
||||||
|
|
||||||
val layoutToInflate = if (config!!.enableLineWrap) R.layout.note_view_static else R.layout.note_view_horiz_scrollable
|
val layoutToInflate = if (config!!.enableLineWrap) R.layout.note_view_static else R.layout.note_view_horiz_scrollable
|
||||||
|
Loading…
x
Reference in New Issue
Block a user