Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c9048c3 authored by Amin Shaikh's avatar Amin Shaikh
Browse files

Ensure QS tile secondary text marquees.

Update the logic to marquee only the currently selected page.

Change-Id: Idc2398e1c67c614414ae4298c43a1609431c62fa
Fixes: 78159844
Test: visual
parent 7468d361
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -50,6 +50,4 @@ public abstract class QSTileView extends LinearLayout {
    public abstract void onStateChanged(State state);

    public abstract int getDetailY();

    public void setExpansion(float expansion) {}
}
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@
        android:layout_below="@id/label_group"
        android:clickable="false"
        android:ellipsize="marquee"
        android:maxLines="1"
        android:singleLine="true"
        android:padding="0dp"
        android:visibility="gone"
        android:gravity="center"
+15 −2
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {

    private AnimatorSet mBounceAnimatorSet;
    private int mAnimatingToPage = -1;
    private float mLastExpansion;

    public PagedTileLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -172,8 +173,19 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {

    @Override
    public void setExpansion(float expansion) {
        for (TileRecord tr : mTiles) {
            tr.tileView.setExpansion(expansion);
        mLastExpansion = 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() {
                @Override
                public void onPageSelected(int position) {
                    updateSelected();
                    if (mPageIndicator == null) return;
                    if (mPageListener != null) {
                        mPageListener.onPageChanged(isLayoutRtl() ? position == mPages.size() - 1
+0 −9
Original line number Diff line number Diff line
@@ -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
    protected void handleStateChanged(QSTile.State state) {
        super.handleStateChanged(state);