Add animation for tiles second line
Test: manual Fixes: 186251234 Change-Id: I0fd6216453b5591469d99a4ba64ac3b1af6e615f
This commit is contained in:
@@ -63,4 +63,8 @@ public abstract class QSTileView extends LinearLayout {
|
||||
public View getLabelContainer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public View getSecondaryLabel() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,8 +336,11 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
|
||||
translationYBuilder
|
||||
);
|
||||
|
||||
firstPageBuilder.addFloat(quickTileView.getSecondaryLabel(), "alpha", 0, 1);
|
||||
|
||||
mQuickQsViews.add(tileView);
|
||||
mAllViews.add(quickTileView);
|
||||
mAllViews.add(quickTileView.getSecondaryLabel());
|
||||
} else if (mFullRows && isIconInAnimatedRow(count)) {
|
||||
|
||||
firstPageBuilder.addFloat(tileView, "translationY", -heightDiff, 0);
|
||||
|
||||
@@ -16,11 +16,17 @@ package com.android.systemui.qs.tileimpl;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
/**
|
||||
* Used for QS tile labels
|
||||
*/
|
||||
public class ButtonRelativeLayout extends RelativeLayout {
|
||||
|
||||
private View mIgnoredView;
|
||||
|
||||
public ButtonRelativeLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
@@ -29,4 +35,27 @@ public class ButtonRelativeLayout extends RelativeLayout {
|
||||
public CharSequence getAccessibilityClassName() {
|
||||
return Button.class.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a view to be ignored for measure.
|
||||
*
|
||||
* The view will be measured and laid out, but its size will be subtracted from the total size
|
||||
* of this view. It assumes that this view only contributes vertical height.
|
||||
*/
|
||||
public void setIgnoredView(View view) {
|
||||
if (mIgnoredView == null || mIgnoredView.getParent() == this) {
|
||||
mIgnoredView = view;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
if (mIgnoredView != null && mIgnoredView.getVisibility() != GONE) {
|
||||
int height = mIgnoredView.getMeasuredHeight();
|
||||
MarginLayoutParams lp = (MarginLayoutParams) mIgnoredView.getLayoutParams();
|
||||
height = height - lp.bottomMargin - lp.topMargin;
|
||||
setMeasuredDimension(getMeasuredWidth(), getMeasuredHeight() - height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -44,7 +43,7 @@ public class QSTileView extends QSTileBaseView {
|
||||
protected TextView mSecondLine;
|
||||
private ImageView mPadLock;
|
||||
protected int mState;
|
||||
protected ViewGroup mLabelContainer;
|
||||
protected ButtonRelativeLayout mLabelContainer;
|
||||
private View mExpandIndicator;
|
||||
private View mExpandSpace;
|
||||
protected ColorStateList mColorLabelActive;
|
||||
@@ -92,7 +91,7 @@ public class QSTileView extends QSTileBaseView {
|
||||
}
|
||||
|
||||
protected void createLabel() {
|
||||
mLabelContainer = (ViewGroup) LayoutInflater.from(getContext())
|
||||
mLabelContainer = (ButtonRelativeLayout) LayoutInflater.from(getContext())
|
||||
.inflate(R.layout.qs_tile_label, this, false);
|
||||
mLabelContainer.setClipChildren(false);
|
||||
mLabelContainer.setClipToPadding(false);
|
||||
@@ -140,7 +139,7 @@ public class QSTileView extends QSTileBaseView {
|
||||
}
|
||||
if (!Objects.equals(mSecondLine.getText(), state.secondaryLabel)) {
|
||||
mSecondLine.setText(state.secondaryLabel);
|
||||
mSecondLine.setVisibility(TextUtils.isEmpty(state.secondaryLabel) || mCollapsedView
|
||||
mSecondLine.setVisibility(TextUtils.isEmpty(state.secondaryLabel)
|
||||
? View.GONE : View.VISIBLE);
|
||||
}
|
||||
boolean dualTarget = mDualTargetAllowed && state.dualTarget;
|
||||
@@ -193,4 +192,9 @@ public class QSTileView extends QSTileBaseView {
|
||||
public View getLabelContainer() {
|
||||
return mLabelContainer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getSecondaryLabel() {
|
||||
return mSecondLine;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,8 @@ open class QSTileViewHorizontal(
|
||||
mSecondLine.textDirection = TEXT_DIRECTION_LOCALE
|
||||
|
||||
if (mCollapsedView) {
|
||||
mSecondLine.visibility = GONE
|
||||
mSecondLine.alpha = 0f
|
||||
mLabelContainer.setIgnoredView(mSecondLine)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,9 +186,7 @@ open class QSTileViewHorizontal(
|
||||
|
||||
private fun setLabelsColor(color: ColorStateList) {
|
||||
mLabel.setTextColor(color)
|
||||
if (!mCollapsedView) {
|
||||
mSecondLine.setTextColor(color)
|
||||
}
|
||||
mSecondLine.setTextColor(color)
|
||||
}
|
||||
|
||||
private fun clearBackgroundAnimator() {
|
||||
|
||||
Reference in New Issue
Block a user