Revert "Revert "Add comment for final pre""

This reverts commit fab225710e.
This commit is contained in:
IF-ACT 2020-05-30 18:07:35 +08:00
parent fab225710e
commit 61a8fc25c7
5 changed files with 11 additions and 0 deletions

View file

@ -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();
}
}

View file

@ -52,6 +52,7 @@ public class LoadNotesListTask extends AsyncTask<Void, Void, List<Item>> {
protected List<Item> doInBackground(Void... voids) {
List<DBNote> 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) {

View file

@ -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();

View file

@ -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">
<!-- CS304 Issue link: https://github.com/stefan-niedermann/nextcloud-notes/issues/603 -->
<item
android:id="@+id/sorting_method"
android:title="@string/action_sorting_method"

View file

@ -9,6 +9,7 @@
<string name="action_settings">Settings</string>
<string name="action_trashbin">Deleted notes</string>
<string name="action_search">Search</string>
<!-- CS304 Issue link: https://github.com/stefan-niedermann/nextcloud-notes/issues/603 -->
<string name="action_sorting_method">Sorting method</string>
<string name="simple_cancel">Cancel</string>
<string name="simple_edit">Edit</string>