am 8ffdb68e: Merge "Flatten notification hiearchy and remove glow."

* commit '8ffdb68e112bf1f949eec56800275beceae7fadc':
  Flatten notification hiearchy and remove glow.
This commit is contained in:
Jorim Jaggi
2014-04-28 20:37:55 +00:00
committed by Android Git Automerger
16 changed files with 100 additions and 291 deletions

View File

@@ -19,34 +19,27 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:clickable="true"
android:background="@*android:drawable/notification_quantum_bg_dim"
>
<com.android.systemui.statusbar.LatestItemView
android:id="@+id/container"
<TextView
android:id="@+id/more_text"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="@dimen/notification_divider_height"
android:focusable="true"
android:clickable="true"
android:background="@*android:drawable/notification_quantum_bg_dim"
>
<TextView
android:id="@+id/more_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center_horizontal"
android:textColor="@color/keyguard_overflow_content_color"
android:textAllCaps="true"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<com.android.systemui.statusbar.NotificationOverflowIconsView
android:id="@+id/overflow_icons_view"
android:layout_gravity="end|center_vertical"
android:gravity="end"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:layout_width="120dp"
android:layout_height="wrap_content"
/>
</com.android.systemui.statusbar.LatestItemView>
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center_horizontal"
android:textColor="@color/keyguard_overflow_content_color"
android:textAllCaps="true"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<com.android.systemui.statusbar.NotificationOverflowIconsView
android:id="@+id/overflow_icons_view"
android:layout_gravity="end|center_vertical"
android:gravity="end"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:layout_width="120dp"
android:layout_height="wrap_content"
/>
</com.android.systemui.statusbar.NotificationOverflowContainer>

View File

@@ -2,17 +2,18 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:clickable="true"
android:background="@*android:drawable/notification_quantum_bg"
>
<View
android:id="@+id/top_glow"
android:alpha="0"
android:visibility="invisible"
<com.android.internal.widget.SizeAdaptiveLayout android:id="@+id/expanded"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<com.android.internal.widget.SizeAdaptiveLayout android:id="@+id/expandedPublic"
android:layout_width="match_parent"
android:layout_height="@dimen/notification_divider_height"
android:layout_gravity="top|center_horizontal"
android:background="@drawable/top_divider_glow"
/>
android:layout_height="wrap_content" />
<Button
android:id="@+id/veto"
@@ -25,35 +26,6 @@
android:paddingStart="8dp"
/>
<com.android.systemui.statusbar.LatestItemView android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/notification_divider_height"
android:layout_marginTop="@dimen/notification_divider_height"
android:focusable="true"
android:clickable="true"
android:background="@*android:drawable/notification_quantum_bg"
>
<com.android.internal.widget.SizeAdaptiveLayout android:id="@+id/expanded"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<com.android.internal.widget.SizeAdaptiveLayout android:id="@+id/expandedPublic"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.android.systemui.statusbar.LatestItemView>
<View
android:id="@+id/bottom_glow"
android:alpha="0"
android:visibility="invisible"
android:layout_width="match_parent"
android:layout_height="@dimen/notification_divider_height"
android:layout_gravity="bottom|center_horizontal"
android:background="@drawable/bottom_divider_glow"
/>
<TextView
android:id="@+id/debug_info"
android:visibility="invisible"

View File

@@ -82,12 +82,6 @@
<!-- Height of a medium notification in the status bar -->
<dimen name="notification_mid_height">128dp</dimen>
<!-- Height of a small notification in the status bar plus glow, padding, etc -->
<dimen name="notification_row_min_height">68dp</dimen>
<!-- Height of a large notification in the status bar plus glow, padding, etc -->
<dimen name="notification_row_max_height">260dp</dimen>
<!-- size at which Notification icons will be drawn in the status bar -->
<dimen name="status_bar_icon_drawing_size">18dip</dimen>
@@ -261,6 +255,9 @@
<!-- Z distance between notifications if they are in the stack -->
<dimen name="z_distance_between_notifications">2dp</dimen>
<!-- The padding between the individual notification cards. -->
<dimen name="notification_padding">3dp</dimen>
<!-- Width of the zen mode interstitial dialog. -->
<dimen name="zen_mode_dialog_width">320dp</dimen>

View File

@@ -19,7 +19,6 @@ package com.android.systemui;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.media.AudioManager;
@@ -81,8 +80,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
private boolean mHasPopped;
private View mEventSource;
private View mCurrView;
private View mCurrViewTopGlow;
private View mCurrViewBottomGlow;
private float mOldHeight;
private float mNaturalHeight;
private float mInitialTouchFocusY;
@@ -99,9 +96,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
private ScaleGestureDetector mSGD;
private ViewScaler mScaler;
private ObjectAnimator mScaleAnimation;
private AnimatorSet mGlowAnimationSet;
private ObjectAnimator mGlowTopAnimation;
private ObjectAnimator mGlowBottomAnimation;
private Vibrator mVibrator;
private int mSmallSize;
@@ -223,14 +217,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
}
};
mGlowTopAnimation = ObjectAnimator.ofFloat(null, "alpha", 0f);
mGlowTopAnimation.addListener(glowVisibilityController);
mGlowBottomAnimation = ObjectAnimator.ofFloat(null, "alpha", 0f);
mGlowBottomAnimation.addListener(glowVisibilityController);
mGlowAnimationSet = new AnimatorSet();
mGlowAnimationSet.play(mGlowTopAnimation).with(mGlowBottomAnimation);
mGlowAnimationSet.setDuration(GLOW_DURATION);
final ViewConfiguration configuration = ViewConfiguration.get(mContext);
mTouchSlop = configuration.getScaledTouchSlop();
@@ -251,7 +237,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
float newHeight = clamp(target);
mScaler.setHeight(newHeight);
setGlow(calculateGlow(target, newHeight));
mLastFocusY = mSGD.getFocusY();
mLastSpanY = mSGD.getCurrentSpan();
}
@@ -322,37 +307,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
return (GLOW_BASE + strength * (1f - GLOW_BASE));
}
public void setGlow(float glow) {
if (!mGlowAnimationSet.isRunning() || glow == 0f) {
if (mGlowAnimationSet.isRunning()) {
mGlowAnimationSet.end();
}
if (mCurrViewTopGlow != null && mCurrViewBottomGlow != null) {
if (glow == 0f || mCurrViewTopGlow.getAlpha() == 0f) {
// animate glow in and out
mGlowTopAnimation.setTarget(mCurrViewTopGlow);
mGlowBottomAnimation.setTarget(mCurrViewBottomGlow);
mGlowTopAnimation.setFloatValues(glow);
mGlowBottomAnimation.setFloatValues(glow);
mGlowAnimationSet.setupStartValues();
mGlowAnimationSet.start();
} else {
// set it explicitly in reponse to touches.
mCurrViewTopGlow.setAlpha(glow);
mCurrViewBottomGlow.setAlpha(glow);
handleGlowVisibility();
}
}
}
}
private void handleGlowVisibility() {
mCurrViewTopGlow.setVisibility(mCurrViewTopGlow.getAlpha() <= 0.0f ?
View.INVISIBLE : View.VISIBLE);
mCurrViewBottomGlow.setVisibility(mCurrViewBottomGlow.getAlpha() <= 0.0f ?
View.INVISIBLE : View.VISIBLE);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
final int action = ev.getAction();
@@ -466,9 +420,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
if (mHasPopped) {
mScaler.setHeight(newHeight);
setGlow(GLOW_BASE);
} else {
setGlow(calculateGlow(4f * pull, 0f));
}
final int x = (int) mSGD.getFocusX();
@@ -517,7 +468,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
if (DEBUG) Log.d(TAG, "scale type " + expandType + " beginning on view: " + v);
mCallback.setUserLockedChild(v, true);
setView(v);
setGlow(GLOW_BASE);
mScaler.setView(v);
mOldHeight = mScaler.getHeight();
if (mCallback.canChildBeExpanded(v)) {
@@ -549,7 +499,6 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
if (mScaleAnimation.isRunning()) {
mScaleAnimation.cancel();
}
setGlow(0f);
mCallback.setUserExpandedChild(mCurrView, h == mNaturalHeight);
if (targetHeight != currentHeight) {
mScaleAnimation.setFloatValues(targetHeight);
@@ -571,23 +520,11 @@ public class ExpandHelper implements Gefingerpoken, OnClickListener {
private void clearView() {
mCurrView = null;
mCurrViewTopGlow = null;
mCurrViewBottomGlow = null;
}
private void setView(View v) {
mCurrView = v;
if (v instanceof ViewGroup) {
ViewGroup g = (ViewGroup) v;
mCurrViewTopGlow = g.findViewById(R.id.top_glow);
mCurrViewBottomGlow = g.findViewById(R.id.bottom_glow);
if (DEBUG) {
String debugLog = "Looking for glows: " +
(mCurrViewTopGlow != null ? "found top " : "didn't find top") +
(mCurrViewBottomGlow != null ? "found bottom " : "didn't find bottom");
Log.v(TAG, debugLog);
}
}
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2008 The Android Open Source Project
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -11,7 +11,7 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License
*/
package com.android.systemui.statusbar;
@@ -21,12 +21,15 @@ import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.accessibility.AccessibilityEvent;
import android.widget.FrameLayout;
import com.android.internal.R;
public class LatestItemView extends FrameLayout {
/**
* Base class for both {@link ExpandableNotificationRow} and {@link NotificationOverflowContainer}
* to implement dimming/activating on Keyguard for the double-tap gesture
*/
public class ActivatableNotificationView extends FrameLayout {
private static final long DOUBLETAP_TIMEOUT_MS = 1000;
@@ -48,11 +51,12 @@ public class LatestItemView extends FrameLayout {
private OnActivatedListener mOnActivatedListener;
public LatestItemView(Context context, AttributeSet attrs) {
public ActivatableNotificationView(Context context, AttributeSet attrs) {
super(context, attrs);
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
}
private final Runnable mTapTimeoutRunnable = new Runnable() {
@Override
public void run() {
@@ -65,20 +69,6 @@ public class LatestItemView extends FrameLayout {
super.setOnClickListener(l);
}
@Override
public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) {
if (super.onRequestSendAccessibilityEvent(child, event)) {
// Add a record for the entire layout since its content is somehow small.
// The event comes from a leaf view that is interacted with.
AccessibilityEvent record = AccessibilityEvent.obtain();
onInitializeAccessibilityEvent(record);
dispatchPopulateAccessibilityEvent(record);
event.appendRecord(record);
return true;
}
return false;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (mLocked) {

View File

@@ -83,7 +83,7 @@ import java.util.ArrayList;
import java.util.Locale;
public abstract class BaseStatusBar extends SystemUI implements
CommandQueue.Callbacks, LatestItemView.OnActivatedListener {
CommandQueue.Callbacks, ActivatableNotificationView.OnActivatedListener {
public static final String TAG = "StatusBar";
public static final boolean DEBUG = false;
public static final boolean MULTIUSER_DEBUG = false;
@@ -760,20 +760,19 @@ public abstract class BaseStatusBar extends SystemUI implements
// NB: the large icon is now handled entirely by the template
// bind the click event to the content area
ViewGroup content = (ViewGroup)row.findViewById(R.id.container);
SizeAdaptiveLayout expanded = (SizeAdaptiveLayout)row.findViewById(R.id.expanded);
SizeAdaptiveLayout expandedPublic
= (SizeAdaptiveLayout)row.findViewById(R.id.expandedPublic);
content.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
row.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
PendingIntent contentIntent = sbn.getNotification().contentIntent;
if (contentIntent != null) {
final View.OnClickListener listener = makeClicker(contentIntent,
sbn.getPackageName(), sbn.getTag(), sbn.getId(), isHeadsUp, sbn.getUserId());
content.setOnClickListener(listener);
row.setOnClickListener(listener);
} else {
content.setOnClickListener(null);
row.setOnClickListener(null);
}
// set up the adaptive layout
@@ -883,7 +882,6 @@ public abstract class BaseStatusBar extends SystemUI implements
entry.row = row;
entry.row.setHeightRange(mRowMinHeight, mRowMaxHeight);
entry.row.setOnActivatedListener(this);
entry.content = content;
entry.expanded = contentViewLocal;
entry.expandedPublic = publicViewLocal;
entry.setBigContentView(bigContentViewLocal);
@@ -1350,9 +1348,9 @@ public abstract class BaseStatusBar extends SystemUI implements
final View.OnClickListener listener = makeClicker(contentIntent,
notification.getPackageName(), notification.getTag(), notification.getId(),
isHeadsUp, notification.getUserId());
entry.content.setOnClickListener(listener);
entry.row.setOnClickListener(listener);
} else {
entry.content.setOnClickListener(null);
entry.row.setOnClickListener(null);
}
}

View File

@@ -20,13 +20,12 @@ import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.view.accessibility.AccessibilityEvent;
import com.android.internal.widget.SizeAdaptiveLayout;
import com.android.systemui.R;
public class ExpandableNotificationRow extends FrameLayout
implements LatestItemView.OnActivatedListener {
public class ExpandableNotificationRow extends ActivatableNotificationView {
private int mRowMinHeight;
private int mRowMaxHeight;
@@ -41,8 +40,6 @@ public class ExpandableNotificationRow extends FrameLayout
/** Are we showing the "public" version */
private boolean mShowingPublic;
private LatestItemView mLatestItemView;
/**
* Is this notification expanded by the system. The expansion state can be overridden by the
* user expansion.
@@ -53,7 +50,6 @@ public class ExpandableNotificationRow extends FrameLayout
private int mMaxExpandHeight;
private boolean mMaxHeightNeedsUpdate;
private NotificationActivator mActivator;
private LatestItemView.OnActivatedListener mOnActivatedListener;
private boolean mSelfInitiatedLayout;
public ExpandableNotificationRow(Context context, AttributeSet attrs) {
@@ -65,10 +61,22 @@ public class ExpandableNotificationRow extends FrameLayout
super.onFinishInflate();
mPublicLayout = (SizeAdaptiveLayout) findViewById(R.id.expandedPublic);
mPrivateLayout = (SizeAdaptiveLayout) findViewById(R.id.expanded);
mLatestItemView = (LatestItemView) findViewById(R.id.container);
mActivator = new NotificationActivator(this);
mLatestItemView.setOnActivatedListener(this);
}
@Override
public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) {
if (super.onRequestSendAccessibilityEvent(child, event)) {
// Add a record for the entire layout since its content is somehow small.
// The event comes from a leaf view that is interacted with.
AccessibilityEvent record = AccessibilityEvent.obtain();
onInitializeAccessibilityEvent(record);
dispatchPopulateAccessibilityEvent(record);
event.appendRecord(record);
return true;
}
return false;
}
public void setHeightRange(int rowMinHeight, int rowMaxHeight) {
@@ -220,7 +228,7 @@ public class ExpandableNotificationRow extends FrameLayout
* Sets the notification as dimmed, meaning that it will appear in a more gray variant.
*/
public void setDimmed(boolean dimmed) {
mLatestItemView.setDimmed(dimmed);
super.setDimmed(dimmed);
mActivator.setDimmed(dimmed);
}
@@ -232,46 +240,10 @@ public class ExpandableNotificationRow extends FrameLayout
return mMaxExpandHeight;
}
/**
* Sets the notification as locked. In the locked state, the first tap will produce a quantum
* ripple to make the notification brighter and only the second tap will cause a click.
*/
public void setLocked(boolean locked) {
mLatestItemView.setLocked(locked);
}
public void setOnActivatedListener(LatestItemView.OnActivatedListener listener) {
mOnActivatedListener = listener;
}
public NotificationActivator getActivator() {
return mActivator;
}
@Override
public void onActivated(View view) {
if (mOnActivatedListener != null) {
mOnActivatedListener.onActivated(this);
}
}
@Override
public void onReset(View view) {
if (mOnActivatedListener != null) {
mOnActivatedListener.onReset(this);
}
}
/**
* Sets the resource id for the background of this notification.
*
* @param bgResId The background resource to use in normal state.
* @param dimmedBgResId The background resource to use in dimmed state.
*/
public void setBackgroundResourceIds(int bgResId, int dimmedBgResId) {
mLatestItemView.setBackgroundResourceIds(bgResId, dimmedBgResId);
}
/**
* @return the potential height this view could expand in addition.
*/

View File

@@ -107,7 +107,7 @@ public class InterceptedNotifications {
mBar.updateNotification(mSynKey, sbn);
}
final NotificationData.Entry entry = mBar.mNotificationData.findByKey(mSynKey);
entry.content.setOnClickListener(mSynClickListener);
entry.row.setOnClickListener(mSynClickListener);
}
private final View.OnClickListener mSynClickListener = new View.OnClickListener() {

View File

@@ -33,7 +33,6 @@ public class NotificationData {
public StatusBarNotification notification;
public StatusBarIconView icon;
public ExpandableNotificationRow row; // the outer expanded view
public View content; // takes the click events and sends the PendingIntent
public View expanded; // the inflated RemoteViews
public View expandedPublic; // for insecure lockscreens
public ImageView largeIcon;

View File

@@ -18,8 +18,6 @@ package com.android.systemui.statusbar;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;
import com.android.systemui.R;
@@ -27,65 +25,30 @@ import com.android.systemui.R;
/**
* Container view for overflowing notification icons on Keyguard.
*/
public class NotificationOverflowContainer extends FrameLayout
implements LatestItemView.OnActivatedListener {
public class NotificationOverflowContainer extends ActivatableNotificationView {
private NotificationOverflowIconsView mIconsView;
private LatestItemView.OnActivatedListener mOnActivatedListener;
private NotificationActivator mActivator;
public NotificationOverflowContainer(Context context) {
super(context);
}
public NotificationOverflowContainer(Context context, AttributeSet attrs) {
super(context, attrs);
}
public NotificationOverflowContainer(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public NotificationOverflowContainer(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mIconsView = (NotificationOverflowIconsView) findViewById(R.id.overflow_icons_view);
mIconsView.setMoreText((TextView) findViewById(R.id.more_text));
LatestItemView latestItemView = (LatestItemView) findViewById(R.id.container);
mActivator = new NotificationActivator(this);
mActivator.setDimmed(true);
latestItemView.setOnActivatedListener(this);
latestItemView.setLocked(true);
setLocked(true);
}
public NotificationOverflowIconsView getIconsView() {
return mIconsView;
}
public void setOnActivatedListener(LatestItemView.OnActivatedListener onActivatedListener) {
mOnActivatedListener = onActivatedListener;
}
@Override
public void onActivated(View view) {
if (mOnActivatedListener != null) {
mOnActivatedListener.onActivated(this);
}
}
@Override
public void onReset(View view) {
if (mOnActivatedListener != null) {
mOnActivatedListener.onReset(this);
}
}
public NotificationActivator getActivator() {
return mActivator;
}

View File

@@ -2718,8 +2718,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
}
mHeadsUpNotificationDecay = res.getInteger(R.integer.heads_up_notification_decay);
mRowMinHeight = res.getDimensionPixelSize(R.dimen.notification_row_min_height);
mRowMaxHeight = res.getDimensionPixelSize(R.dimen.notification_row_max_height);
mRowMinHeight = res.getDimensionPixelSize(R.dimen.notification_min_height);
mRowMaxHeight = res.getDimensionPixelSize(R.dimen.notification_max_height);
mKeyguardMaxNotificationCount = res.getInteger(R.integer.keyguard_max_notification_count);

View File

@@ -69,8 +69,8 @@ public class StatusBarWindowView extends FrameLayout
mStackScrollLayout = (NotificationStackScrollLayout) findViewById(
R.id.notification_stack_scroller);
mNotificationPanel = (NotificationPanelView) findViewById(R.id.notification_panel);
int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_min_height);
int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_max_height);
int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_min_height);
int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_max_height);
mExpandHelper = new ExpandHelper(getContext(), mStackScrollLayout,
minHeight, maxHeight);
mExpandHelper.setEventSource(this);

View File

@@ -135,8 +135,8 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, densityScale, pagingTouchSlop);
mEdgeSwipeHelper = new EdgeSwipeHelper(touchSlop);
int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_min_height);
int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_max_height);
int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_min_height);
int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_max_height);
mExpandHelper = new ExpandHelper(getContext(), this, minHeight, maxHeight);
mContentHolder = (ViewGroup) findViewById(R.id.content_holder);

View File

@@ -145,13 +145,13 @@ public class NotificationStackScrollLayout extends ViewGroup
mSidePaddings = context.getResources()
.getDimensionPixelSize(R.dimen.notification_side_padding);
mCollapsedSize = context.getResources()
.getDimensionPixelSize(R.dimen.notification_row_min_height);
.getDimensionPixelSize(R.dimen.notification_min_height);
mBottomStackPeekSize = context.getResources()
.getDimensionPixelSize(R.dimen.bottom_stack_peek_amount);
mEmptyMarginBottom = context.getResources().getDimensionPixelSize(
R.dimen.notification_stack_margin_bottom);
// currently the padding is in the elements themself
mPaddingBetweenElements = 0;
mPaddingBetweenElements = context.getResources()
.getDimensionPixelSize(R.dimen.notification_padding);
mStackScrollAlgorithm = new StackScrollAlgorithm(context);
}

View File

@@ -62,11 +62,10 @@ public class StackScrollAlgorithm {
}
private void initConstants(Context context) {
// currently the padding is in the elements themself
mPaddingBetweenElements = 0;
mPaddingBetweenElements = context.getResources()
.getDimensionPixelSize(R.dimen.notification_padding);
mCollapsedSize = context.getResources()
.getDimensionPixelSize(R.dimen.notification_row_min_height);
.getDimensionPixelSize(R.dimen.notification_min_height);
mTopStackPeekSize = context.getResources()
.getDimensionPixelSize(R.dimen.top_stack_peek_amount);
mBottomStackPeekSize = context.getResources()
@@ -323,7 +322,8 @@ public class StackScrollAlgorithm {
// the offset starting at the transitionPosition of the bottom stack
float offset = mBottomStackIndentationFunctor.getValue(algorithmState.partialInBottom);
algorithmState.itemsInBottomStack += algorithmState.partialInBottom;
childViewState.yTranslation = transitioningPositionStart + offset - childHeight;
childViewState.yTranslation = transitioningPositionStart + offset - childHeight
- mPaddingBetweenElements;
// We want at least to be at the end of the top stack when collapsing
clampPositionToTopStackEnd(childViewState, childHeight);
@@ -339,7 +339,8 @@ public class StackScrollAlgorithm {
if (algorithmState.itemsInBottomStack < MAX_ITEMS_IN_BOTTOM_STACK) {
// We are visually entering the bottom stack
currentYPosition = transitioningPositionStart
+ mBottomStackIndentationFunctor.getValue(algorithmState.itemsInBottomStack);
+ mBottomStackIndentationFunctor.getValue(algorithmState.itemsInBottomStack)
- mPaddingBetweenElements;
childViewState.location = StackScrollState.ViewState.LOCATION_BOTTOM_STACK_PEEKING;
} else {
// we are fully inside the stack

View File

@@ -197,18 +197,12 @@ public class StackScrollState {
* @param clipHeight the desired clip height, the rest of the view will be clipped from the top
*/
private void updateChildClip(View child, int height, float clipHeight) {
// The children currently have paddings inside themselfs because of the expansion
// visualization. In order for the clipping to work correctly we have to set the correct
// clip rect on the child.
View container = child.findViewById(R.id.container);
if (container != null) {
int clipInset = (int) (height - clipHeight);
mClipRect.set(0,
clipInset,
child.getWidth(),
height);
child.setClipBounds(mClipRect);
}
int clipInset = (int) (height - clipHeight);
mClipRect.set(0,
clipInset,
child.getWidth(),
height);
child.setClipBounds(mClipRect);
}
/**
@@ -218,22 +212,15 @@ public class StackScrollState {
* @param height the currently applied height of the view
* @param outlineHeight the desired height of the outline, the outline ends on the bottom
*/
private void updateChildOutline(View child,
int height,
float outlineHeight) {
// The children currently have paddings inside themselfs because of the expansion
// visualization. In order for the shadows to work correctly we have to set the correct
// outline on the child.
View container = child.findViewById(R.id.container);
if (container != null) {
int shadowInset = (int) (height - outlineHeight);
getOutlineForSize(container.getLeft(),
container.getTop() + shadowInset,
container.getWidth(),
container.getHeight() - shadowInset,
mChildOutline);
child.setOutline(mChildOutline);
}
private void updateChildOutline(View child, int height,
float outlineHeight) {
int shadowInset = (int) (height - outlineHeight);
getOutlineForSize(child.getLeft(),
child.getTop() + shadowInset,
child.getWidth(),
child.getHeight() - shadowInset,
mChildOutline);
child.setOutline(mChildOutline);
}
private void getOutlineForSize(int leftInset, int topInset, int width, int height,