Apply LightActionBar theme to Settings app.
Bug: 33558692
Test: visual
Test: RunSettingsRoboTests
Change-Id: I9f0fb71eb0cd0c58ac3b0f69544adec963faf2dd
diff --git a/res/drawable/ic_search_24dp.xml b/res/drawable/ic_search_24dp.xml
new file mode 100644
index 0000000..4693dd7
--- /dev/null
+++ b/res/drawable/ic_search_24dp.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 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.
+ -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:pathData="M15.5,14l-0.8,0l-0.3,-0.3c1,-1.1 1.6,-2.6 1.6,-4.2C16,5.9 13.1,3 9.5,3C5.9,3 3,5.9 3,9.5S5.9,16 9.5,16c1.6,0 3.1,-0.6 4.2,-1.6l0.3,0.3l0,0.8l5,5l1.5,-1.5L15.5,14zM9.5,14C7,14 5,12 5,9.5S7,5 9.5,5C12,5 14,7 14,9.5S12,14 9.5,14z"
+ android:fillColor="#ffffff"/>
+</vector>
diff --git a/res/layout/apps_filter_spinner.xml b/res/layout/apps_filter_spinner.xml
index b8b5c90..3ba7404 100644
--- a/res/layout/apps_filter_spinner.xml
+++ b/res/layout/apps_filter_spinner.xml
@@ -18,7 +18,6 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
- android:background="@drawable/switchbar_background"
android:gravity="center_vertical"
android:paddingEnd="@dimen/switchbar_subsettings_margin_end"
android:theme="?attr/switchBarTheme" >
diff --git a/res/values/styles.xml b/res/values/styles.xml
index ce7ddaa..35b06eb 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -437,5 +437,4 @@
</style>
<style name="AppActionPrimaryButton" parent="android:Widget.Material.Button.Colored"/>
-
</resources>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 92a1efd..abbe3a7 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -120,7 +120,7 @@
layouts against a remote context using our local theme colors. Due to the implementation
details of Theme, we can't reference any local resources and MUST instead use the values
directly. So use #ff263238 instead of @color/theme_primary and so on. -->
- <style name="Theme.SettingsBase" parent="@android:style/Theme.DeviceDefault.Settings" />
+ <style name="Theme.SettingsBase" parent="@*android:style/Theme.DeviceDefault.Settings.LightActionBar" />
<style name="Theme.Settings" parent="Theme.SettingsBase">
<item name="preferenceTheme">@style/PreferenceTheme</item>
@@ -175,7 +175,7 @@
<item name="android:backgroundDimEnabled">false</item>
</style>
- <style name="Theme.ActionBar" parent="@android:style/Widget.Material.ActionBar.Solid">
+ <style name="Theme.ActionBar" parent="@android:style/Widget.DeviceDefault.Light.ActionBar">
<item name="android:contentInsetStart">@dimen/actionbar_contentInsetStart</item>
</style>
@@ -183,16 +183,16 @@
<item name="android:contentInsetStart">@dimen/actionbar_subsettings_contentInsetStart</item>
</style>
- <style name="ThemeOverlay.SwitchBar.Settings" parent="@*android:style/ThemeOverlay.DeviceDefault.Dark.ActionBar.Accent">
+ <style name="ThemeOverlay.SwitchBar.Settings" parent="@*android:style/ThemeOverlay.DeviceDefault.ActionBar.Accent">
<item name="switchBarMarginStart">@dimen/switchbar_subsettings_margin_start</item>
<item name="switchBarMarginEnd">@dimen/switchbar_subsettings_margin_end</item>
- <item name="switchBarBackgroundColor">?android:attr/colorSecondary</item>
+ <item name="switchBarBackgroundColor">?android:attr/colorBackground</item>
</style>
- <style name="ThemeOverlay.SwitchBar.SubSettings" parent="@android:style/ThemeOverlay.Material.Dark.ActionBar">
+ <style name="ThemeOverlay.SwitchBar.SubSettings" parent="@*android:style/ThemeOverlay.DeviceDefault.ActionBar.Accent">
<item name="switchBarMarginStart">@dimen/switchbar_subsettings_margin_start</item>
<item name="switchBarMarginEnd">@dimen/switchbar_subsettings_margin_end</item>
- <item name="switchBarBackgroundColor">?android:attr/colorSecondary</item>
+ <item name="switchBarBackgroundColor">?android:attr/colorBackground</item>
</style>
<style name="Theme.DialogWhenLarge" parent="@*android:style/Theme.DeviceDefault.Settings.DialogWhenLarge">
@@ -217,8 +217,7 @@
<style name="Theme.SubSettingsDialogWhenLarge" parent="Theme.DialogWhenLarge">
<item name="preferenceTheme">@style/PreferenceTheme</item>
<item name="android:actionBarWidgetTheme">@null</item>
- <item name="android:actionBarTheme">@android:style/ThemeOverlay.Material.Dark.ActionBar</item>
-
+ <item name="android:actionBarTheme">@*android:style/ThemeOverlay.DeviceDefault.ActionBar.Accent</item>
<item name="preferenceBackgroundColor">@drawable/preference_background</item>
</style>
diff --git a/src/com/android/settings/search2/SearchFeatureProviderImpl.java b/src/com/android/settings/search2/SearchFeatureProviderImpl.java
index acb90b7..5aa21df 100644
--- a/src/com/android/settings/search2/SearchFeatureProviderImpl.java
+++ b/src/com/android/settings/search2/SearchFeatureProviderImpl.java
@@ -46,7 +46,7 @@
}
String menuTitle = activity.getString(R.string.search_menu);
MenuItem menuItem = menu.add(Menu.NONE, Menu.NONE, Menu.NONE, menuTitle)
- .setIcon(R.drawable.abc_ic_search_api_material)
+ .setIcon(R.drawable.ic_search_24dp)
.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
diff --git a/tests/robotests/res/values/themes.xml b/tests/robotests/res/values/themes.xml
new file mode 100644
index 0000000..b91df65
--- /dev/null
+++ b/tests/robotests/res/values/themes.xml
@@ -0,0 +1,3 @@
+<resources>
+ <style name="Theme.Settings" parent="@android:style/Theme.DeviceDefault.Settings"/>
+</resources>
diff --git a/tests/robotests/src/com/android/settings/SettingsRobolectricTestRunner.java b/tests/robotests/src/com/android/settings/SettingsRobolectricTestRunner.java
index 4472025..668fc88 100644
--- a/tests/robotests/src/com/android/settings/SettingsRobolectricTestRunner.java
+++ b/tests/robotests/src/com/android/settings/SettingsRobolectricTestRunner.java
@@ -15,9 +15,9 @@
*/
package com.android.settings;
-import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
+
import org.junit.runners.model.InitializationError;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
@@ -55,10 +55,10 @@
// Using the manifest file's relative path, we can figure out the application directory.
final String appRoot = "packages/apps/Settings";
final String manifestPath = appRoot + "/AndroidManifest.xml";
- final String resDir = appRoot + "/res";
+ final String resDir = appRoot + "/tests/robotests/res";
final String assetsDir = appRoot + config.assetDir();
- // By adding any resources from libraries we need to the AndroidManifest, we can access
+ // By adding any resources from libraries we need the AndroidManifest, we can access
// them from within the parallel universe's resource loader.
final AndroidManifest manifest = new AndroidManifest(Fs.fileFromPath(manifestPath),
Fs.fileFromPath(resDir), Fs.fileFromPath(assetsDir)) {
diff --git a/tests/robotests/src/com/android/settings/dashboard/SupportItemAdapterTest.java b/tests/robotests/src/com/android/settings/dashboard/SupportItemAdapterTest.java
index a877ed2..b0dfe61 100644
--- a/tests/robotests/src/com/android/settings/dashboard/SupportItemAdapterTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/SupportItemAdapterTest.java
@@ -18,37 +18,37 @@
import android.accounts.Account;
import android.app.Activity;
-import android.content.Context;
import android.content.Intent;
import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
+
+import com.android.settings.R;
+import com.android.settings.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
import com.android.settings.core.instrumentation.MetricsFeatureProvider;
import com.android.settings.dashboard.SupportItemAdapter.EscalationData;
import com.android.settings.overlay.SupportFeatureProvider;
-import java.util.List;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.Robolectric;
-import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
-import com.android.settings.R;
import org.robolectric.shadows.ShadowActivity;
+import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Mockito.verify;
-import static org.robolectric.Shadows.shadowOf;
import static org.mockito.Mockito.when;
-import static com.google.common.truth.Truth.assertThat;
+import static org.robolectric.Shadows.shadowOf;
-@RunWith(RobolectricTestRunner.class)
+@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public class SupportItemAdapterTest {
private static final String ACCOUNT_TYPE = "com.google";
@@ -106,9 +106,10 @@
@Test
public void testSetAccount_AccountEmpty_NotCrash() {
- when(mSupportFeatureProvider.getSupportEligibleAccounts(mActivity)).thenReturn(ZERO_ACCOUNT);
+ when(mSupportFeatureProvider.getSupportEligibleAccounts(mActivity)).thenReturn(
+ ZERO_ACCOUNT);
mSupportItemAdapter = new SupportItemAdapter(mActivity, null, mSupportFeatureProvider,
- mMetricsFeatureProvider, null);
+ mMetricsFeatureProvider, null);
// Should not crash in this method
mSupportItemAdapter.setAccounts(ONE_ACCOUNT);