Typographic clock apears above NSSL instead of behind on lock screen.

Fixes: 124899907
Fixes: 127347666
Test: mp sysuig and checked transition to lock screen
Change-Id: Ic3d8de34cadfad4ecb85b63bdb3fe07d3ba3f9b1
This commit is contained in:
Robert Snoeberger
2019-03-06 10:03:05 -05:00
parent 516218f9b2
commit 1f19d2c3e0
4 changed files with 54 additions and 18 deletions

View File

@@ -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>

View File

@@ -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"
/>

View File

@@ -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

View File

@@ -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;
}
}