Fix AlertDialog corner and color accent
- Add some attributes in Theme.AlertDialog Change-Id: Ifb9ca98ee11f6c82cda4a576d10b5fde54f788be Fixes: 110917586 Test: mannual
This commit is contained in:
@@ -46,7 +46,7 @@
|
|||||||
<item name="preferenceBackgroundColor">@drawable/preference_background</item>
|
<item name="preferenceBackgroundColor">@drawable/preference_background</item>
|
||||||
|
|
||||||
<!-- For all androidx version of AlertDialogs -->
|
<!-- 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>
|
<item name="*android:lockPatternStyle">@style/LockPatternStyle.Setup</item>
|
||||||
|
|
||||||
@@ -106,11 +106,15 @@
|
|||||||
<item name="android:windowSoftInputMode">adjustResize</item>
|
<item name="android:windowSoftInputMode">adjustResize</item>
|
||||||
</style>
|
</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>
|
<item name="android:windowSoftInputMode">adjustResize</item>
|
||||||
|
|
||||||
<!-- Redefine the ActionBar style for contentInsetStart -->
|
<!-- Redefine the ActionBar style for contentInsetStart -->
|
||||||
<item name="android:actionBarStyle">@style/Theme.ActionBar</item>
|
<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>
|
||||||
|
|
||||||
<style name="Theme.ConfirmDeviceCredentials" parent="Theme.SubSettings">
|
<style name="Theme.ConfirmDeviceCredentials" parent="Theme.SubSettings">
|
||||||
|
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
}
|
@@ -17,6 +17,7 @@
|
|||||||
package com.android.settings.wifi;
|
package com.android.settings.wifi;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import static org.mockito.Mockito.doReturn;
|
import static org.mockito.Mockito.doReturn;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -25,6 +26,7 @@ import android.net.wifi.WifiConfiguration;
|
|||||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||||
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
||||||
import com.android.settings.testutils.shadow.ShadowConnectivityManager;
|
import com.android.settings.testutils.shadow.ShadowConnectivityManager;
|
||||||
|
import com.android.settings.testutils.shadow.SettingsShadowTypedArray;
|
||||||
import com.android.settings.testutils.shadow.ShadowWifiManager;
|
import com.android.settings.testutils.shadow.ShadowWifiManager;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -39,9 +41,10 @@ import org.robolectric.util.ReflectionHelpers;
|
|||||||
|
|
||||||
@RunWith(SettingsRobolectricTestRunner.class)
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
@Config(shadows = {
|
@Config(shadows = {
|
||||||
SettingsShadowResources.SettingsShadowTheme.class,
|
SettingsShadowResources.SettingsShadowTheme.class,
|
||||||
ShadowConnectivityManager.class,
|
ShadowConnectivityManager.class,
|
||||||
ShadowWifiManager.class
|
SettingsShadowTypedArray.class,
|
||||||
|
ShadowWifiManager.class
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
public class WifiDialogActivityTest {
|
public class WifiDialogActivityTest {
|
||||||
@@ -78,7 +81,7 @@ public class WifiDialogActivityTest {
|
|||||||
Robolectric.buildActivity(
|
Robolectric.buildActivity(
|
||||||
WifiDialogActivity.class,
|
WifiDialogActivity.class,
|
||||||
new Intent().putExtra(WifiDialogActivity.KEY_CONNECT_FOR_CALLER, false))
|
new Intent().putExtra(WifiDialogActivity.KEY_CONNECT_FOR_CALLER, false))
|
||||||
.setup().get();
|
.setup().get();
|
||||||
WifiDialog dialog = (WifiDialog) ShadowAlertDialog.getLatestAlertDialog();
|
WifiDialog dialog = (WifiDialog) ShadowAlertDialog.getLatestAlertDialog();
|
||||||
assertThat(dialog).isNotNull();
|
assertThat(dialog).isNotNull();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user