mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-25 04:28:46 +02:00
add some null checks at getting current text
This commit is contained in:
parent
45e2e0c530
commit
de13dbd5c8
@ -214,7 +214,8 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
|
|||||||
|
|
||||||
private fun exportAsFile() {
|
private fun exportAsFile() {
|
||||||
ExportAsDialog(this, mCurrentNote) {
|
ExportAsDialog(this, mCurrentNote) {
|
||||||
exportNoteValueToFile(it, getCurrentNoteText())
|
if (getCurrentNoteText()?.isNotEmpty() == true)
|
||||||
|
exportNoteValueToFile(it, getCurrentNoteText()!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,7 +308,7 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
|
|||||||
|
|
||||||
private fun shareText() {
|
private fun shareText() {
|
||||||
val text = getCurrentNoteText()
|
val text = getCurrentNoteText()
|
||||||
if (text.isEmpty()) {
|
if (text == null || text.isEmpty()) {
|
||||||
toast(R.string.cannot_share_empty_text)
|
toast(R.string.cannot_share_empty_text)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ class NotesPagerAdapter(fm: FragmentManager, val notes: List<Note>, val activity
|
|||||||
|
|
||||||
override fun getPageTitle(position: Int) = notes[position].title
|
override fun getPageTitle(position: Int) = notes[position].title
|
||||||
|
|
||||||
fun getCurrentNoteViewText(position: Int) = fragments[position].getCurrentNoteViewText()
|
fun getCurrentNoteViewText(position: Int) = fragments[position]?.getCurrentNoteViewText()
|
||||||
|
|
||||||
fun saveCurrentNote(position: Int) = fragments[position]?.saveText()
|
fun saveCurrentNote(position: Int) = fragments[position]?.saveText()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user