Skip to content

Commit 0132c9b

Browse files
Refactor code
1 parent 75da88b commit 0132c9b

File tree

32 files changed

+50
-52
lines changed

32 files changed

+50
-52
lines changed

app/src/main/kotlin/com/simplemobiletools/notes/pro/activities/MainActivity.kt

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,7 @@ class MainActivity : SimpleActivity() {
243243
}
244244
}
245245

246-
private fun isCurrentItemChecklist() = mAdapter?.isChecklistFragment(view_pager.currentItem)
247-
?: false
246+
private fun isCurrentItemChecklist() = mAdapter?.isChecklistFragment(view_pager.currentItem) ?: false
248247

249248
private fun checkIntents(intent: Intent) {
250249
intent.apply {
@@ -506,11 +505,11 @@ class MainActivity : SimpleActivity() {
506505
val licenses = LICENSE_RTL
507506

508507
val faqItems = arrayListOf(
509-
FAQItem(R.string.faq_1_title_commons, R.string.faq_1_text_commons),
510-
FAQItem(R.string.faq_1_title, R.string.faq_1_text),
511-
FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons),
512-
FAQItem(R.string.faq_6_title_commons, R.string.faq_6_text_commons),
513-
FAQItem(R.string.faq_7_title_commons, R.string.faq_7_text_commons)
508+
FAQItem(R.string.faq_1_title_commons, R.string.faq_1_text_commons),
509+
FAQItem(R.string.faq_1_title, R.string.faq_1_text),
510+
FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons),
511+
FAQItem(R.string.faq_6_title_commons, R.string.faq_6_text_commons),
512+
FAQItem(R.string.faq_7_title_commons, R.string.faq_7_text_commons)
514513
)
515514

516515
startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true)
@@ -694,8 +693,8 @@ class MainActivity : SimpleActivity() {
694693

695694
private fun showExportFilePickUpdateDialog(exportPath: String, textToExport: String) {
696695
val items = arrayListOf(
697-
RadioItem(EXPORT_FILE_SYNC, getString(R.string.update_file_at_note)),
698-
RadioItem(EXPORT_FILE_NO_SYNC, getString(R.string.only_export_file_content)))
696+
RadioItem(EXPORT_FILE_SYNC, getString(R.string.update_file_at_note)),
697+
RadioItem(EXPORT_FILE_NO_SYNC, getString(R.string.only_export_file_content)))
699698

700699
RadioGroupDialog(this, items) {
701700
val syncFile = it as Int == EXPORT_FILE_SYNC
@@ -725,8 +724,8 @@ class MainActivity : SimpleActivity() {
725724
private fun exportAllNotes() {
726725
ExportFilesDialog(this, mNotes) { parent, extension ->
727726
val items = arrayListOf(
728-
RadioItem(EXPORT_FILE_SYNC, getString(R.string.update_file_at_note)),
729-
RadioItem(EXPORT_FILE_NO_SYNC, getString(R.string.only_export_file_content)))
727+
RadioItem(EXPORT_FILE_SYNC, getString(R.string.update_file_at_note)),
728+
RadioItem(EXPORT_FILE_NO_SYNC, getString(R.string.only_export_file_content)))
730729

731730
RadioGroupDialog(this, items) {
732731
val syncFile = it as Int == EXPORT_FILE_SYNC
@@ -907,8 +906,7 @@ class MainActivity : SimpleActivity() {
907906
private fun saveCurrentNote(force: Boolean) {
908907
getPagerAdapter().saveCurrentNote(view_pager.currentItem, force)
909908
if (mCurrentNote.type == NoteType.TYPE_CHECKLIST.value) {
910-
mCurrentNote.value = getPagerAdapter().getNoteChecklistItems(view_pager.currentItem)
911-
?: ""
909+
mCurrentNote.value = getPagerAdapter().getNoteChecklistItems(view_pager.currentItem) ?: ""
912910
}
913911
}
914912

app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/ChecklistFragment.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener {
6161
try {
6262
val checklistItemType = object : TypeToken<List<ChecklistItem>>() {}.type
6363
items = Gson().fromJson<ArrayList<ChecklistItem>>(storedNote.value, checklistItemType)
64-
?: ArrayList(1)
64+
?: ArrayList(1)
6565
} catch (e: Exception) {
6666
migrateCheckListOnFailure(storedNote)
6767
}
@@ -81,9 +81,9 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener {
8181

8282
note.value.split("\n").map { it.trim() }.filter { it.isNotBlank() }.forEachIndexed { index, value ->
8383
items.add(ChecklistItem(
84-
id = index,
85-
title = value,
86-
isDone = false
84+
id = index,
85+
title = value,
86+
isDone = false
8787
))
8888
}
8989

@@ -138,11 +138,11 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener {
138138
updateUIVisibility()
139139

140140
ChecklistAdapter(
141-
activity = activity as SimpleActivity,
142-
items = items,
143-
listener = this,
144-
recyclerView = view.checklist_list,
145-
showIcons = true
141+
activity = activity as SimpleActivity,
142+
items = items,
143+
listener = this,
144+
recyclerView = view.checklist_list,
145+
showIcons = true
146146
) { item ->
147147
val clickedNote = item as ChecklistItem
148148
clickedNote.isDone = !clickedNote.isDone

app/src/main/res/menu/menu.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<menu xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:app="http://schemas.android.com/apk/res-auto">
3+
xmlns:app="http://schemas.android.com/apk/res-auto">
44
<item
55
android:id="@+id/save_note"
66
android:icon="@drawable/ic_save_vector"

app/src/main/res/values-ar/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<string name="add_new_checklist_item">إضافة عنصر قائمة تدقيق جديد</string>
5656
<string name="add_new_checklist_items">إضافة عناصر قائمة تدقيق جديدة</string>
5757
<string name="checklist_is_empty">قائمة التدقيق فارغة</string>
58+
<string name="remove_done_items">Remove done items</string>
5859

5960
<!-- Import / Export -->
6061
<string name="export_all_notes">تصدير جميع الملاحظات كملفات</string>
@@ -101,7 +102,6 @@
101102
<b>Reddit:</b>
102103
https://www.reddit.com/r/SimpleMobileTools
103104
</string>
104-
<string name="remove_done_items">Remove done items</string>
105105

106106
<!--
107107
Haven't found some strings? There's more at

app/src/main/res/values-az/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<string name="add_new_checklist_item">Add a new checklist item</string>
5656
<string name="add_new_checklist_items">Add new checklist items</string>
5757
<string name="checklist_is_empty">The checklist is empty</string>
58+
<string name="remove_done_items">Remove done items</string>
5859

5960
<!-- Import / Export -->
6061
<string name="export_all_notes">Bütün qeydləri fayl şəklində çıxar</string>
@@ -101,7 +102,6 @@
101102
<b>Reddit:</b>
102103
https://www.reddit.com/r/SimpleMobileTools
103104
</string>
104-
<string name="remove_done_items">Remove done items</string>
105105

106106
<!--
107107
Haven't found some strings? There's more at

app/src/main/res/values-cs/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<string name="add_new_checklist_item">Přidat do seznamu novou položku</string>
5656
<string name="add_new_checklist_items">Přidat do seznamu nové položky</string>
5757
<string name="checklist_is_empty">Seznam položek je prázdný</string>
58+
<string name="remove_done_items">Remove done items</string>
5859

5960
<!-- Import / Export -->
6061
<string name="export_all_notes">Exportovat všechny poznámky jako soubory</string>
@@ -101,7 +102,6 @@
101102
<b>Reddit:</b>
102103
https://www.reddit.com/r/SimpleMobileTools
103104
</string>
104-
<string name="remove_done_items">Remove done items</string>
105105

106106
<!--
107107
Haven't found some strings? There's more at

app/src/main/res/values-cy/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<string name="add_new_checklist_item">Ychwanegu eitem newydd at restr wirio</string>
5656
<string name="add_new_checklist_items">Ychwanegu eitemau newydd at restr wirio</string>
5757
<string name="checklist_is_empty">Mae\'r rhestr wirio yn wag</string>
58+
<string name="remove_done_items">Remove done items</string>
5859

5960
<!-- Import / Export -->
6061
<string name="export_all_notes">Allforio pob nodyn fel ffeil</string>
@@ -101,7 +102,6 @@
101102
<b>Reddit:</b>
102103
https://www.reddit.com/r/SimpleMobileTools
103104
</string>
104-
<string name="remove_done_items">Remove done items</string>
105105

106106
<!--
107107
Haven't found some strings? There's more at

app/src/main/res/values-da/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<string name="add_new_checklist_item">Føj et nyt punkt til tjeklisten</string>
5656
<string name="add_new_checklist_items">Føj nye punkter til tjeklisten</string>
5757
<string name="checklist_is_empty">Tjeklisten er tom</string>
58+
<string name="remove_done_items">Remove done items</string>
5859

5960
<!-- Import / Export -->
6061
<string name="export_all_notes">Eksporter alle noter som filer</string>
@@ -101,7 +102,6 @@
101102
<b>Reddit:</b>
102103
https://www.reddit.com/r/SimpleMobileTools
103104
</string>
104-
<string name="remove_done_items">Remove done items</string>
105105

106106
<!--
107107
Haven't found some strings? There's more at

app/src/main/res/values-de/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<string name="add_new_checklist_item">Einen neuen Checklisteneintrag hinzufügen</string>
5656
<string name="add_new_checklist_items">Neue Checklisteneinträge hinzufügen</string>
5757
<string name="checklist_is_empty">Die Checkliste ist leer</string>
58+
<string name="remove_done_items">Remove done items</string>
5859

5960
<!-- Import / Export -->
6061
<string name="export_all_notes">Alle Notizen als Dateien exportieren</string>
@@ -99,7 +100,6 @@
99100
<b>Reddit:</b>
100101
https://www.reddit.com/r/SimpleMobileTools
101102
</string>
102-
<string name="remove_done_items">Remove done items</string>
103103

104104
<!--
105105
Haven't found some strings? There's more at

app/src/main/res/values-el/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<string name="add_new_checklist_item">Προσθήκη νέου στοιχείου λίστας ελέγχου</string>
5656
<string name="add_new_checklist_items">Προσθήκη νέων στοιχείων λίστας ελέγχου</string>
5757
<string name="checklist_is_empty">Η λίστα ελέγχου είναι κενή</string>
58+
<string name="remove_done_items">Remove done items</string>
5859

5960
<!-- Import / Export -->
6061
<string name="export_all_notes">Εξαγωγή όλων των σημειώσεων ως αρχεία</string>
@@ -101,7 +102,6 @@
101102
<b>Reddit:</b>
102103
https://www.reddit.com/r/SimpleMobileTools
103104
</string>
104-
<string name="remove_done_items">Remove done items</string>
105105

106106
<!--
107107
Haven't found some strings? There's more at

0 commit comments

Comments
 (0)