Merge "Have SearchPanel fade camera and search buttons when activated" into klp-dev
This commit is contained in:
@@ -570,12 +570,14 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
if (DEBUG) Log.d(TAG, "opening search panel");
|
||||
if (mSearchPanelView != null && mSearchPanelView.isAssistantAvailable()) {
|
||||
mSearchPanelView.show(true, true);
|
||||
onShowSearchPanel();
|
||||
}
|
||||
break;
|
||||
case MSG_CLOSE_SEARCH_PANEL:
|
||||
if (DEBUG) Log.d(TAG, "closing search panel");
|
||||
if (mSearchPanelView != null && mSearchPanelView.isShowing()) {
|
||||
mSearchPanelView.show(false, true);
|
||||
onHideSearchPanel();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -607,6 +609,12 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
protected void workAroundBadLayerDrawableOpacity(View v) {
|
||||
}
|
||||
|
||||
protected void onHideSearchPanel() {
|
||||
}
|
||||
|
||||
protected void onShowSearchPanel() {
|
||||
}
|
||||
|
||||
public boolean inflateViews(NotificationData.Entry entry, ViewGroup parent) {
|
||||
int minHeight =
|
||||
mContext.getResources().getDimensionPixelSize(R.dimen.notification_min_height);
|
||||
|
||||
@@ -92,23 +92,16 @@ public class NavigationBarView extends LinearLayout {
|
||||
private final OnTouchListener mCameraTouchListener = new OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View cameraButtonView, MotionEvent event) {
|
||||
View searchLight = getSearchLight();
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
// disable search gesture while interacting with camera
|
||||
mDelegateHelper.setDisabled(true);
|
||||
cameraButtonView.animate().alpha(0.0f).setDuration(CAMERA_BUTTON_FADE_DURATION);
|
||||
if (searchLight != null) {
|
||||
searchLight.animate().alpha(0.0f).setDuration(CAMERA_BUTTON_FADE_DURATION);
|
||||
}
|
||||
transitionCameraAndSearchButtonAlpha(0.0f);
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
mDelegateHelper.setDisabled(false);
|
||||
cameraButtonView.animate().alpha(1.0f).setDuration(CAMERA_BUTTON_FADE_DURATION);
|
||||
if (searchLight != null) {
|
||||
searchLight.animate().alpha(1.0f).setDuration(CAMERA_BUTTON_FADE_DURATION);
|
||||
}
|
||||
transitionCameraAndSearchButtonAlpha(1.0f);
|
||||
break;
|
||||
}
|
||||
return KeyguardTouchDelegate.getInstance(getContext()).dispatch(event);
|
||||
@@ -158,6 +151,17 @@ public class NavigationBarView extends LinearLayout {
|
||||
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() {
|
||||
final IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);
|
||||
|
||||
@@ -646,6 +646,20 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
|
||||
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
|
||||
protected View getStatusBarView() {
|
||||
return mStatusBarView;
|
||||
|
||||
Reference in New Issue
Block a user