From 23dc83fb6a69a39c6b1070fd254968c0713bdd42 Mon Sep 17 00:00:00 2001 From: Anthony Restaino Date: Sun, 1 Nov 2015 16:00:28 -0500 Subject: [PATCH] Fixed bug where you could add generated html pages as bookmarks --- .../lightning/fragment/BookmarksFragment.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/acr/browser/lightning/fragment/BookmarksFragment.java b/app/src/main/java/acr/browser/lightning/fragment/BookmarksFragment.java index cde8686..d7584cb 100644 --- a/app/src/main/java/acr/browser/lightning/fragment/BookmarksFragment.java +++ b/app/src/main/java/acr/browser/lightning/fragment/BookmarksFragment.java @@ -49,6 +49,7 @@ import acr.browser.lightning.dialog.LightningDialogBuilder; import acr.browser.lightning.preference.PreferenceManager; import acr.browser.lightning.async.ImageDownloadTask; import acr.browser.lightning.utils.ThemeUtils; +import acr.browser.lightning.utils.UrlUtils; import acr.browser.lightning.view.LightningView; /** @@ -193,12 +194,14 @@ public class BookmarksFragment extends Fragment implements View.OnClickListener, @Subscribe public void addBookmark(final BrowserEvents.AddBookmark event) { final HistoryItem item = new HistoryItem(event.url, event.title); - if (mBookmarkManager.addBookmark(item)) { - mBookmarks.add(item); - Collections.sort(mBookmarks, new BookmarkManager.SortIgnoreCase()); - mBookmarkAdapter.notifyDataSetChanged(); - mEventBus.post(new BookmarkEvents.Added(item)); - updateBookmarkIndicator(event.url); + if (!UrlUtils.isSpecialUrl(item.getUrl())) { + if (mBookmarkManager.addBookmark(item)) { + mBookmarks.add(item); + Collections.sort(mBookmarks, new BookmarkManager.SortIgnoreCase()); + mBookmarkAdapter.notifyDataSetChanged(); + mEventBus.post(new BookmarkEvents.Added(item)); + updateBookmarkIndicator(event.url); + } } }