Merge "Inherit theme dark/light scheme for MediaRouter dialogs/button" into oc-dr1-dev
@@ -24,6 +24,7 @@ import android.media.MediaRouter;
|
||||
import android.media.MediaRouter.RouteInfo;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -130,7 +131,8 @@ public class MediaRouteChooserDialog extends Dialog {
|
||||
|
||||
// Must be called after setContentView.
|
||||
getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,
|
||||
R.drawable.ic_media_route_off_holo_dark);
|
||||
isLightTheme(getContext()) ? R.drawable.ic_media_route_off_holo_light
|
||||
: R.drawable.ic_media_route_off_holo_dark);
|
||||
|
||||
mAdapter = new RouteAdapter(getContext());
|
||||
mListView = (ListView)findViewById(R.id.media_route_list);
|
||||
@@ -176,6 +178,12 @@ public class MediaRouteChooserDialog extends Dialog {
|
||||
}
|
||||
}
|
||||
|
||||
static boolean isLightTheme(Context context) {
|
||||
TypedValue value = new TypedValue();
|
||||
return context.getTheme().resolveAttribute(R.attr.isLightTheme, value, true)
|
||||
&& value.data != 0;
|
||||
}
|
||||
|
||||
private final class RouteAdapter extends ArrayAdapter<MediaRouter.RouteInfo>
|
||||
implements ListView.OnItemClickListener {
|
||||
private final LayoutInflater mInflater;
|
||||
|
||||
@@ -43,8 +43,12 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
|
||||
* </p>
|
||||
*/
|
||||
public MediaRouteChooserDialogFragment() {
|
||||
int theme = MediaRouteChooserDialog.isLightTheme(getContext())
|
||||
? android.R.style.Theme_DeviceDefault_Light_Dialog
|
||||
: android.R.style.Theme_DeviceDefault_Dialog;
|
||||
|
||||
setCancelable(true);
|
||||
setStyle(STYLE_NORMAL, android.R.style.Theme_DeviceDefault_Dialog);
|
||||
setStyle(STYLE_NORMAL, theme);
|
||||
}
|
||||
|
||||
public int getRouteTypes() {
|
||||
|
||||
@@ -71,16 +71,18 @@ public abstract class MediaRouteDialogPresenter {
|
||||
final MediaRouter router = (MediaRouter)context.getSystemService(
|
||||
Context.MEDIA_ROUTER_SERVICE);
|
||||
|
||||
int theme = MediaRouteChooserDialog.isLightTheme(context)
|
||||
? android.R.style.Theme_DeviceDefault_Light_Dialog
|
||||
: android.R.style.Theme_DeviceDefault_Dialog;
|
||||
|
||||
MediaRouter.RouteInfo route = router.getSelectedRoute();
|
||||
if (route.isDefault() || !route.matchesTypes(routeTypes)) {
|
||||
final MediaRouteChooserDialog d = new MediaRouteChooserDialog(
|
||||
context, android.R.style.Theme_DeviceDefault_Dialog);
|
||||
final MediaRouteChooserDialog d = new MediaRouteChooserDialog(context, theme);
|
||||
d.setRouteTypes(routeTypes);
|
||||
d.setExtendedSettingsClickListener(extendedSettingsClickListener);
|
||||
return d;
|
||||
} else {
|
||||
MediaRouteControllerDialog d = new MediaRouteControllerDialog(
|
||||
context, android.R.style.Theme_DeviceDefault_Dialog);
|
||||
MediaRouteControllerDialog d = new MediaRouteControllerDialog(context, theme);
|
||||
return d;
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 409 B |
BIN
core/res/res/drawable-hdpi/ic_media_route_disabled_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 495 B |
|
After Width: | Height: | Size: 461 B |
|
Before Width: | Height: | Size: 445 B |
BIN
core/res/res/drawable-hdpi/ic_media_route_off_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 559 B |
BIN
core/res/res/drawable-hdpi/ic_media_route_off_mtrl_light.png
Normal file
|
After Width: | Height: | Size: 538 B |
|
Before Width: | Height: | Size: 426 B |
BIN
core/res/res/drawable-hdpi/ic_media_route_on_0_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 659 B |
BIN
core/res/res/drawable-hdpi/ic_media_route_on_0_mtrl_light.png
Normal file
|
After Width: | Height: | Size: 622 B |
|
Before Width: | Height: | Size: 446 B |
BIN
core/res/res/drawable-hdpi/ic_media_route_on_1_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 673 B |
BIN
core/res/res/drawable-hdpi/ic_media_route_on_1_mtrl_light.png
Normal file
|
After Width: | Height: | Size: 640 B |
|
Before Width: | Height: | Size: 448 B |
BIN
core/res/res/drawable-hdpi/ic_media_route_on_2_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 674 B |
BIN
core/res/res/drawable-hdpi/ic_media_route_on_2_mtrl_light.png
Normal file
|
After Width: | Height: | Size: 650 B |
|
Before Width: | Height: | Size: 494 B |
BIN
core/res/res/drawable-hdpi/ic_media_route_on_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 644 B |
BIN
core/res/res/drawable-hdpi/ic_media_route_on_mtrl_light.png
Normal file
|
After Width: | Height: | Size: 627 B |
BIN
core/res/res/drawable-mdpi/ic_media_route_disabled_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 324 B |
|
After Width: | Height: | Size: 301 B |
BIN
core/res/res/drawable-mdpi/ic_media_route_off_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 406 B |
BIN
core/res/res/drawable-mdpi/ic_media_route_off_mtrl_light.png
Normal file
|
After Width: | Height: | Size: 389 B |
BIN
core/res/res/drawable-mdpi/ic_media_route_on_0_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 454 B |
BIN
core/res/res/drawable-mdpi/ic_media_route_on_0_mtrl_light.png
Normal file
|
After Width: | Height: | Size: 438 B |
BIN
core/res/res/drawable-mdpi/ic_media_route_on_1_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 458 B |
BIN
core/res/res/drawable-mdpi/ic_media_route_on_1_mtrl_light.png
Normal file
|
After Width: | Height: | Size: 439 B |
BIN
core/res/res/drawable-mdpi/ic_media_route_on_2_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 450 B |
BIN
core/res/res/drawable-mdpi/ic_media_route_on_2_mtrl_light.png
Normal file
|
After Width: | Height: | Size: 436 B |
BIN
core/res/res/drawable-mdpi/ic_media_route_on_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 451 B |
BIN
core/res/res/drawable-mdpi/ic_media_route_on_mtrl_light.png
Normal file
|
After Width: | Height: | Size: 443 B |
|
After Width: | Height: | Size: 603 B |
|
After Width: | Height: | Size: 609 B |
BIN
core/res/res/drawable-xhdpi/ic_media_route_off_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 752 B |
BIN
core/res/res/drawable-xhdpi/ic_media_route_off_mtrl_light.png
Normal file
|
After Width: | Height: | Size: 751 B |
BIN
core/res/res/drawable-xhdpi/ic_media_route_on_0_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 865 B |
BIN
core/res/res/drawable-xhdpi/ic_media_route_on_0_mtrl_light.png
Normal file
|
After Width: | Height: | Size: 860 B |
BIN
core/res/res/drawable-xhdpi/ic_media_route_on_1_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 899 B |
BIN
core/res/res/drawable-xhdpi/ic_media_route_on_1_mtrl_light.png
Normal file
|
After Width: | Height: | Size: 889 B |
BIN
core/res/res/drawable-xhdpi/ic_media_route_on_2_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 909 B |
BIN
core/res/res/drawable-xhdpi/ic_media_route_on_2_mtrl_light.png
Normal file
|
After Width: | Height: | Size: 889 B |
BIN
core/res/res/drawable-xhdpi/ic_media_route_on_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 875 B |
BIN
core/res/res/drawable-xhdpi/ic_media_route_on_mtrl_light.png
Normal file
|
After Width: | Height: | Size: 877 B |
|
After Width: | Height: | Size: 891 B |
|
After Width: | Height: | Size: 889 B |
BIN
core/res/res/drawable-xxhdpi/ic_media_route_off_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
core/res/res/drawable-xxhdpi/ic_media_route_off_mtrl_light.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
core/res/res/drawable-xxhdpi/ic_media_route_on_0_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
core/res/res/drawable-xxhdpi/ic_media_route_on_0_mtrl_light.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
core/res/res/drawable-xxhdpi/ic_media_route_on_1_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
core/res/res/drawable-xxhdpi/ic_media_route_on_1_mtrl_light.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
core/res/res/drawable-xxhdpi/ic_media_route_on_2_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
core/res/res/drawable-xxhdpi/ic_media_route_on_2_mtrl_light.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
core/res/res/drawable-xxhdpi/ic_media_route_on_mtrl_dark.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
core/res/res/drawable-xxhdpi/ic_media_route_on_mtrl_light.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2014 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.
|
||||
-->
|
||||
|
||||
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:oneshot="false">
|
||||
<item android:duration="500">
|
||||
<bitmap android:src="@drawable/ic_media_route_on_0_mtrl_alpha"
|
||||
android:tint="?attr/colorControlNormal" />
|
||||
</item>
|
||||
<item android:duration="500">
|
||||
<bitmap android:src="@drawable/ic_media_route_on_1_mtrl_alpha"
|
||||
android:tint="?attr/colorControlNormal" />
|
||||
</item>
|
||||
<item android:duration="500">
|
||||
<bitmap android:src="@drawable/ic_media_route_on_2_mtrl_alpha"
|
||||
android:tint="?attr/colorControlNormal" />
|
||||
</item>
|
||||
<item android:duration="500">
|
||||
<bitmap android:src="@drawable/ic_media_route_on_1_mtrl_alpha"
|
||||
android:tint="?attr/colorControlNormal" />
|
||||
</item>
|
||||
</animation-list>
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="true" android:state_enabled="true"
|
||||
android:drawable="@android:drawable/ic_media_route_connecting_material" />
|
||||
android:drawable="@android:drawable/ic_media_route_connecting_material_dark" />
|
||||
<item android:state_activated="true" android:state_enabled="true">
|
||||
<bitmap android:src="@android:drawable/ic_media_route_on_mtrl_alpha"
|
||||
android:tint="?attr/colorControlNormal" />
|
||||
33
core/res/res/drawable/ic_media_route_material_light.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2014 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.
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="true" android:state_enabled="true"
|
||||
android:drawable="@android:drawable/ic_media_route_connecting_material_light" />
|
||||
<item android:state_activated="true" android:state_enabled="true">
|
||||
<bitmap android:src="@android:drawable/ic_media_route_on_mtrl_alpha"
|
||||
android:tint="?attr/colorControlNormal" />
|
||||
</item>
|
||||
<item android:state_enabled="true">
|
||||
<bitmap android:src="@android:drawable/ic_media_route_off_mtrl_alpha"
|
||||
android:tint="?attr/colorControlNormal" />
|
||||
</item>
|
||||
<item>
|
||||
<bitmap android:src="@android:drawable/ic_media_route_disabled_mtrl_alpha"
|
||||
android:tint="?attr/colorControlNormal" />
|
||||
</item>
|
||||
</selector>
|
||||
@@ -66,8 +66,10 @@
|
||||
<item>@drawable/ic_find_previous_material</item>
|
||||
<item>@drawable/ic_go</item>
|
||||
<item>@drawable/ic_go_search_api_material</item>
|
||||
<item>@drawable/ic_media_route_connecting_material</item>
|
||||
<item>@drawable/ic_media_route_material</item>
|
||||
<item>@drawable/ic_media_route_connecting_material_dark</item>
|
||||
<item>@drawable/ic_media_route_connecting_material_light</item>
|
||||
<item>@drawable/ic_media_route_material_dark</item>
|
||||
<item>@drawable/ic_media_route_material_light</item>
|
||||
<item>@drawable/ic_menu_close_clear_cancel</item>
|
||||
<item>@drawable/ic_menu_copy_material</item>
|
||||
<item>@drawable/ic_menu_cut_material</item>
|
||||
|
||||
@@ -1054,7 +1054,7 @@ please see styles_device_defaults.xml.
|
||||
</style>
|
||||
|
||||
<style name="Widget.Material.MediaRouteButton" parent ="Widget.Material.ActionButton">
|
||||
<item name="externalRouteEnabledDrawable">@drawable/ic_media_route_material</item>
|
||||
<item name="externalRouteEnabledDrawable">@drawable/ic_media_route_material_dark</item>
|
||||
<item name="contentDescription">@string/media_route_button_content_description</item>
|
||||
</style>
|
||||
|
||||
@@ -1203,7 +1203,10 @@ please see styles_device_defaults.xml.
|
||||
<style name="Widget.Material.Light.ActionBar" parent="Widget.Material.ActionBar" />
|
||||
<style name="Widget.Material.Light.ActionBar.Solid" parent="Widget.Material.ActionBar.Solid" />
|
||||
<style name="Widget.Material.Light.FastScroll" parent="Widget.Material.FastScroll"/>
|
||||
<style name="Widget.Material.Light.MediaRouteButton" parent="Widget.Material.MediaRouteButton" />
|
||||
|
||||
<style name="Widget.Material.Light.MediaRouteButton" parent ="Widget.Material.MediaRouteButton">
|
||||
<item name="externalRouteEnabledDrawable">@drawable/ic_media_route_material_light</item>
|
||||
</style>
|
||||
|
||||
<!-- Animation Styles -->
|
||||
|
||||
|
||||
@@ -1318,10 +1318,8 @@
|
||||
<java-symbol type="drawable" name="unlock_wave" />
|
||||
<java-symbol type="drawable" name="notification_template_icon_bg" />
|
||||
<java-symbol type="drawable" name="notification_template_icon_low_bg" />
|
||||
<java-symbol type="drawable" name="ic_media_route_on_holo_dark" />
|
||||
<java-symbol type="drawable" name="ic_media_route_off_holo_dark" />
|
||||
<java-symbol type="drawable" name="ic_media_route_connecting_holo_dark" />
|
||||
<java-symbol type="drawable" name="ic_media_route_disabled_holo_dark" />
|
||||
<java-symbol type="drawable" name="ic_media_route_off_holo_light" />
|
||||
<java-symbol type="drawable" name="cling_button" />
|
||||
<java-symbol type="drawable" name="cling_arrow_up" />
|
||||
<java-symbol type="drawable" name="cling_bg" />
|
||||
|
||||
@@ -307,6 +307,9 @@
|
||||
<item name="android:colorControlHighlight">@*android:color/primary_text_material_dark</item>
|
||||
<item name="*android:lockPatternStyle">@style/LockPatternStyle</item>
|
||||
<item name="passwordStyle">@style/PasswordTheme</item>
|
||||
|
||||
<!-- Needed for MediaRoute chooser dialog -->
|
||||
<item name="*android:isLightTheme">false</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.SystemUI.Light" parent="@*android:style/Theme.DeviceDefault.QuickSettings">
|
||||
|
||||