Merge "Large clock positioning" into sc-dev

This commit is contained in:
Matt Pietal
2021-06-30 20:34:33 +00:00
committed by Android (Google) Code Review
8 changed files with 32 additions and 10 deletions

View File

@@ -57,7 +57,7 @@
android:id="@+id/animatable_clock_view_large"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:textSize="@dimen/large_clock_text_size"
android:fontFamily="@font/clock"

View File

@@ -20,4 +20,7 @@
<!-- Large clock maximum font size (dp is intentional, to prevent any further scaling) -->
<dimen name="large_clock_text_size">200dp</dimen>
<!-- With the large clock, move up slightly from the center -->
<dimen name="keyguard_large_clock_top_margin">-104dp</dimen>
</resources>

View File

@@ -208,7 +208,7 @@
<dimen name="keyguard_indication_y_translation">24dp</dimen>
<!-- The padding on the bottom of the notifications on the keyguard -->
<dimen name="keyguard_indication_bottom_padding">12sp</dimen>
<dimen name="keyguard_indication_bottom_padding">16sp</dimen>
<!-- The padding at start and end of indication text shown on AOD -->
<dimen name="keyguard_indication_text_padding">16dp</dimen>
@@ -743,6 +743,10 @@
<dimen name="keyguard_clock_lock_margin">16dp</dimen>
<!-- The amount to shift the clocks during a small/large transition -->
<dimen name="keyguard_clock_switch_y_shift">10dp</dimen>
<!-- When large clock is showing, offset the smartspace by this amount -->
<dimen name="keyguard_smartspace_top_offset">12dp</dimen>
<!-- With the large clock, move up slightly from the center -->
<dimen name="keyguard_large_clock_top_margin">-52dp</dimen>
<!-- Default line spacing multiplier between hours and minutes of the keyguard clock -->
<item name="keyguard_clock_line_spacing_scale" type="dimen" format="float">.7</item>

View File

@@ -57,6 +57,7 @@ public class KeyguardClockSwitch extends RelativeLayout {
private View mKeyguardStatusArea;
/** Mutually exclusive with mKeyguardStatusArea */
private View mSmartspaceView;
private int mSmartspaceTopOffset;
/**
* Maintain state so that a newly connected plugin can be initialized.
@@ -96,6 +97,9 @@ public class KeyguardClockSwitch extends RelativeLayout {
mClockSwitchYAmount = mContext.getResources().getDimensionPixelSize(
R.dimen.keyguard_clock_switch_y_shift);
mSmartspaceTopOffset = mContext.getResources().getDimensionPixelSize(
R.dimen.keyguard_smartspace_top_offset);
}
/**
@@ -193,7 +197,7 @@ public class KeyguardClockSwitch extends RelativeLayout {
if (indexOfChild(in) == -1) addView(in);
direction = -1;
smartspaceYTranslation = mSmartspaceView == null ? 0
: mClockFrame.getTop() - mSmartspaceView.getTop();
: mClockFrame.getTop() - mSmartspaceView.getTop() + mSmartspaceTopOffset;
} else {
in = mClockFrame;
out = mLargeClockFrame;

View File

@@ -189,10 +189,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
.getDimensionPixelSize(R.dimen.below_clock_padding_end);
mSmartspaceView.setPaddingRelative(startPadding, 0, endPadding, 0);
// ... but above the large clock
lp = new RelativeLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT);
lp.addRule(RelativeLayout.BELOW, mSmartspaceView.getId());
mLargeClockFrame.setLayoutParams(lp);
updateClockLayout();
View nic = mView.findViewById(
R.id.left_aligned_notification_icon_container);
@@ -235,6 +232,18 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
*/
public void onDensityOrFontScaleChanged() {
mView.onDensityOrFontScaleChanged();
updateClockLayout();
}
private void updateClockLayout() {
if (mSmartspaceController.isEnabled()) {
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(MATCH_PARENT,
MATCH_PARENT);
lp.topMargin = getContext().getResources().getDimensionPixelSize(
R.dimen.keyguard_large_clock_top_margin);
mLargeClockFrame.setLayoutParams(lp);
}
}
/**

View File

@@ -234,7 +234,9 @@ public class KeyguardClockPositionAlgorithm {
private int getClockY(float panelExpansion, float darkAmount) {
float clockYRegular = getExpandedPreferredClockY();
float clockYBouncer = -mKeyguardStatusHeight;
// Dividing the height creates a smoother transition when the user swipes up to unlock
float clockYBouncer = -mKeyguardStatusHeight / 3.0f;
// Move clock up while collapsing the shade
float shadeExpansion = Interpolators.FAST_OUT_LINEAR_IN.getInterpolation(panelExpansion);

View File

@@ -2788,7 +2788,6 @@ public class NotificationPanelViewController extends PanelViewController {
private int calculatePanelHeightShade() {
int emptyBottomMargin = mNotificationStackScrollLayoutController.getEmptyBottomMargin();
int maxHeight = mNotificationStackScrollLayoutController.getHeight() - emptyBottomMargin;
maxHeight += mNotificationStackScrollLayoutController.getTopPaddingOverflow();
if (mBarState == KEYGUARD) {
int minKeyguardPanelBottom = mClockPositionAlgorithm.getLockscreenStatusViewHeight()

View File

@@ -323,7 +323,8 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
// WHEN the clock position algorithm is run
positionClock();
// THEN the notif padding is zero.
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(0);
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(
(int) (mKeyguardStatusHeight * .667f));
}
@Test