diff options
| -rw-r--r-- | packages/SystemUI/res-keyguard/layout/type_aod_clock.xml (renamed from packages/SystemUI/res-keyguard/layout/type_clock.xml) | 10 | ||||
| -rw-r--r-- | packages/SystemUI/res-keyguard/layout/typographic_clock.xml | 26 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/keyguard/clock/TypeClockController.java | 28 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/keyguard/clock/TypographicClock.java | 8 |
4 files changed, 54 insertions, 18 deletions
diff --git a/packages/SystemUI/res-keyguard/layout/type_clock.xml b/packages/SystemUI/res-keyguard/layout/type_aod_clock.xml index 89bbc09132bd..28ff5a253317 100644 --- a/packages/SystemUI/res-keyguard/layout/type_clock.xml +++ b/packages/SystemUI/res-keyguard/layout/type_aod_clock.xml @@ -19,13 +19,5 @@ android:layout_width="match_parent" android:layout_height="match_parent" > - <com.android.keyguard.clock.TypographicClock - android:id="@+id/type_clock" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingStart="50dp" - android:textAlignment="viewStart" - style="@style/widget_big" - android:textSize="40dp" - /> + <include layout="@layout/typographic_clock" /> </com.android.keyguard.clock.ClockLayout> diff --git a/packages/SystemUI/res-keyguard/layout/typographic_clock.xml b/packages/SystemUI/res-keyguard/layout/typographic_clock.xml new file mode 100644 index 000000000000..73bb4b9a0fc9 --- /dev/null +++ b/packages/SystemUI/res-keyguard/layout/typographic_clock.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2019 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<com.android.keyguard.clock.TypographicClock + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/type_clock" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingStart="50dp" + android:textAlignment="viewStart" + style="@style/widget_big" + android:textSize="40dp" + /> diff --git a/packages/SystemUI/src/com/android/keyguard/clock/TypeClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/TypeClockController.java index 69f86c7886d3..387f2656c6f8 100644 --- a/packages/SystemUI/src/com/android/keyguard/clock/TypeClockController.java +++ b/packages/SystemUI/src/com/android/keyguard/clock/TypeClockController.java @@ -51,7 +51,7 @@ public class TypeClockController implements ClockPlugin { /** * Small clock shown on lock screen above stack scroller. */ - private View mLockClockContainer; + private TypographicClock mLockClock; /** * Controller for transition into dark state. @@ -69,13 +69,15 @@ public class TypeClockController implements ClockPlugin { } private void createViews() { - mView = mLayoutInflater.inflate(R.layout.type_clock, null); + mView = mLayoutInflater.inflate(R.layout.type_aod_clock, null); mTypeClock = mView.findViewById(R.id.type_clock); // For now, this view is used to hide the default digital clock. // Need better transition to lock screen. - mLockClockContainer = mLayoutInflater.inflate(R.layout.digital_clock, null); - mLockClockContainer.setVisibility(View.GONE); + mLockClock = (TypographicClock) mLayoutInflater.inflate(R.layout.typographic_clock, null); + mLockClock.setVisibility(View.GONE); + + mDarkController = new CrossFadeDarkController(mView, mLockClock); } @Override @@ -95,10 +97,10 @@ public class TypeClockController implements ClockPlugin { @Override public View getView() { - if (mLockClockContainer == null) { + if (mLockClock == null) { createViews(); } - return mLockClockContainer; + return mLockClock; } @Override @@ -115,6 +117,7 @@ public class TypeClockController implements ClockPlugin { @Override public void setTextColor(int color) { mTypeClock.setTextColor(color); + mLockClock.setTextColor(color); } @Override @@ -122,21 +125,28 @@ public class TypeClockController implements ClockPlugin { if (colorPalette == null || colorPalette.length == 0) { return; } - final int length = colorPalette.length; - mTypeClock.setClockColor(colorPalette[Math.max(0, length - 5)]); + final int color = colorPalette[Math.max(0, colorPalette.length - 5)]; + mTypeClock.setClockColor(color); + mLockClock.setClockColor(color); } @Override public void onTimeTick() { mTypeClock.onTimeChanged(); + mLockClock.onTimeChanged(); } @Override - public void setDarkAmount(float darkAmount) {} + public void setDarkAmount(float darkAmount) { + if (mDarkController != null) { + mDarkController.setDarkAmount(darkAmount); + } + } @Override public void onTimeZoneChanged(TimeZone timeZone) { mTypeClock.onTimeZoneChanged(timeZone); + mLockClock.onTimeZoneChanged(timeZone); } @Override diff --git a/packages/SystemUI/src/com/android/keyguard/clock/TypographicClock.java b/packages/SystemUI/src/com/android/keyguard/clock/TypographicClock.java index 7bce3c5cb63f..572ab30d7019 100644 --- a/packages/SystemUI/src/com/android/keyguard/clock/TypographicClock.java +++ b/packages/SystemUI/src/com/android/keyguard/clock/TypographicClock.java @@ -119,4 +119,12 @@ public class TypographicClock extends TextView { mTime.setTimeZone(mTimeZone != null ? mTimeZone : TimeZone.getDefault()); onTimeChanged(); } + + /** + * Overriding hasOverlappingRendering as false to improve performance of crossfading. + */ + @Override + public boolean hasOverlappingRendering() { + return false; + } } |