File tree Expand file tree Collapse file tree
java/com/philkes/notallyx/presentation Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -353,6 +353,16 @@ class SettingsFragment : Fragment() {
353353 }
354354 }
355355
356+ defaultListNoteViewMode.observe(viewLifecycleOwner) { value ->
357+ binding.DefaultListNoteViewMode .setup(
358+ defaultListNoteViewMode,
359+ value,
360+ requireContext(),
361+ ) { newValue ->
362+ model.savePreference(defaultListNoteViewMode, newValue)
363+ }
364+ }
365+
356366 autoRemoveDeletedNotesAfterDays.observe(viewLifecycleOwner) { value ->
357367 binding.AutoEmptyBin .setupAutoEmptyBin(
358368 autoRemoveDeletedNotesAfterDays,
Original file line number Diff line number Diff line change @@ -196,6 +196,16 @@ abstract class EditActivity(private val type: Type) : LockedActivity<ActivityEdi
196196 setupListeners()
197197 setStateFromModel(savedInstanceState)
198198
199+ if (
200+ ! notallyModel.isNewNote &&
201+ notallyModel.type == Type .LIST &&
202+ savedInstanceState == null
203+ ) {
204+ val lastUsedViewMode = notallyModel.viewMode.value
205+ notallyModel.viewMode.value =
206+ preferences.defaultListNoteViewMode.value.toNoteViewMode(lastUsedViewMode)
207+ }
208+
199209 configureUI()
200210 binding.ScrollView .visibility = VISIBLE
201211 setupEditNoteReminderChip()
Original file line number Diff line number Diff line change @@ -59,6 +59,14 @@ class NotallyXPreferences private constructor(private val context: Context) {
5959 R .string.list_item_auto_sort,
6060 )
6161
62+ val defaultListNoteViewMode =
63+ createEnumPreference(
64+ preferences,
65+ " defaultListNoteViewMode" ,
66+ DefaultListNoteViewMode .LAST_USED ,
67+ R .string.default_list_note_view_mode,
68+ )
69+
6270 val maxItems =
6371 IntPreference (
6472 " maxItemsToDisplayInList.v1" ,
@@ -313,6 +321,7 @@ class NotallyXPreferences private constructor(private val context: Context) {
313321 editNoteActivityTopActions,
314322 editNoteActivityBottomAction,
315323 defaultNoteColor,
324+ defaultListNoteViewMode,
316325 )
317326 .forEach { it.refresh() }
318327 }
Original file line number Diff line number Diff line change @@ -388,6 +388,20 @@ enum class ListItemSort(override val textResId: Int) : StaticTextProvider {
388388 AUTO_SORT_BY_CHECKED (R .string.auto_sort_by_checked),
389389}
390390
391+ enum class DefaultListNoteViewMode (override val textResId : Int ) : StaticTextProvider {
392+ READ_ONLY (R .string.read_only),
393+ EDIT (R .string.edit),
394+ LAST_USED (R .string.last_used);
395+
396+ fun toNoteViewMode (lastUsed : NoteViewMode ): NoteViewMode {
397+ return when (this ) {
398+ READ_ONLY -> NoteViewMode .READ_ONLY
399+ EDIT -> NoteViewMode .EDIT
400+ LAST_USED -> lastUsed
401+ }
402+ }
403+ }
404+
391405enum class BiometricLock (override val textResId : Int ) : StaticTextProvider {
392406 ENABLED (R .string.enabled),
393407 DISABLED (R .string.disabled);
Original file line number Diff line number Diff line change 6161 android : id =" @+id/StartView"
6262 layout =" @layout/preference" />
6363
64+ <include
65+ android : id =" @+id/DefaultListNoteViewMode"
66+ layout =" @layout/preference" />
67+
6468 <include
6569 android : id =" @+id/AutoSaveAfterIdle"
6670 layout =" @layout/preference_seekbar" />
Original file line number Diff line number Diff line change 112112 <string name =" day" >Day</string >
113113 <string name =" days" >Days</string >
114114 <string name =" default_color_hint" >This is the default color for new notes. To change it, make another color the default</string >
115+ <string name =" default_list_note_view_mode" >Default List-Note View Mode</string >
116+ <string name =" last_used" >Last Used</string >
115117 <string name =" delete" >Delete</string >
116118 <string name =" delete_all" >Delete all</string >
117119 <string name =" delete_all_notes" >Delete all notes\?</string >
You can’t perform that action at this time.
0 commit comments