* commit '83394b25d0fb903a843ae8ce7178e9476e507c59': The heads up now have a margin on top and don't stick to the edge
This commit is contained in:
@@ -21,6 +21,7 @@ import android.view.MotionEvent;
|
|||||||
import android.view.ViewConfiguration;
|
import android.view.ViewConfiguration;
|
||||||
|
|
||||||
import com.android.systemui.Gefingerpoken;
|
import com.android.systemui.Gefingerpoken;
|
||||||
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.statusbar.ExpandableNotificationRow;
|
import com.android.systemui.statusbar.ExpandableNotificationRow;
|
||||||
import com.android.systemui.statusbar.ExpandableView;
|
import com.android.systemui.statusbar.ExpandableView;
|
||||||
import com.android.systemui.statusbar.policy.HeadsUpManager;
|
import com.android.systemui.statusbar.policy.HeadsUpManager;
|
||||||
@@ -42,6 +43,7 @@ public class HeadsUpTouchHelper implements Gefingerpoken {
|
|||||||
private boolean mCollapseSnoozes;
|
private boolean mCollapseSnoozes;
|
||||||
private NotificationPanelView mPanel;
|
private NotificationPanelView mPanel;
|
||||||
private ExpandableNotificationRow mPickedChild;
|
private ExpandableNotificationRow mPickedChild;
|
||||||
|
private final int mNotificationsTopPadding;
|
||||||
|
|
||||||
public HeadsUpTouchHelper(HeadsUpManager headsUpManager,
|
public HeadsUpTouchHelper(HeadsUpManager headsUpManager,
|
||||||
NotificationStackScrollLayout stackScroller,
|
NotificationStackScrollLayout stackScroller,
|
||||||
@@ -52,6 +54,8 @@ public class HeadsUpTouchHelper implements Gefingerpoken {
|
|||||||
Context context = stackScroller.getContext();
|
Context context = stackScroller.getContext();
|
||||||
final ViewConfiguration configuration = ViewConfiguration.get(context);
|
final ViewConfiguration configuration = ViewConfiguration.get(context);
|
||||||
mTouchSlop = configuration.getScaledTouchSlop();
|
mTouchSlop = configuration.getScaledTouchSlop();
|
||||||
|
mNotificationsTopPadding = context.getResources()
|
||||||
|
.getDimensionPixelSize(R.dimen.notifications_top_padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTrackingHeadsUp() {
|
public boolean isTrackingHeadsUp() {
|
||||||
@@ -76,6 +80,10 @@ public class HeadsUpTouchHelper implements Gefingerpoken {
|
|||||||
mInitialTouchX = x;
|
mInitialTouchX = x;
|
||||||
setTrackingHeadsUp(false);
|
setTrackingHeadsUp(false);
|
||||||
ExpandableView child = mStackScroller.getChildAtRawPosition(x, y);
|
ExpandableView child = mStackScroller.getChildAtRawPosition(x, y);
|
||||||
|
if (child == null && y < mNotificationsTopPadding) {
|
||||||
|
// We should also allow drags from the margin above the heads up
|
||||||
|
child = mStackScroller.getChildAtRawPosition(x, y + mNotificationsTopPadding);
|
||||||
|
}
|
||||||
mTouchingHeadsUpView = false;
|
mTouchingHeadsUpView = false;
|
||||||
if (child instanceof ExpandableNotificationRow) {
|
if (child instanceof ExpandableNotificationRow) {
|
||||||
mPickedChild = (ExpandableNotificationRow) child;
|
mPickedChild = (ExpandableNotificationRow) child;
|
||||||
@@ -102,7 +110,8 @@ public class HeadsUpTouchHelper implements Gefingerpoken {
|
|||||||
mInitialTouchX = x;
|
mInitialTouchX = x;
|
||||||
mInitialTouchY = y;
|
mInitialTouchY = y;
|
||||||
int expandedHeight = mPickedChild.getActualHeight();
|
int expandedHeight = mPickedChild.getActualHeight();
|
||||||
mPanel.startExpandMotion(x, y, true /* startTracking */, expandedHeight);
|
mPanel.startExpandMotion(x, y, true /* startTracking */, expandedHeight
|
||||||
|
+ mNotificationsTopPadding);
|
||||||
mHeadsUpManager.unpinAll();
|
mHeadsUpManager.unpinAll();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,6 +190,7 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
private int mOldLayoutDirection;
|
private int mOldLayoutDirection;
|
||||||
private HeadsUpTouchHelper mHeadsUpTouchHelper;
|
private HeadsUpTouchHelper mHeadsUpTouchHelper;
|
||||||
private boolean mIsExpansionFromHeadsUp;
|
private boolean mIsExpansionFromHeadsUp;
|
||||||
|
private boolean mListenForHeadsUp;
|
||||||
private int mNavigationBarBottomHeight;
|
private int mNavigationBarBottomHeight;
|
||||||
private boolean mExpandingFromHeadsUp;
|
private boolean mExpandingFromHeadsUp;
|
||||||
private boolean mCollapsedOnDown;
|
private boolean mCollapsedOnDown;
|
||||||
@@ -649,6 +650,7 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
mQsTouchAboveFalsingThreshold = mQsFullyExpanded;
|
mQsTouchAboveFalsingThreshold = mQsFullyExpanded;
|
||||||
mDozingOnDown = isDozing();
|
mDozingOnDown = isDozing();
|
||||||
mCollapsedOnDown = isFullyCollapsed();
|
mCollapsedOnDown = isFullyCollapsed();
|
||||||
|
mListenForHeadsUp = mCollapsedOnDown && mHeadsUpManager.hasPinnedHeadsUp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -709,6 +711,12 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
initDownStates(event);
|
initDownStates(event);
|
||||||
|
if (mListenForHeadsUp && !mHeadsUpTouchHelper.isTrackingHeadsUp()
|
||||||
|
&& mHeadsUpTouchHelper.onInterceptTouchEvent(event)) {
|
||||||
|
mIsExpansionFromHeadsUp = true;
|
||||||
|
MetricsLogger.count(mContext, COUNTER_PANEL_OPEN, 1);
|
||||||
|
MetricsLogger.count(mContext, COUNTER_PANEL_OPEN_PEEK, 1);
|
||||||
|
}
|
||||||
if ((!mIsExpanding || mHintAnimationRunning)
|
if ((!mIsExpanding || mHintAnimationRunning)
|
||||||
&& !mQsExpanded
|
&& !mQsExpanded
|
||||||
&& mStatusBar.getBarState() != StatusBarState.SHADE) {
|
&& mStatusBar.getBarState() != StatusBarState.SHADE) {
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public abstract class PanelView extends FrameLayout {
|
|||||||
private float mHintDistance;
|
private float mHintDistance;
|
||||||
private int mEdgeTapAreaWidth;
|
private int mEdgeTapAreaWidth;
|
||||||
private float mInitialOffsetOnTouch;
|
private float mInitialOffsetOnTouch;
|
||||||
|
private boolean mCollapsedAndHeadsUpOnDown;
|
||||||
private float mExpandedFraction = 0;
|
private float mExpandedFraction = 0;
|
||||||
protected float mExpandedHeight = 0;
|
protected float mExpandedHeight = 0;
|
||||||
private boolean mPanelClosedOnDown;
|
private boolean mPanelClosedOnDown;
|
||||||
@@ -258,6 +259,8 @@ public abstract class PanelView extends FrameLayout {
|
|||||||
mMotionAborted = false;
|
mMotionAborted = false;
|
||||||
mPeekTouching = mPanelClosedOnDown;
|
mPeekTouching = mPanelClosedOnDown;
|
||||||
mTouchAboveFalsingThreshold = false;
|
mTouchAboveFalsingThreshold = false;
|
||||||
|
mCollapsedAndHeadsUpOnDown = isFullyCollapsed()
|
||||||
|
&& mHeadsUpManager.hasPinnedHeadsUp();
|
||||||
if (mVelocityTracker == null) {
|
if (mVelocityTracker == null) {
|
||||||
initVelocityTracker();
|
initVelocityTracker();
|
||||||
}
|
}
|
||||||
@@ -270,7 +273,7 @@ public abstract class PanelView extends FrameLayout {
|
|||||||
|| mPeekPending || mPeekAnimator != null;
|
|| mPeekPending || mPeekAnimator != null;
|
||||||
onTrackingStarted();
|
onTrackingStarted();
|
||||||
}
|
}
|
||||||
if (isFullyCollapsed()) {
|
if (isFullyCollapsed() && !mHeadsUpManager.hasPinnedHeadsUp()) {
|
||||||
schedulePeek();
|
schedulePeek();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -302,7 +305,7 @@ public abstract class PanelView extends FrameLayout {
|
|||||||
&& (Math.abs(h) > Math.abs(x - mInitialTouchX)
|
&& (Math.abs(h) > Math.abs(x - mInitialTouchX)
|
||||||
|| mIgnoreXTouchSlop)) {
|
|| mIgnoreXTouchSlop)) {
|
||||||
mTouchSlopExceeded = true;
|
mTouchSlopExceeded = true;
|
||||||
if (mGestureWaitForTouchSlop && !mTracking) {
|
if (mGestureWaitForTouchSlop && !mTracking && !mCollapsedAndHeadsUpOnDown) {
|
||||||
if (!mJustPeeked && mInitialOffsetOnTouch != 0f) {
|
if (!mJustPeeked && mInitialOffsetOnTouch != 0f) {
|
||||||
startExpandMotion(x, y, false /* startTracking */, mExpandedHeight);
|
startExpandMotion(x, y, false /* startTracking */, mExpandedHeight);
|
||||||
h = 0;
|
h = 0;
|
||||||
@@ -477,6 +480,7 @@ public abstract class PanelView extends FrameLayout {
|
|||||||
mJustPeeked = false;
|
mJustPeeked = false;
|
||||||
mMotionAborted = false;
|
mMotionAborted = false;
|
||||||
mPanelClosedOnDown = isFullyCollapsed();
|
mPanelClosedOnDown = isFullyCollapsed();
|
||||||
|
mCollapsedAndHeadsUpOnDown = false;
|
||||||
mHasLayoutedSinceDown = false;
|
mHasLayoutedSinceDown = false;
|
||||||
mUpdateFlingOnLayout = false;
|
mUpdateFlingOnLayout = false;
|
||||||
mTouchAboveFalsingThreshold = false;
|
mTouchAboveFalsingThreshold = false;
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL
|
|||||||
|
|
||||||
private final View mStatusBarWindowView;
|
private final View mStatusBarWindowView;
|
||||||
private final int mStatusBarHeight;
|
private final int mStatusBarHeight;
|
||||||
|
private final int mNotificationsTopPadding;
|
||||||
private PhoneStatusBar mBar;
|
private PhoneStatusBar mBar;
|
||||||
private int mSnoozeLengthMs;
|
private int mSnoozeLengthMs;
|
||||||
private ContentObserver mSettingsObserver;
|
private ContentObserver mSettingsObserver;
|
||||||
@@ -128,6 +129,8 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL
|
|||||||
mStatusBarWindowView = statusBarWindowView;
|
mStatusBarWindowView = statusBarWindowView;
|
||||||
mStatusBarHeight = resources.getDimensionPixelSize(
|
mStatusBarHeight = resources.getDimensionPixelSize(
|
||||||
com.android.internal.R.dimen.status_bar_height);
|
com.android.internal.R.dimen.status_bar_height);
|
||||||
|
mNotificationsTopPadding = context.getResources()
|
||||||
|
.getDimensionPixelSize(R.dimen.notifications_top_padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTouchableRegionListener() {
|
private void updateTouchableRegionListener() {
|
||||||
@@ -379,7 +382,7 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL
|
|||||||
}
|
}
|
||||||
|
|
||||||
info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
|
info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
|
||||||
info.touchableRegion.set(minX, minY, maxX, maxY);
|
info.touchableRegion.set(minX, minY, maxX, maxY + mNotificationsTopPadding);
|
||||||
} else if (mHeadsUpGoingAway || mWaitingOnCollapseWhenGoingAway) {
|
} else if (mHeadsUpGoingAway || mWaitingOnCollapseWhenGoingAway) {
|
||||||
info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
|
info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
|
||||||
info.touchableRegion.set(0, 0, mStatusBarWindowView.getWidth(), mStatusBarHeight);
|
info.touchableRegion.set(0, 0, mStatusBarWindowView.getWidth(), mStatusBarHeight);
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ public class StackScrollAlgorithm {
|
|||||||
private int mTopStackTotalSize;
|
private int mTopStackTotalSize;
|
||||||
private int mPaddingBetweenElementsDimmed;
|
private int mPaddingBetweenElementsDimmed;
|
||||||
private int mPaddingBetweenElementsNormal;
|
private int mPaddingBetweenElementsNormal;
|
||||||
|
private int mNotificationsTopPadding;
|
||||||
private int mBottomStackSlowDownLength;
|
private int mBottomStackSlowDownLength;
|
||||||
private int mTopStackSlowDownLength;
|
private int mTopStackSlowDownLength;
|
||||||
private int mCollapseSecondCardPadding;
|
private int mCollapseSecondCardPadding;
|
||||||
@@ -104,6 +105,8 @@ public class StackScrollAlgorithm {
|
|||||||
.getDimensionPixelSize(R.dimen.notification_padding_dimmed);
|
.getDimensionPixelSize(R.dimen.notification_padding_dimmed);
|
||||||
mPaddingBetweenElementsNormal = context.getResources()
|
mPaddingBetweenElementsNormal = context.getResources()
|
||||||
.getDimensionPixelSize(R.dimen.notification_padding);
|
.getDimensionPixelSize(R.dimen.notification_padding);
|
||||||
|
mNotificationsTopPadding = context.getResources()
|
||||||
|
.getDimensionPixelSize(R.dimen.notifications_top_padding);
|
||||||
mCollapsedSize = context.getResources()
|
mCollapsedSize = context.getResources()
|
||||||
.getDimensionPixelSize(R.dimen.notification_min_height);
|
.getDimensionPixelSize(R.dimen.notification_min_height);
|
||||||
mMaxNotificationHeight = context.getResources()
|
mMaxNotificationHeight = context.getResources()
|
||||||
@@ -518,7 +521,8 @@ public class StackScrollAlgorithm {
|
|||||||
bottomPosition);
|
bottomPosition);
|
||||||
}
|
}
|
||||||
if (row.isPinned()) {
|
if (row.isPinned()) {
|
||||||
childState.yTranslation = Math.max(childState.yTranslation, 0);
|
childState.yTranslation = Math.max(childState.yTranslation,
|
||||||
|
mNotificationsTopPadding);
|
||||||
childState.height = row.getHeadsUpHeight();
|
childState.height = row.getHeadsUpHeight();
|
||||||
if (!isTopEntry) {
|
if (!isTopEntry) {
|
||||||
// Ensure that a headsUp doesn't vertically extend further than the heads-up at
|
// Ensure that a headsUp doesn't vertically extend further than the heads-up at
|
||||||
|
|||||||
Reference in New Issue
Block a user