diff --git a/mobile/android/base/home/HomeFragment.java b/mobile/android/base/home/HomeFragment.java index b608fa079ab..3e2bb4554ca 100644 --- a/mobile/android/base/home/HomeFragment.java +++ b/mobile/android/base/home/HomeFragment.java @@ -244,18 +244,17 @@ abstract class HomeFragment extends Fragment { if (mInReadingList) { GeckoEvent e = GeckoEvent.createBroadcastEvent("Reader:Remove", mUrl); GeckoAppShell.sendEventToGecko(e); - - int count = BrowserDB.getReadingListCount(cr); - e = GeckoEvent.createBroadcastEvent("Reader:ListCountUpdated", Integer.toString(count)); - GeckoAppShell.sendEventToGecko(e); } return null; } @Override public void onPostExecute(Void result) { - int messageId = mInReadingList ? R.string.reading_list_removed : R.string.bookmark_removed; - Toast.makeText(mContext, messageId, Toast.LENGTH_SHORT).show(); + // The remove from reading list toast is handled in Reader:Removed, + // so handle only the bookmark removed toast here. + if (!mInReadingList) { + Toast.makeText(mContext, R.string.bookmark_removed, Toast.LENGTH_SHORT).show(); + } } } diff --git a/mobile/android/chrome/content/aboutReader.js b/mobile/android/chrome/content/aboutReader.js index 549461b8027..094ff43ee73 100644 --- a/mobile/android/chrome/content/aboutReader.js +++ b/mobile/android/chrome/content/aboutReader.js @@ -352,16 +352,10 @@ AboutReader.prototype = { }); }.bind(this)); } else { - gChromeWin.Reader.removeArticleFromCache(this._article.url , function(success) { - dump("Reader:Remove (in reader) success=" + success); - - Services.obs.notifyObservers(null, "Reader:Remove", this._article.url); - - gChromeWin.sendMessageToJava({ - type: "Reader:Removed", - url: this._article.url - }); - }.bind(this)); + // In addition to removing the article from the cache (handled in + // browser.js), sending this message will cause the toggle button to be + // updated (handled in this file). + Services.obs.notifyObservers(null, "Reader:Remove", this._article.url); } }, diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index e93aa15e80d..6cc60d9ffd6 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -7571,6 +7571,13 @@ let Reader = { case "Reader:Remove": { this.removeArticleFromCache(aData, function(success) { this.log("Reader:Remove success=" + success + ", url=" + aData); + + if (success) { + sendMessageToJava({ + type: "Reader:Removed", + url: url + }); + } }.bind(this)); break; }