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
This commit is contained in:
Michael Comella 2015-04-23 12:21:55 -07:00
Родитель 32a715b60d
Коммит f0b6ffb212
4 изменённых файлов: 18 добавлений и 19 удалений

Просмотреть файл

@ -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);
}
/**

Просмотреть файл

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

Просмотреть файл

@ -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.

Просмотреть файл

@ -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