am a68da938: Merge "Fixed a bug with notification clipping" into lmp-mr1-dev
* commit 'a68da9382996132bb41d6f60b87a3bd5f8028b45': Fixed a bug with notification clipping
This commit is contained in:
@@ -23,9 +23,7 @@ import android.graphics.PorterDuff;
|
|||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.drawable.RippleDrawable;
|
import android.graphics.drawable.RippleDrawable;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import com.android.systemui.R;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A view that can be used for both the dimmed and normal background of an notification.
|
* A view that can be used for both the dimmed and normal background of an notification.
|
||||||
|
|||||||
@@ -200,15 +200,25 @@ public class StackScrollAlgorithm {
|
|||||||
// apply clipping and shadow
|
// apply clipping and shadow
|
||||||
float newNotificationEnd = newYTranslation + newHeight;
|
float newNotificationEnd = newYTranslation + newHeight;
|
||||||
|
|
||||||
// In the unlocked shade we have to clip a little bit higher because of the rounded
|
float clipHeight;
|
||||||
// corners of the notifications.
|
if (previousNotificationIsSwiped) {
|
||||||
float clippingCorrection = state.dimmed ? 0 : mRoundedRectCornerRadius * state.scale;
|
// When the previous notification is swiped, we don't clip the content to the
|
||||||
|
// bottom of it.
|
||||||
|
clipHeight = newHeight;
|
||||||
|
} else {
|
||||||
|
clipHeight = newNotificationEnd - previousNotificationEnd;
|
||||||
|
clipHeight = Math.max(0.0f, clipHeight);
|
||||||
|
if (clipHeight != 0.0f) {
|
||||||
|
|
||||||
// When the previous notification is swiped, we don't clip the content to the
|
// In the unlocked shade we have to clip a little bit higher because of the rounded
|
||||||
// bottom of it.
|
// corners of the notifications, but only if we are not fully overlapped by
|
||||||
float clipHeight = previousNotificationIsSwiped
|
// the top card.
|
||||||
? newHeight
|
float clippingCorrection = state.dimmed
|
||||||
: newNotificationEnd - (previousNotificationEnd - clippingCorrection);
|
? 0
|
||||||
|
: mRoundedRectCornerRadius * state.scale;
|
||||||
|
clipHeight += clippingCorrection;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
updateChildClippingAndBackground(state, newHeight, clipHeight,
|
updateChildClippingAndBackground(state, newHeight, clipHeight,
|
||||||
newHeight - (previousNotificationStart - newYTranslation));
|
newHeight - (previousNotificationStart - newYTranslation));
|
||||||
@@ -669,7 +679,11 @@ public class StackScrollAlgorithm {
|
|||||||
StackScrollState.ViewState childViewState = resultState.getViewStateForView(child);
|
StackScrollState.ViewState childViewState = resultState.getViewStateForView(child);
|
||||||
if (i < algorithmState.itemsInTopStack) {
|
if (i < algorithmState.itemsInTopStack) {
|
||||||
float stackIndex = algorithmState.itemsInTopStack - i;
|
float stackIndex = algorithmState.itemsInTopStack - i;
|
||||||
stackIndex = Math.min(stackIndex, MAX_ITEMS_IN_TOP_STACK + 2);
|
|
||||||
|
// Ensure that the topmost item is a little bit higher than the rest when fully
|
||||||
|
// scrolled, to avoid drawing errors when swiping it out
|
||||||
|
float max = MAX_ITEMS_IN_TOP_STACK + (i == 0 ? 2.5f : 2);
|
||||||
|
stackIndex = Math.min(stackIndex, max);
|
||||||
if (i == 0 && algorithmState.itemsInTopStack < 2.0f) {
|
if (i == 0 && algorithmState.itemsInTopStack < 2.0f) {
|
||||||
|
|
||||||
// We only have the top item and an additional item in the top stack,
|
// We only have the top item and an additional item in the top stack,
|
||||||
|
|||||||
@@ -119,9 +119,7 @@ public class StackScrollState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// apply alpha
|
// apply alpha
|
||||||
if (!becomesInvisible) {
|
child.setAlpha(newAlpha);
|
||||||
child.setAlpha(newAlpha);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply visibility
|
// apply visibility
|
||||||
|
|||||||
@@ -477,6 +477,7 @@ public class StackStateAnimator {
|
|||||||
if (newEndValue == 0 && !mWasCancelled) {
|
if (newEndValue == 0 && !mWasCancelled) {
|
||||||
child.setVisibility(View.INVISIBLE);
|
child.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
// remove the tag when the animation is finished
|
||||||
child.setTag(TAG_ANIMATOR_ALPHA, null);
|
child.setTag(TAG_ANIMATOR_ALPHA, null);
|
||||||
child.setTag(TAG_START_ALPHA, null);
|
child.setTag(TAG_START_ALPHA, null);
|
||||||
child.setTag(TAG_END_ALPHA, null);
|
child.setTag(TAG_END_ALPHA, null);
|
||||||
@@ -498,13 +499,7 @@ public class StackStateAnimator {
|
|||||||
animator.setStartDelay(delay);
|
animator.setStartDelay(delay);
|
||||||
}
|
}
|
||||||
animator.addListener(getGlobalAnimationFinishedListener());
|
animator.addListener(getGlobalAnimationFinishedListener());
|
||||||
// remove the tag when the animation is finished
|
|
||||||
animator.addListener(new AnimatorListenerAdapter() {
|
|
||||||
@Override
|
|
||||||
public void onAnimationEnd(Animator animation) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
startAnimator(animator);
|
startAnimator(animator);
|
||||||
child.setTag(TAG_ANIMATOR_ALPHA, animator);
|
child.setTag(TAG_ANIMATOR_ALPHA, animator);
|
||||||
child.setTag(TAG_START_ALPHA, child.getAlpha());
|
child.setTag(TAG_START_ALPHA, child.getAlpha());
|
||||||
|
|||||||
Reference in New Issue
Block a user