Merge "Add flags to enable Notifications clipping." into tm-qpr-dev
This commit is contained in:
@@ -25,6 +25,9 @@
|
|||||||
<!-- Whether to enable clipping on Quick Settings -->
|
<!-- Whether to enable clipping on Quick Settings -->
|
||||||
<bool name="qs_enable_clipping">true</bool>
|
<bool name="qs_enable_clipping">true</bool>
|
||||||
|
|
||||||
|
<!-- Whether to enable clipping on Notification Views -->
|
||||||
|
<bool name="notification_enable_clipping">true</bool>
|
||||||
|
|
||||||
<!-- Whether to enable transparent background for notification scrims -->
|
<!-- Whether to enable transparent background for notification scrims -->
|
||||||
<bool name="notification_scrim_transparent">false</bool>
|
<bool name="notification_scrim_transparent">false</bool>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
|
|||||||
private int[] mTmp = new int[2];
|
private int[] mTmp = new int[2];
|
||||||
private boolean mHideBackground;
|
private boolean mHideBackground;
|
||||||
private int mStatusBarHeight;
|
private int mStatusBarHeight;
|
||||||
|
private boolean mEnableNotificationClipping;
|
||||||
private AmbientState mAmbientState;
|
private AmbientState mAmbientState;
|
||||||
private NotificationStackScrollLayoutController mHostLayoutController;
|
private NotificationStackScrollLayoutController mHostLayoutController;
|
||||||
private int mPaddingBetweenElements;
|
private int mPaddingBetweenElements;
|
||||||
@@ -117,7 +118,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
|
|||||||
// Setting this to first in section to get the clipping to the top roundness correct. This
|
// Setting this to first in section to get the clipping to the top roundness correct. This
|
||||||
// value determines the way we are clipping to the top roundness of the overall shade
|
// value determines the way we are clipping to the top roundness of the overall shade
|
||||||
setFirstInSection(true);
|
setFirstInSection(true);
|
||||||
initDimens();
|
updateResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bind(AmbientState ambientState,
|
public void bind(AmbientState ambientState,
|
||||||
@@ -126,7 +127,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
|
|||||||
mHostLayoutController = hostLayoutController;
|
mHostLayoutController = hostLayoutController;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initDimens() {
|
private void updateResources() {
|
||||||
Resources res = getResources();
|
Resources res = getResources();
|
||||||
mStatusBarHeight = SystemBarUtils.getStatusBarHeight(mContext);
|
mStatusBarHeight = SystemBarUtils.getStatusBarHeight(mContext);
|
||||||
mPaddingBetweenElements = res.getDimensionPixelSize(R.dimen.notification_divider_height);
|
mPaddingBetweenElements = res.getDimensionPixelSize(R.dimen.notification_divider_height);
|
||||||
@@ -144,6 +145,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
|
|||||||
mShowNotificationShelf = res.getBoolean(R.bool.config_showNotificationShelf);
|
mShowNotificationShelf = res.getBoolean(R.bool.config_showNotificationShelf);
|
||||||
mCornerAnimationDistance = res.getDimensionPixelSize(
|
mCornerAnimationDistance = res.getDimensionPixelSize(
|
||||||
R.dimen.notification_corner_animation_distance);
|
R.dimen.notification_corner_animation_distance);
|
||||||
|
mEnableNotificationClipping = res.getBoolean(R.bool.notification_enable_clipping);
|
||||||
|
|
||||||
mShelfIcons.setInNotificationIconShelf(true);
|
mShelfIcons.setInNotificationIconShelf(true);
|
||||||
if (!mShowNotificationShelf) {
|
if (!mShowNotificationShelf) {
|
||||||
@@ -154,7 +156,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
|
|||||||
@Override
|
@Override
|
||||||
protected void onConfigurationChanged(Configuration newConfig) {
|
protected void onConfigurationChanged(Configuration newConfig) {
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
initDimens();
|
updateResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -639,7 +641,8 @@ public class NotificationShelf extends ActivatableNotificationView implements
|
|||||||
}
|
}
|
||||||
if (!isPinned) {
|
if (!isPinned) {
|
||||||
if (viewEnd > notificationClipEnd && !shouldClipOwnTop) {
|
if (viewEnd > notificationClipEnd && !shouldClipOwnTop) {
|
||||||
int clipBottomAmount = (int) (viewEnd - notificationClipEnd);
|
int clipBottomAmount =
|
||||||
|
mEnableNotificationClipping ? (int) (viewEnd - notificationClipEnd) : 0;
|
||||||
view.setClipBottomAmount(clipBottomAmount);
|
view.setClipBottomAmount(clipBottomAmount);
|
||||||
} else {
|
} else {
|
||||||
view.setClipBottomAmount(0);
|
view.setClipBottomAmount(0);
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ public class StackScrollAlgorithm {
|
|||||||
private float mGapHeight;
|
private float mGapHeight;
|
||||||
private float mGapHeightOnLockscreen;
|
private float mGapHeightOnLockscreen;
|
||||||
private int mCollapsedSize;
|
private int mCollapsedSize;
|
||||||
|
private boolean mEnableNotificationClipping;
|
||||||
|
|
||||||
private StackScrollAlgorithmState mTempAlgorithmState = new StackScrollAlgorithmState();
|
private StackScrollAlgorithmState mTempAlgorithmState = new StackScrollAlgorithmState();
|
||||||
private boolean mIsExpanded;
|
private boolean mIsExpanded;
|
||||||
@@ -85,6 +86,7 @@ public class StackScrollAlgorithm {
|
|||||||
mPaddingBetweenElements = res.getDimensionPixelSize(
|
mPaddingBetweenElements = res.getDimensionPixelSize(
|
||||||
R.dimen.notification_divider_height);
|
R.dimen.notification_divider_height);
|
||||||
mCollapsedSize = res.getDimensionPixelSize(R.dimen.notification_min_height);
|
mCollapsedSize = res.getDimensionPixelSize(R.dimen.notification_min_height);
|
||||||
|
mEnableNotificationClipping = res.getBoolean(R.bool.notification_enable_clipping);
|
||||||
mClipNotificationScrollToTop = res.getBoolean(R.bool.config_clipNotificationScrollToTop);
|
mClipNotificationScrollToTop = res.getBoolean(R.bool.config_clipNotificationScrollToTop);
|
||||||
int statusBarHeight = SystemBarUtils.getStatusBarHeight(context);
|
int statusBarHeight = SystemBarUtils.getStatusBarHeight(context);
|
||||||
mHeadsUpInset = statusBarHeight + res.getDimensionPixelSize(
|
mHeadsUpInset = statusBarHeight + res.getDimensionPixelSize(
|
||||||
@@ -289,7 +291,7 @@ public class StackScrollAlgorithm {
|
|||||||
// The bottom of this view is peeking out from under the previous view.
|
// The bottom of this view is peeking out from under the previous view.
|
||||||
// Clip the part that is peeking out.
|
// Clip the part that is peeking out.
|
||||||
float overlapAmount = newNotificationEnd - firstHeadsUpEnd;
|
float overlapAmount = newNotificationEnd - firstHeadsUpEnd;
|
||||||
state.clipBottomAmount = (int) overlapAmount;
|
state.clipBottomAmount = mEnableNotificationClipping ? (int) overlapAmount : 0;
|
||||||
} else {
|
} else {
|
||||||
state.clipBottomAmount = 0;
|
state.clipBottomAmount = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user