]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/commitdiff
Add the ability to reorder bookmarks.
authorSoren Stoutner <soren@stoutner.com>
Wed, 13 Jul 2016 04:22:49 +0000 (21:22 -0700)
committerSoren Stoutner <soren@stoutner.com>
Wed, 13 Jul 2016 04:22:49 +0000 (21:22 -0700)
app/src/main/assets/about_licenses.html
app/src/main/assets/images/ic_vertical_align_bottom.png [new file with mode: 0644]
app/src/main/assets/images/ic_vertical_align_top.png [new file with mode: 0644]
app/src/main/java/com/stoutner/privacybrowser/BookmarksActivity.java
app/src/main/java/com/stoutner/privacybrowser/BookmarksDatabaseHandler.java
app/src/main/res/drawable/move_bookmark_down_disabled.xml [new file with mode: 0644]
app/src/main/res/drawable/move_bookmark_down_enabled.xml [new file with mode: 0644]
app/src/main/res/drawable/move_bookmark_up_disabled.xml [new file with mode: 0644]
app/src/main/res/drawable/move_bookmark_up_enabled.xml [new file with mode: 0644]
app/src/main/res/menu/bookmarks_context_menu.xml
app/src/main/res/values/strings.xml

index bb6fa1a26e989f1b29cd4912dc60bd9adb7cf647..63e7996643a3d24f0ee9c4c087c413730d854551 100644 (file)
 
 <p><img class="center" src="images/ic_add.png" height="32" width="32"> ic_add.</p>
 
+<p><img class="center" src="images/ic_vertical_align_top.png" height="32" width="32"> ic_vertical_align_top</p>
+
+<p><img class="center" src="images/ic_vertical_align_bottom.png" height="32" width="32"> ic_vertical_align_bottom</p>
+
 <p><img class="center" src="images/ic_edit.png" height="32" width="32"> ic_edit.</p>
 
 <p><img class="center" src="images/ic_delete.png" height="32" width="32"> ic_download.</p>
diff --git a/app/src/main/assets/images/ic_vertical_align_bottom.png b/app/src/main/assets/images/ic_vertical_align_bottom.png
new file mode 100644 (file)
index 0000000..620a120
Binary files /dev/null and b/app/src/main/assets/images/ic_vertical_align_bottom.png differ
diff --git a/app/src/main/assets/images/ic_vertical_align_top.png b/app/src/main/assets/images/ic_vertical_align_top.png
new file mode 100644 (file)
index 0000000..607c9e6
Binary files /dev/null and b/app/src/main/assets/images/ic_vertical_align_top.png differ
index b6e67c89da48de1144a1bd8c736992a8c6196763..75a340211711d4f9fcb8f70d765fefacd3ac552d 100644 (file)
@@ -35,6 +35,7 @@ import android.support.v4.widget.CursorAdapter;
 import android.support.v7.app.ActionBar;
 import android.support.v7.app.AppCompatActivity;
 import android.support.v7.widget.Toolbar;
+import android.util.SparseBooleanArray;
 import android.view.ActionMode;
 import android.view.Menu;
 import android.view.MenuItem;
@@ -62,6 +63,9 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
     // `contextualActionMode` is used in `onCreate()` and `onEditBookmarkSave()`.
     private ActionMode contextualActionMode;
 
+    // `selectedBookmarkPosition` is used in `onCreate()` and `onEditBookarkSave()`.
+    private int selectedBookmarkPosition;
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -105,11 +109,17 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
 
         // `MultiChoiceModeListener` handles long clicks.
         bookmarksListView.setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() {
+            // `moveBookmarkUpMenuItem` is used in `onCreateActionMode()` and `onItemCheckedStateChanged`.
+            MenuItem moveBookmarkUpMenuItem;
+
+            // `moveBookmarkDownMenuItem` is used in `onCreateActionMode()` and `onItemCheckedStateChanged`.
+            MenuItem moveBookmarkDownMenuItem;
+
             // `editBookmarkMenuItem` is used in `onCreateActionMode()` and `onItemCheckedStateChanged`.
             MenuItem editBookmarkMenuItem;
 
             // `selectAllBookmarks` is used in `onCreateActionMode()` and `onItemCheckedStateChanges`.
-            MenuItem selectAllBookmarks;
+            MenuItem selectAllBookmarksMenuItem;
 
             @Override
             public boolean onCreateActionMode(ActionMode mode, Menu menu) {
@@ -117,9 +127,11 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                 getMenuInflater().inflate(R.menu.bookmarks_context_menu, menu);
                 mode.setTitle(R.string.bookmarks);
 
-                // Get a handle for `R.id.edit_bookmark` and `R.id.select_all_bookmarks`.
+                // Get a handle for MenuItems we need to selectively disable.
+                moveBookmarkUpMenuItem = menu.findItem(R.id.move_bookmark_up);
+                moveBookmarkDownMenuItem = menu.findItem(R.id.move_bookmark_down);
                 editBookmarkMenuItem = menu.findItem(R.id.edit_bookmark);
-                selectAllBookmarks = menu.findItem(R.id.context_menu_select_all_bookmarks);
+                selectAllBookmarksMenuItem = menu.findItem(R.id.context_menu_select_all_bookmarks);
 
                 return true;
             }
@@ -140,18 +152,46 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                 // List the number of selected bookmarks in the subtitle.
                 mode.setSubtitle(numberOfSelectedBookmarks + " " + getString(R.string.selected));
 
-                // Show the `Edit` option only if 1 bookmark is selected.
-                if (numberOfSelectedBookmarks < 2) {
+                if (numberOfSelectedBookmarks == 1) {
+                    // Show the `Move Up`, `Move Down`, and  `Edit` option only if 1 bookmark is selected.
+                    moveBookmarkUpMenuItem.setVisible(true);
+                    moveBookmarkDownMenuItem.setVisible(true);
                     editBookmarkMenuItem.setVisible(true);
-                } else {
+
+                    // Get the database IDs for the bookmarks.
+                    int selectedBookmarkDatabaseId = (int) selectedBookmarksLongArray[0];
+                    int firstBookmarkDatabaseId = (int) bookmarksListView.getItemIdAtPosition(0);
+                    // bookmarksListView is 0 indexed.
+                    int lastBookmarkDatabaseId = (int) bookmarksListView.getItemIdAtPosition(bookmarksListView.getCount() - 1);
+
+                    // Disable `moveBookmarkUpMenuItem` if the selected bookmark is at the top of the ListView.
+                    if (selectedBookmarkDatabaseId == firstBookmarkDatabaseId) {
+                        moveBookmarkUpMenuItem.setEnabled(false);
+                        moveBookmarkUpMenuItem.setIcon(R.drawable.move_bookmark_up_disabled);
+                    } else {  // Otherwise enable `moveBookmarkUpMenuItem`.
+                        moveBookmarkUpMenuItem.setEnabled(true);
+                        moveBookmarkUpMenuItem.setIcon(R.drawable.move_bookmark_up_enabled);
+                    }
+
+                    // Disable `moveBookmarkDownMenuItem` if the selected bookmark is at the bottom of the ListView.
+                    if (selectedBookmarkDatabaseId == lastBookmarkDatabaseId) {
+                        moveBookmarkDownMenuItem.setEnabled(false);
+                        moveBookmarkDownMenuItem.setIcon(R.drawable.move_bookmark_down_disabled);
+                    } else {  // Otherwise enable `moveBookmarkDownMenuItem`.
+                        moveBookmarkDownMenuItem.setEnabled(true);
+                        moveBookmarkDownMenuItem.setIcon(R.drawable.move_bookmark_down_enabled);
+                    }
+                } else {  // Hide the MenuItems because more than one bookmark is selected.
+                    moveBookmarkUpMenuItem.setVisible(false);
+                    moveBookmarkDownMenuItem.setVisible(false);
                     editBookmarkMenuItem.setVisible(false);
                 }
 
                 // Do not show `Select All` if all the bookmarks are already checked.
                 if (bookmarksListView.getCheckedItemIds().length == bookmarksListView.getCount()) {
-                    selectAllBookmarks.setVisible(false);
+                    selectAllBookmarksMenuItem.setVisible(false);
                 } else {
-                    selectAllBookmarks.setVisible(true);
+                    selectAllBookmarksMenuItem.setVisible(true);
                 }
             }
 
@@ -159,13 +199,101 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
             public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
                 int menuItemId = item.getItemId();
 
+                // `numberOfBookmarks` is used in `R.id.move_bookmark_up_enabled`, `R.id.move_bookmark_down_enabled`, and `R.id.context_menu_select_all_bookmarks`.
+                int numberOfBookmarks;
+
+                // `selectedBookmarkLongArray` is used in `R.id.move_bookmark_up` and `R.id.move_bookmark_down`.
+                long[]selectedBookmarkLongArray;
+                // `selectedBookmarkDatabaseId` is used in `R.id.move_bookmark_up` and `R.id.move_bookmark_down`.
+                int selectedBookmarkDatabaseId;
+                // `selectedBookmarkNewPosition` is used in `R.id.move_bookmark_up` and `R.id.move_bookmark_down`.
+                int selectedBookmarkNewPosition;
+
                 switch (menuItemId) {
+                    case R.id.move_bookmark_up:
+                        // Get the selected bookmark database ID.
+                        selectedBookmarkLongArray = bookmarksListView.getCheckedItemIds();
+                        selectedBookmarkDatabaseId = (int) selectedBookmarkLongArray[0];
+
+                        // Initialize `selectedBookmarkNewPosition`.
+                        selectedBookmarkNewPosition = 0;
+
+                        for (int i = 0; i < bookmarksListView.getCount(); i++) {
+                            int databaseId = (int) bookmarksListView.getItemIdAtPosition(i);
+                            int nextBookmarkDatabaseId = (int) bookmarksListView.getItemIdAtPosition(i + 1);
+
+                            if (databaseId == selectedBookmarkDatabaseId || nextBookmarkDatabaseId == selectedBookmarkDatabaseId) {
+                                if (databaseId == selectedBookmarkDatabaseId) {
+                                    // Move the selected bookmark up one and store the new bookmark position.
+                                    bookmarksDatabaseHandler.updateBookmarkDisplayOrder(databaseId, i - 1);
+                                    selectedBookmarkNewPosition = i - 1;
+                                } else {  // Move the bookmark above the selected bookmark down one.
+                                    bookmarksDatabaseHandler.updateBookmarkDisplayOrder(databaseId, i + 1);
+                                }
+                            } else {
+                                // Reset the rest of the bookmarks' DISPLAY_ORDER to match the position in the ListView.
+                                // This isn't necessary, but it clears out any stray values that might have crept into the database.
+                                bookmarksDatabaseHandler.updateBookmarkDisplayOrder(databaseId, i);
+                            }
+                        }
+
+                        // Refresh the ListView.
+                        updateBookmarksListView();
+
+                        // Select the previously selected bookmark in the new location.
+                        bookmarksListView.setItemChecked(selectedBookmarkNewPosition, true);
+
+                        bookmarksListView.setSelection(selectedBookmarkNewPosition - 5);
+
+                        break;
+
+                    case R.id.move_bookmark_down:
+                        // Get the selected bookmark database ID.
+                        selectedBookmarkLongArray = bookmarksListView.getCheckedItemIds();
+                        selectedBookmarkDatabaseId = (int) selectedBookmarkLongArray[0];
+
+                        // Initialize `selectedBookmarkNewPosition`.
+                        selectedBookmarkNewPosition = 0;
+
+                        for (int i = 0; i <bookmarksListView.getCount(); i++) {
+                            int databaseId = (int) bookmarksListView.getItemIdAtPosition(i);
+                            int previousBookmarkDatabaseId = (int) bookmarksListView.getItemIdAtPosition(i - 1);
+
+                            if (databaseId == selectedBookmarkDatabaseId || previousBookmarkDatabaseId == selectedBookmarkDatabaseId) {
+                                if (databaseId == selectedBookmarkDatabaseId) {
+                                    // Move the selected bookmark down one and store the new bookmark position.
+                                    bookmarksDatabaseHandler.updateBookmarkDisplayOrder(databaseId, i + 1);
+                                    selectedBookmarkNewPosition = i + 1;
+                                } else {  // Move the bookmark below the selected bookmark up one.
+                                    bookmarksDatabaseHandler.updateBookmarkDisplayOrder(databaseId, i - 1);
+                                }
+                            } else {
+                                // Reset the rest of the bookmark' DISPLAY_ORDER to match the position in the ListView.
+                                // This isn't necessary, but it clears out any stray values that might have crept into the database.
+                                bookmarksDatabaseHandler.updateBookmarkDisplayOrder(databaseId, i);
+                            }
+                        }
+
+                        // Refresh the ListView.
+                        updateBookmarksListView();
+
+                        // Select the previously selected bookmark in the new location.
+                        bookmarksListView.setItemChecked(selectedBookmarkNewPosition, true);
+
+                        bookmarksListView.setSelection(selectedBookmarkNewPosition - 5);
+                        break;
+
                     case R.id.edit_bookmark:
+                        // Get a handle for `selectedBookmarkPosition` so we can scroll to it after refreshing the ListView.
+                        SparseBooleanArray bookmarkPositionSparseBooleanArray = bookmarksListView.getCheckedItemPositions();
+                        selectedBookmarkPosition = bookmarkPositionSparseBooleanArray.keyAt(0);
+
+                        // Get a handle for `contextualActionMode` so we can close it when `editBookmarkDialog` is finished.
+                        contextualActionMode = mode;
+
                         // Show the `EditBookmark` `AlertDialog` and name the instance `@string/edit_bookmark`.
                         DialogFragment editBookmarkDialog = new EditBookmark();
                         editBookmarkDialog.show(getFragmentManager(), "@string/edit_bookmark");
-
-                        contextualActionMode = mode;
                         break;
 
                     case R.id.delete_bookmark:
@@ -223,7 +351,7 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
                         break;
 
                     case R.id.context_menu_select_all_bookmarks:
-                        int numberOfBookmarks = bookmarksListView.getCount();
+                        numberOfBookmarks = bookmarksListView.getCount();
 
                         for (int i = 0; i < numberOfBookmarks; i++) {
                             bookmarksListView.setItemChecked(i, true);
@@ -306,11 +434,15 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
         MainWebViewActivity.favoriteIcon.compress(Bitmap.CompressFormat.PNG, 0, favoriteIconByteArrayOutputStream);
         byte[] favoriteIconByteArray = favoriteIconByteArrayOutputStream.toByteArray();
 
+        // Display the new bookmark below the current items in the (0 indexed) list.
+        int newBookmarkDisplayOrder = bookmarksListView.getCount();
+
         // Create the bookmark.
-        bookmarksDatabaseHandler.createBookmark(bookmarkNameString, bookmarkUrlString, favoriteIconByteArray);
+        bookmarksDatabaseHandler.createBookmark(bookmarkNameString, bookmarkUrlString, newBookmarkDisplayOrder, favoriteIconByteArray);
 
-        // Refresh the ListView.
+        // Refresh the ListView.  `setSelection` scrolls to the bottom of the list.
         updateBookmarksListView();
+        bookmarksListView.setSelection(bookmarksListView.getCount());
     }
 
     @Override
@@ -334,23 +466,28 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
         int selectedBookmarkDatabaseId = (int) selectedBookmarksLongArray[0];
 
         if (useNewFavoriteIconBitmap.isChecked()) {
+            // Get the new favorite icon from the Dialog and convert it into a Bitmap.
             ImageView newFavoriteIconImageView = (ImageView) editBookmarkDialogFragment.getDialog().findViewById(R.id.edit_bookmark_new_favorite_icon);
             Drawable favoriteIconDrawable = newFavoriteIconImageView.getDrawable();
             Bitmap favoriteIconBitmap = ((BitmapDrawable) favoriteIconDrawable).getBitmap();
+
+            // Convert the new `favoriteIconBitmap` into a Byte Array.
             ByteArrayOutputStream favoriteIconByteArrayOutputStream = new ByteArrayOutputStream();
             favoriteIconBitmap.compress(Bitmap.CompressFormat.PNG, 0, favoriteIconByteArrayOutputStream);
             favoriteIconByteArray = favoriteIconByteArrayOutputStream.toByteArray();
-            bookmarksDatabaseHandler.updateBookmark(selectedBookmarkDatabaseId, bookmarkNameString, bookmarkUrlString, favoriteIconByteArray);
 
-        } else {
-            // Update the bookmark.
+            //  Update the bookmark and the favorite icon.
+            bookmarksDatabaseHandler.updateBookmark(selectedBookmarkDatabaseId, bookmarkNameString, bookmarkUrlString, favoriteIconByteArray);
+        } else {  // Update the bookmark without changing the favorite icon.
             bookmarksDatabaseHandler.updateBookmark(selectedBookmarkDatabaseId, bookmarkNameString, bookmarkUrlString);
         }
 
+        // Close the contextual action mode.
         contextualActionMode.finish();
 
-        // Refresh the `ListView`.
+        // Refresh the `ListView`.  `setSelection` scrolls to that position.
         updateBookmarksListView();
+        bookmarksListView.setSelection(selectedBookmarkPosition);
     }
 
     private void updateBookmarksListView() {
index 2194bc9957d709c57d5eb509e6c5af7646d51936..5a5a025a16aae46bb03fd25cc23bf67c81df9d77 100644 (file)
@@ -62,10 +62,11 @@ public class BookmarksDatabaseHandler extends SQLiteOpenHelper {
         // Code for upgrading the database will be added here when the schema version > 1.
     }
 
-    public void createBookmark(String bookmarkName, String bookmarkURL, byte[] favoriteIcon) {
+    public void createBookmark(String bookmarkName, String bookmarkURL, int displayOrder, byte[] favoriteIcon) {
         ContentValues bookmarkContentValues = new ContentValues();
 
         // ID is created automatically.
+        bookmarkContentValues.put(DISPLAY_ORDER, displayOrder);
         bookmarkContentValues.put(BOOKMARK_NAME, bookmarkName);
         bookmarkContentValues.put(BOOKMARK_URL, bookmarkURL);
         bookmarkContentValues.put(PARENT_FOLDER, "");
@@ -86,7 +87,7 @@ public class BookmarksDatabaseHandler extends SQLiteOpenHelper {
         // Get a readable database handle.
         SQLiteDatabase bookmarksDatabase = this.getReadableDatabase();
 
-        // Prepare the SQL statement to get the cursor for `databaseId`.
+        // Prepare the SQL statement to get the cursor for `databaseId`
         final String GET_ONE_BOOKMARK = "Select * FROM " + BOOKMARKS_TABLE +
                 " WHERE " + _ID + " = " + databaseId;
 
@@ -113,7 +114,7 @@ public class BookmarksDatabaseHandler extends SQLiteOpenHelper {
 
         // Prepare the SQL statement to select all items except those with the specified IDs.
         final String GET_All_BOOKMARKS_EXCEPT_SPECIFIED = "Select * FROM " + BOOKMARKS_TABLE +
-                " WHERE " + _ID + " NOT IN (" + doNotGetIdsString + ")";
+                " WHERE " + _ID + " NOT IN (" + doNotGetIdsString + ") ORDER BY " + DISPLAY_ORDER + " ASC";
 
         // Return the results as a `Cursor`.  The second argument is `null` because there are no selectionArgs.
         // We can't close the `Cursor` because we need to use it in the parent activity.
@@ -125,7 +126,7 @@ public class BookmarksDatabaseHandler extends SQLiteOpenHelper {
         SQLiteDatabase bookmarksDatabase = this.getReadableDatabase();
 
         // Get everything in the BOOKMARKS_TABLE.
-        final String GET_ALL_BOOKMARKS = "Select * FROM " + BOOKMARKS_TABLE;
+        final String GET_ALL_BOOKMARKS = "Select * FROM " + BOOKMARKS_TABLE + " ORDER BY " + DISPLAY_ORDER + " ASC";
 
         // Return the results as a Cursor.  The second argument is `null` because there are no selectionArgs.
         // We can't close the Cursor because we need to use it in the parent activity.
@@ -191,6 +192,22 @@ public class BookmarksDatabaseHandler extends SQLiteOpenHelper {
         bookmarksDatabase.close();
     }
 
+    public void updateBookmarkDisplayOrder(int databaseId, int displayOrder) {
+        // Store the updated values in `bookmarkContentValues`.
+        ContentValues bookmarkContentValues = new ContentValues();
+
+        bookmarkContentValues.put(DISPLAY_ORDER, displayOrder);
+
+        // Get a writable database handle.
+        SQLiteDatabase bookmarksDatabase = this.getWritableDatabase();
+
+        // Update the database.  The last argument is `null` because there are no `whereArgs`.
+        bookmarksDatabase.update(BOOKMARKS_TABLE, bookmarkContentValues, _ID + " = " + databaseId, null);
+
+        // Close the database handle.
+        bookmarksDatabase.close();
+    }
+
     public void deleteBookmark(int databaseId) {
         // Get a writable database handle.
         SQLiteDatabase bookmarksDatabase = this.getWritableDatabase();
diff --git a/app/src/main/res/drawable/move_bookmark_down_disabled.xml b/app/src/main/res/drawable/move_bookmark_down_disabled.xml
new file mode 100644 (file)
index 0000000..674fcda
--- /dev/null
@@ -0,0 +1,15 @@
+<!-- move_bookmark_down_enabled.xmlbled.xml comes from the Android Material icon set, where it is called ic_vertical_align_bottom.
+  It is released under the CC-BY license <https://creativecommons.org/licenses/by/4.0/>. -->
+
+<vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:height="24dp"
+    android:width="24dp"
+    android:viewportHeight="24.0"
+    android:viewportWidth="24.0" >
+
+    <!-- We have to wait until API >=21 to reference `@color/light_blue` directly. -->
+    <path
+        android:fillColor="#FFBBDEFB"
+        android:pathData="M16,13h-3V3h-2v10H8l4,4 4,-4zM4,19v2h16v-2H4z"/>
+</vector>
diff --git a/app/src/main/res/drawable/move_bookmark_down_enabled.xml b/app/src/main/res/drawable/move_bookmark_down_enabled.xml
new file mode 100644 (file)
index 0000000..90b5ae1
--- /dev/null
@@ -0,0 +1,14 @@
+<!-- move_bookmark_down_enabled.xmlbled.xml comes from the Android Material icon set, where it is called ic_vertical_align_bottom.
+  It is released under the CC-BY license <https://creativecommons.org/licenses/by/4.0/>. -->
+
+<vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:height="24dp"
+    android:width="24dp"
+    android:viewportHeight="24.0"
+    android:viewportWidth="24.0" >
+
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M16,13h-3V3h-2v10H8l4,4 4,-4zM4,19v2h16v-2H4z"/>
+</vector>
diff --git a/app/src/main/res/drawable/move_bookmark_up_disabled.xml b/app/src/main/res/drawable/move_bookmark_up_disabled.xml
new file mode 100644 (file)
index 0000000..c38ad46
--- /dev/null
@@ -0,0 +1,15 @@
+<!-- move_bookmark_up_enabled.xmlbled.xml comes from the Android Material icon set, where it is called ic_vertical_align_top.
+  It is released under the CC-BY license <https://creativecommons.org/licenses/by/4.0/>. -->
+
+<vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:height="24dp"
+    android:width="24dp"
+    android:viewportHeight="24.0"
+    android:viewportWidth="24.0" >
+
+    <!-- We have to wait until API >=21 to reference `@color/light_blue` directly. -->
+    <path
+        android:fillColor="#FFBBDEFB"
+        android:pathData="M8,11h3v10h2V11h3l-4,-4 -4,4zM4,3v2h16V3H4z"/>
+</vector>
diff --git a/app/src/main/res/drawable/move_bookmark_up_enabled.xml b/app/src/main/res/drawable/move_bookmark_up_enabled.xml
new file mode 100644 (file)
index 0000000..06c837d
--- /dev/null
@@ -0,0 +1,14 @@
+<!-- move_bookmark_up_enabled_enabled.xml comes from the Android Material icon set, where it is called ic_vertical_align_top.
+  It is released under the CC-BY license <https://creativecommons.org/licenses/by/4.0/>. -->
+
+<vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:height="24dp"
+    android:width="24dp"
+    android:viewportHeight="24.0"
+    android:viewportWidth="24.0" >
+
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M8,11h3v10h2V11h3l-4,-4 -4,4zM4,3v2h16V3H4z"/>
+</vector>
index 98b790adacba33f2559c72e71dba6bb480539701..ba1139ee3a1e22a4c5d02b420dd885f94b4d5c37 100644 (file)
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto">
 
+    <item
+        android:id="@+id/move_bookmark_up"
+        android:title="@string/move_up"
+        android:orderInCategory="10"
+        android:icon="@drawable/move_bookmark_up_enabled"
+        app:showAsAction="ifRoom" />
+
+    <item
+        android:id="@+id/move_bookmark_down"
+        android:title="@string/move_down"
+        android:orderInCategory="20"
+        android:icon="@drawable/move_bookmark_down_enabled"
+        app:showAsAction="ifRoom" />
+
     <item
         android:id="@+id/edit_bookmark"
         android:title="@string/edit"
-        android:orderInCategory="10"
+        android:orderInCategory="30"
         android:icon="@drawable/edit"
         app:showAsAction="ifRoom" />
 
     <item
         android:id="@+id/delete_bookmark"
         android:title="@string/delete"
-        android:orderInCategory="20"
+        android:orderInCategory="40"
         android:icon="@drawable/delete"
         app:showAsAction="ifRoom" />
 
     <item
         android:id="@+id/context_menu_select_all_bookmarks"
         android:title="@string/select_all"
-        android:orderInCategory="30"
+        android:orderInCategory="50"
         android:icon="@drawable/select_all"
         app:showAsAction="ifRoom" />
 </menu>
\ No newline at end of file
index 69424458fc1ed6a9ec7dae37b64fe6bb3d754a6e..a4a030e0c3a781c59b1ed51b50b675a4156dcaea 100644 (file)
@@ -80,6 +80,8 @@
 
     <!-- Bookmarks Contextual App Bar. -->
     <string name="selected">Selected</string>
+    <string name="move_up">Move Up</string>
+    <string name="move_down">Move down</string>
     <string name="edit">Edit</string>
     <string name="delete">Delete</string>
     <string name="select_all">Select All</string>