Bug 1404111 - WIP - Refocus GeckoView when it gains focus to make sure the InputMethodManager is up-to-date
MozReview-Commit-ID: BtAXXOBpYwr
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -245,16 +245,18 @@ public class BrowserApp extends GeckoApp
private View doorhangerOverlay;
// We can't name the TabStrip class because it's not included on API 9.
private TabStripInterface mTabStrip;
private AnimatedProgressBar mProgressView;
private FirstrunAnimationContainer mFirstrunAnimationContainer;
private HomeScreen mHomeScreen;
private TabsPanel mTabsPanel;
+ private boolean mRefocussingGeckoView;
+
private boolean showSplashScreen = false;
private SplashScreen splashScreen;
/**
* Container for the home screen implementation. This will be populated with any valid
* home screen implementation (currently that is just the HomePager, but that will be extended
* to permit further experimental replacement panels such as the activity-stream panel).
*/
private ViewGroup mHomeScreenContainer;
@@ -645,16 +647,35 @@ public class BrowserApp extends GeckoApp
final GeckoApplication app = (GeckoApplication) getApplication();
app.prepareLightweightTheme();
super.onCreate(savedInstanceState);
initSwitchboard(this, intent, isInAutomation);
initTelemetryUploader(isInAutomation);
+ mLayerView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
+ @Override
+ public void onFocusChange(View v, boolean hasFocus) {
+ if (mRefocussingGeckoView) {
+ if (hasFocus) {
+ mRefocussingGeckoView = false;
+ }
+ } else if (hasFocus) {
+ mRefocussingGeckoView = true;
+ ThreadUtils.postToUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mLayerView.clearFocus();
+ }
+ });
+ }
+ }
+ });
+
mBrowserChrome = (ViewGroup) findViewById(R.id.browser_chrome);
mActionBarFlipper = (ViewFlipper) findViewById(R.id.browser_actionbar);
mActionBar = (ActionModeCompatView) findViewById(R.id.actionbar);
mVideoPlayer = (VideoPlayer) findViewById(R.id.video_player);
mVideoPlayer.setFullScreenListener(new VideoPlayer.FullScreenListener() {
@Override
public void onFullScreenChanged(boolean fullScreen) {