Merge changes I70f79400,I2f8cab37 into oc-dev

* changes:
  AOD: Adjust header to spec
  AOD: Only show actually pulsing entries
This commit is contained in:
Adrian Roos
2017-04-05 17:47:29 +00:00
committed by Android (Google) Code Review
8 changed files with 81 additions and 27 deletions

View File

@@ -17,27 +17,24 @@
<NotificationHeaderView <NotificationHeaderView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:theme="@style/Theme.Material.Notification"
android:id="@+id/notification_header" android:id="@+id/notification_header"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/notification_header_height" android:layout_height="@dimen/notification_header_height"
android:clipChildren="false" android:clipChildren="false"
android:paddingTop="@dimen/notification_header_padding_top" style="?attr/notificationHeaderStyle">
android:paddingBottom="@dimen/notification_header_padding_bottom"
android:layout_marginBottom="5dp"
android:paddingStart="@dimen/notification_content_margin_start"
android:paddingEnd="16dp">
<com.android.internal.widget.CachingIconView <com.android.internal.widget.CachingIconView
android:id="@+id/icon" android:id="@+id/icon"
android:layout_width="@dimen/notification_header_icon_size" android:layout_width="?attr/notificationHeaderIconSize"
android:layout_height="@dimen/notification_header_icon_size" android:layout_height="?attr/notificationHeaderIconSize"
android:layout_marginEnd="3dp" android:layout_marginEnd="3dp"
/> />
<TextView <TextView
android:id="@+id/app_name_text" android:id="@+id/app_name_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Material.Notification.Info" android:textAppearance="?attr/notificationHeaderTextAppearance"
android:layout_marginStart="3dp" android:layout_marginStart="3dp"
android:layout_marginEnd="2dp" android:layout_marginEnd="2dp"
android:singleLine="true" android:singleLine="true"
@@ -46,7 +43,7 @@
android:id="@+id/header_text_divider" android:id="@+id/header_text_divider"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Material.Notification.Info" android:textAppearance="?attr/notificationHeaderTextAppearance"
android:layout_marginStart="2dp" android:layout_marginStart="2dp"
android:layout_marginEnd="2dp" android:layout_marginEnd="2dp"
android:text="@string/notification_header_divider_symbol" android:text="@string/notification_header_divider_symbol"
@@ -55,7 +52,7 @@
android:id="@+id/header_text" android:id="@+id/header_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Material.Notification.Info" android:textAppearance="?attr/notificationHeaderTextAppearance"
android:layout_marginStart="2dp" android:layout_marginStart="2dp"
android:layout_marginEnd="2dp" android:layout_marginEnd="2dp"
android:visibility="gone" android:visibility="gone"
@@ -64,7 +61,7 @@
android:id="@+id/time_divider" android:id="@+id/time_divider"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Material.Notification.Info" android:textAppearance="?attr/notificationHeaderTextAppearance"
android:layout_marginStart="2dp" android:layout_marginStart="2dp"
android:layout_marginEnd="2dp" android:layout_marginEnd="2dp"
android:text="@string/notification_header_divider_symbol" android:text="@string/notification_header_divider_symbol"

View File

@@ -23,7 +23,8 @@
android:paddingStart="@dimen/notification_extra_margin_ambient" android:paddingStart="@dimen/notification_extra_margin_ambient"
android:paddingEnd="@dimen/notification_extra_margin_ambient" android:paddingEnd="@dimen/notification_extra_margin_ambient"
> >
<include layout="@layout/notification_template_header" /> <include layout="@layout/notification_template_header"
android:theme="@style/Theme.Material.Notification.Ambient" />
<LinearLayout <LinearLayout
android:id="@+id/notification_action_list_margin_target" android:id="@+id/notification_action_list_margin_target"

View File

@@ -8635,5 +8635,12 @@
<attr name="stackFromEnd" format="boolean" /> <attr name="stackFromEnd" format="boolean" />
</declare-styleable> </declare-styleable>
<!-- @hide -->
<declare-styleable name="NotificationTheme">
<attr name="notificationHeaderStyle" format="reference" />
<attr name="notificationHeaderTextAppearance" format="reference" />
<attr name="notificationHeaderIconSize" format="dimension" />
</declare-styleable>
<attr name="lockPatternStyle" format="reference" /> <attr name="lockPatternStyle" format="reference" />
</resources> </resources>

View File

@@ -191,6 +191,9 @@
<!-- size (width and height) of the icon in the notification header --> <!-- size (width and height) of the icon in the notification header -->
<dimen name="notification_header_icon_size">18dp</dimen> <dimen name="notification_header_icon_size">18dp</dimen>
<!-- size (width and height) of the icon in the notification header -->
<dimen name="notification_header_icon_size_ambient">20dp</dimen>
<!-- Height of a small notification in the status bar --> <!-- Height of a small notification in the status bar -->
<dimen name="notification_min_height">92dp</dimen> <dimen name="notification_min_height">92dp</dimen>

View File

@@ -488,6 +488,10 @@ please see styles_device_defaults.xml.
<style name="TextAppearance.Material.Notification.Time" parent="TextAppearance.Material.Notification.Info" /> <style name="TextAppearance.Material.Notification.Time" parent="TextAppearance.Material.Notification.Info" />
<style name="TextAppearance.Material.Notification.Info.Ambient">
<item name="textSize">@dimen/notification_text_size</item>
</style>
<style name="TextAppearance.Material.Notification.Emphasis"> <style name="TextAppearance.Material.Notification.Emphasis">
<item name="textColor">#66000000</item> <item name="textColor">#66000000</item>
</style> </style>
@@ -1283,4 +1287,12 @@ please see styles_device_defaults.xml.
<style name="DialogWindowTitle.Material.Light" /> <style name="DialogWindowTitle.Material.Light" />
<style name="Notification.Header" parent="">
<item name="paddingTop">@dimen/notification_header_padding_top</item>
<item name="paddingBottom">@dimen/notification_header_padding_bottom</item>
<item name="layout_marginBottom">5dp</item>
<item name="paddingStart">@dimen/notification_content_margin_start</item>
<item name="paddingEnd">16dp</item>
</style>
</resources> </resources>

View File

@@ -1321,6 +1321,19 @@ please see themes_device_defaults.xml.
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
</style> </style>
<!-- Theme for inflating notifications -->
<style name="Theme.Material.Notification" parent="">
<item name="notificationHeaderStyle">@style/Notification.Header</item>
<item name="notificationHeaderTextAppearance">@style/TextAppearance.Material.Notification.Info</item>
<item name="notificationHeaderIconSize">@dimen/notification_header_icon_size</item>
</style>
<!-- Theme for inflating ambient notification -->
<style name="Theme.Material.Notification.Ambient">
<item name="notificationHeaderTextAppearance">@style/TextAppearance.Material.Notification.Info.Ambient</item>
<item name="notificationHeaderIconSize">@dimen/notification_header_icon_size_ambient</item>
</style>
<!-- Default theme for Settings and activities launched from Settings. --> <!-- Default theme for Settings and activities launched from Settings. -->
<style name="Theme.Material.Settings" parent="Theme.Material.Light.LightStatusBar"> <style name="Theme.Material.Settings" parent="Theme.Material.Light.LightStatusBar">
<item name="colorPrimary">@color/primary_material_settings_light</item> <item name="colorPrimary">@color/primary_material_settings_light</item>

View File

@@ -5010,23 +5010,25 @@ public class StatusBar extends SystemUI implements DemoMode,
@Override @Override
public void onPulseStarted() { public void onPulseStarted() {
callback.onPulseStarted(); callback.onPulseStarted();
if (!mHeadsUpManager.getAllEntries().isEmpty()) { Collection<HeadsUpManager.HeadsUpEntry> pulsingEntries =
mHeadsUpManager.getAllEntries();
if (!pulsingEntries.isEmpty()) {
// Only pulse the stack scroller if there's actually something to show. // Only pulse the stack scroller if there's actually something to show.
// Otherwise just show the always-on screen. // Otherwise just show the always-on screen.
setPulsing(true); setPulsing(pulsingEntries);
} }
} }
@Override @Override
public void onPulseFinished() { public void onPulseFinished() {
callback.onPulseFinished(); callback.onPulseFinished();
setPulsing(false); setPulsing(null);
} }
private void setPulsing(boolean pulsing) { private void setPulsing(Collection<HeadsUpManager.HeadsUpEntry> pulsing) {
mStackScroller.setPulsing(pulsing); mStackScroller.setPulsing(pulsing);
mNotificationPanel.setPulsing(pulsing); mNotificationPanel.setPulsing(pulsing != null);
mVisualStabilityManager.setPulsing(pulsing); mVisualStabilityManager.setPulsing(pulsing != null);
} }
}, reason); }, reason);
} }

View File

@@ -72,6 +72,7 @@ import com.android.systemui.statusbar.DismissView;
import com.android.systemui.statusbar.EmptyShadeView; import com.android.systemui.statusbar.EmptyShadeView;
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.NotificationData;
import com.android.systemui.statusbar.NotificationGuts; import com.android.systemui.statusbar.NotificationGuts;
import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.NotificationShelf;
import com.android.systemui.statusbar.StackScrollerDecorView; import com.android.systemui.statusbar.StackScrollerDecorView;
@@ -86,6 +87,7 @@ import com.android.systemui.statusbar.policy.HeadsUpManager;
import com.android.systemui.statusbar.policy.ScrollAdapter; import com.android.systemui.statusbar.policy.ScrollAdapter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashSet; import java.util.HashSet;
@@ -331,7 +333,7 @@ public class NotificationStackScrollLayout extends ViewGroup
} }
}; };
private PorterDuffXfermode mSrcMode = new PorterDuffXfermode(PorterDuff.Mode.SRC); private PorterDuffXfermode mSrcMode = new PorterDuffXfermode(PorterDuff.Mode.SRC);
private boolean mPulsing; private Collection<HeadsUpManager.HeadsUpEntry> mPulsing;
private boolean mDrawBackgroundAsSrc; private boolean mDrawBackgroundAsSrc;
private boolean mFadingOut; private boolean mFadingOut;
private boolean mParentNotFullyVisible; private boolean mParentNotFullyVisible;
@@ -1917,15 +1919,19 @@ public class NotificationStackScrollLayout extends ViewGroup
int numShownItems = 0; int numShownItems = 0;
boolean finish = false; boolean finish = false;
int maxDisplayedNotifications = mAmbientState.isDark() int maxDisplayedNotifications = mAmbientState.isDark()
? (mPulsing ? 1 : 0) ? (isPulsing() ? 1 : 0)
: mMaxDisplayedNotifications; : mMaxDisplayedNotifications;
for (int i = 0; i < getChildCount(); i++) { for (int i = 0; i < getChildCount(); i++) {
ExpandableView expandableView = (ExpandableView) getChildAt(i); ExpandableView expandableView = (ExpandableView) getChildAt(i);
if (expandableView.getVisibility() != View.GONE if (expandableView.getVisibility() != View.GONE
&& !expandableView.hasNoContentHeight()) { && !expandableView.hasNoContentHeight()) {
if (maxDisplayedNotifications != -1 boolean limitReached = maxDisplayedNotifications != -1
&& numShownItems >= maxDisplayedNotifications) { && numShownItems >= maxDisplayedNotifications;
boolean notificationOnAmbientThatIsNotPulsing = isPulsing()
&& expandableView instanceof ExpandableNotificationRow
&& !isPulsing(((ExpandableNotificationRow) expandableView).getEntry());
if (limitReached || notificationOnAmbientThatIsNotPulsing) {
expandableView = mShelf; expandableView = mShelf;
finish = true; finish = true;
} }
@@ -1971,6 +1977,19 @@ public class NotificationStackScrollLayout extends ViewGroup
mAmbientState.setLayoutMaxHeight(mContentHeight); mAmbientState.setLayoutMaxHeight(mContentHeight);
} }
private boolean isPulsing(NotificationData.Entry entry) {
for (HeadsUpManager.HeadsUpEntry e : mPulsing) {
if (e.entry == entry) {
return true;
}
}
return false;
}
private boolean isPulsing() {
return mPulsing != null;
}
private void updateScrollability() { private void updateScrollability() {
boolean scrollable = getScrollRange() > 0; boolean scrollable = getScrollRange() > 0;
if (scrollable != mScrollable) { if (scrollable != mScrollable) {
@@ -2784,7 +2803,7 @@ public class NotificationStackScrollLayout extends ViewGroup
} }
private void updateNotificationAnimationStates() { private void updateNotificationAnimationStates() {
boolean running = mAnimationsEnabled || mPulsing; boolean running = mAnimationsEnabled || isPulsing();
mShelf.setAnimationsEnabled(running); mShelf.setAnimationsEnabled(running);
int childCount = getChildCount(); int childCount = getChildCount();
for (int i = 0; i < childCount; i++) { for (int i = 0; i < childCount; i++) {
@@ -2795,7 +2814,7 @@ public class NotificationStackScrollLayout extends ViewGroup
} }
private void updateAnimationState(View child) { private void updateAnimationState(View child) {
updateAnimationState((mAnimationsEnabled || mPulsing) updateAnimationState((mAnimationsEnabled || isPulsing())
&& (mIsExpanded || isPinnedHeadsUp(child)), child); && (mIsExpanded || isPinnedHeadsUp(child)), child);
} }
@@ -4055,12 +4074,12 @@ public class NotificationStackScrollLayout extends ViewGroup
return mIsExpanded; return mIsExpanded;
} }
public void setPulsing(boolean pulsing) { public void setPulsing(Collection<HeadsUpManager.HeadsUpEntry> pulsing) {
if (mPulsing == pulsing) { if (mPulsing == null && pulsing == null) {
return; return;
} }
mPulsing = pulsing; mPulsing = pulsing;
mAmbientState.setPulsing(pulsing); mAmbientState.setPulsing(isPulsing());
updateNotificationAnimationStates(); updateNotificationAnimationStates();
updateContentHeight(); updateContentHeight();
notifyHeightChangeListener(mShelf); notifyHeightChangeListener(mShelf);