From 61a8fc25c76c8a4d5d97949731f1be43821143d7 Mon Sep 17 00:00:00 2001 From: IF-ACT <44696723+IF-ACT@users.noreply.github.com> Date: Sat, 30 May 2020 18:07:35 +0800 Subject: [PATCH] Revert "Revert "Add comment for final pre"" This reverts commit fab225710e953a2ae287589b169b5e8ce0d4d13c. --- .../notes/android/activity/NotesListViewActivity.java | 6 ++++++ .../owncloud/notes/persistence/LoadNotesListTask.java | 1 + .../owncloud/notes/persistence/NotesDatabase.java | 2 ++ app/src/main/res/menu/menu_list_view.xml | 1 + app/src/main/res/values/strings.xml | 1 + 5 files changed, 11 insertions(+) diff --git a/app/src/main/java/it/niedermann/owncloud/notes/android/activity/NotesListViewActivity.java b/app/src/main/java/it/niedermann/owncloud/notes/android/activity/NotesListViewActivity.java index d8b2927c..68f632a1 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/android/activity/NotesListViewActivity.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/android/activity/NotesListViewActivity.java @@ -111,6 +111,7 @@ public class NotesListViewActivity extends LockedActivity implements ItemAdapter protected ItemAdapter adapter = null; + // CS304 Issue link: https://github.com/stefan-niedermann/nextcloud-notes/issues/603 private Menu currentMenu; protected NotesDatabase db = null; @@ -608,6 +609,7 @@ public class NotesListViewActivity extends LockedActivity implements ItemAdapter new LoadNotesListTask(localAccount.getId(), getApplicationContext(), callback, navigationSelection, query).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new LoadCategoryListTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + // CS304 Issue link: https://github.com/stefan-niedermann/nextcloud-notes/issues/603 updateSortMethodIcon(); } @@ -615,6 +617,7 @@ public class NotesListViewActivity extends LockedActivity implements ItemAdapter * Updates sorting method icon. */ private void updateSortMethodIcon() { + // CS304 Issue link: https://github.com/stefan-niedermann/nextcloud-notes/issues/603 if (localAccount == null || currentMenu == null) { return; } @@ -634,6 +637,7 @@ public class NotesListViewActivity extends LockedActivity implements ItemAdapter */ @Override public boolean onOptionsItemSelected(MenuItem item) { + // CS304 Issue link: https://github.com/stefan-niedermann/nextcloud-notes/issues/603 final String unexpectedSortMethod = "Unexpected sort method"; CategorySortingMethod method; @@ -661,6 +665,7 @@ public class NotesListViewActivity extends LockedActivity implements ItemAdapter */ @Override public boolean onPrepareOptionsMenu(Menu menu) { + // CS304 Issue link: https://github.com/stefan-niedermann/nextcloud-notes/issues/603 currentMenu = menu; updateSortMethodIcon(); return super.onPrepareOptionsMenu(menu); @@ -931,6 +936,7 @@ public class NotesListViewActivity extends LockedActivity implements ItemAdapter mActionMode.finish(); searchView.setIconified(true); + // CS304 Issue link: https://github.com/stefan-niedermann/nextcloud-notes/issues/603 refreshLists(); } } diff --git a/app/src/main/java/it/niedermann/owncloud/notes/persistence/LoadNotesListTask.java b/app/src/main/java/it/niedermann/owncloud/notes/persistence/LoadNotesListTask.java index 82f842f5..7f4995b6 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/persistence/LoadNotesListTask.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/persistence/LoadNotesListTask.java @@ -52,6 +52,7 @@ public class LoadNotesListTask extends AsyncTask> { protected List doInBackground(Void... voids) { List noteList; NotesDatabase db = NotesDatabase.getInstance(context); + // CS304 Issue link: https://github.com/stefan-niedermann/nextcloud-notes/issues/603 noteList = db.searchNotes(accountId, searchQuery, category.category, category.favorite, db.getCategoryOrder(accountId, category)); if (category.category == null) { diff --git a/app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesDatabase.java b/app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesDatabase.java index 5b0226da..073afa5b 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesDatabase.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesDatabase.java @@ -1082,6 +1082,7 @@ public class NotesDatabase extends AbstractNotesDatabase { * @return The sorting method in CategorySortingMethod enum format */ public CategorySortingMethod getCategoryOrder(long accountId, Category category) { + // CS304 Issue link: https://github.com/stefan-niedermann/nextcloud-notes/issues/603 validateAccountId(accountId); final Context ctx = getContext().getApplicationContext(); @@ -1125,6 +1126,7 @@ public class NotesDatabase extends AbstractNotesDatabase { */ public void modifyCategoryOrder( long accountId, Category category, CategorySortingMethod sortingMethod) { + // CS304 Issue link: https://github.com/stefan-niedermann/nextcloud-notes/issues/603 validateAccountId(accountId); final Context ctx = getContext().getApplicationContext(); diff --git a/app/src/main/res/menu/menu_list_view.xml b/app/src/main/res/menu/menu_list_view.xml index 6da62936..76240627 100644 --- a/app/src/main/res/menu/menu_list_view.xml +++ b/app/src/main/res/menu/menu_list_view.xml @@ -3,6 +3,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context="com.example.owncloudnotes.NotesListViewActivity"> + Settings Deleted notes Search + Sorting method Cancel Edit