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 : 646923ac38dfba5ac863f5ae9619aa219e9101dc
extra : source : a4228f6ef8cefeece8a55a17ce1fcec91db2968f
This commit is contained in:
Michael Comella 2015-04-23 12:21:55 -07:00
parent b7c9dc76b1
commit 0b611b230a
4 changed files with 18 additions and 19 deletions

View File

@ -2632,6 +2632,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() {
@ -2648,6 +2658,8 @@ public class BrowserApp extends GeckoApp
getSupportFragmentManager().beginTransaction()
.remove(mBrowserSearch).commitAllowingStateLoss();
mBrowserSearch.setUserVisibleHint(false);
getWindow().setBackgroundDrawable(null);
}
/**

View File

@ -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();

View File

@ -19,10 +19,15 @@
android:layout_height="0dp"
android:layout_weight="1" />
<!-- The window background is set to our desired color, #fff, so
reduce overdraw by not drawing the background.
Note: this needs to be transparent and not null because we
draw a divider in onDraw. -->
<view class="org.mozilla.gecko.home.SearchEngineBar$SearchEngineBarContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff">
android:background="@android:color/transparent">
<!-- We add a marginTop so the outer container can draw a divider.

View File

@ -77,7 +77,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/browser_chrome"
android:background="@android:color/white"
android:visibility="invisible"/>
<!-- When focus is cleared from from BrowserToolbar's EditText to