Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00bbe3ec authored by korelstar's avatar korelstar Committed by Niedermann IT-Dienstleistungen
Browse files

scroll to top after category selection and create note

parent b023d89b
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -231,7 +231,7 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
                if (closeNavigation) {
                    drawerLayout.closeDrawers();
                }
                refreshLists();
                refreshLists(true);
            }

            @Override
@@ -428,6 +428,9 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
    }

    private void refreshLists() {
        refreshLists(false);
    }
    private void refreshLists(final boolean scrollToTop) {
        String subtitle = "";
        if (navigationSelection.category != null) {
            if (navigationSelection.category.isEmpty()) {
@@ -451,6 +454,9 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
            public void onNotesLoaded(List<Item> notes, boolean showCategory) {
                adapter.setShowCategory(showCategory);
                adapter.setItemList(notes);
                if(scrollToTop) {
                    listView.scrollToPosition(0);
                }
            }
        };
        new LoadNotesListTask(getApplicationContext(), callback, navigationSelection, query).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
@@ -545,8 +551,8 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap

                DBNote createdNote = (DBNote) data.getExtras().getSerializable(CREATED_NOTE);
                adapter.add(createdNote);
                // TODO scroll to top
            }
            listView.scrollToPosition(0);
        } else if (requestCode == server_settings) {
            // Create new Instance with new URL and credentials
            db = NoteSQLiteOpenHelper.getInstance(this);