Merge "QS Detail: Fix up open/close animations" into nyc-dev
This commit is contained in:
@@ -178,6 +178,7 @@ public class QSContainer extends FrameLayout {
|
|||||||
private void updateQsState() {
|
private void updateQsState() {
|
||||||
boolean expandVisually = mQsExpanded || mStackScrollerOverscrolling || mHeaderAnimating;
|
boolean expandVisually = mQsExpanded || mStackScrollerOverscrolling || mHeaderAnimating;
|
||||||
mQSPanel.setExpanded(mQsExpanded);
|
mQSPanel.setExpanded(mQsExpanded);
|
||||||
|
mQSDetail.setExpanded(mQsExpanded);
|
||||||
mHeader.setVisibility((mQsExpanded || !mKeyguardShowing || mHeaderAnimating)
|
mHeader.setVisibility((mQsExpanded || !mKeyguardShowing || mHeaderAnimating)
|
||||||
? View.VISIBLE
|
? View.VISIBLE
|
||||||
: View.INVISIBLE);
|
: View.INVISIBLE);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import android.widget.ImageView;
|
|||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
import com.android.systemui.FontSizeUtils;
|
import com.android.systemui.FontSizeUtils;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
@@ -64,6 +65,9 @@ public class QSDetail extends LinearLayout {
|
|||||||
private boolean mFullyExpanded;
|
private boolean mFullyExpanded;
|
||||||
private View mQsDetailHeaderBack;
|
private View mQsDetailHeaderBack;
|
||||||
private BaseStatusBarHeader mHeader;
|
private BaseStatusBarHeader mHeader;
|
||||||
|
private boolean mTriggeredExpand;
|
||||||
|
private int mOpenX;
|
||||||
|
private int mOpenY;
|
||||||
|
|
||||||
public QSDetail(Context context, @Nullable AttributeSet attrs) {
|
public QSDetail(Context context, @Nullable AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
@@ -112,6 +116,7 @@ public class QSDetail extends LinearLayout {
|
|||||||
public void setQsPanel(QSPanel panel, BaseStatusBarHeader header) {
|
public void setQsPanel(QSPanel panel, BaseStatusBarHeader header) {
|
||||||
mQsPanel = panel;
|
mQsPanel = panel;
|
||||||
mHeader = header;
|
mHeader = header;
|
||||||
|
mHeader.setCallback(mQsPanelCallback);
|
||||||
mQsPanel.setCallback(mQsPanelCallback);
|
mQsPanel.setCallback(mQsPanelCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,6 +131,12 @@ public class QSDetail extends LinearLayout {
|
|||||||
mFullyExpanded = fullyExpanded;
|
mFullyExpanded = fullyExpanded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setExpanded(boolean qsExpanded) {
|
||||||
|
if (!qsExpanded) {
|
||||||
|
mTriggeredExpand = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateDetailText() {
|
private void updateDetailText() {
|
||||||
mDetailDoneButton.setText(R.string.quick_settings_done);
|
mDetailDoneButton.setText(R.string.quick_settings_done);
|
||||||
mDetailSettingsButton.setText(R.string.quick_settings_more_settings);
|
mDetailSettingsButton.setText(R.string.quick_settings_more_settings);
|
||||||
@@ -161,6 +172,22 @@ public class QSDetail extends LinearLayout {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (!mFullyExpanded) {
|
||||||
|
mTriggeredExpand = true;
|
||||||
|
mHost.animateToggleQSExpansion();
|
||||||
|
} else {
|
||||||
|
mTriggeredExpand = false;
|
||||||
|
}
|
||||||
|
mOpenX = x;
|
||||||
|
mOpenY = y;
|
||||||
|
} else {
|
||||||
|
// Ensure we collapse into the same point we opened from.
|
||||||
|
x = mOpenX;
|
||||||
|
y = mOpenY;
|
||||||
|
if (mTriggeredExpand) {
|
||||||
|
mHost.animateToggleQSExpansion();
|
||||||
|
mTriggeredExpand = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean visibleDiff = (mDetailAdapter != null) != (adapter != null);
|
boolean visibleDiff = (mDetailAdapter != null) != (adapter != null);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import android.content.res.Resources;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
@@ -56,7 +57,7 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
|
|||||||
|
|
||||||
private int mPanelPaddingBottom;
|
private int mPanelPaddingBottom;
|
||||||
private int mBrightnessPaddingTop;
|
private int mBrightnessPaddingTop;
|
||||||
private boolean mExpanded;
|
protected boolean mExpanded;
|
||||||
protected boolean mListening;
|
protected boolean mListening;
|
||||||
|
|
||||||
private Callback mCallback;
|
private Callback mCallback;
|
||||||
@@ -70,7 +71,6 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
|
|||||||
|
|
||||||
private QSCustomizer mCustomizePanel;
|
private QSCustomizer mCustomizePanel;
|
||||||
private Record mDetailRecord;
|
private Record mDetailRecord;
|
||||||
private boolean mTriggeredExpand;
|
|
||||||
|
|
||||||
public QSPanel(Context context) {
|
public QSPanel(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@@ -221,7 +221,6 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
|
|||||||
}
|
}
|
||||||
MetricsLogger.visibility(mContext, MetricsEvent.QS_PANEL, mExpanded);
|
MetricsLogger.visibility(mContext, MetricsEvent.QS_PANEL, mExpanded);
|
||||||
if (!mExpanded) {
|
if (!mExpanded) {
|
||||||
mTriggeredExpand = false;
|
|
||||||
closeDetail();
|
closeDetail();
|
||||||
} else {
|
} else {
|
||||||
logTiles();
|
logTiles();
|
||||||
@@ -279,6 +278,7 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
|
|||||||
public void setTiles(Collection<QSTile<?>> tiles, boolean collapsedView) {
|
public void setTiles(Collection<QSTile<?>> tiles, boolean collapsedView) {
|
||||||
for (TileRecord record : mRecords) {
|
for (TileRecord record : mRecords) {
|
||||||
mTileLayout.removeTile(record);
|
mTileLayout.removeTile(record);
|
||||||
|
record.tile.removeCallback(record.callback);
|
||||||
}
|
}
|
||||||
mRecords.clear();
|
mRecords.clear();
|
||||||
for (QSTile<?> tile : tiles) {
|
for (QSTile<?> tile : tiles) {
|
||||||
@@ -294,6 +294,10 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
|
|||||||
return new QSTileView(mContext, tile.createTileView(mContext), collapsedView);
|
return new QSTileView(mContext, tile.createTileView(mContext), collapsedView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean shouldShowDetail() {
|
||||||
|
return mExpanded;
|
||||||
|
}
|
||||||
|
|
||||||
protected void addTile(final QSTile<?> tile, boolean collapsedView) {
|
protected void addTile(final QSTile<?> tile, boolean collapsedView) {
|
||||||
final TileRecord r = new TileRecord();
|
final TileRecord r = new TileRecord();
|
||||||
r.tile = tile;
|
r.tile = tile;
|
||||||
@@ -306,7 +310,11 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onShowDetail(boolean show) {
|
public void onShowDetail(boolean show) {
|
||||||
QSPanel.this.showDetail(show, r);
|
// Both the collapsed and full QS panels get this callback, this check determines
|
||||||
|
// which one should handle showing the detail.
|
||||||
|
if (shouldShowDetail()) {
|
||||||
|
QSPanel.this.showDetail(show, r);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -330,6 +338,7 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
r.tile.addCallback(callback);
|
r.tile.addCallback(callback);
|
||||||
|
r.callback = callback;
|
||||||
final View.OnClickListener click = new View.OnClickListener() {
|
final View.OnClickListener click = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@@ -390,17 +399,6 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void handleShowDetail(Record r, boolean show) {
|
protected void handleShowDetail(Record r, boolean show) {
|
||||||
if (show) {
|
|
||||||
if (!mExpanded) {
|
|
||||||
mTriggeredExpand = true;
|
|
||||||
mHost.animateToggleQSExpansion();
|
|
||||||
} else {
|
|
||||||
mTriggeredExpand = false;
|
|
||||||
}
|
|
||||||
} else if (mTriggeredExpand) {
|
|
||||||
mHost.animateToggleQSExpansion();
|
|
||||||
mTriggeredExpand = false;
|
|
||||||
}
|
|
||||||
if (r instanceof TileRecord) {
|
if (r instanceof TileRecord) {
|
||||||
handleShowDetailTile((TileRecord) r, show);
|
handleShowDetailTile((TileRecord) r, show);
|
||||||
} else {
|
} else {
|
||||||
@@ -520,6 +518,7 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
|
|||||||
public QSTile<?> tile;
|
public QSTile<?> tile;
|
||||||
public QSTileBaseView tileView;
|
public QSTileBaseView tileView;
|
||||||
public boolean scanState;
|
public boolean scanState;
|
||||||
|
public QSTile.Callback callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Callback {
|
public interface Callback {
|
||||||
|
|||||||
@@ -161,6 +161,10 @@ public abstract class QSTile<TState extends State> {
|
|||||||
mHandler.obtainMessage(H.ADD_CALLBACK, callback).sendToTarget();
|
mHandler.obtainMessage(H.ADD_CALLBACK, callback).sendToTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeCallback(Callback callback) {
|
||||||
|
mHandler.obtainMessage(H.REMOVE_CALLBACK, callback).sendToTarget();
|
||||||
|
}
|
||||||
|
|
||||||
public void removeCallbacks() {
|
public void removeCallbacks() {
|
||||||
mHandler.sendEmptyMessage(H.REMOVE_CALLBACKS);
|
mHandler.sendEmptyMessage(H.REMOVE_CALLBACKS);
|
||||||
}
|
}
|
||||||
@@ -224,6 +228,10 @@ public abstract class QSTile<TState extends State> {
|
|||||||
handleRefreshState(null);
|
handleRefreshState(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleRemoveCallback(Callback callback) {
|
||||||
|
mCallbacks.remove(callback);
|
||||||
|
}
|
||||||
|
|
||||||
private void handleRemoveCallbacks() {
|
private void handleRemoveCallbacks() {
|
||||||
mCallbacks.clear();
|
mCallbacks.clear();
|
||||||
}
|
}
|
||||||
@@ -334,7 +342,8 @@ public abstract class QSTile<TState extends State> {
|
|||||||
private static final int DESTROY = 10;
|
private static final int DESTROY = 10;
|
||||||
private static final int CLEAR_STATE = 11;
|
private static final int CLEAR_STATE = 11;
|
||||||
private static final int REMOVE_CALLBACKS = 12;
|
private static final int REMOVE_CALLBACKS = 12;
|
||||||
private static final int SET_LISTENING = 13;
|
private static final int REMOVE_CALLBACK = 13;
|
||||||
|
private static final int SET_LISTENING = 14;
|
||||||
|
|
||||||
private H(Looper looper) {
|
private H(Looper looper) {
|
||||||
super(looper);
|
super(looper);
|
||||||
@@ -350,6 +359,9 @@ public abstract class QSTile<TState extends State> {
|
|||||||
} else if (msg.what == REMOVE_CALLBACKS) {
|
} else if (msg.what == REMOVE_CALLBACKS) {
|
||||||
name = "handleRemoveCallbacks";
|
name = "handleRemoveCallbacks";
|
||||||
handleRemoveCallbacks();
|
handleRemoveCallbacks();
|
||||||
|
} else if (msg.what == REMOVE_CALLBACK) {
|
||||||
|
name = "handleRemoveCallback";
|
||||||
|
handleRemoveCallback((QSTile.Callback) msg.obj);
|
||||||
} else if (msg.what == CLICK) {
|
} else if (msg.what == CLICK) {
|
||||||
name = "handleClick";
|
name = "handleClick";
|
||||||
if (mState.disabledByPolicy) {
|
if (mState.disabledByPolicy) {
|
||||||
|
|||||||
@@ -76,6 +76,11 @@ public class QuickQSPanel extends QSPanel {
|
|||||||
mHeader = header;
|
mHeader = header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldShowDetail() {
|
||||||
|
return !mExpanded;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawTile(TileRecord r, State state) {
|
protected void drawTile(TileRecord r, State state) {
|
||||||
if (state instanceof SignalState) {
|
if (state instanceof SignalState) {
|
||||||
@@ -89,11 +94,6 @@ public class QuickQSPanel extends QSPanel {
|
|||||||
super.drawTile(r, state);
|
super.drawTile(r, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void showDetail(boolean show, Record r) {
|
|
||||||
// Do nothing, will be handled by the QSPanel.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected QSTileBaseView createTileView(QSTile<?> tile, boolean collapsedView) {
|
protected QSTileBaseView createTileView(QSTile<?> tile, boolean collapsedView) {
|
||||||
return new QSTileBaseView(mContext, tile.createTileView(mContext), collapsedView);
|
return new QSTileBaseView(mContext, tile.createTileView(mContext), collapsedView);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import android.content.Context;
|
|||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import com.android.systemui.qs.QSPanel;
|
import com.android.systemui.qs.QSPanel;
|
||||||
|
import com.android.systemui.qs.QSPanel.Callback;
|
||||||
import com.android.systemui.statusbar.policy.BatteryController;
|
import com.android.systemui.statusbar.policy.BatteryController;
|
||||||
import com.android.systemui.statusbar.policy.NetworkControllerImpl;
|
import com.android.systemui.statusbar.policy.NetworkControllerImpl;
|
||||||
import com.android.systemui.statusbar.policy.NextAlarmController;
|
import com.android.systemui.statusbar.policy.NextAlarmController;
|
||||||
@@ -44,4 +45,5 @@ public abstract class BaseStatusBarHeader extends RelativeLayout implements
|
|||||||
public abstract void setBatteryController(BatteryController batteryController);
|
public abstract void setBatteryController(BatteryController batteryController);
|
||||||
public abstract void setNextAlarmController(NextAlarmController nextAlarmController);
|
public abstract void setNextAlarmController(NextAlarmController nextAlarmController);
|
||||||
public abstract void setUserInfoController(UserInfoController userInfoController);
|
public abstract void setUserInfoController(UserInfoController userInfoController);
|
||||||
|
public abstract void setCallback(Callback qsPanelCallback);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import com.android.systemui.FontSizeUtils;
|
|||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.qs.QSAnimator;
|
import com.android.systemui.qs.QSAnimator;
|
||||||
import com.android.systemui.qs.QSPanel;
|
import com.android.systemui.qs.QSPanel;
|
||||||
|
import com.android.systemui.qs.QSPanel.Callback;
|
||||||
import com.android.systemui.qs.QuickQSPanel;
|
import com.android.systemui.qs.QuickQSPanel;
|
||||||
import com.android.systemui.qs.TouchAnimator;
|
import com.android.systemui.qs.TouchAnimator;
|
||||||
import com.android.systemui.statusbar.policy.BatteryController;
|
import com.android.systemui.statusbar.policy.BatteryController;
|
||||||
@@ -222,6 +223,7 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements
|
|||||||
@Override
|
@Override
|
||||||
public void setExpanded(boolean expanded) {
|
public void setExpanded(boolean expanded) {
|
||||||
mExpanded = expanded;
|
mExpanded = expanded;
|
||||||
|
mHeaderQsPanel.setExpanded(expanded);
|
||||||
updateEverything();
|
updateEverything();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -392,6 +394,11 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements
|
|||||||
userInfoController.addListener(this);
|
userInfoController.addListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCallback(Callback qsPanelCallback) {
|
||||||
|
mHeaderQsPanel.setCallback(qsPanelCallback);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setEmergencyCallsOnly(boolean show) {
|
public void setEmergencyCallsOnly(boolean show) {
|
||||||
boolean changed = show != mShowEmergencyCallsOnly;
|
boolean changed = show != mShowEmergencyCallsOnly;
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import com.android.systemui.BatteryMeterView;
|
|||||||
import com.android.systemui.FontSizeUtils;
|
import com.android.systemui.FontSizeUtils;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.qs.QSPanel;
|
import com.android.systemui.qs.QSPanel;
|
||||||
|
import com.android.systemui.qs.QSPanel.Callback;
|
||||||
import com.android.systemui.qs.QSTile;
|
import com.android.systemui.qs.QSTile;
|
||||||
import com.android.systemui.qs.QSTile.DetailAdapter;
|
import com.android.systemui.qs.QSTile.DetailAdapter;
|
||||||
import com.android.systemui.statusbar.policy.BatteryController;
|
import com.android.systemui.statusbar.policy.BatteryController;
|
||||||
@@ -510,6 +511,10 @@ public class StatusBarHeaderView extends BaseStatusBarHeader implements View.OnC
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCallback(Callback qsPanelCallback) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (v == mSettingsButton) {
|
if (v == mSettingsButton) {
|
||||||
|
|||||||
Reference in New Issue
Block a user