Remove dashes between clock and notifications

Bug: 111405682
Test: visual - smart space, ambient notification, clock
Change-Id: I68e0d9099e0d4eaa1a6c10838d584aded523c332
This commit is contained in:
Lucas Dupin
2018-10-22 17:59:18 -07:00
parent d845abbac0
commit c9d28b74eb
8 changed files with 24 additions and 109 deletions

View File

@@ -42,18 +42,11 @@
android:id="@+id/clock_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<View
android:id="@+id/clock_separator"
android:layout_width="@dimen/widget_separator_width"
android:layout_height="@dimen/widget_separator_thickness"
android:layout_below="@id/clock_view"
android:background="#f00"
android:layout_centerHorizontal="true" />
<include layout="@layout/keyguard_status_area"
android:id="@+id/keyguard_status_area"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/clock_separator" />
android:layout_below="@id/clock_view" />
</RelativeLayout>
<ImageView
android:layout_width="wrap_content"

View File

@@ -43,6 +43,7 @@
android:id="@+id/row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/subtitle_clock_padding"
android:orientation="horizontal"
android:gravity="center"
/>

View File

@@ -59,19 +59,11 @@
android:id="@+id/clock_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<View
android:id="@+id/clock_separator"
android:layout_width="@dimen/widget_separator_width"
android:layout_height="@dimen/widget_separator_thickness"
android:layout_below="@id/clock_view"
android:background="#f00"
android:layout_centerHorizontal="true" />
<include layout="@layout/keyguard_status_area"
android:id="@+id/keyguard_status_area"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/clock_separator" />
android:layout_below="@id/clock_view" />
</RelativeLayout>
<TextView

View File

@@ -43,7 +43,7 @@
<!-- Slice header -->
<dimen name="widget_title_font_size">24dp</dimen>
<dimen name="widget_title_bottom_margin">7dp</dimen>
<dimen name="widget_title_bottom_margin">14dp</dimen>
<dimen name="bottom_text_spacing_digital">0dp</dimen>
<!-- Slice subtitle -->
<dimen name="widget_label_font_size">16dp</dimen>
@@ -52,19 +52,17 @@
<!-- Clock without header -->
<dimen name="widget_big_font_size">64dp</dimen>
<!-- Clock with header -->
<dimen name="widget_small_clock_padding">-25dp</dimen>
<dimen name="widget_small_font_size">24dp</dimen>
<dimen name="widget_small_font_stroke">0.6dp</dimen>
<!-- Dash between clock and header -->
<dimen name="widget_separator_width">12dp</dimen>
<dimen name="widget_separator_thickness">1dp</dimen>
<dimen name="widget_vertical_padding">26dp</dimen>
<dimen name="widget_icon_bottom_padding">14dp</dimen>
<dimen name="widget_vertical_padding">32dp</dimen>
<!-- Subtitle paddings -->
<dimen name="widget_horizontal_padding">8dp</dimen>
<dimen name="widget_icon_size">16dp</dimen>
<dimen name="widget_icon_padding">8dp</dimen>
<!-- Space between notification shelf and dash above it -->
<dimen name="widget_bottom_separator_padding">28dp</dimen>
<dimen name="subtitle_clock_padding">15dp</dimen>
<!-- Notification shelf padding when dark -->
<dimen name="widget_bottom_separator_padding">-6dp</dimen>
<!-- The y translation to apply at the start in appear animations. -->
<dimen name="appear_y_translation_start">32dp</dimen>

View File

@@ -64,7 +64,6 @@ public class KeyguardStatusView extends GridLayout implements
private TextView mLogoutView;
private KeyguardClockSwitch mClockView;
private View mClockSeparator;
private TextView mOwnerInfo;
private KeyguardSliceView mKeyguardSlice;
private Runnable mPendingMarqueeStart;
@@ -75,8 +74,8 @@ public class KeyguardStatusView extends GridLayout implements
private boolean mWasPulsing;
private float mDarkAmount = 0;
private int mTextColor;
private float mWidgetPadding;
private int mLastLayoutHeight;
private int mSmallClockPadding;
private KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {
@@ -175,14 +174,12 @@ public class KeyguardStatusView extends GridLayout implements
}
mOwnerInfo = findViewById(R.id.owner_info);
mKeyguardSlice = findViewById(R.id.keyguard_status_area);
mClockSeparator = findViewById(R.id.clock_separator);
mVisibleInDoze = Sets.newArraySet(mClockView, mKeyguardSlice);
mTextColor = mClockView.getCurrentTextColor();
int clockStroke = getResources().getDimensionPixelSize(R.dimen.widget_small_font_stroke);
mClockView.getPaint().setStrokeWidth(clockStroke);
mClockView.addOnLayoutChangeListener(this);
mClockSeparator.addOnLayoutChangeListener(this);
mKeyguardSlice.setContentChangeListener(this::onSliceContentChanged);
onSliceContentChanged();
@@ -199,26 +196,18 @@ public class KeyguardStatusView extends GridLayout implements
}
/**
* Moves clock and separator, adjusting margins when slice content changes.
* Moves clock, adjusting margins when slice content changes.
*/
private void onSliceContentChanged() {
boolean smallClock = mKeyguardSlice.hasHeader() || mPulsing;
float clockScale = smallClock ? mSmallClockScale : 1;
RelativeLayout.LayoutParams layoutParams =
(RelativeLayout.LayoutParams) mClockView.getLayoutParams();
int height = mClockView.getHeight();
layoutParams.bottomMargin = (int) -(height - (clockScale * height));
layoutParams.bottomMargin = smallClock ? mSmallClockPadding : 0;
mClockView.setLayoutParams(layoutParams);
layoutParams = (RelativeLayout.LayoutParams) mClockSeparator.getLayoutParams();
layoutParams.topMargin = smallClock ? (int) mWidgetPadding : 0;
layoutParams.bottomMargin = layoutParams.topMargin;
mClockSeparator.setLayoutParams(layoutParams);
}
/**
* Animate clock and its separator when necessary.
* Animate clock when necessary.
*/
@Override
public void onLayoutChange(View view, int left, int top, int right, int bottom,
@@ -258,25 +247,6 @@ public class KeyguardStatusView extends GridLayout implements
mClockView.setStyle(style);
mClockView.invalidate();
}
} else if (view == mClockSeparator) {
boolean hasSeparator = hasHeader && !mPulsing;
float alpha = hasSeparator ? 1 : 0;
mClockSeparator.animate().cancel();
if (shouldAnimate) {
boolean isAwake = mDarkAmount != 0;
mClockSeparator.setY(oldTop + heightOffset);
mClockSeparator.animate()
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
.setDuration(duration)
.setListener(isAwake ? null : new KeepAwakeAnimationListener(getContext()))
.setStartDelay(delay)
.y(top)
.alpha(alpha)
.start();
} else {
mClockSeparator.setY(top);
mClockSeparator.setAlpha(alpha);
}
}
}
@@ -291,7 +261,8 @@ public class KeyguardStatusView extends GridLayout implements
@Override
public void onDensityOrFontScaleChanged() {
mWidgetPadding = getResources().getDimension(R.dimen.widget_vertical_padding);
mSmallClockPadding = getResources()
.getDimensionPixelSize(R.dimen.widget_small_clock_padding);
if (mClockView != null) {
mClockView.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimensionPixelSize(R.dimen.widget_big_font_size));
@@ -434,7 +405,6 @@ public class KeyguardStatusView extends GridLayout implements
updateDozeVisibleViews();
mKeyguardSlice.setDarkAmount(mDarkAmount);
mClockView.setTextColor(blendedTextColor);
mClockSeparator.setBackgroundColor(blendedTextColor);
}
private void layoutOwnerInfo() {

View File

@@ -25,7 +25,6 @@ import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.TimeAnimator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.WallpaperManager;
@@ -101,13 +100,11 @@ import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.NotificationUtils;
import com.android.systemui.statusbar.notification.ShadeViewRefactor;
import com.android.systemui.statusbar.notification.ShadeViewRefactor.RefactorComponent;
import com.android.systemui.statusbar.notification.VisibilityLocationProvider;
import com.android.systemui.statusbar.notification.VisualStabilityManager;
import com.android.systemui.statusbar.notification.logging.NotificationLogger;
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.ExpandableView;
import com.android.systemui.statusbar.notification.row.ExpandableView.OnHeightChangedListener;
import com.android.systemui.statusbar.notification.row.FooterView;
import com.android.systemui.statusbar.notification.row.NotificationBlockingHelperManager;
import com.android.systemui.statusbar.notification.row.NotificationGuts;
@@ -195,7 +192,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
// Current padding, will be either mRegularTopPadding or mDarkTopPadding
private int mTopPadding;
// Distance between AOD separator and shelf
private int mDarkSeparatorPadding;
private int mDarkShelfPadding;
private int mBottomMargin;
private int mBottomInset = 0;
private float mQsExpansionFraction;
@@ -424,8 +421,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
private Runnable mAnimateScroll = this::animateScroll;
private int mCornerRadius;
private int mSidePaddings;
private final int mSeparatorWidth;
private final int mSeparatorThickness;
private final Rect mBackgroundAnimationRect = new Rect();
private int mAntiBurnInOffsetX;
private ArrayList<BiConsumer<Float, Float>> mExpandedHeightListeners = new ArrayList<>();
@@ -499,9 +494,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
res.getBoolean(R.bool.config_drawNotificationBackground);
mFadeNotificationsOnDismiss =
res.getBoolean(R.bool.config_fadeNotificationsOnDismiss);
mSeparatorWidth = res.getDimensionPixelSize(R.dimen.widget_separator_width);
mSeparatorThickness = res.getDimensionPixelSize(R.dimen.widget_separator_thickness);
mDarkSeparatorPadding = res.getDimensionPixelSize(R.dimen.widget_bottom_separator_padding);
mDarkShelfPadding = res.getDimensionPixelSize(R.dimen.widget_bottom_separator_padding);
mRoundnessManager.setAnimatedChildren(mChildrenToAddAnimated);
mRoundnessManager.setOnRoundingChangedCallback(this::invalidate);
addOnExpandedHeightListener(mRoundnessManager::setExpanded);
@@ -673,23 +666,15 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
final int lockScreenRight = getWidth() - mSidePaddings;
final int lockScreenTop = mCurrentBounds.top;
final int lockScreenBottom = mCurrentBounds.bottom;
int separatorWidth = 0;
int separatorThickness = 0;
if (mIconAreaController.hasShelfIconsWhenFullyDark()) {
separatorThickness = mSeparatorThickness;
separatorWidth = mSeparatorWidth;
}
final int darkLeft = getWidth() / 2 - separatorWidth / 2;
final int darkRight = darkLeft + separatorWidth;
final int darkTop = (int) (mRegularTopPadding + separatorThickness / 2f);
final int darkBottom = darkTop + separatorThickness;
final int darkLeft = getWidth() / 2;
final int darkTop = mRegularTopPadding;
if (mAmbientState.hasPulsingNotifications()) {
// No divider, we have a notification icon instead
} else if (mAmbientState.isFullyDark()) {
// Only draw divider on AOD if we actually have notifications
if (mFirstVisibleBackgroundChild != null) {
canvas.drawRect(darkLeft, darkTop, darkRight, darkBottom, mBackgroundPaint);
canvas.drawRect(darkLeft, darkTop, darkLeft, darkTop, mBackgroundPaint);
}
} else {
float yProgress = 1 - mInterpolatedDarkAmount;
@@ -699,8 +684,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
mBackgroundAnimationRect.set(
(int) MathUtils.lerp(darkLeft, lockScreenLeft, xProgress),
(int) MathUtils.lerp(darkTop, lockScreenTop, yProgress),
(int) MathUtils.lerp(darkRight, lockScreenRight, xProgress),
(int) MathUtils.lerp(darkBottom, lockScreenBottom, yProgress));
(int) MathUtils.lerp(darkLeft, lockScreenRight, xProgress),
(int) MathUtils.lerp(darkTop, lockScreenBottom, yProgress));
if (!mAmbientState.isDark() || mFirstVisibleBackgroundChild != null) {
canvas.drawRoundRect(mBackgroundAnimationRect.left, mBackgroundAnimationRect.top,
@@ -1013,7 +998,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
private void setTopPadding(int topPadding, boolean animate) {
if (mRegularTopPadding != topPadding) {
mRegularTopPadding = topPadding;
mDarkTopPadding = topPadding + mDarkSeparatorPadding;
mDarkTopPadding = topPadding + mDarkShelfPadding;
mAmbientState.setDarkTopPadding(mDarkTopPadding);
updateAlgorithmHeightAndPadding();
updateContentHeight();

View File

@@ -145,7 +145,7 @@ public class KeyguardClockPositionAlgorithm {
final int y = getClockY();
result.clockY = y;
result.clockAlpha = getClockAlpha(y);
result.stackScrollerPadding = y + (mPulsing ? 0 : mKeyguardStatusHeight);
result.stackScrollerPadding = y + (mPulsing ? mPulsingPadding : mKeyguardStatusHeight);
result.clockX = (int) interpolate(0, burnInPreventionOffsetX(), mDarkAmount);
}

View File

@@ -49,7 +49,6 @@ public class NotificationIconAreaController implements DarkReceiver {
private ViewGroup mNotificationScrollLayout;
private Context mContext;
private boolean mFullyDark;
private boolean mHasShelfIconsWhenFullyDark;
public NotificationIconAreaController(Context context, StatusBar statusBar) {
mStatusBar = statusBar;
@@ -176,33 +175,10 @@ public class NotificationIconAreaController implements DarkReceiver {
updateStatusBarIcons();
updateShelfIcons();
updateHasShelfIconsWhenFullyDark();
applyNotificationIconsTint();
}
private void updateHasShelfIconsWhenFullyDark() {
boolean hasIconsWhenFullyDark = false;
for (int i = 0; i < mNotificationScrollLayout.getChildCount(); i++) {
View view = mNotificationScrollLayout.getChildAt(i);
if (view instanceof ExpandableNotificationRow) {
NotificationData.Entry ent = ((ExpandableNotificationRow) view).getEntry();
if (shouldShowNotificationIcon(ent,
NotificationShelf.SHOW_AMBIENT_ICONS /* showAmbient */,
false /* hideDismissed */,
true /* hideReplied */)) {
hasIconsWhenFullyDark = true;
break;
}
}
}
mHasShelfIconsWhenFullyDark = hasIconsWhenFullyDark;
}
public boolean hasShelfIconsWhenFullyDark() {
return mHasShelfIconsWhenFullyDark;
}
private void updateShelfIcons() {
updateIconsForLayout(entry -> entry.expandedIcon, mShelfIcons,
NotificationShelf.SHOW_AMBIENT_ICONS, false /* hideDismissed */,