import com.android.systemui.plugins.qs.QSIconView;
import com.android.systemui.plugins.qs.QSTile;
-
import java.util.Objects;
/** View that represents a standard quick settings tile. **/
public class QSTileView extends QSTileBaseView {
- private static final int DEFAULT_MAX_LINES = 2;
private static final boolean DUAL_TARGET_ALLOWED = false;
private View mDivider;
protected TextView mLabel;
mLabelContainer.setClipChildren(false);
mLabelContainer.setClipToPadding(false);
mLabel = mLabelContainer.findViewById(R.id.tile_label);
- mLabel.setSelected(true); // Allow marquee to work.
mPadLock = mLabelContainer.findViewById(R.id.restricted_padlock);
mDivider = mLabelContainer.findViewById(R.id.underline);
mExpandIndicator = mLabelContainer.findViewById(R.id.expand_indicator);
mExpandSpace = mLabelContainer.findViewById(R.id.expand_space);
mSecondLine = mLabelContainer.findViewById(R.id.app_label);
mSecondLine.setAlpha(.6f);
- mSecondLine.setSelected(true); // Allow marquee to work.
addView(mLabelContainer);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- if (mLabel.getMaxLines() != DEFAULT_MAX_LINES) {
- mLabel.setMaxLines(DEFAULT_MAX_LINES);
- }
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
// Remeasure view if the secondary label text will be cut off.
}
@Override
+ public void setExpansion(float expansion) {
+ // Start the marquee when fully expanded and stop when fully collapsed. Leave as is for
+ // other expansion ratios since there is no way way to pause the marquee.
+ boolean selected = expansion == 1f ? true : expansion == 0f ? false : mLabel.isSelected();
+ mLabel.setSelected(selected);
+ mSecondLine.setSelected(selected);
+ }
+
+ @Override
protected void handleStateChanged(QSTile.State state) {
super.handleStateChanged(state);
if (!Objects.equals(mLabel.getText(), state.label) || mState != state.state) {