OSDN Git Service

Themeable keyguard clock
authorLucas Dupin <dupin@google.com>
Sun, 14 May 2017 05:04:22 +0000 (22:04 -0700)
committerLucas Dupin <dupin@google.com>
Thu, 1 Jun 2017 19:14:39 +0000 (12:14 -0700)
Bug: 37014702
Test: change wallpaper to light/dark, look at the clock on the keyguard
Change-Id: I7e222401dfa0e3ac8be6635f45a4f517dd5509d9

packages/SystemUI/res-keyguard/drawable/ic_access_alarms_big.xml
packages/SystemUI/res-keyguard/layout/keyguard_presentation.xml
packages/SystemUI/res-keyguard/layout/keyguard_status_area.xml
packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml
packages/SystemUI/res-keyguard/values/colors.xml
packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java

index 84ccb7c..cfa2914 100644 (file)
@@ -20,6 +20,6 @@ Copyright (C) 2014 The Android Open Source Project
     android:viewportHeight="24.0">
 
     <path
-        android:fillColor="@color/clock_gray"
+        android:fillColor="?attr/bgProtectSecondaryTextColor"
         android:pathData="M22.0,5.7l-4.6,-3.9l-1.3,1.5l4.6,3.9L22.0,5.7zM7.9,3.4L6.6,1.9L2.0,5.7l1.3,1.5L7.9,3.4zM12.5,8.0L11.0,8.0l0.0,6.0l4.7,2.9l0.8,-1.2l-4.0,-2.4L12.5,8.0zM12.0,4.0c-5.0,0.0 -9.0,4.0 -9.0,9.0c0.0,5.0 4.0,9.0 9.0,9.0s9.0,-4.0 9.0,-9.0C21.0,8.0 17.0,4.0 12.0,4.0zM12.0,20.0c-3.9,0.0 -7.0,-3.1 -7.0,-7.0c0.0,-3.9 3.1,-7.0 7.0,-7.0c3.9,0.0 7.0,3.1 7.0,7.0C19.0,16.9 15.9,20.0 12.0,20.0z"/>
 </vector>
index 920498f..87b1ee7 100644 (file)
@@ -41,7 +41,7 @@
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_gravity="center_horizontal|top"
-                android:textColor="@color/clock_white"
+                android:textColor="?attr/bgProtectTextColor"
                 android:singleLine="true"
                 style="@style/widget_big_thin"
                 android:format12Hour="@string/keyguard_widget_12_hours_format"
index ed415b8..52261e1 100644 (file)
@@ -28,7 +28,7 @@
     <TextClock android:id="@+id/date_view"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:textColor="@color/clock_white"
+        android:textColor="?attr/bgProtectTextColor"
         style="@style/widget_label"
         android:letterSpacing="0.15"
         android:gravity="center"
@@ -38,7 +38,7 @@
         android:layout_height="wrap_content"
         android:drawablePadding="6dp"
         android:drawableStart="@drawable/ic_access_alarms_big"
-        android:textColor="@color/clock_gray"
+        android:textColor="?attr/bgProtectSecondaryTextColor"
         android:letterSpacing="0.15"
         style="@style/widget_label"
         android:layout_marginStart="6dp"
index 51adc1e..44fae86 100644 (file)
@@ -40,7 +40,7 @@
             android:layout_gravity="center_horizontal"
             android:layout_centerHorizontal="true"
             android:layout_alignParentTop="true"
-            android:textColor="@color/clock_white"
+            android:textColor="?attr/bgProtectTextColor"
             android:singleLine="true"
             style="@style/widget_big_thin"
             android:format12Hour="@string/keyguard_widget_12_hours_format"
@@ -73,7 +73,7 @@
             android:layout_marginTop="@dimen/date_owner_info_margin"
             android:layout_centerHorizontal="true"
             android:layout_below="@id/keyguard_status_area"
-            android:textColor="@color/clock_gray"
+            android:textColor="?attr/bgProtectSecondaryTextColor"
             android:textSize="@dimen/widget_label_font_size"
             android:letterSpacing="0.05"
             android:ellipsize="marquee"
index 3998c5b..5071594 100644 (file)
@@ -14,8 +14,8 @@
      limitations under the License.
 -->
 <resources>
-
-    <!-- Clock -->
-    <color name="clock_white">#ffffffff</color>
-    <color name="clock_gray">@*android:color/secondary_text_default_material_dark</color>
+    <color name="keyguard_numpad_divider_light">#80FFFFFF</color> <!-- 50% white -->
+    <color name="keyguard_numpad_divider_dark">#FF9FA4A6</color>
+    <color name="keyguard_numpad_delete_light">#FFFFFFFF</color>
+    <color name="keyguard_numpad_delete_dark">@color/material_grey_600</color>
 </resources>
index db1e8a9..988ab04 100644 (file)
@@ -21,7 +21,9 @@ import android.app.AlarmManager;
 import android.content.Context;
 import android.content.res.Configuration;
 import android.content.res.Resources;
+import android.graphics.Color;
 import android.os.UserHandle;
+import android.support.v4.graphics.ColorUtils;
 import android.text.TextUtils;
 import android.text.format.DateFormat;
 import android.util.AttributeSet;
@@ -56,7 +58,8 @@ public class KeyguardStatusView extends GridLayout {
 
     private View[] mVisibleInDoze;
     private boolean mPulsing;
-    private boolean mDark;
+    private float mDarkAmount;
+    private int mTextColor;
 
     private KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {
 
@@ -124,6 +127,7 @@ public class KeyguardStatusView extends GridLayout {
         mOwnerInfo = findViewById(R.id.owner_info);
         mBatteryDoze = findViewById(R.id.battery_doze);
         mVisibleInDoze = new View[]{mBatteryDoze, mClockView};
+        mTextColor = mClockView.getCurrentTextColor();
 
         boolean shouldMarquee = KeyguardUpdateMonitor.getInstance(mContext).isDeviceInteractive();
         setEnableMarquee(shouldMarquee);
@@ -281,12 +285,13 @@ public class KeyguardStatusView extends GridLayout {
         }
     }
 
-    public void setDark(boolean dark) {
-        if (mDark == dark) {
+    public void setDark(float darkAmount) {
+        if (mDarkAmount == darkAmount) {
             return;
         }
-        mDark = dark;
+        mDarkAmount = darkAmount;
 
+        boolean dark = darkAmount == 1;
         final int N = mClockContainer.getChildCount();
         for (int i = 0; i < N; i++) {
             View child = mClockContainer.getChildAt(i);
@@ -297,6 +302,7 @@ public class KeyguardStatusView extends GridLayout {
         }
         updateDozeVisibleViews();
         mBatteryDoze.setDark(dark);
+        mClockView.setTextColor(ColorUtils.blendARGB(mTextColor, Color.WHITE, darkAmount));
     }
 
     public void setPulsing(boolean pulsing) {
@@ -306,7 +312,7 @@ public class KeyguardStatusView extends GridLayout {
 
     private void updateDozeVisibleViews() {
         for (View child : mVisibleInDoze) {
-            child.setAlpha(mDark && mPulsing ? 0.8f : 1);
+            child.setAlpha(mDarkAmount == 1 && mPulsing ? 0.8f : 1);
         }
     }
 }
index 3dc6827..4009db6 100644 (file)
@@ -2550,7 +2550,7 @@ public class NotificationPanelView extends PanelView implements
 
     private void setDarkAmount(float amount) {
         mDarkAmount = amount;
-        mKeyguardStatusView.setDark(amount == 1);
+        mKeyguardStatusView.setDark(mDarkAmount);
         positionClockAndNotifications();
     }