Introduced overscrolling for the panel expansion
Notifications now overscroll in a rubberbandy motion when expanding. Bug: 14486987 Change-Id: I5ad47027adab10d6996e70f489e8c2550220e224
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user