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

Commit 8a3e23ce authored by Amin Shaikh's avatar Amin Shaikh
Browse files

Allow QS expansion in switch access mode.

Change-Id: I90ffc96f3bbbc8e5cad1509cc8d7b4028ff3fe04
Fixes: 78129194
Test: manually
parent 2557f341
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -65,10 +65,9 @@ public interface QSFooter {
    void setKeyguardShowing(boolean keyguardShowing);

    /**
     * Returns the {@link View} that should expand the quick settings when clicked.
     * Sets the {@link android.view.View.OnClickListener to be used on elements that expend QS.
     */
    @Nullable
    View getExpandView();
    void setExpandClickListener(View.OnClickListener onClickListener);

    default void disable(int state1, int state2, boolean animate) {}
}
+23 −3
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.systemui.qs;

import static android.app.StatusBarManager.DISABLE2_QUICK_SETTINGS;
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;

import android.content.Context;
import android.content.Intent;
@@ -27,6 +26,7 @@ import android.content.res.Configuration;
import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.RippleDrawable;
import android.os.Bundle;
import android.os.UserManager;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
@@ -34,6 +34,7 @@ import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -96,6 +97,7 @@ public class QSFooterImpl extends FrameLayout implements QSFooter,
    private ImageView mMobileRoaming;
    private final int mColorForeground;
    private final CellSignalState mInfo = new CellSignalState();
    private OnClickListener mExpandClickListener;

    public QSFooterImpl(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -140,6 +142,7 @@ public class QSFooterImpl extends FrameLayout implements QSFooter,
        mActivityStarter = Dependency.get(ActivityStarter.class);
        addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight,
                oldBottom) -> updateAnimator(right - left));
        setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
    }

    private void updateAnimator(int width) {
@@ -204,6 +207,11 @@ public class QSFooterImpl extends FrameLayout implements QSFooter,
        setExpansion(mExpansionAmount);
    }

    @Override
    public void setExpandClickListener(OnClickListener onClickListener) {
        mExpandClickListener = onClickListener;
    }

    @Override
    public void setExpanded(boolean expanded) {
        if (mExpanded == expanded) return;
@@ -238,8 +246,20 @@ public class QSFooterImpl extends FrameLayout implements QSFooter,
    }

    @Override
    public View getExpandView() {
        return findViewById(R.id.expand_indicator);
    public boolean performAccessibilityAction(int action, Bundle arguments) {
        if (action == AccessibilityNodeInfo.ACTION_EXPAND) {
            if (mExpandClickListener != null) {
                mExpandClickListener.onClick(null);
                return true;
            }
        }
        return super.performAccessibilityAction(action, arguments);
    }

    @Override
    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
        super.onInitializeAccessibilityNodeInfo(info);
        info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_EXPAND);
    }

    @Override
+1 −10
Original line number Diff line number Diff line
@@ -240,11 +240,6 @@ public class QSFragment extends Fragment implements QS, CommandQueue.Callbacks {
    @Override
    public void setHeaderClickable(boolean clickable) {
        if (DEBUG) Log.d(TAG, "setHeaderClickable " + clickable);

        View expandView = mFooter.getExpandView();
        if (expandView != null) {
            expandView.setClickable(clickable);
        }
    }

    @Override
@@ -369,11 +364,7 @@ public class QSFragment extends Fragment implements QS, CommandQueue.Callbacks {

    @Override
    public void setExpandClickListener(OnClickListener onClickListener) {
        View expandView = mFooter.getExpandView();

        if (expandView != null) {
            expandView.setOnClickListener(onClickListener);
        }
        mFooter.setExpandClickListener(onClickListener);
    }

    @Override
+1 −3
Original line number Diff line number Diff line
@@ -114,11 +114,9 @@ public class CarQSFooter extends RelativeLayout implements QSFooter,
        }
    }

    @Nullable
    @Override
    public View getExpandView() {
    public void setExpandClickListener(OnClickListener onClickListener) {
        // No view that should expand/collapse the quick settings.
        return null;
    }

    @Override
+6 −8
Original line number Diff line number Diff line
@@ -1965,7 +1965,6 @@ public class NotificationPanelView extends PanelView implements

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.expand_indicator) {
        onQsExpansionStarted();
        if (mQsExpanded) {
            flingSettings(0 /* vel */, false /* expand */, null, true /* isClick */);
@@ -1974,7 +1973,6 @@ public class NotificationPanelView extends PanelView implements
            flingSettings(0 /* vel */, true /* expand */, null, true /* isClick */);
        }
    }
    }

    @Override
    public void onAnimationToSideStarted(boolean rightPage, float translation, float vel) {