Bug 975239 - (Part 2) Request a home banner message when the HomePager loads. r=bnicholson

This commit is contained in:
Margaret Leibovic 2014-03-07 11:23:27 -08:00
Родитель 64121e61cf
Коммит 94443148b1
2 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -98,7 +98,6 @@ public class HomeBanner extends LinearLayout
});
GeckoAppShell.getEventDispatcher().registerEventListener("HomeBanner:Data", this);
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("HomeBanner:Get", null));
}
@Override
@ -123,6 +122,13 @@ public class HomeBanner extends LinearLayout
mScrollingPages = scrollingPages;
}
/**
* Sends a message to gecko to request a new banner message. UI is updated in handleMessage.
*/
public void update() {
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("HomeBanner:Get", null));
}
@Override
public void handleMessage(String event, JSONObject message) {
try {

Просмотреть файл

@ -155,6 +155,11 @@ public class HomePager extends ViewPager {
mLoaded = true;
mInitialPanelId = panelId;
// Update the home banner message each time the HomePager is loaded.
if (mHomeBanner != null) {
mHomeBanner.update();
}
// Only animate on post-HC devices, when a non-null animator is given
final boolean shouldAnimate = (animator != null && Build.VERSION.SDK_INT >= 11);