Loading res/values/themes.xml +6 −2 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ <item name="preferenceBackgroundColor">@drawable/preference_background</item> <!-- For all androidx version of AlertDialogs --> <item name="alertDialogTheme">@style/Theme.AppCompat.DayNight.Dialog.Alert</item> <item name="alertDialogTheme">@style/Theme.AlertDialog</item> <item name="*android:lockPatternStyle">@style/LockPatternStyle.Setup</item> Loading Loading @@ -106,11 +106,15 @@ <item name="android:windowSoftInputMode">adjustResize</item> </style> <style name="Theme.AlertDialog" parent="@*android:style/Theme.DeviceDefault.Settings.Dialog.Alert"> <style name="Theme.AlertDialog" parent="@style/Theme.AppCompat.DayNight.Dialog.Alert"> <item name="android:windowSoftInputMode">adjustResize</item> <!-- Redefine the ActionBar style for contentInsetStart --> <item name="android:actionBarStyle">@style/Theme.ActionBar</item> <!-- copied from Theme.DeviceDefault.Light.Dialog.Alert --> <item name="colorAccent">@*android:color/accent_device_default_light</item> <item name="dialogCornerRadius">@*android:dimen/config_dialogCornerRadius</item> </style> <style name="Theme.ConfirmDeviceCredentials" parent="Theme.SubSettings"> Loading tests/robotests/src/com/android/settings/testutils/shadow/SettingsShadowTypedArray.java 0 → 100644 +47 −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.settings.testutils.shadow; import static org.robolectric.shadow.api.Shadow.directlyOn; import android.content.res.ColorStateList; import android.content.res.TypedArray; import android.graphics.Color; import androidx.annotation.Nullable; import androidx.annotation.StyleableRes; import org.robolectric.annotation.Implementation; import org.robolectric.annotation.Implements; import org.robolectric.annotation.RealObject; import org.robolectric.shadows.ShadowTypedArray; @Implements(value = TypedArray.class, inheritImplementationMethods = true) public class SettingsShadowTypedArray extends ShadowTypedArray { @RealObject TypedArray realTypedArray; @Implementation @Nullable public ColorStateList getColorStateList(@StyleableRes int index) { if (index == com.android.internal.R.styleable.TextView_textColorLink) { return ColorStateList.valueOf(Color.WHITE); } return directlyOn(realTypedArray, TypedArray.class).getColorStateList(index); } } tests/robotests/src/com/android/settings/wifi/WifiDialogActivityTest.java +7 −4 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.settings.wifi; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.doReturn; import android.content.Intent; Loading @@ -25,6 +26,7 @@ import android.net.wifi.WifiConfiguration; import com.android.settings.testutils.SettingsRobolectricTestRunner; import com.android.settings.testutils.shadow.SettingsShadowResources; import com.android.settings.testutils.shadow.ShadowConnectivityManager; import com.android.settings.testutils.shadow.SettingsShadowTypedArray; import com.android.settings.testutils.shadow.ShadowWifiManager; import org.junit.Before; Loading @@ -41,6 +43,7 @@ import org.robolectric.util.ReflectionHelpers; @Config(shadows = { SettingsShadowResources.SettingsShadowTheme.class, ShadowConnectivityManager.class, SettingsShadowTypedArray.class, ShadowWifiManager.class } ) Loading Loading
res/values/themes.xml +6 −2 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ <item name="preferenceBackgroundColor">@drawable/preference_background</item> <!-- For all androidx version of AlertDialogs --> <item name="alertDialogTheme">@style/Theme.AppCompat.DayNight.Dialog.Alert</item> <item name="alertDialogTheme">@style/Theme.AlertDialog</item> <item name="*android:lockPatternStyle">@style/LockPatternStyle.Setup</item> Loading Loading @@ -106,11 +106,15 @@ <item name="android:windowSoftInputMode">adjustResize</item> </style> <style name="Theme.AlertDialog" parent="@*android:style/Theme.DeviceDefault.Settings.Dialog.Alert"> <style name="Theme.AlertDialog" parent="@style/Theme.AppCompat.DayNight.Dialog.Alert"> <item name="android:windowSoftInputMode">adjustResize</item> <!-- Redefine the ActionBar style for contentInsetStart --> <item name="android:actionBarStyle">@style/Theme.ActionBar</item> <!-- copied from Theme.DeviceDefault.Light.Dialog.Alert --> <item name="colorAccent">@*android:color/accent_device_default_light</item> <item name="dialogCornerRadius">@*android:dimen/config_dialogCornerRadius</item> </style> <style name="Theme.ConfirmDeviceCredentials" parent="Theme.SubSettings"> Loading
tests/robotests/src/com/android/settings/testutils/shadow/SettingsShadowTypedArray.java 0 → 100644 +47 −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.settings.testutils.shadow; import static org.robolectric.shadow.api.Shadow.directlyOn; import android.content.res.ColorStateList; import android.content.res.TypedArray; import android.graphics.Color; import androidx.annotation.Nullable; import androidx.annotation.StyleableRes; import org.robolectric.annotation.Implementation; import org.robolectric.annotation.Implements; import org.robolectric.annotation.RealObject; import org.robolectric.shadows.ShadowTypedArray; @Implements(value = TypedArray.class, inheritImplementationMethods = true) public class SettingsShadowTypedArray extends ShadowTypedArray { @RealObject TypedArray realTypedArray; @Implementation @Nullable public ColorStateList getColorStateList(@StyleableRes int index) { if (index == com.android.internal.R.styleable.TextView_textColorLink) { return ColorStateList.valueOf(Color.WHITE); } return directlyOn(realTypedArray, TypedArray.class).getColorStateList(index); } }
tests/robotests/src/com/android/settings/wifi/WifiDialogActivityTest.java +7 −4 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.settings.wifi; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.doReturn; import android.content.Intent; Loading @@ -25,6 +26,7 @@ import android.net.wifi.WifiConfiguration; import com.android.settings.testutils.SettingsRobolectricTestRunner; import com.android.settings.testutils.shadow.SettingsShadowResources; import com.android.settings.testutils.shadow.ShadowConnectivityManager; import com.android.settings.testutils.shadow.SettingsShadowTypedArray; import com.android.settings.testutils.shadow.ShadowWifiManager; import org.junit.Before; Loading @@ -41,6 +43,7 @@ import org.robolectric.util.ReflectionHelpers; @Config(shadows = { SettingsShadowResources.SettingsShadowTheme.class, ShadowConnectivityManager.class, SettingsShadowTypedArray.class, ShadowWifiManager.class } ) Loading