Fix AlertDialog corner and color accent

- Add some attributes in Theme.AlertDialog

Change-Id: Ifb9ca98ee11f6c82cda4a576d10b5fde54f788be
Fixes: 110917586
Test: mannual
This commit is contained in:
Raff Tsai
2018-07-17 09:59:58 +08:00
parent 7eea41f5af
commit 0810afee9b
3 changed files with 60 additions and 6 deletions

View File

@@ -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>
@@ -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">

View File

@@ -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);
}
}

View File

@@ -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;
@@ -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;
@@ -41,6 +43,7 @@ import org.robolectric.util.ReflectionHelpers;
@Config(shadows = {
SettingsShadowResources.SettingsShadowTheme.class,
ShadowConnectivityManager.class,
SettingsShadowTypedArray.class,
ShadowWifiManager.class
}
)