Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ad178a43 authored by Jim Miller's avatar Jim Miller
Browse files

Have SearchPanel fade camera and search buttons when activated

Bug 10991981

Change-Id: Iabc497ce992b675bff1df634add755e67a7fb794
parent c739a765
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -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);
+13 −9
Original line number Original line Diff line number Diff line
@@ -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);
+14 −0
Original line number Original line Diff line number Diff line
@@ -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;