- // 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_up_disabled);
- } else { // Otherwise enable `moveBookmarkUpMenuItem`.
- moveBookmarkUpMenuItem.setEnabled(true);
-
- // Set the icon according to the theme.
- if (MainWebViewActivity.darkTheme) {
- moveBookmarkUpMenuItem.setIcon(R.drawable.move_up_enabled_dark);
- } else {
- moveBookmarkUpMenuItem.setIcon(R.drawable.move_up_enabled_light);
- }
- }
-
- // Disable `moveBookmarkDownMenuItem` if the selected bookmark is at the bottom of the ListView.
- if (selectedBookmarkDatabaseId == lastBookmarkDatabaseId) {
- moveBookmarkDownMenuItem.setEnabled(false);
- moveBookmarkDownMenuItem.setIcon(R.drawable.move_down_disabled);
- } else { // Otherwise enable `moveBookmarkDownMenuItem`.
- moveBookmarkDownMenuItem.setEnabled(true);
-
- // Set the icon according to the theme.
- if (MainWebViewActivity.darkTheme) {
- moveBookmarkDownMenuItem.setIcon(R.drawable.move_down_enabled_dark);
- } else {
- moveBookmarkDownMenuItem.setIcon(R.drawable.move_down_enabled_light);
- }
- }