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

Commit 161920fa authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

Merge "Introduced overscrolling for the panel expansion" into lmp-preview-dev

parents 0b176bbc 24120a5c
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -21,9 +21,7 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Path;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
@@ -32,7 +30,6 @@ import android.view.ViewTreeObserver;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.view.animation.PathInterpolator;
import android.widget.LinearLayout;

import com.android.systemui.R;
@@ -645,6 +642,23 @@ public class NotificationPanelView extends PanelView implements
        mNotificationStackScroller.onExpansionStopped();
    }

    @Override
    protected void onOverExpansionChanged(float overExpansion) {
        float currentOverScroll = mNotificationStackScroller.getCurrentOverScrolledPixels(true);
        mNotificationStackScroller.setOverScrolledPixels(currentOverScroll + overExpansion
                        - mOverExpansion, true /* onTop */, false /* animate */);
        super.onOverExpansionChanged(overExpansion);
    }

    @Override
    protected void onTrackingStopped() {
        super.onTrackingStopped();
        mOverExpansion = 0.0f;
        mNotificationStackScroller.setOverScrolledPixels(0.0f, true /* onTop */,
                true /* animate */);
    }


    @Override
    public void onHeightChanged(ExpandableView view) {
        requestPanelHeightUpdate();
+10 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import java.io.PrintWriter;
public class PanelView extends FrameLayout {
    public static final boolean DEBUG = PanelBar.DEBUG;
    public static final String TAG = PanelView.class.getSimpleName();
    protected float mOverExpansion;

    private final void logf(String fmt, Object... args) {
        Log.v(TAG, (mViewName != null ? (mViewName + ": ") : "") + String.format(fmt, args));
@@ -403,6 +404,11 @@ public class PanelView extends FrameLayout {
    public void setExpandedHeightInternal(float h) {
        float fh = getMaxPanelHeight();
        mExpandedHeight = Math.min(fh, h);
        float overExpansion = h - fh;
        overExpansion = Math.max(0, overExpansion);
        if (overExpansion != mOverExpansion) {
            onOverExpansionChanged(overExpansion);
        }

        if (DEBUG) {
            logf("setExpansion: height=%.1f fh=%.1f tracking=%s", h, fh, mTracking ? "T" : "f");
@@ -412,6 +418,10 @@ public class PanelView extends FrameLayout {
        mExpandedFraction = Math.min(1f, (fh == 0) ? 0 : h / fh);
    }

    protected void onOverExpansionChanged(float overExpansion) {
        mOverExpansion = overExpansion;
    }

    protected void onHeightUpdated(float expandedHeight) {
        requestLayout();
    }