Loading packages/SystemUI/res/values/config.xml +11 −0 Original line number Diff line number Diff line Loading @@ -345,4 +345,15 @@ have been scrolled off-screen. --> <bool name="config_showNotificationShelf">true</bool> <!-- Whether or not the notifications should always fade as they are dismissed. --> <bool name="config_fadeNotificationsOnDismiss">false</bool> <!-- Whether or not the parent of the notification row itself is being translated when swiped or its children views. If true, then the contents are translated and vice versa. --> <bool name="config_translateNotificationContentsOnSwipe">true</bool> <!-- Whether or not the fade on the notification is based on the amount that it has been swiped off-screen. --> <bool name="config_fadeDependingOnAmountSwiped">false</bool> </resources> packages/SystemUI/res/values/dimens.xml +4 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,10 @@ <!-- Height of a small notification in the status bar--> <dimen name="notification_min_height">92dp</dimen> <!-- Width of each individual notification in the notification panel. MATCH_PARENT in this case means the notifications will be measured with its parent's MeasureSpec. --> <dimen name="notification_child_width">@dimen/match_parent</dimen> <!-- Increased height of a small notification in the status bar --> <dimen name="notification_min_height_increased">132dp</dimen> Loading packages/SystemUI/src/com/android/systemui/SwipeHelper.java +16 −10 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.animation.ValueAnimator.AnimatorUpdateListener; import android.content.Context; import android.content.res.Resources; import android.graphics.RectF; import android.os.Handler; import android.util.Log; Loading @@ -30,9 +31,7 @@ import android.view.VelocityTracker; import android.view.View; import android.view.ViewConfiguration; import android.view.accessibility.AccessibilityEvent; import com.android.systemui.classifier.FalsingManager; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin.MenuItem; import com.android.systemui.statusbar.ExpandableNotificationRow; import com.android.systemui.statusbar.FlingAnimationUtils; Loading Loading @@ -88,6 +87,7 @@ public class SwipeHelper implements Gefingerpoken { private int mFalsingThreshold; private boolean mTouchAboveFalsingThreshold; private boolean mDisableHwLayers; private boolean mFadeDependingOnAmountSwiped; private Context mContext; private HashMap<View, Animator> mDismissPendingMap = new HashMap<>(); Loading @@ -98,12 +98,15 @@ public class SwipeHelper implements Gefingerpoken { mHandler = new Handler(); mSwipeDirection = swipeDirection; mVelocityTracker = VelocityTracker.obtain(); mDensityScale = context.getResources().getDisplayMetrics().density; mPagingTouchSlop = ViewConfiguration.get(context).getScaledPagingTouchSlop(); mLongPressTimeout = (long) (ViewConfiguration.getLongPressTimeout() * 1.5f); // extra long-press! mFalsingThreshold = context.getResources().getDimensionPixelSize( R.dimen.swipe_helper_falsing_threshold); // Extra long-press! mLongPressTimeout = (long) (ViewConfiguration.getLongPressTimeout() * 1.5f); Resources res = context.getResources(); mDensityScale = res.getDisplayMetrics().density; mFalsingThreshold = res.getDimensionPixelSize(R.dimen.swipe_helper_falsing_threshold); mFadeDependingOnAmountSwiped = res.getBoolean(R.bool.config_fadeDependingOnAmountSwiped); mFalsingManager = FalsingManager.getInstance(context); mFlingAnimationUtils = new FlingAnimationUtils(context, getMaxEscapeAnimDuration() / 1000f); } Loading Loading @@ -173,8 +176,7 @@ public class SwipeHelper implements Gefingerpoken { } protected float getSize(View v) { return mSwipeDirection == X ? v.getMeasuredWidth() : v.getMeasuredHeight(); return mSwipeDirection == X ? v.getMeasuredWidth() : v.getMeasuredHeight(); } public void setMinSwipeProgress(float minSwipeProgress) { Loading @@ -192,6 +194,11 @@ public class SwipeHelper implements Gefingerpoken { } private float getSwipeAlpha(float progress) { if (mFadeDependingOnAmountSwiped) { // The more progress has been fade, the lower the alpha value so that the view fades. return Math.max(1 - progress, 0); } return Math.min(0, Math.max(1, progress / SWIPE_PROGRESS_FADE_END)); } Loading @@ -204,9 +211,8 @@ public class SwipeHelper implements Gefingerpoken { float swipeProgress = getSwipeProgressForOffset(animView, translation); if (!mCallback.updateSwipeProgress(animView, dismissable, swipeProgress)) { if (FADE_OUT_DURING_SWIPE && dismissable) { float alpha = swipeProgress; if (!mDisableHwLayers) { if (alpha != 0f && alpha != 1f) { if (swipeProgress != 0f && swipeProgress != 1f) { animView.setLayerType(View.LAYER_TYPE_HARDWARE, null); } else { animView.setLayerType(View.LAYER_TYPE_NONE, null); Loading packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +38 −18 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.animation.ObjectAnimator; import android.animation.ValueAnimator.AnimatorUpdateListener; import android.annotation.Nullable; import android.content.Context; import android.content.res.Resources; import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.AnimationDrawable; import android.graphics.drawable.ColorDrawable; Loading Loading @@ -1143,9 +1144,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView mMaxHeadsUpHeight = getFontScaledHeight(R.dimen.notification_max_heads_up_height); mMaxHeadsUpHeightIncreased = getFontScaledHeight( R.dimen.notification_max_heads_up_height_increased); mIncreasedPaddingBetweenElements = getResources() .getDimensionPixelSize(R.dimen.notification_divider_height_increased); mIconTransformContentShiftNoIcon = getResources().getDimensionPixelSize( Resources res = getResources(); mIncreasedPaddingBetweenElements = res.getDimensionPixelSize( R.dimen.notification_divider_height_increased); mIconTransformContentShiftNoIcon = res.getDimensionPixelSize( R.dimen.notification_icon_transform_content_shift); } Loading Loading @@ -1199,12 +1201,16 @@ public class ExpandableNotificationRow extends ActivatableNotificationView mChildrenContainer.setIsLowPriority(mIsLowPriority); mChildrenContainer.setContainingNotification(ExpandableNotificationRow.this); mChildrenContainer.onNotificationUpdated(); if (mShouldTranslateContents) { mTranslateableViews.add(mChildrenContainer); } } }); if (mShouldTranslateContents) { // Add the views that we translate to reveal the menu mTranslateableViews = new ArrayList<View>(); mTranslateableViews = new ArrayList<>(); for (int i = 0; i < getChildCount(); i++) { mTranslateableViews.add(getChildAt(i)); } Loading @@ -1212,17 +1218,22 @@ public class ExpandableNotificationRow extends ActivatableNotificationView mTranslateableViews.remove(mChildrenContainerStub); mTranslateableViews.remove(mGutsStub); } } public void resetTranslation() { if (mTranslateAnim != null) { mTranslateAnim.cancel(); } if (mTranslateableViews != null) { if (!mShouldTranslateContents) { setTranslationX(0); } else if (mTranslateableViews != null) { for (int i = 0; i < mTranslateableViews.size(); i++) { mTranslateableViews.get(i).setTranslationX(0); } } invalidateOutline(); } mMenuRow.resetMenu(); } Loading @@ -1242,6 +1253,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView // Don't translate if guts are showing. return; } if (!mShouldTranslateContents) { setTranslationX(translationX); } else if (mTranslateableViews != null) { // Translate the group of views for (int i = 0; i < mTranslateableViews.size(); i++) { if (mTranslateableViews.get(i) != null) { Loading @@ -1249,6 +1263,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } } invalidateOutline(); } if (mMenuRow.getMenuView() != null) { mMenuRow.onTranslationUpdate(translationX); } Loading @@ -1256,10 +1271,15 @@ public class ExpandableNotificationRow extends ActivatableNotificationView @Override public float getTranslation() { if (mShouldTranslateContents) { return getTranslationX(); } if (mTranslateableViews != null && mTranslateableViews.size() > 0) { // All of the views in the list should have same translation, just use first one. return mTranslateableViews.get(0).getTranslationX(); } return 0; } Loading packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java +13 −2 Original line number Diff line number Diff line Loading @@ -17,12 +17,14 @@ package com.android.systemui.statusbar; import android.content.Context; import android.content.res.Resources; import android.graphics.Outline; import android.graphics.Rect; import android.graphics.RectF; import android.util.AttributeSet; import android.view.View; import android.view.ViewOutlineProvider; import com.android.systemui.R; /** * Like {@link ExpandableView}, but setting an outline for the height and clipping. Loading @@ -33,10 +35,16 @@ public abstract class ExpandableOutlineView extends ExpandableView { private boolean mCustomOutline; private float mOutlineAlpha = -1f; ViewOutlineProvider mProvider = new ViewOutlineProvider() { /** * {@code true} if the children views of the {@link ExpandableOutlineView} are translated when * it is moved. Otherwise, the translation is set on the {@code ExpandableOutlineView} itself. */ protected boolean mShouldTranslateContents; private final ViewOutlineProvider mProvider = new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { int translation = (int) getTranslation(); int translation = mShouldTranslateContents ? 0 : (int) getTranslation(); if (!mCustomOutline) { outline.setRect(translation, mClipTopAmount, Loading @@ -52,6 +60,9 @@ public abstract class ExpandableOutlineView extends ExpandableView { public ExpandableOutlineView(Context context, AttributeSet attrs) { super(context, attrs); setOutlineProvider(mProvider); Resources res = getResources(); mShouldTranslateContents = res.getBoolean(R.bool.config_translateNotificationContentsOnSwipe); } @Override Loading Loading
packages/SystemUI/res/values/config.xml +11 −0 Original line number Diff line number Diff line Loading @@ -345,4 +345,15 @@ have been scrolled off-screen. --> <bool name="config_showNotificationShelf">true</bool> <!-- Whether or not the notifications should always fade as they are dismissed. --> <bool name="config_fadeNotificationsOnDismiss">false</bool> <!-- Whether or not the parent of the notification row itself is being translated when swiped or its children views. If true, then the contents are translated and vice versa. --> <bool name="config_translateNotificationContentsOnSwipe">true</bool> <!-- Whether or not the fade on the notification is based on the amount that it has been swiped off-screen. --> <bool name="config_fadeDependingOnAmountSwiped">false</bool> </resources>
packages/SystemUI/res/values/dimens.xml +4 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,10 @@ <!-- Height of a small notification in the status bar--> <dimen name="notification_min_height">92dp</dimen> <!-- Width of each individual notification in the notification panel. MATCH_PARENT in this case means the notifications will be measured with its parent's MeasureSpec. --> <dimen name="notification_child_width">@dimen/match_parent</dimen> <!-- Increased height of a small notification in the status bar --> <dimen name="notification_min_height_increased">132dp</dimen> Loading
packages/SystemUI/src/com/android/systemui/SwipeHelper.java +16 −10 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.animation.ValueAnimator.AnimatorUpdateListener; import android.content.Context; import android.content.res.Resources; import android.graphics.RectF; import android.os.Handler; import android.util.Log; Loading @@ -30,9 +31,7 @@ import android.view.VelocityTracker; import android.view.View; import android.view.ViewConfiguration; import android.view.accessibility.AccessibilityEvent; import com.android.systemui.classifier.FalsingManager; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin.MenuItem; import com.android.systemui.statusbar.ExpandableNotificationRow; import com.android.systemui.statusbar.FlingAnimationUtils; Loading Loading @@ -88,6 +87,7 @@ public class SwipeHelper implements Gefingerpoken { private int mFalsingThreshold; private boolean mTouchAboveFalsingThreshold; private boolean mDisableHwLayers; private boolean mFadeDependingOnAmountSwiped; private Context mContext; private HashMap<View, Animator> mDismissPendingMap = new HashMap<>(); Loading @@ -98,12 +98,15 @@ public class SwipeHelper implements Gefingerpoken { mHandler = new Handler(); mSwipeDirection = swipeDirection; mVelocityTracker = VelocityTracker.obtain(); mDensityScale = context.getResources().getDisplayMetrics().density; mPagingTouchSlop = ViewConfiguration.get(context).getScaledPagingTouchSlop(); mLongPressTimeout = (long) (ViewConfiguration.getLongPressTimeout() * 1.5f); // extra long-press! mFalsingThreshold = context.getResources().getDimensionPixelSize( R.dimen.swipe_helper_falsing_threshold); // Extra long-press! mLongPressTimeout = (long) (ViewConfiguration.getLongPressTimeout() * 1.5f); Resources res = context.getResources(); mDensityScale = res.getDisplayMetrics().density; mFalsingThreshold = res.getDimensionPixelSize(R.dimen.swipe_helper_falsing_threshold); mFadeDependingOnAmountSwiped = res.getBoolean(R.bool.config_fadeDependingOnAmountSwiped); mFalsingManager = FalsingManager.getInstance(context); mFlingAnimationUtils = new FlingAnimationUtils(context, getMaxEscapeAnimDuration() / 1000f); } Loading Loading @@ -173,8 +176,7 @@ public class SwipeHelper implements Gefingerpoken { } protected float getSize(View v) { return mSwipeDirection == X ? v.getMeasuredWidth() : v.getMeasuredHeight(); return mSwipeDirection == X ? v.getMeasuredWidth() : v.getMeasuredHeight(); } public void setMinSwipeProgress(float minSwipeProgress) { Loading @@ -192,6 +194,11 @@ public class SwipeHelper implements Gefingerpoken { } private float getSwipeAlpha(float progress) { if (mFadeDependingOnAmountSwiped) { // The more progress has been fade, the lower the alpha value so that the view fades. return Math.max(1 - progress, 0); } return Math.min(0, Math.max(1, progress / SWIPE_PROGRESS_FADE_END)); } Loading @@ -204,9 +211,8 @@ public class SwipeHelper implements Gefingerpoken { float swipeProgress = getSwipeProgressForOffset(animView, translation); if (!mCallback.updateSwipeProgress(animView, dismissable, swipeProgress)) { if (FADE_OUT_DURING_SWIPE && dismissable) { float alpha = swipeProgress; if (!mDisableHwLayers) { if (alpha != 0f && alpha != 1f) { if (swipeProgress != 0f && swipeProgress != 1f) { animView.setLayerType(View.LAYER_TYPE_HARDWARE, null); } else { animView.setLayerType(View.LAYER_TYPE_NONE, null); Loading
packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +38 −18 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.animation.ObjectAnimator; import android.animation.ValueAnimator.AnimatorUpdateListener; import android.annotation.Nullable; import android.content.Context; import android.content.res.Resources; import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.AnimationDrawable; import android.graphics.drawable.ColorDrawable; Loading Loading @@ -1143,9 +1144,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView mMaxHeadsUpHeight = getFontScaledHeight(R.dimen.notification_max_heads_up_height); mMaxHeadsUpHeightIncreased = getFontScaledHeight( R.dimen.notification_max_heads_up_height_increased); mIncreasedPaddingBetweenElements = getResources() .getDimensionPixelSize(R.dimen.notification_divider_height_increased); mIconTransformContentShiftNoIcon = getResources().getDimensionPixelSize( Resources res = getResources(); mIncreasedPaddingBetweenElements = res.getDimensionPixelSize( R.dimen.notification_divider_height_increased); mIconTransformContentShiftNoIcon = res.getDimensionPixelSize( R.dimen.notification_icon_transform_content_shift); } Loading Loading @@ -1199,12 +1201,16 @@ public class ExpandableNotificationRow extends ActivatableNotificationView mChildrenContainer.setIsLowPriority(mIsLowPriority); mChildrenContainer.setContainingNotification(ExpandableNotificationRow.this); mChildrenContainer.onNotificationUpdated(); if (mShouldTranslateContents) { mTranslateableViews.add(mChildrenContainer); } } }); if (mShouldTranslateContents) { // Add the views that we translate to reveal the menu mTranslateableViews = new ArrayList<View>(); mTranslateableViews = new ArrayList<>(); for (int i = 0; i < getChildCount(); i++) { mTranslateableViews.add(getChildAt(i)); } Loading @@ -1212,17 +1218,22 @@ public class ExpandableNotificationRow extends ActivatableNotificationView mTranslateableViews.remove(mChildrenContainerStub); mTranslateableViews.remove(mGutsStub); } } public void resetTranslation() { if (mTranslateAnim != null) { mTranslateAnim.cancel(); } if (mTranslateableViews != null) { if (!mShouldTranslateContents) { setTranslationX(0); } else if (mTranslateableViews != null) { for (int i = 0; i < mTranslateableViews.size(); i++) { mTranslateableViews.get(i).setTranslationX(0); } } invalidateOutline(); } mMenuRow.resetMenu(); } Loading @@ -1242,6 +1253,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView // Don't translate if guts are showing. return; } if (!mShouldTranslateContents) { setTranslationX(translationX); } else if (mTranslateableViews != null) { // Translate the group of views for (int i = 0; i < mTranslateableViews.size(); i++) { if (mTranslateableViews.get(i) != null) { Loading @@ -1249,6 +1263,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } } invalidateOutline(); } if (mMenuRow.getMenuView() != null) { mMenuRow.onTranslationUpdate(translationX); } Loading @@ -1256,10 +1271,15 @@ public class ExpandableNotificationRow extends ActivatableNotificationView @Override public float getTranslation() { if (mShouldTranslateContents) { return getTranslationX(); } if (mTranslateableViews != null && mTranslateableViews.size() > 0) { // All of the views in the list should have same translation, just use first one. return mTranslateableViews.get(0).getTranslationX(); } return 0; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java +13 −2 Original line number Diff line number Diff line Loading @@ -17,12 +17,14 @@ package com.android.systemui.statusbar; import android.content.Context; import android.content.res.Resources; import android.graphics.Outline; import android.graphics.Rect; import android.graphics.RectF; import android.util.AttributeSet; import android.view.View; import android.view.ViewOutlineProvider; import com.android.systemui.R; /** * Like {@link ExpandableView}, but setting an outline for the height and clipping. Loading @@ -33,10 +35,16 @@ public abstract class ExpandableOutlineView extends ExpandableView { private boolean mCustomOutline; private float mOutlineAlpha = -1f; ViewOutlineProvider mProvider = new ViewOutlineProvider() { /** * {@code true} if the children views of the {@link ExpandableOutlineView} are translated when * it is moved. Otherwise, the translation is set on the {@code ExpandableOutlineView} itself. */ protected boolean mShouldTranslateContents; private final ViewOutlineProvider mProvider = new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { int translation = (int) getTranslation(); int translation = mShouldTranslateContents ? 0 : (int) getTranslation(); if (!mCustomOutline) { outline.setRect(translation, mClipTopAmount, Loading @@ -52,6 +60,9 @@ public abstract class ExpandableOutlineView extends ExpandableView { public ExpandableOutlineView(Context context, AttributeSet attrs) { super(context, attrs); setOutlineProvider(mProvider); Resources res = getResources(); mShouldTranslateContents = res.getBoolean(R.bool.config_translateNotificationContentsOnSwipe); } @Override Loading