Merge "Update spacing/layout of LS clock"
This commit is contained in:
committed by
Android (Google) Code Review
commit
963d92cce2
@@ -67,20 +67,18 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:visibility="gone">
|
||||
<com.android.keyguard.AnimatableClockView
|
||||
android:id="@+id/animatable_clock_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right"
|
||||
android:textSize="80dp"
|
||||
android:letterSpacing="0.02"
|
||||
android:lineSpacingMultiplier=".8"
|
||||
android:includeFontPadding="false"
|
||||
android:fontFamily="@font/clock"
|
||||
android:typeface="monospace"
|
||||
android:format12Hour="hh\nmm"
|
||||
android:format24Hour="HH\nmm"
|
||||
android:elegantTextHeight="false"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
package com.android.keyguard;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.util.MathUtils;
|
||||
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||
@@ -54,6 +56,11 @@ public class AnimatableClockController extends ViewController<AnimatableClockVie
|
||||
mStatusBarStateController.removeCallback(mStatusBarStateListener);
|
||||
}
|
||||
|
||||
float getClockTextTopPadding() {
|
||||
Paint.FontMetrics fm = mView.getPaint().getFontMetrics();
|
||||
return MathUtils.abs(fm.ascent - fm.top);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the time for this view.
|
||||
*/
|
||||
|
||||
@@ -232,6 +232,11 @@ public class KeyguardClockSwitch extends RelativeLayout {
|
||||
}
|
||||
}
|
||||
|
||||
float getClockTextTopPadding() {
|
||||
Paint.FontMetrics fm = mClockView.getPaint().getFontMetrics();
|
||||
return fm.ascent - fm.top;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set container for big clock face appearing behind NSSL and KeyguardStatusView.
|
||||
*/
|
||||
|
||||
@@ -239,6 +239,15 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
|
||||
mView.setFormat24Hour(Patterns.sClockView24);
|
||||
}
|
||||
|
||||
float getClockTextTopPadding() {
|
||||
if (mLockScreenMode == KeyguardUpdateMonitor.LOCK_SCREEN_MODE_LAYOUT_1
|
||||
&& mNewLockScreenClockViewController != null) {
|
||||
return mNewLockScreenClockViewController.getClockTextTopPadding();
|
||||
}
|
||||
|
||||
return mView.getClockTextTopPadding();
|
||||
}
|
||||
|
||||
private void updateAodIcons() {
|
||||
NotificationIconContainer nic = (NotificationIconContainer)
|
||||
mView.findViewById(
|
||||
|
||||
@@ -154,12 +154,7 @@ public class KeyguardSliceView extends LinearLayout {
|
||||
public void updateLockScreenMode(int mode) {
|
||||
mLockScreenMode = mode;
|
||||
if (mLockScreenMode == KeyguardUpdateMonitor.LOCK_SCREEN_MODE_LAYOUT_1) {
|
||||
// add top padding to better align with top of clock
|
||||
final int topPadding = (int) TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP,
|
||||
20,
|
||||
getResources().getDisplayMetrics());
|
||||
mTitle.setPaddingRelative(0, topPadding, 0, 0);
|
||||
mTitle.setPaddingRelative(0, 0, 0, 0);
|
||||
mTitle.setGravity(Gravity.START);
|
||||
setGravity(Gravity.START);
|
||||
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) getLayoutParams();
|
||||
@@ -524,9 +519,9 @@ public class KeyguardSliceView extends LinearLayout {
|
||||
.getDimension(R.dimen.widget_horizontal_padding) / 2;
|
||||
if (mLockScreenMode == KeyguardUpdateMonitor.LOCK_SCREEN_MODE_LAYOUT_1) {
|
||||
// orientation is vertical, so add padding to top & bottom
|
||||
setPadding(0, padding, 0, padding * (hasText ? 1 : -1));
|
||||
setPadding(0, padding, 0, hasText ? padding : 0);
|
||||
} else {
|
||||
// oreintation is horizontal, so add padding to left & right
|
||||
// orientation is horizontal, so add padding to left & right
|
||||
setPadding(padding, 0, padding * (hasText ? 1 : -1), 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LiveData;
|
||||
@@ -148,6 +149,12 @@ public class KeyguardSliceViewController extends ViewController<KeyguardSliceVie
|
||||
KeyguardSliceViewController.this.hashCode()));
|
||||
}
|
||||
|
||||
void updateTopMargin(float clockTopTextPadding) {
|
||||
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) mView.getLayoutParams();
|
||||
lp.topMargin = (int) clockTopTextPadding;
|
||||
mView.setLayoutParams(lp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the lockscreen mode which may change the layout of the keyguard slice view.
|
||||
*/
|
||||
|
||||
@@ -297,6 +297,15 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
|
||||
mLockScreenMode = mode;
|
||||
mKeyguardClockSwitchController.updateLockScreenMode(mode);
|
||||
mKeyguardSliceViewController.updateLockScreenMode(mode);
|
||||
if (mLockScreenMode == KeyguardUpdateMonitor.LOCK_SCREEN_MODE_LAYOUT_1) {
|
||||
// align the top of keyguard_status_area with the top of the clock text instead
|
||||
// of the top of the view
|
||||
mKeyguardSliceViewController.updateTopMargin(
|
||||
mKeyguardClockSwitchController.getClockTextTopPadding());
|
||||
} else {
|
||||
// reset margin
|
||||
mKeyguardSliceViewController.updateTopMargin(0);
|
||||
}
|
||||
updateAodIcons();
|
||||
}
|
||||
|
||||
|
||||
@@ -256,10 +256,9 @@ public class KeyguardClockPositionAlgorithm {
|
||||
|
||||
// TODO(b/12836565) - prototyping only adjustment
|
||||
if (mLockScreenMode != KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL) {
|
||||
// This will keep the clock at the top for AOD
|
||||
return (int) (clockY + burnInPreventionOffsetY() + mEmptyDragAmount);
|
||||
// This will keep the clock at the top
|
||||
clockYDark = (int) (clockY + burnInPreventionOffsetY());
|
||||
}
|
||||
|
||||
return (int) (MathUtils.lerp(clockY, clockYDark, darkAmount) + mEmptyDragAmount);
|
||||
}
|
||||
|
||||
|
||||
@@ -221,6 +221,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
|
||||
@Override
|
||||
public void onLockScreenModeChanged(int mode) {
|
||||
mLockScreenMode = mode;
|
||||
mClockPositionAlgorithm.onLockScreenModeChanged(mode);
|
||||
}
|
||||
|
||||
@@ -472,6 +473,8 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
private int mOldLayoutDirection;
|
||||
private NotificationShelfController mNotificationShelfController;
|
||||
|
||||
private int mLockScreenMode = KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL;
|
||||
|
||||
private View.AccessibilityDelegate mAccessibilityDelegate = new View.AccessibilityDelegate() {
|
||||
@Override
|
||||
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
|
||||
@@ -872,8 +875,10 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
mNotificationStackScrollLayoutController.getIntrinsicContentHeight(),
|
||||
getExpandedFraction(),
|
||||
totalHeight,
|
||||
(int) (mKeyguardStatusViewController.getHeight()
|
||||
- mShelfHeight / 2.0f - mDarkIconSize / 2.0f),
|
||||
mLockScreenMode == KeyguardUpdateMonitor.LOCK_SCREEN_MODE_LAYOUT_1
|
||||
? mKeyguardStatusViewController.getHeight()
|
||||
: (int) (mKeyguardStatusViewController.getHeight()
|
||||
- mShelfHeight / 2.0f - mDarkIconSize / 2.0f),
|
||||
clockPreferredY, hasCustomClock(),
|
||||
hasVisibleNotifications, mInterpolatedDarkAmount, mEmptyDragAmount,
|
||||
bypassEnabled, getUnlockedStackScrollerPadding(),
|
||||
|
||||
Reference in New Issue
Block a user