Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +29 −8 Original line number Diff line number Diff line Loading @@ -45,9 +45,10 @@ import java.util.ArrayList; public class NotificationPanelView extends PanelView implements ExpandableView.OnHeightChangedListener, ObservableScrollView.Listener, View.OnClickListener, KeyguardPageSwipeHelper.Callback { View.OnClickListener, NotificationStackScrollLayout.OnOverscrollTopChangedListener, KeyguardPageSwipeHelper.Callback { private static float EXPANSION_RUBBER_BAND_EXTRA_FACTOR = 0.4f; private static float EXPANSION_RUBBER_BAND_EXTRA_FACTOR = 0.6f; private KeyguardPageSwipeHelper mPageSwiper; PhoneStatusBar mStatusBar; Loading Loading @@ -86,6 +87,7 @@ public class NotificationPanelView extends PanelView implements private int mQsPeekHeight; private float mNotificationTranslation; private int mStackScrollerIntrinsicPadding; private boolean mStackScrollerOverscrolling; private boolean mQsExpansionEnabled = true; private ValueAnimator mQsExpansionAnimator; private FlingAnimationUtils mFlingAnimationUtils; Loading Loading @@ -139,6 +141,7 @@ public class NotificationPanelView extends PanelView implements mNotificationStackScroller = (NotificationStackScrollLayout) findViewById(R.id.notification_stack_scroller); mNotificationStackScroller.setOnHeightChangedListener(this); mNotificationStackScroller.setOverscrollTopChangedListener(this); mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(getContext(), android.R.interpolator.fast_out_slow_in); mKeyguardBottomArea = (KeyguardBottomAreaView) findViewById(R.id.keyguard_bottom_area); Loading Loading @@ -172,7 +175,9 @@ public class NotificationPanelView extends PanelView implements setQsStackScrollerPadding(mQsMaxExpansionHeight); } } else { if (!mStackScrollerOverscrolling) { setQsExpansion(mQsMinExpansionHeight); } positionClockAndNotifications(); mNotificationStackScroller.setStackHeight(getExpandedHeight()); } Loading @@ -185,7 +190,10 @@ public class NotificationPanelView extends PanelView implements private void positionClockAndNotifications() { boolean animateClock = mNotificationStackScroller.isAddOrRemoveAnimationPending(); if (mStatusBar.getBarState() != StatusBarState.KEYGUARD) { mStackScrollerIntrinsicPadding = mHeader.getBottom() + mQsPeekHeight int bottom = mStackScrollerOverscrolling ? mHeader.getCollapsedHeight() : mHeader.getBottom(); mStackScrollerIntrinsicPadding = bottom + mQsPeekHeight + mNotificationTopPadding; mTopPaddingAdjustment = 0; } else { Loading Loading @@ -489,6 +497,16 @@ public class NotificationPanelView extends PanelView implements } } @Override public void onOverscrollTopChanged(float amount) { cancelAnimation(); float rounded = amount >= 1f ? amount : 0f; mStackScrollerOverscrolling = rounded != 0f; setQsExpansion(mQsMinExpansionHeight + rounded); updateQsState(); } private void onQsExpansionStarted() { onQsExpansionStarted(0); } Loading Loading @@ -516,9 +534,10 @@ public class NotificationPanelView extends PanelView implements } private void updateQsState() { mHeader.setExpanded(mQsExpanded); boolean expandVisually = mQsExpanded || mStackScrollerOverscrolling; mHeader.setExpanded(expandVisually, mStackScrollerOverscrolling); mNotificationStackScroller.setEnabled(!mQsExpanded); mQsPanel.setVisibility(mQsExpanded ? View.VISIBLE : View.INVISIBLE); mQsPanel.setVisibility(expandVisually ? View.VISIBLE : View.INVISIBLE); mQsContainer.setVisibility(mKeyguardShowing && !mQsExpanded ? View.INVISIBLE : View.VISIBLE); Loading @@ -528,7 +547,7 @@ public class NotificationPanelView extends PanelView implements private void setQsExpansion(float height) { height = Math.min(Math.max(height, mQsMinExpansionHeight), mQsMaxExpansionHeight); mQsFullyExpanded = height == mQsMaxExpansionHeight; if (height > mQsMinExpansionHeight && !mQsExpanded) { if (height > mQsMinExpansionHeight && !mQsExpanded && !mStackScrollerOverscrolling) { setQsExpanded(true); } else if (height <= mQsMinExpansionHeight && mQsExpanded) { setQsExpanded(false); Loading @@ -536,7 +555,9 @@ public class NotificationPanelView extends PanelView implements mQsExpansionHeight = height; mHeader.setExpansion(height - mQsPeekHeight); setQsTranslation(height); if (!mStackScrollerOverscrolling) { setQsStackScrollerPadding(height); } mStatusBar.userActivity(); } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java +9 −6 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL private static final float EXPANSION_RUBBERBAND_FACTOR = 0.35f; private boolean mExpanded; private boolean mOverscrolled; private boolean mKeyguardShowing; private View mBackground; Loading Loading @@ -125,10 +126,12 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL return mExpandedHeight; } public void setExpanded(boolean expanded) { public void setExpanded(boolean expanded, boolean overscrolled) { boolean changed = expanded != mExpanded; boolean overscrollChanged = overscrolled != mOverscrolled; mExpanded = expanded; if (changed) { mOverscrolled = overscrolled; if (changed || overscrollChanged) { updateHeights(); updateVisibilities(); updateSystemIconsLayoutParams(); Loading @@ -136,7 +139,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL updateZTranslation(); updateClickTargets(); if (mQSPanel != null) { mQSPanel.setExpanded(expanded); mQSPanel.setExpanded(expanded && !overscrolled); } } } Loading Loading @@ -184,13 +187,13 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL mDateTime.setVisibility(onKeyguardAndCollapsed ? View.INVISIBLE : View.VISIBLE); mKeyguardCarrierText.setVisibility(onKeyguardAndCollapsed ? View.VISIBLE : View.GONE); mDate.setVisibility(mExpanded ? View.VISIBLE : View.GONE); mSettingsButton.setVisibility(mExpanded ? View.VISIBLE : View.GONE); mSettingsButton.setVisibility(mExpanded && !mOverscrolled ? View.VISIBLE : View.GONE); mBrightnessContainer.setVisibility(mExpanded ? View.VISIBLE : View.GONE); if (mStatusIcons != null) { mStatusIcons.setVisibility(!mExpanded ? View.VISIBLE : View.GONE); mStatusIcons.setVisibility(!mExpanded || mOverscrolled ? View.VISIBLE : View.GONE); } if (mSignalCluster != null) { mSignalCluster.setVisibility(!mExpanded ? View.VISIBLE : View.GONE); mSignalCluster.setVisibility(!mExpanded || mOverscrolled ? View.VISIBLE : View.GONE); } } Loading packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +30 −4 Original line number Diff line number Diff line Loading @@ -18,13 +18,10 @@ package com.android.systemui.statusbar.stack; import android.content.Context; import android.content.res.Configuration; import android.graphics.Canvas; import android.graphics.Paint; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; Loading @@ -40,8 +37,8 @@ import com.android.systemui.SwipeHelper; import com.android.systemui.statusbar.ExpandableNotificationRow; import com.android.systemui.statusbar.ExpandableView; import com.android.systemui.statusbar.SpeedBumpView; import com.android.systemui.statusbar.stack.StackScrollState.ViewState; import com.android.systemui.statusbar.policy.ScrollAdapter; import com.android.systemui.statusbar.stack.StackScrollState.ViewState; import java.util.ArrayList; Loading Loading @@ -121,6 +118,7 @@ public class NotificationStackScrollLayout extends ViewGroup private float mOverScrolledBottomPixels; private OnChildLocationsChangedListener mListener; private OnOverscrollTopChangedListener mOverscrollTopChangedListener; private ExpandableView.OnHeightChangedListener mOnHeightChangedListener; private boolean mNeedsAnimation; private boolean mTopPaddingNeedsAnimation; Loading Loading @@ -875,7 +873,22 @@ public class NotificationStackScrollLayout extends ViewGroup setOverScrolledPixels(amount / RUBBER_BAND_FACTOR, onTop); mAmbientState.setOverScrollAmount(amount, onTop); requestChildrenUpdate(); if (onTop) { float scrollAmount = mOwnScrollY < 0 ? -mOwnScrollY : 0; notifyOverscrollTopListener(scrollAmount + amount); } } } private void notifyOverscrollTopListener(float amount) { if (mOverscrollTopChangedListener != null) { mOverscrollTopChangedListener.onOverscrollTopChanged(amount); } } public void setOverscrollTopChangedListener( OnOverscrollTopChangedListener overscrollTopChangedListener) { mOverscrollTopChangedListener = overscrollTopChangedListener; } public float getCurrentOverScrollAmount(boolean top) { Loading Loading @@ -913,6 +926,12 @@ public class NotificationStackScrollLayout extends ViewGroup onScrollChanged(mScrollX, mOwnScrollY, oldX, oldY); invalidateParentIfNeeded(); updateChildren(); float overScrollTop = getCurrentOverScrollAmount(true); if (mOwnScrollY < 0) { notifyOverscrollTopListener(-mOwnScrollY + overScrollTop); } else { notifyOverscrollTopListener(overScrollTop); } } } else { customScrollTo(scrollY); Loading Loading @@ -1596,6 +1615,13 @@ public class NotificationStackScrollLayout extends ViewGroup public void onChildLocationsChanged(NotificationStackScrollLayout stackScrollLayout); } /** * A listener that gets notified when the overscroll at the top has changed. */ public interface OnOverscrollTopChangedListener { public void onOverscrollTopChanged(float amount); } static class AnimationEvent { static AnimationFilter[] FILTERS = new AnimationFilter[] { Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +29 −8 Original line number Diff line number Diff line Loading @@ -45,9 +45,10 @@ import java.util.ArrayList; public class NotificationPanelView extends PanelView implements ExpandableView.OnHeightChangedListener, ObservableScrollView.Listener, View.OnClickListener, KeyguardPageSwipeHelper.Callback { View.OnClickListener, NotificationStackScrollLayout.OnOverscrollTopChangedListener, KeyguardPageSwipeHelper.Callback { private static float EXPANSION_RUBBER_BAND_EXTRA_FACTOR = 0.4f; private static float EXPANSION_RUBBER_BAND_EXTRA_FACTOR = 0.6f; private KeyguardPageSwipeHelper mPageSwiper; PhoneStatusBar mStatusBar; Loading Loading @@ -86,6 +87,7 @@ public class NotificationPanelView extends PanelView implements private int mQsPeekHeight; private float mNotificationTranslation; private int mStackScrollerIntrinsicPadding; private boolean mStackScrollerOverscrolling; private boolean mQsExpansionEnabled = true; private ValueAnimator mQsExpansionAnimator; private FlingAnimationUtils mFlingAnimationUtils; Loading Loading @@ -139,6 +141,7 @@ public class NotificationPanelView extends PanelView implements mNotificationStackScroller = (NotificationStackScrollLayout) findViewById(R.id.notification_stack_scroller); mNotificationStackScroller.setOnHeightChangedListener(this); mNotificationStackScroller.setOverscrollTopChangedListener(this); mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(getContext(), android.R.interpolator.fast_out_slow_in); mKeyguardBottomArea = (KeyguardBottomAreaView) findViewById(R.id.keyguard_bottom_area); Loading Loading @@ -172,7 +175,9 @@ public class NotificationPanelView extends PanelView implements setQsStackScrollerPadding(mQsMaxExpansionHeight); } } else { if (!mStackScrollerOverscrolling) { setQsExpansion(mQsMinExpansionHeight); } positionClockAndNotifications(); mNotificationStackScroller.setStackHeight(getExpandedHeight()); } Loading @@ -185,7 +190,10 @@ public class NotificationPanelView extends PanelView implements private void positionClockAndNotifications() { boolean animateClock = mNotificationStackScroller.isAddOrRemoveAnimationPending(); if (mStatusBar.getBarState() != StatusBarState.KEYGUARD) { mStackScrollerIntrinsicPadding = mHeader.getBottom() + mQsPeekHeight int bottom = mStackScrollerOverscrolling ? mHeader.getCollapsedHeight() : mHeader.getBottom(); mStackScrollerIntrinsicPadding = bottom + mQsPeekHeight + mNotificationTopPadding; mTopPaddingAdjustment = 0; } else { Loading Loading @@ -489,6 +497,16 @@ public class NotificationPanelView extends PanelView implements } } @Override public void onOverscrollTopChanged(float amount) { cancelAnimation(); float rounded = amount >= 1f ? amount : 0f; mStackScrollerOverscrolling = rounded != 0f; setQsExpansion(mQsMinExpansionHeight + rounded); updateQsState(); } private void onQsExpansionStarted() { onQsExpansionStarted(0); } Loading Loading @@ -516,9 +534,10 @@ public class NotificationPanelView extends PanelView implements } private void updateQsState() { mHeader.setExpanded(mQsExpanded); boolean expandVisually = mQsExpanded || mStackScrollerOverscrolling; mHeader.setExpanded(expandVisually, mStackScrollerOverscrolling); mNotificationStackScroller.setEnabled(!mQsExpanded); mQsPanel.setVisibility(mQsExpanded ? View.VISIBLE : View.INVISIBLE); mQsPanel.setVisibility(expandVisually ? View.VISIBLE : View.INVISIBLE); mQsContainer.setVisibility(mKeyguardShowing && !mQsExpanded ? View.INVISIBLE : View.VISIBLE); Loading @@ -528,7 +547,7 @@ public class NotificationPanelView extends PanelView implements private void setQsExpansion(float height) { height = Math.min(Math.max(height, mQsMinExpansionHeight), mQsMaxExpansionHeight); mQsFullyExpanded = height == mQsMaxExpansionHeight; if (height > mQsMinExpansionHeight && !mQsExpanded) { if (height > mQsMinExpansionHeight && !mQsExpanded && !mStackScrollerOverscrolling) { setQsExpanded(true); } else if (height <= mQsMinExpansionHeight && mQsExpanded) { setQsExpanded(false); Loading @@ -536,7 +555,9 @@ public class NotificationPanelView extends PanelView implements mQsExpansionHeight = height; mHeader.setExpansion(height - mQsPeekHeight); setQsTranslation(height); if (!mStackScrollerOverscrolling) { setQsStackScrollerPadding(height); } mStatusBar.userActivity(); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java +9 −6 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL private static final float EXPANSION_RUBBERBAND_FACTOR = 0.35f; private boolean mExpanded; private boolean mOverscrolled; private boolean mKeyguardShowing; private View mBackground; Loading Loading @@ -125,10 +126,12 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL return mExpandedHeight; } public void setExpanded(boolean expanded) { public void setExpanded(boolean expanded, boolean overscrolled) { boolean changed = expanded != mExpanded; boolean overscrollChanged = overscrolled != mOverscrolled; mExpanded = expanded; if (changed) { mOverscrolled = overscrolled; if (changed || overscrollChanged) { updateHeights(); updateVisibilities(); updateSystemIconsLayoutParams(); Loading @@ -136,7 +139,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL updateZTranslation(); updateClickTargets(); if (mQSPanel != null) { mQSPanel.setExpanded(expanded); mQSPanel.setExpanded(expanded && !overscrolled); } } } Loading Loading @@ -184,13 +187,13 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL mDateTime.setVisibility(onKeyguardAndCollapsed ? View.INVISIBLE : View.VISIBLE); mKeyguardCarrierText.setVisibility(onKeyguardAndCollapsed ? View.VISIBLE : View.GONE); mDate.setVisibility(mExpanded ? View.VISIBLE : View.GONE); mSettingsButton.setVisibility(mExpanded ? View.VISIBLE : View.GONE); mSettingsButton.setVisibility(mExpanded && !mOverscrolled ? View.VISIBLE : View.GONE); mBrightnessContainer.setVisibility(mExpanded ? View.VISIBLE : View.GONE); if (mStatusIcons != null) { mStatusIcons.setVisibility(!mExpanded ? View.VISIBLE : View.GONE); mStatusIcons.setVisibility(!mExpanded || mOverscrolled ? View.VISIBLE : View.GONE); } if (mSignalCluster != null) { mSignalCluster.setVisibility(!mExpanded ? View.VISIBLE : View.GONE); mSignalCluster.setVisibility(!mExpanded || mOverscrolled ? View.VISIBLE : View.GONE); } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +30 −4 Original line number Diff line number Diff line Loading @@ -18,13 +18,10 @@ package com.android.systemui.statusbar.stack; import android.content.Context; import android.content.res.Configuration; import android.graphics.Canvas; import android.graphics.Paint; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; Loading @@ -40,8 +37,8 @@ import com.android.systemui.SwipeHelper; import com.android.systemui.statusbar.ExpandableNotificationRow; import com.android.systemui.statusbar.ExpandableView; import com.android.systemui.statusbar.SpeedBumpView; import com.android.systemui.statusbar.stack.StackScrollState.ViewState; import com.android.systemui.statusbar.policy.ScrollAdapter; import com.android.systemui.statusbar.stack.StackScrollState.ViewState; import java.util.ArrayList; Loading Loading @@ -121,6 +118,7 @@ public class NotificationStackScrollLayout extends ViewGroup private float mOverScrolledBottomPixels; private OnChildLocationsChangedListener mListener; private OnOverscrollTopChangedListener mOverscrollTopChangedListener; private ExpandableView.OnHeightChangedListener mOnHeightChangedListener; private boolean mNeedsAnimation; private boolean mTopPaddingNeedsAnimation; Loading Loading @@ -875,7 +873,22 @@ public class NotificationStackScrollLayout extends ViewGroup setOverScrolledPixels(amount / RUBBER_BAND_FACTOR, onTop); mAmbientState.setOverScrollAmount(amount, onTop); requestChildrenUpdate(); if (onTop) { float scrollAmount = mOwnScrollY < 0 ? -mOwnScrollY : 0; notifyOverscrollTopListener(scrollAmount + amount); } } } private void notifyOverscrollTopListener(float amount) { if (mOverscrollTopChangedListener != null) { mOverscrollTopChangedListener.onOverscrollTopChanged(amount); } } public void setOverscrollTopChangedListener( OnOverscrollTopChangedListener overscrollTopChangedListener) { mOverscrollTopChangedListener = overscrollTopChangedListener; } public float getCurrentOverScrollAmount(boolean top) { Loading Loading @@ -913,6 +926,12 @@ public class NotificationStackScrollLayout extends ViewGroup onScrollChanged(mScrollX, mOwnScrollY, oldX, oldY); invalidateParentIfNeeded(); updateChildren(); float overScrollTop = getCurrentOverScrollAmount(true); if (mOwnScrollY < 0) { notifyOverscrollTopListener(-mOwnScrollY + overScrollTop); } else { notifyOverscrollTopListener(overScrollTop); } } } else { customScrollTo(scrollY); Loading Loading @@ -1596,6 +1615,13 @@ public class NotificationStackScrollLayout extends ViewGroup public void onChildLocationsChanged(NotificationStackScrollLayout stackScrollLayout); } /** * A listener that gets notified when the overscroll at the top has changed. */ public interface OnOverscrollTopChangedListener { public void onOverscrollTopChanged(float amount); } static class AnimationEvent { static AnimationFilter[] FILTERS = new AnimationFilter[] { Loading