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

Commit 1d92689e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add QS scrolling support"

parents 97ce94fc 231b052d
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@

package com.android.systemui.plugins.qs;

import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
@@ -65,6 +66,18 @@ public interface QS extends FragmentBase {
    default void setHasNotifications(boolean hasNotifications) {
    }

    /**
     * We need this to handle nested scrolling for QS..
     * Normally we would do this with requestDisallowInterceptTouchEvent, but when both the
     * scroll containers are using the same touch slop, they try to start scrolling at the
     * same time and NotificationPanelView wins, this lets QS win.
     *
     * TODO: Do this using NestedScroll capabilities.
     */
    default boolean onInterceptTouchEvent(MotionEvent event) {
        return isCustomizing();
    }

    @ProvidesInterface(version = HeightListener.VERSION)
    interface HeightListener {
        int VERSION = 1;
+2 −0
Original line number Diff line number Diff line
@@ -336,6 +336,8 @@
    <dimen name="qs_footer_padding_end">24dp</dimen>
    <dimen name="qs_footer_icon_size">16dp</dimen>

    <dimen name="qs_notif_collapsed_space">64dp</dimen>

    <!-- Desired qs icon overlay size. -->
    <dimen name="qs_detail_icon_overlay_size">24dp</dimen>

+0 −3
Original line number Diff line number Diff line
@@ -244,10 +244,8 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
            mFirstPageDelayedAnimator = new TouchAnimator.Builder()
                    .setStartDelay(EXPANDED_TILE_DELAY)
                    .addFloat(tileLayout, "alpha", 0, 1)
                    .addFloat(mQsPanel.getPageIndicator(), "alpha", 0, 1)
                    .addFloat(mQsPanel.getDivider(), "alpha", 0, 1)
                    .addFloat(mQsPanel.getFooter().getView(), "alpha", 0, 1).build();
            mAllViews.add(mQsPanel.getPageIndicator());
            mAllViews.add(mQsPanel.getDivider());
            mAllViews.add(mQsPanel.getFooter().getView());
            float px = 0;
@@ -265,7 +263,6 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
        }
        mNonfirstPageAnimator = new TouchAnimator.Builder()
                .addFloat(mQuickQsPanel, "alpha", 1, 0)
                .addFloat(mQsPanel.getPageIndicator(), "alpha", 0, 1)
                .addFloat(mQsPanel.getDivider(), "alpha", 0, 1)
                .setListener(mNonFirstPageListener)
                .setEndDelay(.5f)
+14 −4
Original line number Diff line number Diff line
@@ -17,11 +17,11 @@
package com.android.systemui.qs;

import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Canvas;
import android.graphics.Path;
import android.graphics.Point;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.widget.FrameLayout;

@@ -80,11 +80,22 @@ public class QSContainerImpl extends FrameLayout {

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        getDisplay().getRealSize(mSizePoint);

        // Since we control our own bottom, be whatever size we want.
        // Otherwise the QSPanel ends up with 0 height when the window is only the
        // size of the status bar.
        mQSPanel.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(
                MeasureSpec.getSize(heightMeasureSpec), MeasureSpec.UNSPECIFIED));
        Configuration config = getResources().getConfiguration();
        boolean navBelow = config.smallestScreenWidthDp >= 600
                || config.orientation != Configuration.ORIENTATION_LANDSCAPE;
        MarginLayoutParams params = (MarginLayoutParams) mQSPanel.getLayoutParams();
        int maxQs = mSizePoint.y - params.topMargin - params.bottomMargin - getPaddingBottom()
                - getResources().getDimensionPixelSize(R.dimen.qs_notif_collapsed_space);
        if (navBelow) {
            maxQs -= getResources().getDimensionPixelSize(R.dimen.navigation_bar_height);
        }
        mQSPanel.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(maxQs, MeasureSpec.AT_MOST));

        int width = mQSPanel.getMeasuredWidth();
        LayoutParams layoutParams = (LayoutParams) mQSPanel.getLayoutParams();
        int height = layoutParams.topMargin + layoutParams.bottomMargin
@@ -94,7 +105,6 @@ public class QSContainerImpl extends FrameLayout {

        // QSCustomizer will always be the height of the screen, but do this after
        // other measuring to avoid changing the height of the QS.
        getDisplay().getRealSize(mSizePoint);
        mQSCustomizer.measure(widthMeasureSpec,
                MeasureSpec.makeMeasureSpec(mSizePoint.y, MeasureSpec.EXACTLY));
    }
+6 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.support.annotation.VisibleForTesting;
import android.util.Log;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
@@ -206,6 +207,11 @@ public class QSFragment extends Fragment implements QS {
        return mQSPanel.isShowingCustomize() || mQSDetail.isShowingDetail();
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent event) {
        return isCustomizing() || mQSPanel.onInterceptTouchEvent(event);
    }

    @Override
    public void setHeaderClickable(boolean clickable) {
        if (DEBUG) Log.d(TAG, "setHeaderClickable " + clickable);
Loading