mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-25 12:38:45 +02:00
adding a placeholder at empty checklists
This commit is contained in:
parent
57450ac5f7
commit
334056852a
app/src/main
kotlin/com/simplemobiletools/notes/pro/fragments
res
layout
values-az
values-da
values-de
values-es
values-fr
values-gl
values-hr
values-hu
values-it
values-ja
values-lt
values-nl
values-pl
values-pt-rBR
values-pt
values-ru
values-sk
values-sv
values-tr
values-zh-rCN
values-zh-rTW
values
@ -42,6 +42,7 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener {
|
|||||||
|
|
||||||
val checklistItemType = object : TypeToken<List<ChecklistItem>>() {}.type
|
val checklistItemType = object : TypeToken<List<ChecklistItem>>() {}.type
|
||||||
items = Gson().fromJson<ArrayList<ChecklistItem>>(note!!.value, checklistItemType) ?: ArrayList(1)
|
items = Gson().fromJson<ArrayList<ChecklistItem>>(note!!.value, checklistItemType) ?: ArrayList(1)
|
||||||
|
context!!.updateTextColors(view.checklist_holder)
|
||||||
setupFragment()
|
setupFragment()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -56,22 +57,42 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener {
|
|||||||
|
|
||||||
private fun setupFragment() {
|
private fun setupFragment() {
|
||||||
val plusIcon = resources.getColoredDrawableWithColor(R.drawable.ic_plus, if (context!!.isBlackAndWhiteTheme()) Color.BLACK else Color.WHITE)
|
val plusIcon = resources.getColoredDrawableWithColor(R.drawable.ic_plus, if (context!!.isBlackAndWhiteTheme()) Color.BLACK else Color.WHITE)
|
||||||
view.checklist_fab.apply {
|
view.apply {
|
||||||
setImageDrawable(plusIcon)
|
checklist_fab.apply {
|
||||||
background.applyColorFilter(context!!.getAdjustedPrimaryColor())
|
setImageDrawable(plusIcon)
|
||||||
setOnClickListener {
|
background.applyColorFilter(context!!.getAdjustedPrimaryColor())
|
||||||
NewChecklistItemDialog(activity as SimpleActivity) {
|
setOnClickListener {
|
||||||
val currentMaxId = items.maxBy { it.id }?.id ?: 0
|
showNewItemDialog()
|
||||||
val checklistItem = ChecklistItem(currentMaxId + 1, it, false)
|
}
|
||||||
items.add(checklistItem)
|
}
|
||||||
saveNote()
|
|
||||||
|
fragment_placeholder_2.apply {
|
||||||
|
setTextColor(context!!.getAdjustedPrimaryColor())
|
||||||
|
underlineText()
|
||||||
|
setOnClickListener {
|
||||||
|
showNewItemDialog()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setupAdapter()
|
setupAdapter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun showNewItemDialog() {
|
||||||
|
NewChecklistItemDialog(activity as SimpleActivity) {
|
||||||
|
val currentMaxId = items.maxBy { it.id }?.id ?: 0
|
||||||
|
val checklistItem = ChecklistItem(currentMaxId + 1, it, false)
|
||||||
|
items.add(checklistItem)
|
||||||
|
saveNote()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupAdapter() {
|
private fun setupAdapter() {
|
||||||
|
view.apply {
|
||||||
|
fragment_placeholder.beVisibleIf(items.isEmpty())
|
||||||
|
fragment_placeholder_2.beVisibleIf(items.isEmpty())
|
||||||
|
checklist_list.beVisibleIf(items.isNotEmpty())
|
||||||
|
}
|
||||||
|
|
||||||
ChecklistAdapter(activity as SimpleActivity, items, this, view.checklist_list) {
|
ChecklistAdapter(activity as SimpleActivity, items, this, view.checklist_list) {
|
||||||
val clickedNote = it as ChecklistItem
|
val clickedNote = it as ChecklistItem
|
||||||
clickedNote.isDone = !clickedNote.isDone
|
clickedNote.isDone = !clickedNote.isDone
|
||||||
@ -101,5 +122,6 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun refreshItems() {
|
override fun refreshItems() {
|
||||||
|
setupAdapter()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,13 +6,45 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyRecyclerView
|
<RelativeLayout
|
||||||
android:id="@+id/checklist_list"
|
android:id="@+id/checklist_items_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:clipToPadding="false"
|
|
||||||
android:overScrollMode="never"
|
<com.simplemobiletools.commons.views.MyRecyclerView
|
||||||
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"/>
|
android:id="@+id/checklist_list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:overScrollMode="never"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"/>
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
|
android:id="@+id/fragment_placeholder"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/activity_margin"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingLeft="@dimen/activity_margin"
|
||||||
|
android:paddingRight="@dimen/activity_margin"
|
||||||
|
android:text="@string/checklist_is_empty"
|
||||||
|
android:textSize="@dimen/bigger_text_size"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
|
android:id="@+id/fragment_placeholder_2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/fragment_placeholder"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="@dimen/activity_margin"
|
||||||
|
android:text="@string/add_new_checklist_item"
|
||||||
|
android:textSize="@dimen/bigger_text_size"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyFloatingActionButton
|
<com.simplemobiletools.commons.views.MyFloatingActionButton
|
||||||
android:id="@+id/checklist_fab"
|
android:id="@+id/checklist_fab"
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Checklist</string>
|
<string name="checklist">Checklist</string>
|
||||||
<string name="add_new_checklist_item">Add a new checklist item</string>
|
<string name="add_new_checklist_item">Add a new checklist item</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Bütün qeydləri fayl şəklində çıxar</string>
|
<string name="export_all_notes">Bütün qeydləri fayl şəklində çıxar</string>
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Checklist</string>
|
<string name="checklist">Checklist</string>
|
||||||
<string name="add_new_checklist_item">Add a new checklist item</string>
|
<string name="add_new_checklist_item">Add a new checklist item</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Eksporter alle noter som filer</string>
|
<string name="export_all_notes">Eksporter alle noter som filer</string>
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Checklist</string>
|
<string name="checklist">Checklist</string>
|
||||||
<string name="add_new_checklist_item">Add a new checklist item</string>
|
<string name="add_new_checklist_item">Add a new checklist item</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Alle Notizen als Dateien exportieren</string>
|
<string name="export_all_notes">Alle Notizen als Dateien exportieren</string>
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Checklist</string>
|
<string name="checklist">Checklist</string>
|
||||||
<string name="add_new_checklist_item">Add a new checklist item</string>
|
<string name="add_new_checklist_item">Add a new checklist item</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Exportar todas las notas como archivos</string>
|
<string name="export_all_notes">Exportar todas las notas como archivos</string>
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Checklist</string>
|
<string name="checklist">Checklist</string>
|
||||||
<string name="add_new_checklist_item">Add a new checklist item</string>
|
<string name="add_new_checklist_item">Add a new checklist item</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Exporter toutes les notes en tant que fichiers</string>
|
<string name="export_all_notes">Exporter toutes les notes en tant que fichiers</string>
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Checklist</string>
|
<string name="checklist">Checklist</string>
|
||||||
<string name="add_new_checklist_item">Add a new checklist item</string>
|
<string name="add_new_checklist_item">Add a new checklist item</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Exportar todas as notas como ficheiros</string>
|
<string name="export_all_notes">Exportar todas as notas como ficheiros</string>
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Checklist</string>
|
<string name="checklist">Checklist</string>
|
||||||
<string name="add_new_checklist_item">Add a new checklist item</string>
|
<string name="add_new_checklist_item">Add a new checklist item</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Izvezi sve bilješke kao datoteke</string>
|
<string name="export_all_notes">Izvezi sve bilješke kao datoteke</string>
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Checklist</string>
|
<string name="checklist">Checklist</string>
|
||||||
<string name="add_new_checklist_item">Add a new checklist item</string>
|
<string name="add_new_checklist_item">Add a new checklist item</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Export all notes as files</string>
|
<string name="export_all_notes">Export all notes as files</string>
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Checklist</string>
|
<string name="checklist">Checklist</string>
|
||||||
<string name="add_new_checklist_item">Add a new checklist item</string>
|
<string name="add_new_checklist_item">Add a new checklist item</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Esporta le note come file</string>
|
<string name="export_all_notes">Esporta le note come file</string>
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Checklist</string>
|
<string name="checklist">Checklist</string>
|
||||||
<string name="add_new_checklist_item">Add a new checklist item</string>
|
<string name="add_new_checklist_item">Add a new checklist item</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Export all notes as files</string>
|
<string name="export_all_notes">Export all notes as files</string>
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Checklist</string>
|
<string name="checklist">Checklist</string>
|
||||||
<string name="add_new_checklist_item">Add a new checklist item</string>
|
<string name="add_new_checklist_item">Add a new checklist item</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Eksportuoti visus užrašus kaip bylas</string>
|
<string name="export_all_notes">Eksportuoti visus užrašus kaip bylas</string>
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Checklist</string>
|
<string name="checklist">Checklist</string>
|
||||||
<string name="add_new_checklist_item">Add a new checklist item</string>
|
<string name="add_new_checklist_item">Add a new checklist item</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Export all notes as files</string>
|
<string name="export_all_notes">Export all notes as files</string>
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Checklist</string>
|
<string name="checklist">Checklist</string>
|
||||||
<string name="add_new_checklist_item">Add a new checklist item</string>
|
<string name="add_new_checklist_item">Add a new checklist item</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Eksportuj wszystkie notatki jako pliki</string>
|
<string name="export_all_notes">Eksportuj wszystkie notatki jako pliki</string>
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Checklist</string>
|
<string name="checklist">Checklist</string>
|
||||||
<string name="add_new_checklist_item">Add a new checklist item</string>
|
<string name="add_new_checklist_item">Add a new checklist item</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Exportar todas as notas como arquivo</string>
|
<string name="export_all_notes">Exportar todas as notas como arquivo</string>
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Checklist</string>
|
<string name="checklist">Checklist</string>
|
||||||
<string name="add_new_checklist_item">Add a new checklist item</string>
|
<string name="add_new_checklist_item">Add a new checklist item</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Exportar todas as notas como ficheiros</string>
|
<string name="export_all_notes">Exportar todas as notas como ficheiros</string>
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Checklist</string>
|
<string name="checklist">Checklist</string>
|
||||||
<string name="add_new_checklist_item">Add a new checklist item</string>
|
<string name="add_new_checklist_item">Add a new checklist item</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Экспортировать все заметки в файлы</string>
|
<string name="export_all_notes">Экспортировать все заметки в файлы</string>
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Zoznam položiek</string>
|
<string name="checklist">Zoznam položiek</string>
|
||||||
<string name="add_new_checklist_item">Pridať do zoznamu novú položku</string>
|
<string name="add_new_checklist_item">Pridať do zoznamu novú položku</string>
|
||||||
|
<string name="checklist_is_empty">Zoznam položiek je prázdny</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Exportovať všetky poznámky ako súbory</string>
|
<string name="export_all_notes">Exportovať všetky poznámky ako súbory</string>
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Checklist</string>
|
<string name="checklist">Checklist</string>
|
||||||
<string name="add_new_checklist_item">Add a new checklist item</string>
|
<string name="add_new_checklist_item">Add a new checklist item</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Exportera alla anteckningar som filer</string>
|
<string name="export_all_notes">Exportera alla anteckningar som filer</string>
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Checklist</string>
|
<string name="checklist">Checklist</string>
|
||||||
<string name="add_new_checklist_item">Add a new checklist item</string>
|
<string name="add_new_checklist_item">Add a new checklist item</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Tüm notları dosya olarak dışa aktar</string>
|
<string name="export_all_notes">Tüm notları dosya olarak dışa aktar</string>
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Checklist</string>
|
<string name="checklist">Checklist</string>
|
||||||
<string name="add_new_checklist_item">Add a new checklist item</string>
|
<string name="add_new_checklist_item">Add a new checklist item</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Export all notes as files</string>
|
<string name="export_all_notes">Export all notes as files</string>
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">核對清單</string>
|
<string name="checklist">核對清單</string>
|
||||||
<string name="add_new_checklist_item">新增新的核對清單項目</string>
|
<string name="add_new_checklist_item">新增新的核對清單項目</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">將全部筆記匯出成檔案</string>
|
<string name="export_all_notes">將全部筆記匯出成檔案</string>
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<!-- Checklists -->
|
<!-- Checklists -->
|
||||||
<string name="checklist">Checklist</string>
|
<string name="checklist">Checklist</string>
|
||||||
<string name="add_new_checklist_item">Add a new checklist item</string>
|
<string name="add_new_checklist_item">Add a new checklist item</string>
|
||||||
|
<string name="checklist_is_empty">The checklist is empty</string>
|
||||||
|
|
||||||
<!-- Import / Export -->
|
<!-- Import / Export -->
|
||||||
<string name="export_all_notes">Export all notes as files</string>
|
<string name="export_all_notes">Export all notes as files</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user