зеркало из https://github.com/mozilla/gecko-dev.git
Bug 975239 - (Part 2) Request a home banner message when the HomePager loads. r=bnicholson
This commit is contained in:
Родитель
64121e61cf
Коммит
94443148b1
|
@ -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);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче