<string name="bookmarks_button_remove_bookmark_cd">Remove the bookmark.</string>
<!-- Bookmarks - Bookmarks - Actions - Bookmark successfully added -->
<string name="bookmarks_msgs_add_success">The bookmark was added successfully.</string>
+ <!-- Bookmarks - Bookmarks - Actions - Bookmark already exists -->
+ <string name="bookmarks_msgs_add_exists">The bookmark was already exists.</string>
<!-- Initial directory dialog title -->
<string name="initial_directory_dialog_title">Initial folder</string>
case R.id.mnu_actions_add_to_bookmarks_current_folder:
Bookmark bookmark = BookmarksActionPolicy.addToBookmarks(
this.mContext, this.mFso);
- if (mBackRef != null) {
+ if (mBackRef != null && bookmark != null) {
// tell NavigationActivity's drawer to add the bookmark
mBackRef.addBookmark(bookmark);
}
*/
public static Bookmark addToBookmarks(final Context ctx, final FileSystemObject fso) {
try {
+ // Check if the bookmark exists already
+ if (Bookmarks.getBookmark(ctx.getContentResolver(), fso.getFullPath()) != null) {
+ DialogHelper.showToast(
+ ctx,
+ R.string.bookmarks_msgs_add_exists,
+ Toast.LENGTH_SHORT);
+ return null;
+ }
+
// Create the bookmark
Bookmark bookmark =
new Bookmark(BOOKMARK_TYPE.USER_DEFINED, fso.getName(), fso.getFullPath());