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

Commit 037c2cdc authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Make QS buttons squishy

Pass squishiness fraction from notifications to QS, and make it behave
accordingly.

Test: manual
Test: atest QSSquishinessControllerTest
Bug: 199047412
Change-Id: I9f5df7ae99e0bced4626dcb36053c9dba78ec672
parent 0566e1ec
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -55,13 +55,14 @@ public interface QS extends FragmentBase {

    /**
     * Asks QS to update its presentation, according to {@code NotificationPanelViewController}.
     *
     * @param qsExpansionFraction How much each UI element in QS should be expanded (QQS to QS.)
     * @param panelExpansionFraction Whats the expansion of the whole shade.
     * @param headerTranslation How much we should vertically translate QS.
     * @param squishinessFraction Fraction that affects tile height. 0 when collapsed,
     *                            1 when expanded.
     */
    void setQsExpansion(float qsExpansionFraction, float panelExpansionFraction,
            float headerTranslation);
            float headerTranslation, float squishinessFraction);
    void setHeaderListening(boolean listening);
    void notifyCustomizeChanged();
    void setContainerController(QSContainerController controller);
+1 −1
Original line number Diff line number Diff line
@@ -23,6 +23,6 @@
    <dimen name="widget_big_font_size">88dp</dimen>

    <dimen name="qs_header_system_icons_area_height">0dp</dimen>
    <dimen name="qs_panel_padding_top">0dp</dimen>
    <dimen name="qs_panel_padding_top">@dimen/qqs_layout_margin_top</dimen>

</resources>
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@
                android:id="@+id/qqs_footer_actions"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:layout_marginTop="@dimen/qqs_layout_margin_top"
                android:layout_marginStart="@dimen/qs_footer_margin"
                android:layout_marginEnd="@dimen/qs_footer_margin"
                />
+5 −0
Original line number Diff line number Diff line
@@ -166,6 +166,11 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
        updateListening();
    }

    @Override
    public void setSquishinessFraction(float squishinessFraction) {
        // No-op, paged layouts are not squishy.
    }

    private void updateListening() {
        for (TileLayout tilePage : mPages) {
            tilePage.setListening(tilePage.getParent() != null && mListening);
+8 −6
Original line number Diff line number Diff line
@@ -316,8 +316,8 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha

                    if (mQQSTileHeightAnimator == null) {
                        mQQSTileHeightAnimator = new HeightExpansionAnimator(this,
                                quickTileView.getHeight(), tileView.getHeight());
                        qqsTileHeight = quickTileView.getHeight();
                                quickTileView.getMeasuredHeight(), tileView.getMeasuredHeight());
                        qqsTileHeight = quickTileView.getMeasuredHeight();
                    }

                    mQQSTileHeightAnimator.addView(quickTileView);
@@ -380,7 +380,7 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
                    if (mOtherTilesExpandAnimator == null) {
                        mOtherTilesExpandAnimator =
                                new HeightExpansionAnimator(
                                        this, qqsTileHeight, tileView.getHeight());
                                        this, qqsTileHeight, tileView.getMeasuredHeight());
                    }
                    mOtherTilesExpandAnimator.addView(tileView);
                    tileView.setClipChildren(true);
@@ -658,7 +658,7 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
        mTranslateWhileExpanding = shouldTranslate;
    }

    static class HeightExpansionAnimator {
    private static class HeightExpansionAnimator {
        private final List<View> mViews = new ArrayList<>();
        private final ValueAnimator mAnimator;
        private final TouchAnimator.Listener mListener;
@@ -673,9 +673,10 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
                int height = (Integer) valueAnimator.getAnimatedValue();
                for (int i = 0; i < viewCount; i++) {
                    View v = mViews.get(i);
                    v.setBottom(v.getTop() + height);
                    if (v instanceof HeightOverrideable) {
                        ((HeightOverrideable) v).setHeightOverride(height);
                    } else {
                        v.setBottom(v.getTop() + height);
                    }
                }
                if (t == 0f) {
@@ -713,9 +714,10 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
            final int viewsCount = mViews.size();
            for (int i = 0; i < viewsCount; i++) {
                View v = mViews.get(i);
                v.setBottom(v.getTop() + v.getMeasuredHeight());
                if (v instanceof HeightOverrideable) {
                    ((HeightOverrideable) v).resetOverride();
                } else {
                    v.setBottom(v.getTop() + v.getMeasuredHeight());
                }
            }
        }
Loading