Ensuring that Launcher always has a search bar. (Bug 10965514)

- Also disabling voice proxy when we are in now (Bug 10915381)

Change-Id: I4ad6392b5139d12b9b298110109b9363ba426cb4
This commit is contained in:
Winson Chung 2013-09-27 11:44:58 -07:00
parent a6125efb66
commit 54e6513554
5 changed files with 18 additions and 11 deletions

View File

@ -85,6 +85,8 @@
android:layout_height="match_parent"
android:visibility="gone" />
<!-- This is the search bar voice button proxy view. It allows us to have a larger
touch target than the microphone constrained by the search bar bounds. -->
<com.android.launcher3.DrawableStateProxyView
android:id="@+id/voice_button_proxy"
android:layout_width="0dp"

View File

@ -17,6 +17,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
style="@style/SearchDropTargetBar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/search_frame">
<!-- Global search icon -->
<com.android.launcher3.HolographicLinearLayout

View File

@ -359,14 +359,14 @@ class DeviceProfile {
boolean hasVerticalBarLayout = isVerticalBarLayout();
// Layout the search bar space
View searchBarSpace = launcher.findViewById(R.id.qsb_bar);
lp = (FrameLayout.LayoutParams) searchBarSpace.getLayoutParams();
View searchBar = launcher.getSearchBar();
lp = (FrameLayout.LayoutParams) searchBar.getLayoutParams();
if (hasVerticalBarLayout) {
// Vertical search bar
lp.gravity = Gravity.TOP | Gravity.LEFT;
lp.width = searchBarSpaceHeightPx;
lp.height = LayoutParams.MATCH_PARENT;
searchBarSpace.setPadding(
searchBar.setPadding(
0, 2 * edgeMarginPx, 0,
2 * edgeMarginPx);
} else {
@ -374,19 +374,19 @@ class DeviceProfile {
lp.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
lp.width = searchBarSpaceWidthPx;
lp.height = searchBarSpaceHeightPx;
searchBarSpace.setPadding(
searchBar.setPadding(
2 * edgeMarginPx,
2 * edgeMarginPx,
2 * edgeMarginPx, 0);
}
searchBarSpace.setLayoutParams(lp);
searchBar.setLayoutParams(lp);
// Layout the search bar
View searchBar = launcher.getQsbBar();
lp = (FrameLayout.LayoutParams) searchBar.getLayoutParams();
lp.width = LayoutParams.MATCH_PARENT;
lp.height = LayoutParams.MATCH_PARENT;
searchBar.setLayoutParams(lp);
View qsbBar = launcher.getQsbBar();
LayoutParams vglp = qsbBar.getLayoutParams();
vglp.width = LayoutParams.MATCH_PARENT;
vglp.height = LayoutParams.MATCH_PARENT;
qsbBar.setLayoutParams(vglp);
// Layout the voice proxy
View voiceButtonProxy = launcher.findViewById(R.id.voice_button_proxy);

View File

@ -3263,7 +3263,8 @@ public class Launcher extends Activity
public View getQsbBar() {
if (mQsbBar == null) {
mQsbBar = mInflater.inflate(R.layout.qsb_bar, mSearchDropTargetBar);
mQsbBar = mInflater.inflate(R.layout.search_bar, mSearchDropTargetBar, false);
mSearchDropTargetBar.addView(mQsbBar);
}
return mQsbBar;
}

View File

@ -1030,12 +1030,14 @@ public class Workspace extends SmoothPagedView
if (mCustomContentCallbacks != null) {
mCustomContentCallbacks.onShow();
mCustomContentShowTime = System.currentTimeMillis();
mLauncher.setVoiceButtonProxyVisible(false);
}
} else if (hasCustomContent() && getNextPage() != 0 && mCustomContentShowing) {
mCustomContentShowing = false;
if (mCustomContentCallbacks != null) {
mCustomContentCallbacks.onHide();
mLauncher.resetQSBScroll();
mLauncher.setVoiceButtonProxyVisible(true);
}
}
}