From f0b6ffb212cdb90c352aec5bbf3b3edc790073fa Mon Sep 17 00:00:00 2001 From: Michael Comella Date: Thu, 23 Apr 2015 12:21:55 -0700 Subject: [PATCH] Bug 1137483 - Move search engine bar under keyboard when shown. r=liuche This requires the window to resize when the keyboard is shown, which required a revision in when we draw the window background. --HG-- extra : rebase_source : 55c7f5db5bdc8c9d5baa8e3df6f0979013b06b23 --- mobile/android/base/BrowserApp.java | 12 ++++++++++++ mobile/android/base/home/BrowserSearch.java | 17 ----------------- .../base/resources/layout/browser_search.xml | 7 ++++++- .../android/base/resources/layout/gecko_app.xml | 1 - 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/mobile/android/base/BrowserApp.java b/mobile/android/base/BrowserApp.java index 43b80987733f..8fccf0507052 100644 --- a/mobile/android/base/BrowserApp.java +++ b/mobile/android/base/BrowserApp.java @@ -2616,6 +2616,16 @@ public class BrowserApp extends GeckoApp fm.beginTransaction().add(R.id.search_container, mBrowserSearch, BROWSER_SEARCH_TAG).commitAllowingStateLoss(); mBrowserSearch.setUserVisibleHint(true); + + // We want to adjust the window size when the keyboard appears to bring the + // SearchEngineBar above the keyboard. However, adjusting the window size + // when hiding the keyboard results in graphical glitches where the keyboard was + // because nothing was being drawn underneath (bug 933422). This can be + // prevented drawing content under the keyboard (i.e. in the Window). + // + // We do this here because there are glitches when unlocking a device with + // BrowserSearch in the foreground if we use BrowserSearch.onStart/Stop. + getActivity().getWindow().setBackgroundDrawableResource(android.R.color.white); } private void hideBrowserSearch() { @@ -2632,6 +2642,8 @@ public class BrowserApp extends GeckoApp getSupportFragmentManager().beginTransaction() .remove(mBrowserSearch).commitAllowingStateLoss(); mBrowserSearch.setUserVisibleHint(false); + + getWindow().setBackgroundDrawable(null); } /** diff --git a/mobile/android/base/home/BrowserSearch.java b/mobile/android/base/home/BrowserSearch.java index d657ed1095dd..2689c53e1893 100644 --- a/mobile/android/base/home/BrowserSearch.java +++ b/mobile/android/base/home/BrowserSearch.java @@ -230,23 +230,6 @@ public class BrowserSearch extends HomeFragment mSearchEngines = null; } - @Override - public void onStart() { - super.onStart(); - - // Adjusting the window size when showing the keyboard results in the underlying - // activity being painted when the keyboard is hidden (bug 933422). This can be - // prevented by not resizing the window. - getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING); - } - - @Override - public void onStop() { - super.onStop(); - - getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); - } - @Override public void onResume() { super.onResume(); diff --git a/mobile/android/base/resources/layout/browser_search.xml b/mobile/android/base/resources/layout/browser_search.xml index 27f9ebc1d8d5..3c24aecf0c11 100644 --- a/mobile/android/base/resources/layout/browser_search.xml +++ b/mobile/android/base/resources/layout/browser_search.xml @@ -19,10 +19,15 @@ android:layout_height="0dp" android:layout_weight="1" /> + + android:background="@android:color/transparent">