Merge "Allow QS expansion in switch access mode." into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
caa429eada
@@ -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) {}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1965,14 +1965,12 @@ 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 */);
|
||||
} else if (mQsExpansionEnabled) {
|
||||
mLockscreenGestureLogger.write(MetricsEvent.ACTION_SHADE_QS_TAP, 0, 0);
|
||||
flingSettings(0 /* vel */, true /* expand */, null, true /* isClick */);
|
||||
}
|
||||
onQsExpansionStarted();
|
||||
if (mQsExpanded) {
|
||||
flingSettings(0 /* vel */, false /* expand */, null, true /* isClick */);
|
||||
} else if (mQsExpansionEnabled) {
|
||||
mLockscreenGestureLogger.write(MetricsEvent.ACTION_SHADE_QS_TAP, 0, 0);
|
||||
flingSettings(0 /* vel */, true /* expand */, null, true /* isClick */);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user