mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 920791 - Hide banner when URL bar is focused. r=lucasr
This commit is contained in:
parent
b4b53f4dd3
commit
a7052884e7
@ -520,6 +520,15 @@ abstract public class BrowserApp extends GeckoApp
|
||||
}
|
||||
});
|
||||
|
||||
mBrowserToolbar.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (isHomePagerVisible()) {
|
||||
mHomePager.onToolbarFocusChange(hasFocus);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Intercept key events for gamepad shortcuts
|
||||
mBrowserToolbar.setOnKeyListener(this);
|
||||
|
||||
|
@ -97,13 +97,13 @@ public class HomeBanner extends LinearLayout
|
||||
GeckoAppShell.getEventDispatcher().unregisterEventListener("HomeBanner:Data", this);
|
||||
}
|
||||
|
||||
public void showBanner() {
|
||||
public void show() {
|
||||
if (!mDismissed) {
|
||||
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("HomeBanner:Get", null));
|
||||
}
|
||||
}
|
||||
|
||||
public void hideBanner() {
|
||||
public void hide() {
|
||||
animateDown();
|
||||
}
|
||||
|
||||
|
@ -288,9 +288,9 @@ public class HomePager extends ViewPager {
|
||||
}
|
||||
if (mHomeBanner != null) {
|
||||
if (item == mDefaultPanelIndex) {
|
||||
mHomeBanner.showBanner();
|
||||
mHomeBanner.show();
|
||||
} else {
|
||||
mHomeBanner.hideBanner();
|
||||
mHomeBanner.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -315,6 +315,14 @@ public class HomePager extends ViewPager {
|
||||
return super.dispatchTouchEvent(event);
|
||||
}
|
||||
|
||||
public void onToolbarFocusChange(boolean hasFocus) {
|
||||
if (hasFocus) {
|
||||
mHomeBanner.hide();
|
||||
} else if (mDefaultPanelIndex == getCurrentItem() || getAdapter().getCount() == 0) {
|
||||
mHomeBanner.show();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateUiFromPanelConfigs(List<PanelConfig> panelConfigs) {
|
||||
// We only care about the adapter if HomePager is currently
|
||||
// loaded, which means it's visible in the activity.
|
||||
@ -396,9 +404,9 @@ public class HomePager extends ViewPager {
|
||||
|
||||
if (mHomeBanner != null) {
|
||||
if (position == mDefaultPanelIndex) {
|
||||
mHomeBanner.showBanner();
|
||||
mHomeBanner.show();
|
||||
} else {
|
||||
mHomeBanner.hideBanner();
|
||||
mHomeBanner.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -142,6 +142,7 @@ public class BrowserToolbar extends GeckoRelativeLayout
|
||||
private OnFilterListener mFilterListener;
|
||||
private OnStartEditingListener mStartEditingListener;
|
||||
private OnStopEditingListener mStopEditingListener;
|
||||
private OnFocusChangeListener mFocusChangeListener;
|
||||
|
||||
final private BrowserApp mActivity;
|
||||
private boolean mHasSoftMenuButton;
|
||||
@ -315,6 +316,9 @@ public class BrowserToolbar extends GeckoRelativeLayout
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
setSelected(hasFocus);
|
||||
if (mFocusChangeListener != null) {
|
||||
mFocusChangeListener.onFocusChange(v, hasFocus);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -793,6 +797,10 @@ public class BrowserToolbar extends GeckoRelativeLayout
|
||||
mStopEditingListener = listener;
|
||||
}
|
||||
|
||||
public void setOnFocusChangeListener(OnFocusChangeListener listener) {
|
||||
mFocusChangeListener = listener;
|
||||
}
|
||||
|
||||
private void showUrlEditLayout() {
|
||||
setUrlEditLayoutVisibility(true, null);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user