diff --git a/app/src/main/java/com/omgodse/notally/parents/NotallyFragment.kt b/app/src/main/java/com/omgodse/notally/parents/NotallyFragment.kt index 76b39e0d..b01a29a7 100644 --- a/app/src/main/java/com/omgodse/notally/parents/NotallyFragment.kt +++ b/app/src/main/java/com/omgodse/notally/parents/NotallyFragment.kt @@ -101,7 +101,10 @@ abstract class NotallyFragment : Fragment(), NoteListener { if (note.isEmpty()){ model.handleNoteDeleted(filePath, getPayload()) val rootView = (mContext as MainActivity).binding.CoordinatorLayout - Snackbar.make(rootView, R.string.discarded_empty_note, Snackbar.LENGTH_SHORT).show() + if (note.isNote) { + Snackbar.make(rootView, R.string.discarded_empty_note, Snackbar.LENGTH_SHORT).show() + } + else Snackbar.make(rootView, R.string.discarded_empty_list, Snackbar.LENGTH_SHORT).show() } } } diff --git a/app/src/main/java/com/omgodse/notally/viewmodels/BaseModel.kt b/app/src/main/java/com/omgodse/notally/viewmodels/BaseModel.kt index 27ec7169..72283547 100644 --- a/app/src/main/java/com/omgodse/notally/viewmodels/BaseModel.kt +++ b/app/src/main/java/com/omgodse/notally/viewmodels/BaseModel.kt @@ -22,7 +22,7 @@ abstract class BaseModel : ViewModel() { setStateFromFile() } - abstract fun saveNote() : Boolean + abstract fun saveNote() abstract fun setStateFromFile() } \ No newline at end of file diff --git a/app/src/main/java/com/omgodse/notally/viewmodels/MakeListModel.kt b/app/src/main/java/com/omgodse/notally/viewmodels/MakeListModel.kt index 2528db23..26397edf 100644 --- a/app/src/main/java/com/omgodse/notally/viewmodels/MakeListModel.kt +++ b/app/src/main/java/com/omgodse/notally/viewmodels/MakeListModel.kt @@ -10,7 +10,7 @@ class MakeListModel : BaseModel() { val items = ArrayList() - override fun saveNote() : Boolean { + override fun saveNote() { val listItems = items.filter { item -> item.body.isNotBlank() } if (file != null) { val fileWriter = FileWriter(file) @@ -24,9 +24,7 @@ class MakeListModel : BaseModel() { fileWriter.write(xmlWriter.getText()) fileWriter.close() - return true } - else return false } override fun setStateFromFile() { diff --git a/app/src/main/java/com/omgodse/notally/viewmodels/NoteModel.kt b/app/src/main/java/com/omgodse/notally/viewmodels/NoteModel.kt index d96f4894..39fb40cf 100644 --- a/app/src/main/java/com/omgodse/notally/viewmodels/NoteModel.kt +++ b/app/src/main/java/com/omgodse/notally/viewmodels/NoteModel.kt @@ -85,7 +85,6 @@ class NoteModel(private val app: Application) : AndroidViewModel(app) { val note = list.find { note -> note.filePath == filePath } if (notesHelper.moveFileToDeleted(file)){ - println("Removed file from list") list.remove(note) liveData.value = list } diff --git a/app/src/main/java/com/omgodse/notally/viewmodels/TakeNoteModel.kt b/app/src/main/java/com/omgodse/notally/viewmodels/TakeNoteModel.kt index c9fdb064..638c6f07 100644 --- a/app/src/main/java/com/omgodse/notally/viewmodels/TakeNoteModel.kt +++ b/app/src/main/java/com/omgodse/notally/viewmodels/TakeNoteModel.kt @@ -18,7 +18,7 @@ class TakeNoteModel : BaseModel() { var body = Editable.Factory.getInstance().newEditable(String()) - override fun saveNote() : Boolean { + override fun saveNote() { if (file != null) { val fileWriter = FileWriter(file) val xmlWriter = XMLWriter(XMLTags.Note) @@ -33,9 +33,7 @@ class TakeNoteModel : BaseModel() { fileWriter.write(xmlWriter.getText()) fileWriter.close() - return true } - else return false } override fun setStateFromFile() {