am 12677272: Merge "Have SearchPanel fade camera and search buttons when activated" into klp-dev

* commit '1267727241c941af42faf19bfc1e21034112e0da':
  Have SearchPanel fade camera and search buttons when activated
This commit is contained in:
Jim Miller
2013-10-09 16:51:20 -07:00
committed by Android Git Automerger
3 changed files with 35 additions and 9 deletions

View File

@@ -570,12 +570,14 @@ public abstract class BaseStatusBar extends SystemUI implements
if (DEBUG) Log.d(TAG, "opening search panel"); if (DEBUG) Log.d(TAG, "opening search panel");
if (mSearchPanelView != null && mSearchPanelView.isAssistantAvailable()) { if (mSearchPanelView != null && mSearchPanelView.isAssistantAvailable()) {
mSearchPanelView.show(true, true); mSearchPanelView.show(true, true);
onShowSearchPanel();
} }
break; break;
case MSG_CLOSE_SEARCH_PANEL: case MSG_CLOSE_SEARCH_PANEL:
if (DEBUG) Log.d(TAG, "closing search panel"); if (DEBUG) Log.d(TAG, "closing search panel");
if (mSearchPanelView != null && mSearchPanelView.isShowing()) { if (mSearchPanelView != null && mSearchPanelView.isShowing()) {
mSearchPanelView.show(false, true); mSearchPanelView.show(false, true);
onHideSearchPanel();
} }
break; break;
} }
@@ -607,6 +609,12 @@ public abstract class BaseStatusBar extends SystemUI implements
protected void workAroundBadLayerDrawableOpacity(View v) { protected void workAroundBadLayerDrawableOpacity(View v) {
} }
protected void onHideSearchPanel() {
}
protected void onShowSearchPanel() {
}
public boolean inflateViews(NotificationData.Entry entry, ViewGroup parent) { public boolean inflateViews(NotificationData.Entry entry, ViewGroup parent) {
int minHeight = int minHeight =
mContext.getResources().getDimensionPixelSize(R.dimen.notification_min_height); mContext.getResources().getDimensionPixelSize(R.dimen.notification_min_height);

View File

@@ -92,23 +92,16 @@ public class NavigationBarView extends LinearLayout {
private final OnTouchListener mCameraTouchListener = new OnTouchListener() { private final OnTouchListener mCameraTouchListener = new OnTouchListener() {
@Override @Override
public boolean onTouch(View cameraButtonView, MotionEvent event) { public boolean onTouch(View cameraButtonView, MotionEvent event) {
View searchLight = getSearchLight();
switch (event.getAction()) { switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN:
// disable search gesture while interacting with camera // disable search gesture while interacting with camera
mDelegateHelper.setDisabled(true); mDelegateHelper.setDisabled(true);
cameraButtonView.animate().alpha(0.0f).setDuration(CAMERA_BUTTON_FADE_DURATION); transitionCameraAndSearchButtonAlpha(0.0f);
if (searchLight != null) {
searchLight.animate().alpha(0.0f).setDuration(CAMERA_BUTTON_FADE_DURATION);
}
break; break;
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_CANCEL:
mDelegateHelper.setDisabled(false); mDelegateHelper.setDisabled(false);
cameraButtonView.animate().alpha(1.0f).setDuration(CAMERA_BUTTON_FADE_DURATION); transitionCameraAndSearchButtonAlpha(1.0f);
if (searchLight != null) {
searchLight.animate().alpha(1.0f).setDuration(CAMERA_BUTTON_FADE_DURATION);
}
break; break;
} }
return KeyguardTouchDelegate.getInstance(getContext()).dispatch(event); return KeyguardTouchDelegate.getInstance(getContext()).dispatch(event);
@@ -158,6 +151,17 @@ public class NavigationBarView extends LinearLayout {
watchForDevicePolicyChanges(); watchForDevicePolicyChanges();
} }
protected void transitionCameraAndSearchButtonAlpha(float alpha) {
View cameraButtonView = getCameraButton();
if (cameraButtonView != null) {
cameraButtonView.animate().alpha(alpha).setDuration(CAMERA_BUTTON_FADE_DURATION);
}
View searchLight = getSearchLight();
if (searchLight != null) {
searchLight.animate().alpha(alpha).setDuration(CAMERA_BUTTON_FADE_DURATION);
}
}
private void watchForDevicePolicyChanges() { private void watchForDevicePolicyChanges() {
final IntentFilter filter = new IntentFilter(); final IntentFilter filter = new IntentFilter();
filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED); filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);

View File

@@ -646,6 +646,20 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
return mStatusBarView; return mStatusBarView;
} }
@Override
protected void onShowSearchPanel() {
if (mNavigationBarView != null) {
mNavigationBarView.transitionCameraAndSearchButtonAlpha(0.0f);
}
}
@Override
protected void onHideSearchPanel() {
if (mNavigationBarView != null) {
mNavigationBarView.transitionCameraAndSearchButtonAlpha(1.0f);
}
}
@Override @Override
protected View getStatusBarView() { protected View getStatusBarView() {
return mStatusBarView; return mStatusBarView;