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

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

Merge "[DO NOT MERGE]Revert "Migrate KeyguardClockSwitch to new shared Clock...

Merge "[DO NOT MERGE]Revert "Migrate KeyguardClockSwitch to new shared Clock library"" into tm-qpr-dev
parents 8415396e 23535e29
Loading
Loading
Loading
Loading
+1 −7
Original line number Original line Diff line number Diff line
@@ -485,13 +485,7 @@ class TextInterpolator(
        val out = mutableListOf<List<PositionedGlyphs>>()
        val out = mutableListOf<List<PositionedGlyphs>>()
        for (lineNo in 0 until layout.lineCount) { // Shape all lines.
        for (lineNo in 0 until layout.lineCount) { // Shape all lines.
            val lineStart = layout.getLineStart(lineNo)
            val lineStart = layout.getLineStart(lineNo)
            var count = layout.getLineEnd(lineNo) - lineStart
            val count = layout.getLineEnd(lineNo) - lineStart
            // Do not render the last character in the line if it's a newline and unprintable
            val last = lineStart + count - 1
            if (last > lineStart && last < layout.text.length && layout.text[last] == '\n') {
                count--
            }

            val runs = mutableListOf<PositionedGlyphs>()
            val runs = mutableListOf<PositionedGlyphs>()
            TextShaper.shapeText(layout.text, lineStart, count, layout.textDirectionHeuristic,
            TextShaper.shapeText(layout.text, lineStart, count, layout.textDirectionHeuristic,
                    paint) { _, _, glyphs, _ ->
                    paint) { _, _, glyphs, _ ->
+8 −13
Original line number Original line Diff line number Diff line
@@ -13,9 +13,9 @@
 */
 */
package com.android.systemui.plugins
package com.android.systemui.plugins


import android.content.res.Resources
import android.graphics.drawable.Drawable
import android.graphics.drawable.Drawable
import android.view.View
import android.view.View
import com.android.internal.colorextraction.ColorExtractor
import com.android.systemui.plugins.annotations.ProvidesInterface
import com.android.systemui.plugins.annotations.ProvidesInterface
import java.io.PrintWriter
import java.io.PrintWriter
import java.util.Locale
import java.util.Locale
@@ -57,15 +57,7 @@ interface Clock {
    val events: ClockEvents
    val events: ClockEvents


    /** Triggers for various animations */
    /** Triggers for various animations */
    val animations: ClockAnimations
    val animation: ClockAnimation

    /** Initializes various rendering parameters. If never called, provides reasonable defaults. */
    fun initialize(resources: Resources, dozeFraction: Float, foldFraction: Float) {
        events.onColorPaletteChanged(resources)
        animations.doze(dozeFraction)
        animations.fold(foldFraction)
        events.onTimeTick()
    }


    /** Optional method for dumping debug information */
    /** Optional method for dumping debug information */
    fun dump(pw: PrintWriter) { }
    fun dump(pw: PrintWriter) { }
@@ -88,12 +80,15 @@ interface ClockEvents {
    /** Call whenever font settings change */
    /** Call whenever font settings change */
    fun onFontSettingChanged() { }
    fun onFontSettingChanged() { }


    /** Call whenever the color palette should update */
    /** Call whenever the color pallete should update */
    fun onColorPaletteChanged(resources: Resources) { }
    fun onColorPaletteChanged(palette: ColorExtractor.GradientColors) { }
}
}


/** Methods which trigger various clock animations */
/** Methods which trigger various clock animations */
interface ClockAnimations {
interface ClockAnimation {
    /** Initializes the doze & fold animation positions. Defaults to neither folded nor dozing. */
    fun initialize(dozeFraction: Float, foldFraction: Float) { }

    /** Runs an enter animation (if any) */
    /** Runs an enter animation (if any) */
    fun enter() { }
    fun enter() { }


+28 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
**
** Copyright 2020, 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.
*/
-->

<!--
** AOD/LockScreen Clock font.
** Should include all numeric glyphs in all supported locales.
** Recommended: font with variable width to support AOD => LS animations
-->
<!-- TODO: Remove when clock migration complete -->
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
    <font android:typeface="monospace"/>
</font-family>
 No newline at end of file
+30 −2
Original line number Original line Diff line number Diff line
@@ -31,14 +31,42 @@
        android:layout_alignParentStart="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        android:layout_alignParentTop="true"
        android:paddingStart="@dimen/clock_padding_start">
        android:paddingStart="@dimen/clock_padding_start">
        <com.android.systemui.shared.clocks.AnimatableClockView
            android:id="@+id/animatable_clock_view"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="start"
            android:gravity="start"
            android:textSize="@dimen/clock_text_size"
            android:fontFamily="@font/clock"
            android:elegantTextHeight="false"
            android:singleLine="true"
            android:fontFeatureSettings="pnum"
            chargeAnimationDelay="350"
            dozeWeight="200"
            lockScreenWeight="400"
        />
    </FrameLayout>
    </FrameLayout>
    <FrameLayout
    <FrameLayout
        android:id="@+id/lockscreen_clock_view_large"
        android:id="@+id/lockscreen_clock_view_large"
        android:layout_width="match_parent"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/keyguard_slice_view"
        android:layout_below="@id/keyguard_slice_view"
        android:paddingTop="@dimen/keyguard_large_clock_top_padding"
        android:visibility="gone">
        android:visibility="gone">
        <com.android.systemui.shared.clocks.AnimatableClockView
            android:id="@+id/animatable_clock_view_large"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center_horizontal"
            android:textSize="@dimen/large_clock_text_size"
            android:fontFamily="@font/clock"
            android:typeface="monospace"
            android:elegantTextHeight="false"
            chargeAnimationDelay="200"
            dozeWeight="200"
            lockScreenWeight="400"
        />
    </FrameLayout>
    </FrameLayout>


    <!-- Not quite optimal but needed to translate these items as a group. The
    <!-- Not quite optimal but needed to translate these items as a group. The
+1 −1
Original line number Original line Diff line number Diff line
@@ -19,7 +19,7 @@
    android:id="@+id/time_view"
    android:id="@+id/time_view"
    android:layout_width="wrap_content"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_height="wrap_content"
    android:fontFamily="@*android:string/config_clockFontFamily"
    android:fontFamily="@font/clock"
    android:includeFontPadding="false"
    android:includeFontPadding="false"
    android:textColor="@android:color/white"
    android:textColor="@android:color/white"
    android:format12Hour="@string/dream_time_complication_12_hr_time_format"
    android:format12Hour="@string/dream_time_complication_12_hr_time_format"
Loading