+ private void updateMoveIcons() {
+ // Get a long array of the selected bookmarks.
+ long[] selectedBookmarksLongArray = bookmarksListView.getCheckedItemIds();
+
+ // Get the database IDs for the first, last, and selected bookmarks.
+ int selectedBookmarkDatabaseId = (int) selectedBookmarksLongArray[0];
+ int firstBookmarkDatabaseId = (int) bookmarksListView.getItemIdAtPosition(0);
+ // bookmarksListView is 0 indexed.
+ int lastBookmarkDatabaseId = (int) bookmarksListView.getItemIdAtPosition(bookmarksListView.getCount() - 1);
+
+ // Get the current theme status.
+ int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
+
+ // Update the move bookmark up `MenuItem`.
+ if (selectedBookmarkDatabaseId == firstBookmarkDatabaseId) { // The selected bookmark is in the first position.
+ // Disable the move bookmark up `MenuItem`.
+ moveBookmarkUpMenuItem.setEnabled(false);
+
+ // Set the move bookmark up icon to be ghosted.
+ moveBookmarkUpMenuItem.setIcon(R.drawable.move_up_disabled);
+ } else { // The selected bookmark is not in the first position.
+ // Enable the move bookmark up menu item.
+ moveBookmarkUpMenuItem.setEnabled(true);
+
+ // Set the icon according to the theme.
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ moveBookmarkUpMenuItem.setIcon(R.drawable.move_up_enabled_night);
+ } else {
+ moveBookmarkUpMenuItem.setIcon(R.drawable.move_up_enabled_day);
+ }
+ }
+
+ // Update the move bookmark down `MenuItem`.
+ if (selectedBookmarkDatabaseId == lastBookmarkDatabaseId) { // The selected bookmark is in the last position.
+ // Disable the move bookmark down `MenuItem`.
+ moveBookmarkDownMenuItem.setEnabled(false);
+
+ // Set the move bookmark down icon to be ghosted.
+ moveBookmarkDownMenuItem.setIcon(R.drawable.move_down_disabled);
+ } else { // The selected bookmark is not in the last position.
+ // Enable the move bookmark down `MenuItem`.
+ moveBookmarkDownMenuItem.setEnabled(true);
+
+ // Set the icon according to the theme.
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ moveBookmarkDownMenuItem.setIcon(R.drawable.move_down_enabled_night);
+ } else {
+ moveBookmarkDownMenuItem.setIcon(R.drawable.move_down_enabled_day);
+ }