mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-05-27 20:34:19 +02:00
- updated code style format and removed debug extension
This commit is contained in:
parent
7b12650db9
commit
f66c90e495
@ -2,11 +2,8 @@ package com.simplemobiletools.notes.pro.extensions
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import com.simplemobiletools.notes.pro.BuildConfig
|
||||
import com.simplemobiletools.notes.pro.helpers.Config
|
||||
|
||||
val Fragment.config: Config? get() = if (context != null) Config.newInstance(context!!) else null
|
||||
|
||||
val Fragment.requiredActivity: FragmentActivity get() = this.activity!!
|
||||
|
||||
val Fragment.isDebug get(): Boolean = BuildConfig.DEBUG
|
@ -46,7 +46,9 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener {
|
||||
override fun setMenuVisibility(menuVisible: Boolean) {
|
||||
super.setMenuVisibility(menuVisible)
|
||||
|
||||
if (menuVisible) activity?.hideKeyboard()
|
||||
if (menuVisible) {
|
||||
activity?.hideKeyboard()
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadNoteById(noteId: Long) {
|
||||
@ -56,13 +58,16 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener {
|
||||
|
||||
try {
|
||||
val checklistItemType = object : TypeToken<List<ChecklistItem>>() {}.type
|
||||
items = Gson().fromJson<ArrayList<ChecklistItem>>(storedNote.value, checklistItemType) ?: ArrayList(1)
|
||||
items = Gson().fromJson<ArrayList<ChecklistItem>>(storedNote.value, checklistItemType)
|
||||
?: ArrayList(1)
|
||||
} catch (e: Exception) {
|
||||
migrateCheckListOnFailure(storedNote)
|
||||
if (isDebug) e.printStackTrace()
|
||||
}
|
||||
|
||||
if (config?.moveUndoneChecklistItems == true) items.sortBy { it.isDone }
|
||||
if (config?.moveUndoneChecklistItems == true) {
|
||||
items.sortBy { it.isDone }
|
||||
}
|
||||
|
||||
requiredActivity.updateTextColors(view.checklist_holder)
|
||||
setupFragment()
|
||||
}
|
||||
@ -167,6 +172,11 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener {
|
||||
}
|
||||
}
|
||||
|
||||
override fun saveChecklist() { saveNote() }
|
||||
override fun refreshItems() { setupAdapter() }
|
||||
override fun saveChecklist() {
|
||||
saveNote()
|
||||
}
|
||||
|
||||
override fun refreshItems() {
|
||||
setupAdapter()
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user