summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-08-26 22:52:31 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-08-26 22:52:32 +0000
commitf3542fd63f97be96c41a10f6a42e12af66888068 (patch)
treeda27bf043ea4e75976b2b9e5493c3d7f63292383
parent03740d74cae3afd4aeaaf3b20f12cfafdc3883a5 (diff)
parented6f14a20c69da3d221cc1acbaa31e74e837917c (diff)
downloadframeworks_base-f3542fd63f97be96c41a10f6a42e12af66888068.zip
frameworks_base-f3542fd63f97be96c41a10f6a42e12af66888068.tar.gz
frameworks_base-f3542fd63f97be96c41a10f6a42e12af66888068.tar.bz2
Merge "Make shadow alpha properties public, add lighting values for TV" into lmp-dev
-rw-r--r--api/current.txt2
-rw-r--r--core/java/android/view/ThreadedRenderer.java10
-rw-r--r--core/res/res/values-television/dimens.xml23
-rw-r--r--core/res/res/values/attrs.xml32
-rw-r--r--core/res/res/values/dimens.xml7
-rw-r--r--core/res/res/values/public.xml2
-rw-r--r--core/res/res/values/styles.xml8
-rw-r--r--core/res/res/values/symbols.xml1
-rw-r--r--core/res/res/values/themes.xml11
-rw-r--r--packages/SystemUI/res/values/styles.xml5
10 files changed, 69 insertions, 32 deletions
diff --git a/api/current.txt b/api/current.txt
index 96a1a2a..351a2d8 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -327,6 +327,7 @@ package android {
field public static final int alwaysRetainTaskState = 16843267; // 0x1010203
field public static final int amPmBackgroundColor = 16843942; // 0x10104a6
field public static final int amPmTextColor = 16843941; // 0x10104a5
+ field public static final int ambientShadowAlpha = 16843967; // 0x10104bf
field public static final int angle = 16843168; // 0x10101a0
field public static final int animateFirstView = 16843477; // 0x10102d5
field public static final int animateLayoutChanges = 16843506; // 0x10102f2
@@ -1147,6 +1148,7 @@ package android {
field public static final int spinnersShown = 16843595; // 0x101034b
field public static final int splitMotionEvents = 16843503; // 0x10102ef
field public static final int splitTrack = 16843852; // 0x101044c
+ field public static final int spotShadowAlpha = 16843968; // 0x10104c0
field public static final int src = 16843033; // 0x1010119
field public static final int ssp = 16843747; // 0x10103e3
field public static final int sspPattern = 16843749; // 0x10103e5
diff --git a/core/java/android/view/ThreadedRenderer.java b/core/java/android/view/ThreadedRenderer.java
index 50341fc..3af214d 100644
--- a/core/java/android/view/ThreadedRenderer.java
+++ b/core/java/android/view/ThreadedRenderer.java
@@ -99,15 +99,13 @@ public class ThreadedRenderer extends HardwareRenderer {
private boolean mRootNodeNeedsUpdate;
ThreadedRenderer(Context context, boolean translucent) {
- final TypedArray a = context.obtainStyledAttributes(
- null, R.styleable.Lighting, R.attr.lightingStyle, 0);
+ final TypedArray a = context.obtainStyledAttributes(null, R.styleable.Lighting, 0, 0);
mLightY = a.getDimension(R.styleable.Lighting_lightY, 0);
mLightZ = a.getDimension(R.styleable.Lighting_lightZ, 0);
mLightRadius = a.getDimension(R.styleable.Lighting_lightRadius, 0);
- mAmbientShadowAlpha = Math.round(
- 255 * a.getFloat(R.styleable.Lighting_ambientShadowAlpha, 0));
- mSpotShadowAlpha = Math.round(
- 255 * a.getFloat(R.styleable.Lighting_spotShadowAlpha, 0));
+ mAmbientShadowAlpha =
+ (int) (255 * a.getFloat(R.styleable.Lighting_ambientShadowAlpha, 0) + 0.5f);
+ mSpotShadowAlpha = (int) (255 * a.getFloat(R.styleable.Lighting_spotShadowAlpha, 0) + 0.5f);
a.recycle();
long rootNodePtr = nCreateRootRenderNode();
diff --git a/core/res/res/values-television/dimens.xml b/core/res/res/values-television/dimens.xml
new file mode 100644
index 0000000..8266642
--- /dev/null
+++ b/core/res/res/values-television/dimens.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+<resources>
+
+ <!-- Lighting and shadow properties -->
+ <dimen name="light_y">-300dp</dimen>
+ <item type="dimen" format="float" name="ambient_shadow_alpha">0.4</item>
+ <item type="dimen" format="float" name="spot_shadow_alpha">0.4</item>
+
+</resources>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 7023837..d8b129c 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -1012,13 +1012,25 @@
<!-- The color applied to framework switch thumbs in their normal state. -->
<attr name="colorSwitchThumbNormal" format="color" />
- <!-- ================== -->
- <!-- Hardware rendering -->
- <!-- ================== -->
+ <!-- =================== -->
+ <!-- Lighting properties -->
+ <!-- =================== -->
<eat-comment />
- <!-- Reference to the Lighting style. -->
- <attr name="lightingStyle" format="reference" />
+ <!-- @hide The default Y position of the light used to project view shadows. -->
+ <attr name="lightY" format="dimension" />
+
+ <!-- @hide The default Z position of the light used to project view shadows. -->
+ <attr name="lightZ" format="dimension" />
+
+ <!-- @hide The default radius of the light used to project view shadows. -->
+ <attr name="lightRadius" format="dimension" />
+
+ <!-- Alpha value of the ambient shadow projected by elevated views, between 0 and 1. -->
+ <attr name="ambientShadowAlpha" format="float" />
+
+ <!-- Alpha value of the spot shadow projected by elevated views, between 0 and 1. -->
+ <attr name="spotShadowAlpha" format="float" />
</declare-styleable>
<!-- **************************************************************** -->
@@ -7384,11 +7396,11 @@
<!-- @hide -->
<declare-styleable name="Lighting">
- <attr name="lightY" format="dimension" />
- <attr name="lightZ" format="dimension" />
- <attr name="lightRadius" format="dimension" />
- <attr name="ambientShadowAlpha" format="float" />
- <attr name="spotShadowAlpha" format="float" />
+ <attr name="lightY" />
+ <attr name="lightZ" />
+ <attr name="lightRadius" />
+ <attr name="ambientShadowAlpha" />
+ <attr name="spotShadowAlpha" />
</declare-styleable>
<declare-styleable name="RestrictionEntry">
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index f6c19d9..4e3abb9 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -405,4 +405,11 @@
<dimen name="text_handle_min_size">40dp</dimen>
+ <!-- Lighting and shadow properties -->
+ <dimen name="light_y">-200dp</dimen>
+ <dimen name="light_z">800dp</dimen>
+ <dimen name="light_radius">800dp</dimen>
+ <item type="dimen" format="float" name="ambient_shadow_alpha">0.06</item>
+ <item type="dimen" format="float" name="spot_shadow_alpha">0.16</item>
+
</resources>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 07874c7..82125fe 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2278,6 +2278,8 @@
<public type="attr" name="windowSharedElementsUseOverlay" />
<public type="attr" name="reparent" />
<public type="attr" name="reparentWithOverlay" />
+ <public type="attr" name="ambientShadowAlpha" />
+ <public type="attr" name="spotShadowAlpha" />
<public-padding type="dimen" name="l_resource_pad" end="0x01050010" />
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index bb0be48..4aed037 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -1355,12 +1355,4 @@ please see styles_device_defaults.xml.
<item name="padding">16dp</item>
</style>
- <style name="Lighting">
- <item name="lightY">-200dp</item>
- <item name="lightZ">800dp</item>
- <item name="lightRadius">800dp</item>
- <item name="ambientShadowAlpha">0.06</item>
- <item name="spotShadowAlpha">0.16</item>
- </style>
-
</resources>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 723f30c..d8c29b0 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1977,7 +1977,6 @@
<java-symbol type="string" name="whichEditApplicationNamed" />
<java-symbol type="string" name="whichSendApplication" />
<java-symbol type="string" name="whichSendApplicationNamed" />
- <java-symbol type="attr" name="lightingStyle" />
<java-symbol type="attr" name="lightY" />
<java-symbol type="attr" name="lightZ" />
<java-symbol type="attr" name="lightRadius" />
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 5445816..48de5ad 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -410,14 +410,19 @@ please see themes_device_defaults.xml.
<item name="fastScrollPreviewBackgroundLeft">@drawable/menu_submenu_background</item>
<item name="fastScrollOverlayPosition">floating</item>
<item name="fastScrollTextColor">@color/primary_text_dark</item>
+
<!-- Pointer style -->
<item name="pointerStyle">@style/Pointer</item>
- <!-- Accessibility focused drawable. -->
+ <!-- Accessibility focused drawable -->
<item name="accessibilityFocusedDrawable">@drawable/view_accessibility_focused</item>
- <!-- Lighting and shadow style. -->
- <item name="lightingStyle">@style/Lighting</item>
+ <!-- Lighting and shadow properties -->
+ <item name="lightY">@dimen/light_y</item>
+ <item name="lightZ">@dimen/light_z</item>
+ <item name="lightRadius">@dimen/light_radius</item>
+ <item name="ambientShadowAlpha">@dimen/ambient_shadow_alpha</item>
+ <item name="spotShadowAlpha">@dimen/spot_shadow_alpha</item>
</style>
<!-- Variant of {@link #Theme} with no title bar -->
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index 8c1ac9f..b39fe24 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -33,11 +33,8 @@
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowAnimationStyle">@style/Animation.RecentsActivity</item>
- <item name="*android:lightingStyle">@style/RecentsLighting</item>
- </style>
- <style name="RecentsLighting" parent="@*android:style/Lighting">
- <item name="*android:ambientShadowAlpha">0.30</item>
+ <item name="android:ambientShadowAlpha">0.30</item>
</style>
<!-- Animations for a non-full-screen window or activity. -->