Loading packages/SystemUI/res-keyguard/layout/keyguard_status_area.xml +1 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ android:layout_marginBottom="7dp" android:paddingStart="64dp" android:paddingEnd="64dp" android:textColor="?attr/wallpaperTextColor" android:theme="@style/TextAppearance.Keyguard" /> <LinearLayout android:id="@+id/row" Loading packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml +1 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ android:layout_marginTop="22dp" android:layout_below="@id/clock_view" android:background="#f00" android:backgroundTint="?attr/wallpaperTextColor" android:layout_centerHorizontal="true" /> <include layout="@layout/keyguard_status_area" Loading packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java +10 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.keyguard; import android.annotation.ColorInt; import android.app.PendingIntent; import android.arch.lifecycle.LiveData; import android.arch.lifecycle.Observer; Loading @@ -34,6 +35,7 @@ import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.graphics.ColorUtils; import com.android.settingslib.Utils; import com.android.systemui.Dependency; Loading Loading @@ -307,10 +309,17 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe } } public int getTextColor() { @VisibleForTesting int getTextColor() { return ColorUtils.blendARGB(mTextColor, Color.WHITE, mDarkAmount); } @VisibleForTesting void setTextColor(@ColorInt int textColor) { mTextColor = textColor; updateTextColors(); } /** * Representation of an item that appears under the clock on main keyguard message. */ Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardSliceViewTest.java 0 → 100644 +54 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 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 */ package com.android.keyguard; import android.graphics.Color; import android.test.suitebuilder.annotation.SmallTest; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper.RunWithLooper; import android.view.LayoutInflater; import com.android.systemui.SysuiTestCase; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @SmallTest @RunWithLooper @RunWith(AndroidTestingRunner.class) public class KeyguardSliceViewTest extends SysuiTestCase { private KeyguardSliceView mKeyguardSliceView; @Before public void setUp() throws Exception { mKeyguardSliceView = (KeyguardSliceView) LayoutInflater.from(getContext()) .inflate(R.layout.keyguard_status_area, null); } @Test public void getTextColor_whiteTextWhenAOD() { // Set text color to red since the default is white and test would always pass mKeyguardSliceView.setTextColor(Color.RED); mKeyguardSliceView.setDark(0); Assert.assertEquals("Should be using regular text color", Color.RED, mKeyguardSliceView.getTextColor()); mKeyguardSliceView.setDark(1); Assert.assertEquals("Should be using AOD text color", Color.WHITE, mKeyguardSliceView.getTextColor()); } } No newline at end of file Loading
packages/SystemUI/res-keyguard/layout/keyguard_status_area.xml +1 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ android:layout_marginBottom="7dp" android:paddingStart="64dp" android:paddingEnd="64dp" android:textColor="?attr/wallpaperTextColor" android:theme="@style/TextAppearance.Keyguard" /> <LinearLayout android:id="@+id/row" Loading
packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml +1 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ android:layout_marginTop="22dp" android:layout_below="@id/clock_view" android:background="#f00" android:backgroundTint="?attr/wallpaperTextColor" android:layout_centerHorizontal="true" /> <include layout="@layout/keyguard_status_area" Loading
packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java +10 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.keyguard; import android.annotation.ColorInt; import android.app.PendingIntent; import android.arch.lifecycle.LiveData; import android.arch.lifecycle.Observer; Loading @@ -34,6 +35,7 @@ import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.graphics.ColorUtils; import com.android.settingslib.Utils; import com.android.systemui.Dependency; Loading Loading @@ -307,10 +309,17 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe } } public int getTextColor() { @VisibleForTesting int getTextColor() { return ColorUtils.blendARGB(mTextColor, Color.WHITE, mDarkAmount); } @VisibleForTesting void setTextColor(@ColorInt int textColor) { mTextColor = textColor; updateTextColors(); } /** * Representation of an item that appears under the clock on main keyguard message. */ Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardSliceViewTest.java 0 → 100644 +54 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 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 */ package com.android.keyguard; import android.graphics.Color; import android.test.suitebuilder.annotation.SmallTest; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper.RunWithLooper; import android.view.LayoutInflater; import com.android.systemui.SysuiTestCase; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @SmallTest @RunWithLooper @RunWith(AndroidTestingRunner.class) public class KeyguardSliceViewTest extends SysuiTestCase { private KeyguardSliceView mKeyguardSliceView; @Before public void setUp() throws Exception { mKeyguardSliceView = (KeyguardSliceView) LayoutInflater.from(getContext()) .inflate(R.layout.keyguard_status_area, null); } @Test public void getTextColor_whiteTextWhenAOD() { // Set text color to red since the default is white and test would always pass mKeyguardSliceView.setTextColor(Color.RED); mKeyguardSliceView.setDark(0); Assert.assertEquals("Should be using regular text color", Color.RED, mKeyguardSliceView.getTextColor()); mKeyguardSliceView.setDark(1); Assert.assertEquals("Should be using AOD text color", Color.WHITE, mKeyguardSliceView.getTextColor()); } } No newline at end of file