diff --git a/mobile/android/base/BrowserApp.java b/mobile/android/base/BrowserApp.java index 39360ab83872..df6e0a78c9db 100644 --- a/mobile/android/base/BrowserApp.java +++ b/mobile/android/base/BrowserApp.java @@ -416,6 +416,19 @@ abstract public class BrowserApp extends GeckoApp return values; } + void handleReaderRemoved(final String url) { + ThreadUtils.postToBackgroundThread(new Runnable() { + @Override + public void run() { + BrowserDB.removeReadingListItemWithURL(getContentResolver(), url); + showToast(R.string.page_removed, Toast.LENGTH_SHORT); + + final int count = BrowserDB.getReadingListCount(getContentResolver()); + GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Reader:ListCountUpdated", Integer.toString(count))); + } + }); + } + private void handleReaderFaviconRequest(final String url) { (new UiAsyncTask(ThreadUtils.getBackgroundHandler()) { @Override @@ -529,6 +542,7 @@ abstract public class BrowserApp extends GeckoApp "Menu:Add", "Menu:Remove", "Reader:ListStatusRequest", + "Reader:Removed", "Reader:Share", "Settings:Show", "Telemetry:Gather", @@ -881,6 +895,7 @@ abstract public class BrowserApp extends GeckoApp "Menu:Add", "Menu:Remove", "Reader:ListStatusRequest", + "Reader:Removed", "Reader:Share", "Settings:Show", "Telemetry:Gather", @@ -1211,6 +1226,10 @@ abstract public class BrowserApp extends GeckoApp } else if ("Reader:ListStatusRequest".equals(event)) { handleReaderListStatusRequest(message.getString("url")); + } else if ("Reader:Removed".equals(event)) { + final String url = message.getString("url"); + handleReaderRemoved(url); + } else if ("Reader:Share".equals(event)) { final String title = message.getString("title"); final String url = message.getString("url"); diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index d4ac8ceee7d4..4a455ea4dc7a 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -7323,6 +7323,13 @@ let Reader = { let url = aData; this.removeArticleFromCache(url, function(success) { this.log("Reader:Remove success=" + success + ", url=" + url); + + if (success) { + sendMessageToJava({ + type: "Reader:Removed", + url: url + }); + } }.bind(this)); break; }