Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e80f6774 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

parents 4d6ddb29 1f19d2c3
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -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>
+26 −0
Original line number Diff line number Diff line
<?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"
    />
+19 −9
Original line number Diff line number Diff line
@@ -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
+8 −0
Original line number Diff line number Diff line
@@ -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;
    }
}