Merge changes I53d2205b,I2dc43001 into sc-dev

* changes:
  Smartspace - Update fonts/margins
  AOD/LS - Move clock to start
This commit is contained in:
TreeHugger Robot
2021-02-22 14:12:48 +00:00
committed by Android (Google) Code Review
9 changed files with 23 additions and 59 deletions

View File

@@ -64,7 +64,7 @@
android:id="@+id/new_lockscreen_clock_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:visibility="gone">
<com.android.keyguard.AnimatableClockView
@@ -73,7 +73,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:textSize="100dp"
android:textSize="60dp"
android:fontFamily="@font/clock"
android:typeface="monospace"
android:elegantTextHeight="false"

View File

@@ -47,26 +47,25 @@
<dimen name="eca_overlap">-10dip</dimen>
<!-- Slice header -->
<dimen name="widget_title_font_size">24dp</dimen>
<dimen name="header_subtitle_padding">12dp</dimen>
<dimen name="widget_title_font_size">20dp</dimen>
<dimen name="widget_title_line_height">24dp</dimen>
<dimen name="header_icon_size">16dp</dimen>
<!-- Slice subtitle -->
<dimen name="widget_label_font_size">18dp</dimen>
<dimen name="widget_label_font_size">16dp</dimen>
<dimen name="widget_label_line_height">20dp</dimen>
<!-- Clock without header -->
<dimen name="widget_big_font_size">54dp</dimen>
<dimen name="bottom_text_spacing_digital">0dp</dimen>
<dimen name="title_clock_padding">4dp</dimen>
<!-- Clock with header -->
<dimen name="widget_small_font_size">@dimen/widget_title_font_size</dimen>
<dimen name="widget_vertical_padding">17dp</dimen>
<dimen name="widget_vertical_padding">5dp</dimen>
<dimen name="widget_vertical_padding_with_header">25dp</dimen>
<dimen name="widget_vertical_padding_clock">12dp</dimen>
<!-- Subtitle paddings -->
<dimen name="widget_horizontal_padding">8dp</dimen>
<dimen name="widget_icon_size">20dp</dimen>
<dimen name="widget_icon_size">18dp</dimen>
<dimen name="widget_icon_padding">8dp</dimen>
<dimen name="subtitle_clock_padding">0dp</dimen>
<dimen name="header_row_font_size">14dp</dimen>
<!-- Notification shelf padding when dark -->
<dimen name="widget_bottom_separator_padding">-6dp</dimen>

View File

@@ -120,6 +120,7 @@
<style name="TextAppearance.Keyguard">
<item name="android:textSize">@dimen/widget_title_font_size</item>
<item name="android:lineHeight">@dimen/widget_title_line_height</item>
<item name="android:gravity">center</item>
<item name="android:ellipsize">end</item>
<item name="android:maxLines">2</item>
@@ -133,6 +134,7 @@
<item name="android:layout_height">wrap_content</item>
<item name="android:lines">1</item>
<item name="android:textSize">@dimen/widget_label_font_size</item>
<item name="android:lineHeight">@dimen/widget_label_line_height</item>
</style>
<style name="TextAppearance.Keyguard.BottomArea">

View File

@@ -21,9 +21,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
import android.graphics.Paint;
import android.icu.text.NumberFormat;
import android.util.MathUtils;
import com.android.settingslib.Utils;
import com.android.systemui.R;
@@ -94,11 +92,6 @@ 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 the view.
*/

View File

@@ -179,20 +179,15 @@ public class KeyguardClockSwitch extends RelativeLayout {
setPaddingRelative(startEndPadding, 0, startEndPadding, 0);
mSmallClockFrame.setVisibility(GONE);
mNewLockscreenClockFrame.setVisibility(VISIBLE);
statusAreaLP.removeRule(RelativeLayout.BELOW);
statusAreaLP.addRule(RelativeLayout.BELOW, R.id.new_lockscreen_clock_view);
statusAreaLP.addRule(RelativeLayout.ALIGN_PARENT_START);
statusAreaLP.addRule(RelativeLayout.START_OF, R.id.new_lockscreen_clock_view);
statusAreaLP.width = 0;
} else {
setPaddingRelative(0, 0, 0, 0);
mSmallClockFrame.setVisibility(VISIBLE);
mNewLockscreenClockFrame.setVisibility(GONE);
statusAreaLP.removeRule(RelativeLayout.ALIGN_PARENT_START);
statusAreaLP.removeRule(RelativeLayout.START_OF);
statusAreaLP.addRule(RelativeLayout.BELOW, R.id.clock_view);
statusAreaLP.width = ViewGroup.LayoutParams.MATCH_PARENT;
}
requestLayout();

View File

@@ -20,6 +20,7 @@ import android.app.WallpaperManager;
import android.content.ContentResolver;
import android.content.res.Resources;
import android.provider.Settings;
import android.text.TextUtils;
import android.text.format.DateFormat;
import android.view.View;
import android.view.ViewGroup;
@@ -212,10 +213,10 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
* keep the clock centered.
*/
void updatePosition(int x, float scale, AnimationProperties props, boolean animate) {
x = Math.abs(x);
x = getCurrentLayoutDirection() == View.LAYOUT_DIRECTION_RTL ? -x : x;
if (mNewLockScreenClockFrame != null) {
PropertyAnimator.setProperty(mNewLockScreenClockFrame, AnimatableProperty.TRANSLATION_X,
-x, props, animate);
x, props, animate);
PropertyAnimator.setProperty(mNewLockScreenLargeClockFrame, AnimatableProperty.SCALE_X,
scale, props, animate);
PropertyAnimator.setProperty(mNewLockScreenLargeClockFrame, AnimatableProperty.SCALE_Y,
@@ -277,15 +278,6 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
refreshFormat(mTimeFormat);
}
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(
@@ -337,4 +329,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
sCacheKey = key;
}
}
private int getCurrentLayoutDirection() {
return TextUtils.getLayoutDirectionFromLocale(Locale.getDefault());
}
}

View File

@@ -85,10 +85,6 @@ public class KeyguardSliceView extends LinearLayout {
*/
private Runnable mContentChangeListener;
private boolean mHasHeader;
private final int mRowWithHeaderPadding;
private final int mRowPadding;
private float mRowTextSize;
private float mRowWithHeaderTextSize;
private View.OnClickListener mOnClickListener;
private int mLockScreenMode = KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL;
@@ -97,9 +93,6 @@ public class KeyguardSliceView extends LinearLayout {
super(context, attrs);
Resources resources = context.getResources();
mRowPadding = resources.getDimensionPixelSize(R.dimen.subtitle_clock_padding);
mRowWithHeaderPadding = resources.getDimensionPixelSize(R.dimen.header_subtitle_padding);
mLayoutTransition = new LayoutTransition();
mLayoutTransition.setStagger(LayoutTransition.CHANGE_APPEARING, DEFAULT_ANIM_DURATION / 2);
mLayoutTransition.setDuration(LayoutTransition.APPEARING, DEFAULT_ANIM_DURATION);
@@ -120,10 +113,6 @@ public class KeyguardSliceView extends LinearLayout {
mTextColor = Utils.getColorAttrDefaultColor(mContext, R.attr.wallpaperTextColor);
mIconSize = (int) mContext.getResources().getDimension(R.dimen.widget_icon_size);
mIconSizeWithHeader = (int) mContext.getResources().getDimension(R.dimen.header_icon_size);
mRowTextSize = mContext.getResources().getDimensionPixelSize(
R.dimen.widget_label_font_size);
mRowWithHeaderTextSize = mContext.getResources().getDimensionPixelSize(
R.dimen.header_row_font_size);
mTitle.setBreakStrategy(LineBreaker.BREAK_STRATEGY_BALANCED);
}
@@ -204,7 +193,6 @@ public class KeyguardSliceView extends LinearLayout {
LinearLayout.LayoutParams layoutParams = (LayoutParams) mRow.getLayoutParams();
layoutParams.gravity = mLockScreenMode != KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL
? Gravity.START : Gravity.CENTER;
layoutParams.topMargin = mHasHeader ? mRowWithHeaderPadding : mRowPadding;
mRow.setLayoutParams(layoutParams);
for (int i = startIndex; i < subItemsCount; i++) {
@@ -230,8 +218,6 @@ public class KeyguardSliceView extends LinearLayout {
final SliceItem titleItem = rc.getTitleItem();
button.setText(titleItem == null ? null : titleItem.getText());
button.setContentDescription(rc.getContentDescription());
button.setTextSize(TypedValue.COMPLEX_UNIT_PX,
mHasHeader ? mRowWithHeaderTextSize : mRowTextSize);
Drawable iconDrawable = null;
SliceItem icon = SliceQuery.find(item.getSlice(),
@@ -313,10 +299,6 @@ public class KeyguardSliceView extends LinearLayout {
void onDensityOrFontScaleChanged() {
mIconSize = mContext.getResources().getDimensionPixelSize(R.dimen.widget_icon_size);
mIconSizeWithHeader = (int) mContext.getResources().getDimension(R.dimen.header_icon_size);
mRowTextSize = mContext.getResources().getDimensionPixelSize(
R.dimen.widget_label_font_size);
mRowWithHeaderTextSize = mContext.getResources().getDimensionPixelSize(
R.dimen.header_row_font_size);
}
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {

View File

@@ -266,15 +266,9 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
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());
mView.setCanShowOwnerInfo(false);
mView.setCanShowLogout(false);
} else {
// reset margin
mKeyguardSliceViewController.updateTopMargin(0);
mView.setCanShowOwnerInfo(true);
mView.setCanShowLogout(false);
}

View File

@@ -344,8 +344,11 @@ public class KeyguardClockPositionAlgorithm {
}
private float burnInPreventionOffsetX() {
return getBurnInOffset(mBurnInPreventionOffsetX * 2, true /* xAxis */)
- mBurnInPreventionOffsetX;
if (mLockScreenMode == KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL) {
return getBurnInOffset(mBurnInPreventionOffsetX * 2, true /* xAxis */)
- mBurnInPreventionOffsetX;
}
return getBurnInOffset(mBurnInPreventionOffsetX, true /* xAxis */);
}
public static class Result {