Merge "Ensure QS tile secondary text marquees." into pi-dev

This commit is contained in:
TreeHugger Robot
2018-04-20 16:52:42 +00:00
committed by Android (Google) Code Review
4 changed files with 16 additions and 14 deletions

View File

@@ -50,6 +50,4 @@ public abstract class QSTileView extends LinearLayout {
public abstract void onStateChanged(State state); public abstract void onStateChanged(State state);
public abstract int getDetailY(); public abstract int getDetailY();
public void setExpansion(float expansion) {}
} }

View File

@@ -76,7 +76,7 @@
android:layout_below="@id/label_group" android:layout_below="@id/label_group"
android:clickable="false" android:clickable="false"
android:ellipsize="marquee" android:ellipsize="marquee"
android:maxLines="1" android:singleLine="true"
android:padding="0dp" android:padding="0dp"
android:visibility="gone" android:visibility="gone"
android:gravity="center" android:gravity="center"

View File

@@ -56,6 +56,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
private AnimatorSet mBounceAnimatorSet; private AnimatorSet mBounceAnimatorSet;
private int mAnimatingToPage = -1; private int mAnimatingToPage = -1;
private float mLastExpansion;
public PagedTileLayout(Context context, AttributeSet attrs) { public PagedTileLayout(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
@@ -172,8 +173,19 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
@Override @Override
public void setExpansion(float expansion) { public void setExpansion(float expansion) {
for (TileRecord tr : mTiles) { mLastExpansion = expansion;
tr.tileView.setExpansion(expansion); updateSelected();
}
private void updateSelected() {
// 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.
if (mLastExpansion > 0f && mLastExpansion < 1f) {
return;
}
boolean selected = mLastExpansion == 1f;
for (int i = 0; i < mPages.size(); i++) {
mPages.get(i).setSelected(i == getCurrentItem() ? selected : false);
} }
} }
@@ -323,6 +335,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
new ViewPager.SimpleOnPageChangeListener() { new ViewPager.SimpleOnPageChangeListener() {
@Override @Override
public void onPageSelected(int position) { public void onPageSelected(int position) {
updateSelected();
if (mPageIndicator == null) return; if (mPageIndicator == null) return;
if (mPageListener != null) { if (mPageListener != null) {
mPageListener.onPageChanged(isLayoutRtl() ? position == mPages.size() - 1 mPageListener.onPageChanged(isLayoutRtl() ? position == mPages.size() - 1

View File

@@ -106,15 +106,6 @@ public class QSTileView extends QSTileBaseView {
} }
} }
@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 @Override
protected void handleStateChanged(QSTile.State state) { protected void handleStateChanged(QSTile.State state) {
super.handleStateChanged(state); super.handleStateChanged(state);