Merge "Ensure QS tile secondary text marquees." into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2cb02549dd
@@ -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) {}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user