- // Update the ListView.
- bookmarksListView.setAdapter(bookmarksCursorAdapter);
-
- // Set a listener to edit a bookmark when it is tapped.
- bookmarksListView.setOnItemClickListener((AdapterView<?> parent, View view, int position, long id) -> {
- // Convert the database ID to an int.
- int databaseId = (int) id;
-
- // Show the edit bookmark or edit bookmark folder dialog.
- if (bookmarksDatabaseHelper.isFolder(databaseId)) {
- // Save the current folder name, which is used in `onSaveBookmarkFolder()`.
- oldFolderNameString = bookmarksCursor.getString(bookmarksCursor.getColumnIndex(BookmarksDatabaseHelper.BOOKMARK_NAME));
-
- // Show the edit bookmark folder dialog.
- DialogFragment editBookmarkFolderDatabaseViewDialog = EditBookmarkFolderDatabaseViewDialog.folderDatabaseId(databaseId, favoriteIconBitmap);
- editBookmarkFolderDatabaseViewDialog.show(getSupportFragmentManager(), getResources().getString(R.string.edit_folder));
- } else {
- // Show the edit bookmark dialog.
- DialogFragment editBookmarkDatabaseViewDialog = EditBookmarkDatabaseViewDialog.bookmarkDatabaseId(databaseId, favoriteIconBitmap);
- editBookmarkDatabaseViewDialog.show(getSupportFragmentManager(), getResources().getString(R.string.edit_bookmark));
- }
- });
+ // Get the display order from the `Cursor` and display it in `bookmarkDisplayOrderTextView`.
+ int bookmarkDisplayOrder = cursor.getInt(cursor.getColumnIndexOrThrow(BookmarksDatabaseHelper.DISPLAY_ORDER));
+ TextView bookmarkDisplayOrderTextView = view.findViewById(R.id.bookmarks_databaseview_display_order);
+ bookmarkDisplayOrderTextView.setText(String.valueOf(bookmarkDisplayOrder));
+
+ // Get the parent folder from the `Cursor` and display it in `bookmarkParentFolder`.
+ String bookmarkParentFolder = cursor.getString(cursor.getColumnIndexOrThrow(BookmarksDatabaseHelper.PARENT_FOLDER));
+ ImageView parentFolderImageView = view.findViewById(R.id.bookmarks_databaseview_parent_folder_icon);
+ TextView bookmarkParentFolderTextView = view.findViewById(R.id.bookmarks_databaseview_parent_folder);
+
+ // Make the folder name gray if it is the home folder.
+ if (bookmarkParentFolder.isEmpty()) {
+ parentFolderImageView.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.folder_gray));
+ bookmarkParentFolderTextView.setText(R.string.home_folder);
+ bookmarkParentFolderTextView.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.gray_500));
+ } else {
+ parentFolderImageView.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.folder_dark_blue));
+ bookmarkParentFolderTextView.setText(bookmarkParentFolder);
+
+ // Get the current theme status.
+ int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
+
+ // Set the text color according to the theme.
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ // This color is a little darker than the default night mode text. But the effect is rather nice.
+ bookmarkParentFolderTextView.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.gray_300));
+ } else {
+ bookmarkParentFolderTextView.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.black));
+ }
+ }
+ }
+ };