summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.mk1
-rw-r--r--docs/html/auto/images/assets/02_a_notif.gifbin209808 -> 159726 bytes
-rw-r--r--docs/html/auto/images/assets/02_b_switcher.gifbin1119360 -> 1071430 bytes
-rw-r--r--docs/html/auto/images/assets/03_b_voice.gifbin136911 -> 143309 bytes
-rw-r--r--docs/html/guide/practices/verifying-apps-art.jd2
-rw-r--r--docs/html/images/tools/wizard2.pngbin0 -> 128450 bytes
-rw-r--r--docs/html/images/tools/wizard3.pngbin0 -> 147549 bytes
-rw-r--r--docs/html/images/tools/wizard4.pngbin0 -> 230102 bytes
-rw-r--r--docs/html/images/tools/wizard5.pngbin0 -> 171163 bytes
-rw-r--r--docs/html/images/tools/wizard6.pngbin0 -> 78865 bytes
-rw-r--r--docs/html/images/tools/wizard7.pngbin0 -> 737853 bytes
-rw-r--r--docs/html/preview/material/animations.jd189
-rw-r--r--docs/html/preview/material/compatibility.jd29
-rw-r--r--docs/html/preview/material/get-started.jd53
-rw-r--r--docs/html/preview/material/images/MaterialDark.pngbin179552 -> 88935 bytes
-rw-r--r--docs/html/preview/material/images/MaterialLight.pngbin171367 -> 82081 bytes
-rw-r--r--docs/html/preview/material/images/card_travel.pngbin2373669 -> 414026 bytes
-rw-r--r--docs/html/preview/material/images/list_mail.pngbin1012790 -> 191671 bytes
-rw-r--r--docs/html/preview/material/index.jd45
-rw-r--r--docs/html/preview/material/theme.jd51
-rw-r--r--docs/html/preview/material/ui-widgets.jd67
-rw-r--r--docs/html/preview/material/views-shadows.jd73
-rw-r--r--docs/html/preview/tv/adt-1/index.jd282
-rw-r--r--docs/html/preview/tv/adt-1/regulatory.jd79
-rw-r--r--docs/html/preview/tv/adt-1/safety.jd140
-rw-r--r--docs/html/preview/tv/games/index.jd70
-rw-r--r--docs/html/preview/tv/images/android-tv-remote.pngbin0 -> 532064 bytes
-rw-r--r--docs/html/preview/tv/images/home-recommendations.pngbin0 -> 297797 bytes
-rw-r--r--docs/html/preview/tv/index.jd22
-rw-r--r--docs/html/preview/tv/start/hardware-features.jd183
-rw-r--r--docs/html/preview/tv/start/index.jd233
-rw-r--r--docs/html/preview/tv/ui/browse.jd199
-rw-r--r--docs/html/preview/tv/ui/details.jd214
-rw-r--r--docs/html/preview/tv/ui/in-app-search.jd111
-rw-r--r--docs/html/preview/tv/ui/index.jd40
-rw-r--r--docs/html/preview/tv/ui/layouts.jd298
-rw-r--r--docs/html/preview/tv/ui/navigation.jd136
-rw-r--r--docs/html/preview/tv/ui/recommendations.jd209
-rw-r--r--docs/html/sdk/installing/create-project.jd86
-rw-r--r--docs/html/tools/tools_toc.cs4
-rw-r--r--docs/html/training/tv/index.jd59
-rw-r--r--docs/html/training/tv/optimizing-layouts-tv.jd246
-rw-r--r--docs/html/training/tv/optimizing-navigation-tv.jd206
-rw-r--r--docs/html/training/tv/unsupported-features-tv.jd157
-rw-r--r--docs/html/wear/images/hero.jpgbin248879 -> 443273 bytes
-rw-r--r--docs/html/wear/images/partners/arm.pngbin2711 -> 0 bytes
-rw-r--r--docs/html/wear/index.jd3
47 files changed, 3280 insertions, 207 deletions
diff --git a/Android.mk b/Android.mk
index 8fdcea2f8dff..60e8143e5398 100644
--- a/Android.mk
+++ b/Android.mk
@@ -721,6 +721,7 @@ LOCAL_DROIDDOC_OPTIONS:= \
$(framework_docs_LOCAL_DROIDDOC_OPTIONS) \
-toroot / \
-hdf android.whichdoc online \
+ -briefdocs \
$(sample_groups) \
-hdf android.hasSamples true \
-samplesdir $(samples_dir)
diff --git a/docs/html/auto/images/assets/02_a_notif.gif b/docs/html/auto/images/assets/02_a_notif.gif
index 6a830ae97d6c..9f3d35d6828e 100644
--- a/docs/html/auto/images/assets/02_a_notif.gif
+++ b/docs/html/auto/images/assets/02_a_notif.gif
Binary files differ
diff --git a/docs/html/auto/images/assets/02_b_switcher.gif b/docs/html/auto/images/assets/02_b_switcher.gif
index 626f94b74e0c..c4014e39f340 100644
--- a/docs/html/auto/images/assets/02_b_switcher.gif
+++ b/docs/html/auto/images/assets/02_b_switcher.gif
Binary files differ
diff --git a/docs/html/auto/images/assets/03_b_voice.gif b/docs/html/auto/images/assets/03_b_voice.gif
index ddd13e48ed31..b280a9b026ed 100644
--- a/docs/html/auto/images/assets/03_b_voice.gif
+++ b/docs/html/auto/images/assets/03_b_voice.gif
Binary files differ
diff --git a/docs/html/guide/practices/verifying-apps-art.jd b/docs/html/guide/practices/verifying-apps-art.jd
index 0eedfafbbd93..8a88222ee2a0 100644
--- a/docs/html/guide/practices/verifying-apps-art.jd
+++ b/docs/html/guide/practices/verifying-apps-art.jd
@@ -66,7 +66,7 @@ to prevent <a
href="{@docRoot}/tools/debugging/debugging-memory.html#LogMessages"><code>GC_FOR_ALLOC</code></a>-type
occurrences or to reduce fragmentation. You can verify which runtime is in use
by calling {@link java.lang.System#getProperty(java.lang.String)
-System.getProperty("dalvik.vm.version")}. If ART is in use, the property's value
+System.getProperty("java.vm.version")}. If ART is in use, the property's value
is <code>"2.0.0"</code> or higher.</p>
<p>Furthermore, a compacting garbage collector is under development in the <a
diff --git a/docs/html/images/tools/wizard2.png b/docs/html/images/tools/wizard2.png
new file mode 100644
index 000000000000..921d58c1421f
--- /dev/null
+++ b/docs/html/images/tools/wizard2.png
Binary files differ
diff --git a/docs/html/images/tools/wizard3.png b/docs/html/images/tools/wizard3.png
new file mode 100644
index 000000000000..d5749d53a1d3
--- /dev/null
+++ b/docs/html/images/tools/wizard3.png
Binary files differ
diff --git a/docs/html/images/tools/wizard4.png b/docs/html/images/tools/wizard4.png
new file mode 100644
index 000000000000..2709f7b8c1a7
--- /dev/null
+++ b/docs/html/images/tools/wizard4.png
Binary files differ
diff --git a/docs/html/images/tools/wizard5.png b/docs/html/images/tools/wizard5.png
new file mode 100644
index 000000000000..105cf2adfc25
--- /dev/null
+++ b/docs/html/images/tools/wizard5.png
Binary files differ
diff --git a/docs/html/images/tools/wizard6.png b/docs/html/images/tools/wizard6.png
new file mode 100644
index 000000000000..8b0691c9a7e1
--- /dev/null
+++ b/docs/html/images/tools/wizard6.png
Binary files differ
diff --git a/docs/html/images/tools/wizard7.png b/docs/html/images/tools/wizard7.png
new file mode 100644
index 000000000000..83396cfe4a69
--- /dev/null
+++ b/docs/html/images/tools/wizard7.png
Binary files differ
diff --git a/docs/html/preview/material/animations.jd b/docs/html/preview/material/animations.jd
index cee782a0289b..b8d063b8e5df 100644
--- a/docs/html/preview/material/animations.jd
+++ b/docs/html/preview/material/animations.jd
@@ -10,8 +10,9 @@ page.title=Animations
<li><a href="#reveal">Reveal Effect</a></li>
<li><a href="#transitions">Activity Transitions</a></li>
<li><a href="#curvedmotion">Curved Motion</a></li>
- <li><a href="#viewstate">View State Changes</a></li>
+ <li><a href="#viewstate">Animating View State Changes</a></li>
<li><a href="#drawabletint">Drawable Tinting</a></li>
+ <li><a href="#colorextract">Extracting Colors from an Image</a></li>
</ol>
</div>
</div>
@@ -32,19 +33,26 @@ APIs that let you customize these animations and create new ones:</p>
<h2 id="touch">Touch Feedback</h2>
-<p>In the Android L Developer Preview the default touch feedback animations for buttons use the new
+<p>The default touch feedback animations for buttons use the new
<code>RippleDrawable</code> class, which transitions between different states with a ripple
effect.</p>
-<p>To use this functionality in your custom views, create a <code>RippleDrawable</code> and set
-it as the background of your view. You can define a <code>RippleDrawable</code> as an XML resource
-using the <code>ripple</code> element.</p>
+<p>In most cases, this functionality should be applied in your view XML by specifying the
+background as <code>?android:attr/selectableItemBackground</code> for a bounded ripple or
+<code>?android:attr/selectableItemBackgroundBorderless</code> for a ripple that extends beyond
+the view bounds. You can also create a <code>RippleDrawable</code> and set
+it as the background of your view. Alternatively, you can define a <code>RippleDrawable</code>
+as an XML resource using the <code>ripple</code> element. The
+Android L Developer Preview animates the selection color with a ripple effect.</p>
+
+<p>You can assign a color to <code>RippleDrawable</code> objects. To change the default touch
+feedback color, use the theme's <code>android:colorControlHighlight</code> attribute.</p>
<h2 id="reveal">Reveal Effect</h2>
-<p>The <code>View.createRevealAnimator</code> method enables you to animate a clipping circle
-to reveal or hide a view.</p>
+<p>The <code>ViewAnimationUtils.createCircularReveal</code> method enables you to animate a
+clipping circle to reveal or hide a view.</p>
<p>To reveal a previously invisible view using this effect:</p>
@@ -61,7 +69,8 @@ int finalRadius = myView.getWidth();
// create and start the animator for this view
// (the start radius is zero)
-ValueAnimator anim = myView.createRevealAnimator(cx, cy, 0, finalRadius);
+ValueAnimator anim =
+ ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0, finalRadius);
anim.start();
</pre>
@@ -79,7 +88,8 @@ int cy = (myView.getTop() + myView.getBottom()) / 2;
int initialRadius = myView.getWidth();
// create the animation (the final radius is zero)
-ValueAnimator anim = myView.createRevealAnimator(cx, cy, initialRadius, 0);
+ValueAnimator anim =
+ ViewAnimationUtils.createCircularReveal(myView, cx, cy, initialRadius, 0);
// make the view invisible when the animation is done
anim.addListener(new AnimatorListenerAdapter() {
@@ -97,25 +107,48 @@ anim.start();
<h2 id="transitions">Activity Transitions</h2>
-<p>The Android L Developer Preview enables your app to customize the default animations for
-activity transitions. You can specify custom animations for enter and exit transitions and for
+<p>You can specify custom animations for enter and exit transitions and for
transitions of shared elements between activities.</p>
<ul>
- <li>An <strong>enter</strong> transition determines how views in an activity enter the scene.
- For example, in the <em>explode</em> enter transition the views enter the scene from outside
- and fly in towards the center of the screen.</li>
-
- <li>An <strong>exit</strong> transition determines how views in an activity exit the scene. For
- example, in the <em>explode</em> exit transition the views exit the scene away from the
- center.</li>
-
- <li>A <strong>shared elements</strong> transition determines how views that are shared between
- two activities transition between these activities. For example, if two activities have the same
- image in different positions and sizes, the <em>moveImage</em> shared element transition
- translates and scales the image smoothly between these activities.</li>
+<li>An <strong>enter</strong> transition determines how views in an activity enter the scene.
+For example, in the <em>explode</em> enter transition, the views enter the scene from the outside
+and fly in towards the center of the screen.</li>
+
+<li>An <strong>exit</strong> transition determines how views in an activity exit the scene. For
+ example, in the <em>explode</em> exit transition, the views exit the scene away from the
+center.</li>
+
+<li>A <strong>shared elements</strong> transition determines how views that are shared between
+two activities transition between these activities. For example, if two activities have the same
+image in different positions and sizes, the <em>moveImage</em> shared element transition
+translates and scales the image smoothly between these activities.</li>
+</ul>
+
+<p>The Android L Developer Preview supports these enter and exit transitions:</p>
+
+<ul>
+<li><em>explode</em> - Moves views in or out from the center of the scene.</li>
+<li><em>slide</em> - Moves views in or out from one of the edges of the scene.</li>
+<li><em>fade</em> - Mades views in or out of the scene.</li>
</ul>
+<p>Any transition that extends the <code>android.transition.Visibility</code> class is supported
+as an enter or exit transition. For more information, see the API reference for the
+<code>android.transition.Transition</code> class.</p>
+
+<p>The Android L Developer Preview also supports these shared elements transitions:</p>
+
+<ul>
+<li><em>changeBounds</em> - Animates the changes in layout bounds of target views.</li>
+<li><em>changeClipBounds</em> - Animates the changes in clip bounds of target views.</li>
+<li><em>changeTransform</em> - Animates the changes in scale and rotation of target views.</li>
+<li><em>moveImage</em> - Animates changes in size and scale type for an image view.</li>
+</ul>
+
+<p>When you enable activity transitions in your app, the default cross-fading transition is
+activated between the entering and exiting activities.</p>
+
<img src="/preview/material/images/SceneTransition.png" alt=""
id="figure1" style="width:600px;margin-top:20px"/>
<p class="img-caption">
@@ -125,7 +158,8 @@ transitions of shared elements between activities.</p>
<h3>Specify custom transitions</h3>
<p>First, enable window content transitions with the <code>android:windowContentTransitions</code>
-attribute when you define a style that inherits from the material theme:</p>
+attribute when you define a style that inherits from the material theme. You can also specify
+enter, exit, and shared element transitions in your style definition:</p>
<pre>
&lt;style name="BaseAppTheme" parent="android:Theme.Material">
@@ -144,21 +178,13 @@ attribute when you define a style that inherits from the material theme:</p>
&lt;/style>
</pre>
-<p>You can also specify enter, exit, and shared element transitions in your style definition.
-The <code>move_image</code> transition in this example is defined as follows:</p>
+<p>The <code>move_image</code> transition in this example is defined as follows:</p>
<pre>
&lt;!-- res/transition/move_image.xml -->
&lt;!-- (see also Shared Transitions below) -->
&lt;transitionSet xmlns:android="http://schemas.android.com/apk/res/android">
- &lt;moveImage>
- &lt;targets>
- &lt;!-- shared view in the first activity -->
- &lt;target android:targetId="@id/image_small" />
- &lt;!-- shared view in the second activity -->
- &lt;target android:targetId="@id/image_big" />
- &lt;/targets>
- &lt;/moveImage>
+ &lt;moveImage/>
&lt;/transitionSet>
</pre>
@@ -170,7 +196,7 @@ class. For more information, see the API reference for <code>android.transition.
<code>Window.requestFeature</code> method:</p>
<pre>
-// inside your activity
+// inside your activity (if you did not enable transitions in your theme)
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
// set an exit transition
@@ -187,6 +213,20 @@ object:</p>
<li><code>Window.setSharedElementExitTransition</code></li>
</ul>
+<p>The <code>setExitTransition</code> and <code>setSharedElementExitTransition</code> methods
+define the exit transition for the calling activity. The <code>setEnterTransition</code> and
+<code>setSharedElementEnterTransition</code> methods define the enter transition for the called
+activity.</p>
+
+<p>To get the full effect of a transition, you must enable window content transitions on both the
+calling and called activities. Otherwise, the calling activity will start the exit transition,
+but then you'll see a window transition (like scale or fade).</p>
+
+<p>To start an enter transition as soon as possible, use the
+<code>Window.setAllowEnterTransitionOverlap</code> method on the called activity. This lets you
+have more dramatic enter transitions. The same applies for the calling activity and exit
+transitions with the <code>Window.setAllowExitTransitionOverlap</code> method.</p>
+
<h3>Start an activity using transitions</h3>
<p>If you enable transitions and set an exit transition for an activity, the transition is activated
@@ -201,7 +241,7 @@ starts.</p>
<ol>
<li>Enable window content transitions in your style.</li>
<li>Specify a shared elements transition in your style.</li>
-<li>Define your transition as an XML resource specifying the IDs of the target views.</li>
+<li>Define your transition as an XML resource.</li>
<li>Assign a common name to the shared elements in both layouts with the
<code>android:viewName</code> attribute.</li>
<li>Use the <code>ActivityOptions.makeSceneTransitionAnimation</code> method.</li>
@@ -212,7 +252,7 @@ starts.</p>
final View imgContainerView = findViewById(R.id.img_container);
// get the common element for the transition in this activity
-final View androidRobotView = findViewById(R.id.android_robot_img);
+final View androidRobotView = findViewById(R.id.image_small);
// define a click listener
imgContainerView.setOnClickListener(new View.OnClickListener() {
@@ -232,6 +272,9 @@ imgContainerView.setOnClickListener(new View.OnClickListener() {
<p>For shared dynamic views that you generate in your code, use the <code>View.setViewName</code>
method to specify a common element name in both activities.</p>
+<p>To reverse the scene transition animation when you finish the second activity, call the
+<code>Activity.finishAfterTransition</code> method instead of <code>Activity.finish</code>.</p>
+
<h3>Multiple shared elements</h3>
<p>To make a scene transition animation between two activities that have more than one shared
@@ -241,12 +284,8 @@ attribute (or use the <code>View.setViewName</code> in both activities), and cre
<pre>
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this,
- new Pair[] {
Pair.create(view1, "agreedName1"),
- Pair.create(view2, "agreedName2"),
- ...
- }
-);
+ Pair.create(view2, "agreedName2"));
</pre>
@@ -279,7 +318,7 @@ material design specification:</p>
</ul>
<p>You can pass a <code>PathInterpolator</code> object to the
-<code>Animation.setInterpolation</code> method.</p>
+<code>Animator.setInterpolation</code> method.</p>
<p>The <code>ObjectAnimator</code> class has new constructors that enable you to animate
coordinates along a path using two or more properties at once. For example, the following animator
@@ -293,20 +332,20 @@ mAnimator.start();
</pre>
-<h2 id="viewstate">View State Changes</h2>
+<h2 id="viewstate">Animating View State Changes</h2>
<p>The new <code>StateListAnimator</code> class lets you define animators that run when the state
of a view changes. The following example shows how to define an <code>StateListAnimator</code> as
an XML resource:</p>
<pre>
-&lt;!-- animate the elevation property of a view when pressed -->
+&lt;!-- animate the translationZ property of a view when pressed -->
&lt;selector xmlns:android="http://schemas.android.com/apk/res/android">
&lt;item android:state_pressed="true">
&lt;set>
- &lt;objectAnimator android:propertyName="elevation"
+ &lt;objectAnimator android:propertyName="translationZ"
android:duration="100"
- android:valueTo="60"
+ android:valueTo="2"
android:valueType="floatType"/>
&lt;!-- you could have other objectAnimator elements
here for "x" and "y", or other properties -->
@@ -316,15 +355,19 @@ an XML resource:</p>
android:state_pressed="false"
android:state_focused="true">
&lt;set>
- &lt;objectAnimator android:propertyName="elevation"
+ &lt;objectAnimator android:propertyName="translationZ"
android:duration="100"
- android:valueTo="10"
+ android:valueTo="2"
android:valueType="floatType"/>
&lt;/set>
&lt;/item>
&lt;/selector>
</pre>
+<p class="note"><strong>Note:</strong> There is a known issue in the L Developer Preview release
+that requires valueFrom values to be provided in StateListAnimator animations to get the correct
+behavior.</p>
+
<p>The new <code>AnimatedStateListDrawable</code> class lets you create drawables that show
animations between state changes of the associated view. Some of the system widgets in the
Android L Developer Preview use these animations by default. The following example shows how
@@ -337,9 +380,9 @@ to define an <code>AnimatedStateListDrawable</code> as an XML resource:</p>
&lt;!-- provide a different drawable for each state-->
&lt;item android:id="@+id/pressed" android:drawable="@drawable/drawableP"
- android:state-pressed="true"/>
+ android:state_pressed="true"/>
&lt;item android:id="@+id/focused" android:drawable="@drawable/drawableF"
- android:state-focused="true"/>
+ android:state_focused="true"/>
&lt;item android:id="@id/default"
android:drawable="@drawable/drawableD"/>
@@ -358,21 +401,41 @@ to define an <code>AnimatedStateListDrawable</code> as an XML resource:</p>
<h2 id="drawabletint">Drawable Tinting</h2>
-<p>The Android L Developer Preview enables you to define bitmaps as an alpha mask and to tint
-them using a color resource or a theme attribute that resolves to a color resource. You can
-create these assets only once and color them automatically to match your theme.</p>
+<p>The Android L Developer Preview enables you to define bitmaps or nine-patches as alpha masks and
+to tint them using a color resource or a theme attribute that resolves to a color resource (for
+example, <code>?android:attr/colorPrimary</code>). You can create these assets only once and color them
+automatically to match your theme.</p>
-<p>To apply a tint to a bitmap in your code, use the <code>setTint</code> method in these
-classes:</p>
+<p>To apply a tint to a bitmap, use the <code>setTint</code> method or the <code>android:tint</code>
+attribute for <code>BitmapDrawable</code> and <code>NinePatchDrawable</code>.</p>
+
+<p>The <code>setTint</code> method also lets you set the Porter-Duff mode used to blend the
+tint color for <code>NinePatchDrawable</code> and <code>BitmapDrawable</code> objects in your code.
+To set the tint mode in your layouts, use the <code>android:tintMode</code> attribute.</p>
+
+
+<h2 id="colorextract">Extracting Prominent Colors from an Image</h2>
+
+<p>The Android L Developer Preview Support Library includes the <code>Palette</code> class,
+which lets you extract prominent colors from an image. This class extracts the following
+prominent colors:</p>
<ul>
-<li><code>PaintDrawable</code></li>
-<li><code>NinePatchDrawable</code></li>
-<li><code>RippleDrawable</code></li>
+<li>Vibrant</li>
+<li>Vibrant dark</li>
+<li>Vibrant light</li>
+<li>Muted</li>
+<li>Muted dark</li>
+<li>Muted light</li>
</ul>
-<p>In your layouts, use the <code>android:tint</code> attribute instead.</p>
+<p>To extract these colors, pass a <code>Bitmap</code> object to the
+<code>Palette.generate</code> static method in the background thread where you load your images.
+If you can't use that thread, call the <code>Palette.generateAsync</code> method instead and
+provide a listener.</p>
+
+<p>To retrieve the prominent colors from the image, use the getter methods in the
+<code>Palette</code> class, such as <code>Palette.getVibrantColor</code>.</p>
-<p>The <code>setTint</code> method also lets you set the tint blending mode for
-<code>NinePatchDrawable</code> and <code>RippleDrawable</code> objects in your code. To set the
-tint mode in your layouts, use the <code>android:tintMode</code> attribute.</p>
+<p>For more information, see the API reference for the
+<code>android.support.v7.graphics.Palette</code> class.</p> \ No newline at end of file
diff --git a/docs/html/preview/material/compatibility.jd b/docs/html/preview/material/compatibility.jd
index ce04e9e8f8b3..fb971124bbf0 100644
--- a/docs/html/preview/material/compatibility.jd
+++ b/docs/html/preview/material/compatibility.jd
@@ -14,7 +14,7 @@ page.title=Compatibility
</div>
</div>
-<p>The new material design features (like the material theme and custom animations) are only
+<p>The new material design features (like the material theme and activity transitions) are only
available in the Android L Developer Preview. However, you can design your apps to make use of
these features when running on devices with the Android L Developer Preview and still be
compatible with previous releases of Android.</p>
@@ -49,15 +49,34 @@ alternative layouts to customize how your app looks on earlier versions of Andro
and your alternative layout files for earlier versions of Android inside <code>res/layout/</code>.
Alternative layouts have the same file name.</p>
+<p>To avoid duplication of code, define your styles inside <code>res/values/</code> and modify the
+styles in <code>res/values-v21/</code> for the new APIs.</p>
+
<h2 id="widgets">UI Widgets</h2>
<p>The <code>RecyclerView</code> and <code>CardView</code> widgets are included in the Android L
-Developer Preview Support Library, so they are available in earlier versions of Android.</p>
+Developer Preview Support Library, so they are available in earlier versions of Android with
+these limitations:</p>
+
+<ul>
+<li><code>CardView</code> falls back to a programmatic shadow implementation using additional padding.</li>
+<li><code>CardView</code> does not clip its children views that intersect with rounded corners.</li>
+</ul>
+
+<p>These limitations do not apply to the Android L Developer Preview.</p>
<h2 id="animation">Animation APIs</h2>
-<p>The new APIs for custom animations are only available in the Android L Developer Preview. To
-preserve compatibility with earlier verisons of Android, check the system version at runtime before
-you invoke these APIs.</p> \ No newline at end of file
+<p>The following new APIs are only available in the Android L Developer Preview:</p>
+
+<ul>
+<li>Activity transitions</li>
+<li>Touch feedback</li>
+<li>Reveal animations</li>
+<li>Path-based animations</li>
+</ul>
+
+<p>To preserve compatibility with earlier verisons of Android, check the system version at
+runtime before you invoke these APIs.</p> \ No newline at end of file
diff --git a/docs/html/preview/material/get-started.jd b/docs/html/preview/material/get-started.jd
index 9c0e55d6f0d6..7d0625e5b88c 100644
--- a/docs/html/preview/material/get-started.jd
+++ b/docs/html/preview/material/get-started.jd
@@ -8,9 +8,9 @@ page.title=Get Started
<ol>
<li><a href="#applytheme">Apply the Material Theme</a></li>
<li><a href="#layouts">Design Your Layouts</a></li>
- <li><a href="#depth">Specify Depth in Your Views</a></li>
+ <li><a href="#depth">Specify Elevation in Your Views</a></li>
<li><a href="#widgets">Use the New UI Widgets</a></li>
- <li><a href="#apis">Use the New APIs</a></li>
+ <li><a href="#animations">Customize Your Animations</a></li>
</ol>
</div>
</div>
@@ -19,7 +19,8 @@ page.title=Get Started
<ol>
<li style="margin-bottom:10px">
- Take a look at the <a href="">material design specification</a>.</li>
+ Take a look at the <a href="http://www.google.com/design/spec">material design
+ specification</a>.</li>
<li style="margin-bottom:10px">
Apply the material <strong>theme</strong> to your app.</li>
<li style="margin-bottom:10px">
@@ -27,11 +28,11 @@ page.title=Get Started
<li style="margin-bottom:10px">
Create your <strong>layouts</strong> following material design guidelines.</li>
<li style="margin-bottom:10px">
- Specify the <strong>depth</strong> for views to cast appropriate shadows.</li>
+ Specify the <strong>elevation</strong> of your views to cast appropriate shadows.</li>
<li style="margin-bottom:10px">
Use the new <strong>widgets</strong> for complex views, such as lists and cards.</li>
<li style="margin-bottom:10px">
- Use the new <strong>APIs</strong> to customize the animations in your app.</li>
+ Use the new APIs to customize the <strong>animations</strong> in your app.</li>
</ol>
<h3>Update Your App for the Android L Developer Preview</h3>
@@ -42,15 +43,16 @@ incorporating depth, touch feedback and animations in your UI.</p>
<h3>Create New Apps for the Android L Developer Preview</h3>
-<p>If you are creating a new app for the Android L Developer Preview, the material design
-guidelines provide you with a solid design framework for your app. Follow these guidelines and
+<p>If you are creating a new app for the Android L Developer Preview, the <a
+href="http://www.google.com/design/spec">material design guidelines</a> provide you with a
+cohesive design framework for your app. Follow these guidelines and
use the new functionality in the Android framework to design and develop your app.</p>
<h2 id="applytheme">Apply the Material Theme</h2>
<p>To apply the material theme in your app, specify a style that inherits from
-<code>android:theme.Material</code>:</p>
+<code>android:Theme.Material</code>:</p>
<pre>
&lt;!-- res/values/styles.xml -->
@@ -70,8 +72,8 @@ animations for touch feedback and activity transitions. For more details, see
<h2 id="layouts">Design Your Layouts</h2>
<p>In addition to applying and customizing the material theme, your layouts should conform to
-the material design guidelines. When you design your layouts, pay special attention to the
-following:</p>
+the <a href="http://www.google.com/design/spec">material design guidelines</a>. When you design
+your layouts, pay special attention to the following:</p>
<ul>
<li>Baseline grids</li>
@@ -81,37 +83,36 @@ following:</p>
<li>Layout structure</li>
</ul>
-<p>You still define layouts inside XML files using the standard tools from the Android framework.
-For details on the material design guidelines, see the <a href="">material design
-specification</a>.</p>
+<h2 id="depth">Specify Elevation in Your Views</h2>
-<h2 id="depth">Specify Depth in Your Views</h2>
-
-<p>In the Android L Developer Preview, views can cast shadows. The elevation value of a view
-determines the size of its shadow. To set the elevation of a view, use the
+<p>Views can cast shadows, and the elevation value of a view
+determines the size of its shadow and its drawing order. To set the elevation of a view, use the
<code>android:elevation</code> attribute in your layouts:</p>
<pre>
-&lt;Button
- android:id="@+id/my_button"
+&lt;TextView
+ android:id="@+id/my_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/next"
- <strong>android:elevation</strong>="10dp" />
+ android:background="@color/white"
+ <strong>android:elevation</strong>="5dp" />
</pre>
+<p>The new <code>translationZ</code> property lets you create animations that reflect temporary
+changes in the elevation of a view. For example, this is useful to respond to touch gestures.</p>
+
<p>For more details, see <a href="{@docRoot}preview/material/views-shadows.html">Views and
Shadows</a>.</p>
<h2 id="widgets">Use the New UI Widgets</h2>
-<p>The Android L Developer Preview includes two new UI widgets for complex views,
-<code>RecyclerView</code> and <code>CardView</code>. <code>RecyclerView</code> is a more advanced
-version of <code>ListView</code> that provides performance improvements and is easier to use.
-<code>CardView</code> lets you show pieces of information inside cards with a consistent look
-across apps. To include a <code>CardView</code> in your layout:</p>
+<p><code>RecyclerView</code> is a more advanced version of <code>ListView</code> that provides
+performance improvements and is easier to use. <code>CardView</code> lets you show pieces of
+information inside cards with a consistent look across apps. To include a <code>CardView</code>
+in your layout:</p>
<pre>
&lt;android.support.v7.widget.CardView
@@ -126,7 +127,7 @@ across apps. To include a <code>CardView</code> in your layout:</p>
<p>For more information, see <a href="{@docRoot}preview/material/ui-widgets.html">UI Widgets</a>.</p>
-<h2 id="apis">Use the APIs to Customize Your Animations</h2>
+<h2 id="animations">Customize Your Animations</h2>
<p>The Android L Developer Preview includes new APIs to create custom animations in your app.
For example, you can enable activity transitions and define an exit transition inside an
diff --git a/docs/html/preview/material/images/MaterialDark.png b/docs/html/preview/material/images/MaterialDark.png
index 6a72280109f2..f1018af79f65 100644
--- a/docs/html/preview/material/images/MaterialDark.png
+++ b/docs/html/preview/material/images/MaterialDark.png
Binary files differ
diff --git a/docs/html/preview/material/images/MaterialLight.png b/docs/html/preview/material/images/MaterialLight.png
index 0e855283181e..4ed7d5cfb953 100644
--- a/docs/html/preview/material/images/MaterialLight.png
+++ b/docs/html/preview/material/images/MaterialLight.png
Binary files differ
diff --git a/docs/html/preview/material/images/card_travel.png b/docs/html/preview/material/images/card_travel.png
index a804ca088b47..19752a865ad1 100644
--- a/docs/html/preview/material/images/card_travel.png
+++ b/docs/html/preview/material/images/card_travel.png
Binary files differ
diff --git a/docs/html/preview/material/images/list_mail.png b/docs/html/preview/material/images/list_mail.png
index ca53ee189e03..bd107ff8f145 100644
--- a/docs/html/preview/material/images/list_mail.png
+++ b/docs/html/preview/material/images/list_mail.png
Binary files differ
diff --git a/docs/html/preview/material/index.jd b/docs/html/preview/material/index.jd
index b7abcb4db0de..d9a276f70c63 100644
--- a/docs/html/preview/material/index.jd
+++ b/docs/html/preview/material/index.jd
@@ -3,11 +3,11 @@ page.type=design
@jd:body
-<p itemprop="description">The Android L Developer Preview includes support for material design apps. Material design
-is a comprehensive guide for visual, motion, and interaction design across platforms and devices.
-To use material design in your Android apps, follow the guidelines defined in the
-<a href="">material design specification</a> and use the new components and functionality
-available in the Android L Developer Preview.</p>
+<p itemprop="description">The Android L Developer Preview includes support for material design
+apps. Material design is a comprehensive guide for visual, motion, and interaction design across
+platforms and devices. To use material design in your Android apps, follow the guidelines defined
+in the <a href="http://www.google.com/design/spec">material design specification</a> and use the
+new components and functionality available in the Android L Developer Preview.</p>
<p>The Android L Developer Preview provides the following elements for you to build material
design apps:</p>
@@ -27,13 +27,13 @@ their color palette, and default animations for touch feedback and activity tran
<!-- two columns -->
<div style="width:700px;margin-top:25px;margin-bottom:20px">
<div style="float:left;width:250px;margin-left:40px;margin-right:60px;">
- <img src="{@docRoot}preview/material/images/MaterialDark.png" style="width:250px;"/>
+ <img src="{@docRoot}preview/material/images/MaterialDark.png" width="500" height="238"/>
<div style="width:140px;margin:0 auto">
<p style="margin-top:8px">Dark Material theme</p>
</div>
</div>
<div style="float:left;width:250px;margin-right:0px;">
- <img src="{@docRoot}preview/material/images/MaterialLight.png" style="width:250px;"/>
+ <img src="{@docRoot}preview/material/images/MaterialLight.png" width="500" height="238"/>
<div style="width:140px;margin:0 auto">
<p style="margin-top:8px">Light Material theme</p>
</div>
@@ -49,12 +49,12 @@ their color palette, and default animations for touch feedback and activity tran
<!-- two columns -->
<div style="width:700px;margin-top:25px;margin-bottom:20px">
<div style="float:left;width:250px;margin-left:40px;margin-right:60px;">
- <img src="{@docRoot}preview/material/images/list_mail.png" style="width:250px;"/>
+ <img src="{@docRoot}preview/material/images/list_mail.png" width="500" height="426"/>
<p>The new <code>RecyclerView</code> widget is a more advanced version of <code>ListView</code>
- provides performance improvements for dynamic views and is easier to use.</p>
+ that provides performance improvements for dynamic views and is easier to use.</p>
</div>
<div style="float:left;width:250px;margin-right:0px;">
- <img src="{@docRoot}preview/material/images/card_travel.png" style="width:250px;"/>
+ <img src="{@docRoot}preview/material/images/card_travel.png" width="500" height="426"/>
<p>The new <code>CardView</code> widget lets you display important pieces of information inside
cards that have a consistent look and feel.</p>
</div>
@@ -64,9 +64,13 @@ their color palette, and default animations for touch feedback and activity tran
<h3>View Shadows</h3>
-<p>In addition to the X and Y components, views in the Android L Developer Preview have a Z
-component. This new component represents the elevation of a view, which determines the size of
-its shadow: views with higher Z values cast bigger shadows.</p>
+<p>In addition to the X and Y properties, views in the Android L Developer Preview have a Z
+property. This new property represents the elevation of a view, which determines:</p>
+
+<ul>
+<li>The size of the shadow - Views with higher Z values cast bigger shadows.</li>
+<li>The drawing order - Views with higher Z values appear on top of other views.</li>
+</ul>
<div style="width:290px;margin-left:35px;float:right">
<div class="framed-nexus5-port-span-5">
@@ -86,7 +90,7 @@ its shadow: views with higher Z values cast bigger shadows.</p>
<p>The Android L Developer Preview provides new APIs that let you create custom animations for
touch feedback in UI controls, view state changes, and activity transitions.</p>
-<p>The new animation APIs in the Android L Developer Preview let you:</p>
+<p>The new animation APIs let you:</p>
<ul>
<li style="margin-bottom:15px">
@@ -99,7 +103,7 @@ Hide and show views with <strong>reveal effect</strong> animations.
Switch between activities with custom <strong>activity transition</strong> animations.
</li>
<li style="margin-bottom:15px">
-Create custom animation patterns with <strong>curved motion</strong>.
+Create more natural animations with <strong>curved motion</strong>.
</li>
<li style="margin-bottom:15px">
Animate changes in one or more view properties with <strong>view state change</strong> animations.
@@ -109,9 +113,16 @@ Show animations in <strong>state list drawables</strong> between view state chan
</li>
</ul>
+<p>Touch feedback animations are built into several standard views, such as buttons. The new APIs
+let you customize these animations and add animations to your custom views.</p>
+
<h3>New Capabilities for Drawables</h3>
<p>The Android L Developer Preview supports <strong>drawable tinting</strong>: you can define
-bitmaps as an alpha mask and tint them using a color resource. You can create these assets only
-once and color each instance to match your theme.</p>
+bitmaps as an alpha mask and tint them using a color resource. You create these assets only
+once and color each instance to match your theme. Drawables also now support specifying most XML
+properties as <strong>theme attributes</strong>.</p>
+
+<p>The Android L Developer Preview Support Library includes a <strong>color extraction</strong>
+library that lets you automatically extract prominent colors from a bitmap image.</p> \ No newline at end of file
diff --git a/docs/html/preview/material/theme.jd b/docs/html/preview/material/theme.jd
index b954960b8979..5e4bcdf2ba09 100644
--- a/docs/html/preview/material/theme.jd
+++ b/docs/html/preview/material/theme.jd
@@ -8,7 +8,7 @@ page.title=Material Theme
<ol>
<li><a href="#colorpalette">Customize the Colot Palette</a></li>
<li><a href="#statusbar">Customize the Status Bar</a></li>
- <li><a href="#inheritance">Theme Inheritance</a></li>
+ <li><a href="#inheritance">Theme Individual Views</a></li>
</ol>
</div>
</div>
@@ -21,18 +21,18 @@ page.title=Material Theme
<li>Activity transition animations</li>
</ul>
-<p>The Android L Developer Preview lets you easily customize the look of the material theme
-according to your brand identity with a color palette you control. You can tint the app bar and
+<p>You can customize the look of the material theme
+according to your brand identity with a color palette you control. You can tint the action bar and
the status bar using theme attributes, as shown in Figure 1.</p>
-<div style="float:right;margin-left:25px;margin-top:-25px">
+<div style="float:right;margin-left:25px;margin-top:-50px">
<img src="{@docRoot}preview/material/images/ThemeColors.png" style="width:250px"/>
-<p class="img-caption"><strong>Figure 1.</strong> Customizing the material theme.</p>
+<p class="img-caption" style="margin-bottom:0px">
+<strong>Figure 1.</strong> Customizing the material theme.</p>
</div>
-<p>The system widgets have a new design and touch feedback animations. Activity transitions help
-users navigate your app by providing visual continuity. You can customize the color palette,
-the touch feedback animations, and the activity transitions for your app.</p>
+<p>The system widgets have a new design and touch feedback animations. You can customize the
+color palette, the touch feedback animations, and the activity transitions for your app.</p>
<p>The material theme is defined as:</p>
@@ -43,7 +43,7 @@ the touch feedback animations, and the activity transitions for your app.</p>
</ul>
<p>For a list of material styles that you can use, see the API reference for
-<code>android.R.styles</code>.</p>
+<code>android.R.style</code>.</p>
<p class="note">
<strong>Note:</strong> The material theme is only available in the Android L Developer Preview.
@@ -53,8 +53,8 @@ For more information, see <a href="{@docRoot}preview/material/compatibility.html
<h2 id="colorpalette">Customize the Color Palette</h2>
-<p>To customize the theme's base colors to fit your brand, define your custom colors using
-theme attributes when you inherit from the material theme:</p>
+<p style="margin-bottom:30px">To customize the theme's base colors to fit your brand, define
+your custom colors using theme attributes when you inherit from the material theme:</p>
<pre>
&lt;resources>
@@ -63,28 +63,27 @@ theme attributes when you inherit from the material theme:</p>
&lt;!-- Main theme colors -->
&lt;!-- your app's branding color (for the app bar) -->
&lt;item name="android:colorPrimary">@color/primary&lt;/item>
- &lt;!-- darker variant of colorPrimary (for contextual app bars) -->
+ &lt;!-- darker variant of colorPrimary (for status bar, contextual app bars) -->
&lt;item name="android:colorPrimaryDark">@color/primary_dark&lt;/item>
-
- &lt;!-- other theme colors -->
- &lt;item name="android:colorButtonNormal">@color/button_normal&lt;/item>
- &lt;item name="android:windowBackground">@color/wbackground&lt;/item>
+ &lt;!-- theme UI controls like checkboxes and text fields -->
+ &lt;item name="android:colorAccent">@color/accent&lt;/item>
&lt;/style>
&lt;/resources>
</pre>
-<h2 id="statusbar">Customize the Status Bar</h2>
+<h2 id="statusbar">Customize the Status and Navigation Bar</h2>
<p>The material theme lets you easily customize the status bar, so you can specify a
-color which fits your brand and provides enough contrast to show the white status icons. To
+color that fits your brand and provides enough contrast to show the white status icons. To
set a custom color for the status bar, use the <code>android:statusBarColor</code> attribute when
-you extend the material theme.</p>
+you extend the material theme. By default, <code>android:statusBarColor</code> inherits the
+value of <code>android:colorPrimaryDark</code>.</p>
<p>To handle the color of the status bar yourself (for example, by adding a gradient in the
background), set the <code>android:statusBarColor</code> attribute to
-<code>&#64;android:color/transparent</code>. You can also use the
-<code>Window.setStatusBarColor</code> method for animations or fading.</p>
+<code>&#64;android:color/transparent</code> and adjust the window flags as required. You can
+also use the <code>Window.setStatusBarColor</code> method for animations or fading.</p>
<p class="note"><strong>Note:</strong>
The status bar should almost always have a clear delineation from the primary toolbar, except for
@@ -92,9 +91,9 @@ full-bleed imagery cases and when you use a gradient as a protection.
</p>
-<h2 id="inheritance">Theme Inheritance</h3>
+<h2 id="inheritance">Theme Individual Views</h3>
-<p>In the Android L Developer Preview, elements in XML layout definitions can specify the
-<code>android:theme</code> attribute, which references a theme resource. This attribute modifies
-the theme for the element and any elements inflated below it, which is useful to alter theme
-color palettes in a specific portion of an interface.</p> \ No newline at end of file
+<p>Elements in XML layout definitions can specify the <code>android:theme</code> attribute,
+which references a theme resource. This attribute modifies the theme for the element and any
+elements inflated below it, which is useful to alter theme color palettes in a specific portion
+of an interface.</p> \ No newline at end of file
diff --git a/docs/html/preview/material/ui-widgets.jd b/docs/html/preview/material/ui-widgets.jd
index f18bff9e52b9..31604d6b9200 100644
--- a/docs/html/preview/material/ui-widgets.jd
+++ b/docs/html/preview/material/ui-widgets.jd
@@ -14,19 +14,20 @@ page.title=UI Widgets
<p>The support library in the Android L Developer Preview contains two new widgets,
<code>RecyclerView</code> and <code>CardView</code>. Use these widgets to show complex lists
-and cards in your app. These widgets have material design styles and animations by default.</p>
+and cards in your app. These widgets have material design style by default.</p>
<h2 id="recyclerview">RecyclerView</h2>
-<p><code>RecyclerView</code> is a more advanced version of <code>ListView</code>. This widget is
-a container for large sets of views that can be recycled and scrolled very efficiently. Use the
-<code>RecyclerView</code> widget when you have lists with elements that change dynamically.</p>
+<p><code>RecyclerView</code> is a more advanced and flexible version of <code>ListView</code>.
+This widget is a container for large sets of views that can be recycled and scrolled very
+efficiently. Use the <code>RecyclerView</code> widget when you have lists with elements that
+change dynamically.</p>
<p><code>RecyclerView</code> is easy to use, because it provides:</p>
<ul>
- <li>A set of layout managers for positioning items</li>
+ <li>A layout manager for positioning items</li>
<li>Default animations for common item operations</li>
</ul>
@@ -34,20 +35,9 @@ a container for large sets of views that can be recycled and scrolled very effic
widget.</p>
<p>To use the <code>RecyclerView</code> widget, you have to specify an adapter and a layout
-manager. An <strong>adapter</strong> provides a binding from a dataset to views that are displayed
-within a <code>RecyclerView</code>. For example, if your dataset is an array of strings displayed
-as <code>TextView</code> items, the layout manager asks the adapter to:
-</p>
-
-<ul>
- <li>Set the text of an existing <code>TextView</code> to one of the strings in the dataset</li>
- <li>Create new <code>TextView</code> objects</li>
- <li>Determine the size of the dataset</li>
-</ul>
-
-<p>To create an adapter, you extend the <code>RecyclerView.Adapter</code> class. The details of
-the implementation depend on the specifics of your dataset and the type of views. Fore more
-information, see the examples below.</p>
+manager. To create an adapter, you extend the <code>RecyclerView.Adapter</code> class. The details
+of the implementation depend on the specifics of your dataset and the type of views. For more
+information, see the <a href="#rvexamples">examples</a> below.</p>
<img src="/preview/material/images/RecyclerView.png" alt="" id="figure1" style="width:550px"/>
<p class="img-caption">
@@ -62,16 +52,17 @@ performance by avoiding the creation of unnecessary views or performing expensiv
<code>findViewById</code> lookups.
</p>
-<p><code>RecyclerView</code> provides two layout managers you can use:</p>
+<p><code>RecyclerView</code> provides <code>LinearLayoutManager</code>, which shows the items in a
+vertical or horizontal scrolling list. To create a custom layout, you extend the
+<code>RecyclerView.LayoutManager</code> class.</p>
-<ul>
- <li><code>LinearLayoutManager</code> shows the items in a vertically scrolling list.</li>
- <li><code>GridLayoutManager</code> shows the items in a rectangular grid.</li>
-</ul>
+<h3>Animations</h3>
-<p>To create a custom layout, you extend the <code>RecyclerView.LayoutManager</code> class.</p>
+<p>Animations for adding and removing items are enabled by default in <code>RecyclerView</code>.
+To customize these animations, extend the <code>RecyclerView.ItemAnimator</code> class and use
+the <code>RecyclerView.setItemAnimator</code> method.</p>
-<h3>Examples</h3>
+<h3 id="rvexamples">Examples</h3>
<p>To include a <code>RecyclerView</code> in your layout:</p>
@@ -87,7 +78,7 @@ performance by avoiding the creation of unnecessary views or performing expensiv
<p>To get the <code>RecyclerView</code> object in your activity:</p>
<pre>
-public class MyActivity extends ActionBarActivity {
+public class MyActivity extends Activity {
private RecyclerView mRecyclerView;
private RecyclerView.Adapter mAdapter;
private RecyclerView.LayoutManager mLayoutManager;
@@ -98,7 +89,8 @@ public class MyActivity extends ActionBarActivity {
setContentView(R.layout.my_activity);
mRecyclerView = (RecyclerView) findViewById(R.id.my_recycler_view);
- // improve performance if the size is fixed
+ // improve performance if you know that changes in content
+ // do not change the size of the RecyclerView
mRecyclerView.setHasFixedSize(true);
// use a linear layout manager
@@ -139,7 +131,8 @@ public class MyAdapter extends RecyclerView.Adapter&lt;MyAdapter.ViewHolder> {
public MyAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
int viewType) {
// create a new view
- View v = new TextView(parent.getContext());
+ View v = LayoutInflater.from(parent.getContext())
+ .inflate(R.layout.my_text_view, null);
// set the view's size, margins, paddings and layout parameters
...
ViewHolder vh = new ViewHolder(v);
@@ -167,22 +160,30 @@ public class MyAdapter extends RecyclerView.Adapter&lt;MyAdapter.ViewHolder> {
<h2 id="cardview">CardView</h2>
<p><code>CardView</code> extends the <code>FrameLayout</code> class and lets you show information
-inside a card with optional rounded corners:</p>
+inside cards that have a consistent look on any app. <code>CardView</code> widgets can have
+shadows and rounded corners.</p>
+
+<p>To create a card with a shadow, use the <code>android:elevation</code> attribute.
+<code>CardView</code> uses real elevation and dynamic shadows
+and falls back to a programmatic shadow implementation on earlier versions. For more information,
+see <a href="{@docRoot}preview/material/compatibility.html">Compatibility</a>.</p>
+
+<p>Here's how to specify properties of <code>CardView</code>:</p>
<ul>
<li>To set the corner radius in your layouts, use the <code>android:cardCornerRadius</code>
attribute.</li>
<li>To set the corner radius in your code, use the <code>CardView.setRadius</code> method.</li>
+ <li>To set the background color of a card, use the <code>android:cardBackgroundColor</code>
+attribute.</li>
</ul>
-<p>To set the background color of a card, use the <code>android:cardBackgroundColor</code>
-attribute.</p>
-
<p>To include a <code>CardView</code> in your layout:</p>
<pre>
&lt;!-- A CardView that contains a TextView -->
&lt;android.support.v7.widget.CardView
+ xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_gravity="center"
android:layout_width="200dp"
diff --git a/docs/html/preview/material/views-shadows.jd b/docs/html/preview/material/views-shadows.jd
index c5884d65d2df..f7682f54ed51 100644
--- a/docs/html/preview/material/views-shadows.jd
+++ b/docs/html/preview/material/views-shadows.jd
@@ -13,10 +13,12 @@ page.title=Views and Shadows
</div>
</div>
-<p>In apps with material design, depth has meaning. You should assign higher elevation values to more
-important UI elements in your app. The elevation value of a view determines the size of its
-shadow: views with higher Z values cast bigger shadows. Views only cast shadows on the Z=0 plane
-under an orthographic projection (the views do not scale for different values of Z).</p>
+<p>The elevation of a view determines the size of its shadow:
+views with higher Z values cast bigger shadows. Views only cast shadows on the Z=0 plane under an
+orthographic projection (the views do not scale for different values of Z).</p>
+
+<p>Elevation is also useful to create animations where widgets temporarily rise above the
+view plane when performing some action.</p>
<h2 id="elevation">View Elevation</h2>
@@ -35,52 +37,59 @@ static component, and the translation is used for animations:</p>
<p>To set the translation of a view, use the <code>View.setTranslationZ</code> method.</p>
-<p>The Z values are measured in the same units as the X and Y values (like <code>dp</code> or
-<code>px</code>).</p>
+<p>The new <code>ViewPropertyAnimator.z</code> and <code>ViewPropertyAnimator.translationZ</code>
+methods enable you to easily animate the elevation of views. For more information, see
+the API reference for <code>ViewPropertyAnimator</code> and the <a
+href="{@docRoot}guide/topics/graphics/prop-animation.html#object-animator">Property Animation</a>
+developer guide.</p>
+
+<p>The Z values are measured in the same units as the X and Y values.</p>
<h2 id="shadows">Shadows and Outlines</h2>
-<p>The bounds of a view's background drawable determine the default shape of its shadow. To define
-a custom shape for a shadow, such as an oval, use the <code>View.setOutline</code> method:</p>
+<p>The bounds of a view's background drawable determine the default shape of its shadow.
+<strong>Outlines</strong> represent the outer shape of a graphics object and define the ripple
+area for touch feedback.</p>
+
+<p>For example, if you define a view with a background drawable:</p>
<pre>
-View v = findViewById(R.id.my_view);
+&lt;TextView
+ android:id="@+id/myview"
+ ...
+ android:elevation="2dp"
+ android:background="@drawable/myrect" />
+</pre>
-// add 10px to the static elevation
-v.setTranslationZ(10);
+<p>where the background drawable is defined as a rectangle with rounded corners:</p>
-// set an oval shadow
-Outline outline = new Outline();
-outline.setOval(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
-myView.setOutline(outline);
+<pre>
+&lt;!-- res/drawable/myrect.xml -->
+&lt;shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ &lt;solid android:color="#42000000" />
+ &lt;corners android:radius="5dp" />
+&lt;/shape>
</pre>
-<p>An <code>Outline</code> represents the outer shape of a graphics object. You can create
-<code>Outline</code> objects as in this example, or you can obtain the outline from a
-<code>Drawable</code> object with the <code>getOutline</code> method.</p>
+<p>Then this view and drawable cast the appropiate shadow.</p>
-<p>The outline of a view also defines the ripple area for touch feedback.</p>
+<p>You can also create outlines in your code using the methods in the <code>Outline</code> class,
+and you can assign them to views with the <code>View.setOutline</code> method.</p>
<p>To prevent a view from casting a shadow, set its outline to <code>null</code>.</p>
<h2 id="clip">Clipping Views</h2>
-<p>The Android L Developer Preview lets you clip a view to its outline area using the
+<p>Clip a view to its outline area using the
<code>View.setClipToOutline</code> method. Only rectangle, circle, and round rectangle outlines
support clipping, as determined by the <code>Outline.canClip</code> method.</p>
-<p>To determine if a view has been clipped, use the <code>View.getClipToOutline</code> method.</p>
+<p>To clip a view to the shape of a drawable, set the drawable as the background of the view
+(as shown above) and call the <code>View.setClipToOutline</code> method.</p>
-<pre>
-// clip a view to an oval
-View v = findViewById(R.id.my_view);
-outline.setOval(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
-myView.setOutline(outline);
-
-// if the view is not already clipped
-if (v.getClipToOutline() == false) {
- v.setClipToOutline(true);
-}
-</pre> \ No newline at end of file
+<p>Because clipping views is an expensive operation, don't animate the shape you use to
+clip a view. To achieve this effect, use a <a
+href="{@docRoot}preview/material/animations.html#reveal">Reveal Effect</a> animation.</p> \ No newline at end of file
diff --git a/docs/html/preview/tv/adt-1/index.jd b/docs/html/preview/tv/adt-1/index.jd
new file mode 100644
index 000000000000..d83dd11db41a
--- /dev/null
+++ b/docs/html/preview/tv/adt-1/index.jd
@@ -0,0 +1,282 @@
+page.title=ADT-1 Developer Kit
+page.tags="emote","e-mote","adt"
+
+@jd:body
+
+<div id="qv-wrapper">
+<div id="qv">
+ <h2>In this document</h2>
+ <ol>
+ <li><a href="#faq">Frequently Asked Questions</a>
+ <ol>
+ <li><a href="#setup">Device Setup</a></li>
+ <li><a href="#input">User Input</a></li>
+ <li><a href="#cast">Google Cast</a></li>
+ <li><a href="#trouble">Troubleshooting</a></li>
+ </ol>
+ </li>
+ <li><a href="#emote">Android TV Remote Control App</a></li>
+ <li><a href="#reg-safety">Regulatory Disclosures and Safety</a></li>
+ </ol>
+</div>
+</div>
+
+<p>The ADT-1 Developer Kit is a streaming media player and game controller designed for running
+and testing apps built for Android TV. Supplies of ADT-1 are limited and it is intended for
+developers who are interested in building new apps or extending their existing apps to run on the
+Android TV platform.</p>
+
+<p class="note">
+ <strong>Note:</strong> The ADT-1 kit <em>is not required</em> for building and testing apps
+ for Android TV. You can build apps for TV and test them using an emulator for TV devices. The
+ L Developer Preview includes all the software needed to build TV apps and an emulator for running
+ and testing them. For more information, see the
+ <a href="{@docRoot}preview/tv/start/index.html">Get Started</a> guide for TV apps.
+</p>
+
+<h2 id="faq">ADT-1 Frequently Asked Questions</h2>
+
+<p>The following information is provided to help set up and use the ADT-1 device.</p>
+
+
+<h3 id="setup">Device Setup</h3>
+
+<p>
+ <strong>How do I turn my device on?</strong>
+</p>
+<p>Plug the included power cable into the back of ADT-1. The device does not have an on/off
+ switch.</p>
+
+<p>
+ <strong>How do I completely turn my device off? </strong>
+</p>
+<p>Unplug the included power cable from the back of ADT-1. The device does not have an on/off
+ switch. However, ADT-1 will begin sleeping (daydream) based on user settings in
+ <strong>Settings &gt; Display &gt; Daydream</strong>.
+ </p>
+
+<p>
+ <strong>How do I connect to the network?</strong>
+</p>
+<p>ADT-1 has both wireless and Ethernet for connecting to your network. To change your wireless
+ network, go to <strong>Settings -&gt; Wi-Fi</strong>. To use an Ethernet network connection,
+ simply plug an Ethernet cable (that is connected to your network) into the port on the back of
+ ADT-1.</p>
+
+<p>
+ <strong>How do I use the developer cable?</strong>
+</p>
+<p>The developer cable has three connectors: a small, male power connector that plugs into the
+ power port on the back of ADT-1, a standard male USB-A connector that connects your PC, and a
+ small, female power connector that the included power supply plugs into.</p>
+
+
+
+<h3 id="input">User Input</h3>
+
+<p>
+ <strong>How do I put the gamepad that came with my ADT-1 into pairing mode?</strong>
+</p>
+<p>Press and hold the Back and Home buttons together for about three seconds, until all four
+ blue LEDs flash together. When the LEDs are flashing, the gamepad is in pairing mode.</p>
+
+<p>
+ <strong>How do I use the gamepad with the on-screen keyboard?</strong>
+</p>
+<p>Use the D-pad or left joystick to move the cursor, and press A to select. Press X to delete a
+ character, and press Y to insert a space. Also, you can press the right joystick to toggle caps
+ lock, and press the left joystick to show additional symbols.</p>
+
+<p>
+ <strong>Can I control ADT-1 with my phone or tablet?</strong>
+</p>
+<p>Yes. In order to control the ADT-1 with Android phones or tablets, you can download a remote
+ control app from the Google Play store. For more information, see <a href="#emote">Android TV
+ Remote Control App</a>.
+ </p>
+
+<p>
+ <strong>Can I connect a USB keyboard or mouse to ADT-1?</strong>
+</p>
+<p>Yes, you can connect a USB keyboard or mouse to the USB port on the back of ADT-1.
+
+<p class="note">
+ <strong>Note:</strong> The ADT-1 device is not compatible with all manufacturers and models of
+ these devices. If a particular keyboard or mouse does not work, try a different model.
+</p>
+
+<p>
+ <strong>How do I connect a Bluetooth device without an input device already attached?</strong>
+</p>
+<p>You can put ADT-1 into Bluetooth pairing mode using a hardware button. Press the small, round
+ button on the back of ADT-1 to make it search for Bluetooth devices in pairing mode. If multiple
+ accessories are found, press the small, round button to select the device you want to pair.
+ Pairing will happen automatically after a few seconds.
+</p>
+
+<p>
+ <strong>How do I connect additional Bluetooth accessories?</strong>
+<p>
+<p>To pair Bluetooth devices to ADT-1 from the user interface, go to <strong>Settings &gt;
+ Remote &amp; Accessories &gt; Add accessory</strong>
+
+
+<h3 id="cast">Google Cast</h3>
+
+<p>
+ <strong>Can I cast to an ADT-1 device?</strong>
+<p>
+<p>Yes. The ADT-1 includes Google Cast receiver functionality, similar to Chromecast. Since the
+ ADT-1 is a developer device running a development software release, the Google Cast receiver is
+ open only to a limited number of apps.</p>
+
+<p>
+ <strong>Which Cast apps are supported on ADT-1?</strong>
+<p>
+<p>As a developer device, the ADT-1 supports casting from only the following apps/websites:</p>
+
+<ul>
+ <li>YouTube</li>
+ <li>Netflix</li>
+ <li>Google+ Photos</li>
+ <li>Google Play Movies and TV (Android only)</li>
+</ul>
+
+<p>Coming soon:</p>
+
+<ul>
+ <li>Google Play Music</li>
+ <li>Google Play Movies and TV (iOS and Chrome)</li>
+ <li>Mirror you Android device screen to ADT-1</li>
+</ul>
+
+<p class="note">
+ <strong>Note:</strong> When casting from a Chrome browser, you must use Chrome V.36 or higher.
+ Chrome V.36 is available in beta-channel and is planned to be released soon.
+</p>
+
+<p>
+ <strong>How do I cast to ADT-1?</strong>
+<p>
+<p>You cast to an ADT-1 device the same way you do with a Chromecast device. Open the supported
+ Cast apps or webpages, press the <strong>Cast</strong> button and you should see the ADT-1 as a
+ Cast target. For more infomation about on how to cast, see
+ <a href="http://www.google.com/intl/en/chrome/devices/chromecast/learn.html">Learn How to
+ Cast</a>.
+ </p>
+
+<p>
+ <strong>Will my Google Cast sender apps work on ADT-1 just like Chromecast?</strong>
+<p>
+<p>Yes. Your Cast app works on ADT-1 and Android TV products without additional work.<p>
+
+<p class="note">
+ <strong>Note:</strong> Your iOS sender app requires the Google Cast iOS API version 2.2.1
+ or later to work with the ADT-1 device.
+</p>
+
+<p>
+ <strong>How do I register my ADT-1 in order to run my apps?</strong>
+</p>
+<ol>
+ <li>Go to <strong>Settings &gt; Google Cast</strong> and turn on developer support, allowing the
+ ADT-1 device to send its serial number to Google.</li>
+ <li>Register your ADT-1 device in the Google Cast Developer Console, using the 12 character
+ serial number engraved on the back of the ADT-1.</li>
+</ol>
+
+<p>For more Google Cast developer information, see the
+ <a href="https://developers.google.com/cast/">Cast developer site</a>. Please use the Google Cast
+ SDK <a href="https://code.google.com/p/google-cast-sdk/issues/list">issue tracker</a> for filing
+ issues related to Cast. Make sure you mention the ADT-1 device when filing an issue.
+</p>
+
+<p>
+ <strong>How do I debug my Cast app on ADT-1?</strong>
+</p>
+<p>Connect your development platform using the power/USB cable, and using a Chrome browser,
+ navigate to <code>chrome://inspect/#devices</code> to debug the webview.</p>
+
+
+<h3 id="trouble">Troubleshooting</h3>
+
+<p>
+ <strong>Why doesn't the on-screen keyboard come up?</strong>
+</p>
+<p>Enable the keyboard in the device Settings. Go to <strong>Settings &gt; Keyboard &gt; Current
+ keyboard</strong> and choose <strong>Leanback keyboard</strong>.
+
+<p>
+ <strong>How do I perform a hardware reboot?</strong>
+</p>
+<p>Locked it up, huh? No worries. We've done that a few times ourselves. Unplug and replug the
+ included power cable from the back of ADT-1 to reboot it.
+</p>
+
+<p>
+ <strong>How do I perform a factory reset?</strong>
+</p>
+<p class="warning">
+ <strong>Warning:</strong> This procedure removes all data from the device, including system
+ data, downloaded apps, app data, and account settings.
+</p>
+
+<p>From the home screen, go to <strong>Settings &gt; Device &gt; Factory data reset</strong>, and
+ select <strong>Reset device</strong>.
+</p>
+
+<p>
+ <strong>How do I perform a hardware reset?</strong>
+</p>
+<p class="warning">
+ <strong>Warning:</strong> This procedure performs a factory data reset, removing all data from
+ the device, including system data, downloaded apps, app data, and account settings.
+</p>
+
+<p>Unplug the power cable from the back of ADT-1. Press and hold the small, round button on the
+ back of ADT-1 as you re-insert the power cable, and continue to hold the small round button. The
+ LED will begin flashing red for a few seconds, then change to multi-color cycle. When the LED
+ starts the multi-color cycle, release the small, round button, and ADT-1 boots up. If you release
+ the button while the LED is flashing red, the device will be in Fastboot mode.</p>
+
+<p>
+ <strong>There is a hardware problem with my ADT-1. How do I return it?</strong>
+</p>
+<p>You can request a return of the device using the
+ <a href="https://support.google.com/googleplay/android-developer/contact/adt_rma">return
+ merchandise authorization form</a>.
+</p>
+
+
+<h2 id="emote">Android TV Remote Control App</h2>
+
+<div class="figure" style="width:250px;margin-top:0">
+<img src="/preview/tv/images/android-tv-remote.png" alt="Android TV Remote Screenshots">
+</div>
+
+<p>A remote control app is available for Android phones and tablets that allows you to interact
+ with the ADT-1 device. This app allows you to switch between D-pad input mode or touchpad mode
+ to navigate content and play games on a Android TV device. You can also tap the mic button to
+ start a voice search, or use the keyboard to input text using this app.</p>
+
+<p>You download the remote control app from the Google Play store using
+ <a href="https://play.google.com/store/apps/details?id=com.google.android.tv.remote">this
+ link</a>.
+</p>
+
+<p class="note">
+ <strong>Note:</strong> your Android ​phone or tablet must be connected to the same local network
+ as ADT-1.
+</p>
+
+
+<h2 id="reg-safety">Regulatory Disclosures and Safety Information</h2>
+
+<p>The ADT-1 device comes with important regulatory disclosures and safety information. Please
+read this information before using the device:</p>
+
+<ul>
+ <li><a href="regulatory.html">Regulatory Disclosures</a></li>
+ <li><a href="safety.html">Important Safety Information</a></li>
+</ul>
+
diff --git a/docs/html/preview/tv/adt-1/regulatory.jd b/docs/html/preview/tv/adt-1/regulatory.jd
new file mode 100644
index 000000000000..2f5bf7e6f662
--- /dev/null
+++ b/docs/html/preview/tv/adt-1/regulatory.jd
@@ -0,0 +1,79 @@
+page.title=Regulatory Disclosures for ADT-1
+parent.title=ADT-1 Developer Kit
+parent.link=index.html
+
+@jd:body
+
+<p>Disclosures for the <a href="index.html">ADT-1</a> device.</p>
+
+<p>
+ Model: W2<br>
+ FCC ID: A4R-W2<br>
+ IC: 10395A-W2
+</p>
+
+<p>U.S. Federal Communications Commission Notices</p>
+<p>To satisfy FCC and IC exposure requirements, a separation distance of at least 20 cm should
+ be maintained between the antenna of this device and persons during device operation. Operations
+ at closer than this distance are not recommended.</p>
+<p>The antenna used for this transmitter must not be co-located in conjunction with any other
+ antenna or transmitter.</p>
+<p>This equipment has been tested and found to comply with the limits for a Class B digital
+ device, pursuant to part 15 of the FCC Rules. These limits are designed to provide reasonable
+ protection against harmful interference in a residential installation. This equipment generates,
+ uses and can radiate radio frequency energy and, if not installed and used in accordance with the
+ instructions, may cause harmful interference to radio communications. However, there is no
+ guarantee that interference will not occur in a particular installation. If this equipment does
+ cause harmful interference to radio or television reception, which can be determined by turning
+ the equipment off and on, the user is encouraged to try to correct the interference by one or more
+ of the following measures:</p>
+<p>—Reorient or relocate the receiving antenna.</p>
+<p>—Increase the separation between the equipment and receiver.</p>
+<p>—Connect the equipment into an outlet on a circuit different from that to which the receiver
+ is connected.</p>
+<p>—Consult the dealer or an experienced radio/ TV technician for help.</p>
+<p>This device complies with part 15 of the FCC Rules. Operation is subject to the following two
+ conditions: (1) This device may not cause harmful interference, and (2) this device must accept
+ any interference received, including interference that may cause undesired operation.</p>
+<p>Changes or modifications not expressly approved by Google Inc. could void the user's
+ authority to operate the equipment.</p>
+<p>Industry Canada Notices</p>
+<p>This device complies with Industry Canada licence-exempt RSS standard(s). Operation is
+ subject to the following two conditions: (1) this device may not cause interference, and (2) this
+ device must accept any interference, including interference that may cause undesired operation of
+ the device.</p>
+<p>Under Industry Canada regulations, this radio transmitter may only operate using an antenna
+ of a type and maximum (or lesser) gain approved for the transmitter by Industry Canada. To reduce
+ potential radio interference to other users, the antenna type and its gain should be so chosen
+ that the equivalent isotropically radiated power (e.i.r.p.) is not more than that necessary for
+ successful communication.</p>
+<p>The radiated output power of the Wireless Device is below the Industry Canada (IC) radio
+ frequency exposure limits. The Wireless Device should be used in such a manner such that the
+ potential for human contact during normal operation is minimized.</p>
+
+<hr />
+
+<p>CAN ICES-3 (B)/NMB-3(B)</p>
+<p>
+ <u>Avis d’<em>Industrie Canada</em></u>
+</p>
+<p>
+ Le présent appareil est conforme aux <em>CNR</em> d'Industrie Canada applicables aux appareils
+ radio exempts de licence. L'exploitation est autorisée aux deux conditions suivantes : (1)
+ l'appareil ne doit pas produire de brouillage, et (2) l'appareil doit accepter tout brouillage
+ radioélectrique subi, même si le brouillage est susceptible d'en compromettre le fonctionnement.
+</p>
+<p>
+ En vertu de la règlementation d’<em>Industrie Canada</em>, cet émetteur radio peut
+ fonctionner avec une antenne d'un type et d'un gain maximal (ou inférieur) approuvé pour
+ l'émetteur par <em>Industrie Canada</em>. Dans le but de réduire les risques de brouillage
+ radioélectrique à l'intention des autres utilisateurs, il faut choisir le type d'antenne et son
+ gain de sorte que la puissance isotrope rayonnée équivalente (p.i.r.e.) ne dépasse pas l'intensité
+ nécessaire à l'établissement d'une communication satisfaisante.
+</p>
+<p>
+ La puissance rayonnée en sortie de l'appareil sans fil est inférieure aux limites fixées par
+ <em>Industrie Canada</em> en matière d'exposition aux radiofréquences. L'appareil sans fil
+ doit être utilisé de sorte que la possibilité d'un contact humain pendant le fonctionnement
+ normal soit limitée.
+</p>
diff --git a/docs/html/preview/tv/adt-1/safety.jd b/docs/html/preview/tv/adt-1/safety.jd
new file mode 100644
index 000000000000..198485306336
--- /dev/null
+++ b/docs/html/preview/tv/adt-1/safety.jd
@@ -0,0 +1,140 @@
+page.title=Important Safety Instructions for ADT-1
+parent.title=ADT-1 Developer Kit
+parent.link=index.html
+
+@jd:body
+
+<p>Safety information for the <a href="index.html">ADT-1</a> device.</p>
+
+<p>
+ <strong>WARNING:</strong> Read all safety information below before using this device to avoid
+ injury.
+</p>
+<ul>
+ <li><p>Do not install near heat sources, such as heaters and other devices.</p></li>
+ <li><p>Use in a well-ventilated area and plug power adapter into an easily accessible
+ outlet. Only use this device with the provided power adapter.</p></li>
+ <li><p>The device has no on/off switch. To disconnect from power, you must unplug the
+ power adapter.</p></li>
+ <li><p>Only use indoors and do not expose to rain, liquid, moisture, excessive heat, or
+ naked flame.</p></li>
+ <li><p>Clean only with a dry cloth.</p></li>
+</ul>
+<p>
+ <strong>WARNING:</strong> Playing video games has been linked to injuries in some
+ users. Read all safety and health information below before using the gamepad to avoid possible
+ injury.
+</p>
+
+<p><u>Photosensitive Seizures</u></p>
+
+<p>
+ A very small percentage of people may experience a seizure when exposed to certain visual images,
+ including flashing lights or patterns that may appear in some video games, even people who have no
+ history of seizures or epilepsy. These seizures have a variety of symptoms, including
+ lightheadedness, altered vision, disorientation, loss of awareness, involuntary movements, loss of
+ consciousness, or convulsions. If you experience any of these symptoms, <u>stop gaming
+ immediately and consult your doctor</u>.
+</p>
+
+<p><u>Ergonomics</u></p>
+
+<p>Long periods of repetitive motion using incorrect body positioning may be associated with
+ physical discomfort and injuries to nerves, tendons, and muscles. If during or after gaming you
+ feel pain, numbness, weakness, swelling, burning, cramping, or stiffness, <u>stop gaming
+ and consult your doctor</u>.
+
+<p>
+ <strong>Healthy Gaming</strong>
+</p>
+
+<p>To reduce risk of seizures or injury, take the following precautions:</p>
+
+<ul>
+ <li><p>Sit as far away from the TV screen as possible.</p></li>
+ <li><p>Play in a well-lit room.</p></li>
+ <li><p>Do not play when you are drowsy or fatigued.</p></li>
+ <li><p>Take 10-15 minute breaks every hour if playing video games and avoid prolonged
+ gaming.</p></li>
+</ul>
+
+<p>
+ <strong>Do Not Attempt Repairs Yourself</strong>
+</p>
+
+<p>There are no user-serviceable parts inside. Do not attempt to open or disassemble.</p>
+
+<p>Failure to follow these safety instructions could result in fire, electric shock, damage to
+ the device or other property, or personal injury.</p>
+
+<hr />
+
+<p>
+ <strong>Importantes instructions concernant la sécurité</strong>
+</p>
+
+<p>
+ <strong>ATTENTION:</strong> Veuillez lire toutes les informations de sécurité énoncées ci-bas
+ avant d’utiliser l’appareil pour éviter des blessures.
+</p>
+
+<ul>
+ <li><p>Ne pas installer à proximité d’une source de chaleur telle une chaufferette ou un
+ autre appareil similaire.</p></li>
+ <li><p>Utiliser dans un endroit bien aéré et brancher l’adaptateur électrique dans une
+ prise de courant facilement accessible.</p></li>
+ <li><p>L’appareil ne possède aucun interrupteur marché/arrêt. Pour mettre l’appareil hors
+ tension, il faut débrancher l’appareil de la prise de courant.</p></li>
+ <li><p>Utiliser l’appareil uniquement à l’intérieur et ne pas l’exposer à la pluie, à des
+ substances liquides, à l’humidité, à la chaleur excessive ou à une flamme.</p></li>
+ <li><p>Nettoyer uniquement avec un linge sec.</p></li>
+</ul>
+
+<p>
+ <strong>ATTENTION:</strong> Le fait de jouer à des jeux vidéo a été relié à des blessures chez certains
+ utilisateurs. Afin d’éviter de possibles blessures, veuillez lire toutes les informations
+ concernant la sécurité et la santé énoncées ci-bas avant d’utiliser la tablette de jeu.
+</p>
+
+<p><u>Épilepsie photosensible</u></p>
+
+<p>L’exposition à certaines images visuelles, incluant les lumières ou motifs clignotants qui
+ peuvent apparaître dans certains jeux vidéo, peut provoquer chez un très faible pourcentage de
+ personnes une crise d’épilepsie, et ce, même si ces personnes n’ont aucun historique de crises ou
+ d’épilepsie. Ces crises comportent divers symptômes tels que des étourdissements, une vision
+ altérée, un sentiment de désorientation, la perte de conscience, des mouvements involontaires, la
+ perte de connaissance ou de conscience ou des convulsions. Si vous ressentez quelconque de ces
+ symptômes, <u>cessez de jouer immédiatement et consultez votre médecin</u>.</p>
+
+<p><u>Ergonomie</u></p>
+
+<p>Les longues périodes de mouvements répétitifs effectués dans une position corporelle
+ inadéquate peuvent mener à un inconfort physique et à des blessures aux nerfs, tendons et muscles.
+ Si durant ou après avoir joué à des jeux vidéo, vous ressentez de la douleur, de
+ l’engourdissement, une faiblesse, de l’inflammation, une sensation de brûlure, des crampes ou de
+ la rigidité, <u>cessez de jouer immédiatement et consultez votre médecin</u>.</p>
+
+<p>
+ <strong>Le jeu sécuritaire</strong>
+</p>
+
+<p>Afin de réduire les risques de crises d’épilepsie ou de blessures, veuillez prendre les
+ précautions suivantes :</p>
+
+<ul>
+ <li>Asseyez-vous aussi loin de l’écran de télévision que possible.</li>
+ <li>Jouez dans une pièce munie d’un éclairage adéquat.</li>
+ <li>Ne jouez pas lorsque vous êtes étourdi ou fatigué.</li>
+ <li>Prenez 10 à 15 minutes de pause après chaque heure de jeu et évitez les périodes de jeu
+ prolongées.</li>
+</ul>
+
+<p>
+ <strong>Ne pas tenter d’effectuer des réparations par vous-même</strong>
+</p>
+
+<p>L’Appareil ne contient aucune pièce pouvant être réparée par l’utilisateur. Ne pas tenter
+ d’ouvrir ou de désassembler l’Appareil.</p>
+
+<p>Le défaut de suivre ces instructions de sécurité pourrait provoquer un feu, un choc
+ électrique, un dommage à l’Appareil ou à d’autres objets ou des lésions corporelles.</p>
diff --git a/docs/html/preview/tv/games/index.jd b/docs/html/preview/tv/games/index.jd
new file mode 100644
index 000000000000..b9de3a4bf051
--- /dev/null
+++ b/docs/html/preview/tv/games/index.jd
@@ -0,0 +1,70 @@
+page.title=Games on TV
+page.tags="controller"
+
+@jd:body
+
+<p>This section complements the [larger best-practices guidance for designing for Android TV](TODO, use formal name of referenced doc, and add link). It assumes that you have read that guidance, and seeks to minimize repetition.</p>
+
+<h2>Overview</h2>
+<p>Because of factors including its large size, its control scheme, and its nature as a shared display, the television screen presents a number of considerations that may be new to mobile developers. This document breaks these considerations down into five sections:</p>
+<ul>
+<li>Display</li>
+<li>Control</li>
+<li>Manifest</li>
+<li>Google Play Game Services</li>
+<li>Web</li>
+</ul>
+<h2>Display</h2>
+<p>Large and centrally situated, the television screen imposes limitations, but also opens up new opportunities for immersive gameplay.</p>
+<h3>A shared display</h3>
+<p>A living-room TV poses design challenges for multiplayer games, in that all players can see everything. This issue is especially germane to games (such as card games or strategy games) that rely on each player’s possession of hidden information.</p>
+<p>Some mechanisms you can implement to address the problem of one player’s “eavesdropping” on another’s information are:</p>
+<ul>
+<li>A player might place a "blinder" on the screen to help conceal information. For example, in a turn-based game like a word or card game, one player at a time might view the display. When the player finishes a move, the game allows him or her to cover the screen with a “blinder” that blocks anyone from viewing secret information. When the next player begins a turn, the blinder opens to reveal his or her own information.</li>
+<li>A second screen, such as a handset or larger device, can enable a player to conceal information. For information on implementing second-screen support, see <a href="http://developer.android.com/reference/android/app/Presentation.html">Presentation</a> on the Android developer site.</li>
+</ul>
+<h3>No touch interface</h3>
+<p>A television does not have a touch interface. Your game design, therefore, need not take into account the possibility that a player’s controlling fingers might block the on-screen action. You can assume constant visibility of the entire viewing area.</p>
+<p>See the <a href=#control>Control</a> section in this document and in [Design for TV](TODO, use formal name of referenced doc, and add link) for more implications of the lack of touch interface.</p>
+<h3>Landscape display</h3>
+<p>In mobile-device terms, a TV is always “sideways.” You can’t turn it, and there is no portrait orientation. You should always be designing your TV games to be displayed in landscape mode.</p>
+<a id=control><h2>Control</h2>
+<p>Without a touch interface, it's even more important than usual to get your controls right, so that players find them intuitive and fun to use. The separation of controller from device also introduces some other issues to pay attention to, like keeping track of multiple players' controllers, and handling disconnects gracefully.</p>
+<h3>D-pad</h3>
+<p>Because of the lack of touch interface, you should be planning your control scheme based on a D-pad. Some key points to keep in mind include:</p>
+<p>The player needs to use the gamepad in all aspects of the game&ndash;not just controlling core gameplay, but also navigating menus and ads. For this reason, you should also ensure that your Android TV game does not refer to a touch interface: for example, an Android TV game cannot tell a player to "Tap to skip".</p>
+<p>You can avoid unhappy surprises (and resulting low ratings) by using your Play Store description to communicate to the player any expectations about controllers. If a game is better suited to a gamepad with a joystick than one with only a D-pad, you should make this clear. A player who uses an ill-suited controller for a game is likely to have a subpar experience&ndash;and penalize your game in the ratings.</p>
+<p>You can also help ensure a good player experience by ensuring that button mapping is intuitive and flexible. For example, you can adhere to accepted custom by using the A button to <code>Accept</code>, and the B button to <code>Cancel</code>. You can also offer flexibility in the form of remappability. For more information on button mapping, see <a href="http://developer.android.com/training/game-controllers/controller-input.html">Handling Controller Actions</a>.</p>
+<p>Your game can also contribute to a good match between controller and game by querying the controller about its capabilities. For example, you may intend for a player to steer an object by waving the controller in the air. If a player's controller lacks accelerometer and gyroscope hardware, however, waving will not work. But when your game queries the controller and discovers that motion detection is not supported, it can switch over to an alternative, available control scheme.</p>
+<p>For more information on querying controller capabilities, see <a href="http://developer.android.com/training/game-controllers/compatibility.html">Supporting Controllers Across Android Versions</a>.</p>
+<h3>Back-button behavior</h3>
+<p>The Back button should never act as a toggle. For example, do not use it to both open and close a menu. Its behavior should only be linear. For example: Game play &gt; Game pause screen &gt; Game main screen &gt; Android home screen.</p>
+<p>With this principle of "linear navigation" in mind, you <b>may</b> use the back button to leave an in-game menu (opened by a different button) and return to gameplay.</p>
+<h3>Handling multiple controllers</h3>
+<p>When multiple players are playing a game, each with his or her own controller, it is important to map each player-controller pair. For information on how to implement controller-number identification, see <a href="http://developer.android.com/reference/android/view/InputDevice.html#getControllerNumber(">Input Devices</a>) on the Android developer site.</p>
+<h3>Handling disconnects</h3>
+<p>When a controller is disconnected in the middle of gameplay, the game should pause, and a dialog should appear prompting the disconnected player to reconnect his or her controller.</p>
+<p>The dialog should also offer troubleshooting tips (e.g., "Check your Bluetooth connection").</p>
+<h2>Manifest</h2>
+<p>Games are displayed in a separate row from regular apps in the launcher. Android TV uses the <code>android:isGame</code> flag to differentiate games from non-game apps. You can assign it a value of either <code>true</code> or <code>false</code>. For example:</p>
+<pre class="fragment">&lt;application&gt;
+ . . .
+ &lt;meta-data android:name="isGame" android:value=["true" | "false"]/&gt;
+android:isGame=["true" | "false"] &gt;
+ . . .
+&lt;/application&gt;
+</pre><h2>Google Play Game Services</h2>
+<p>If your game integrates Google Play Game Services, you should keep in mind a number of considerations pertaining to achievements, sign-on, saving games, and multiplayer play.</p>
+<h3>Achievements</h3>
+<p>Your game should include at least five (earnable) achievements. Only a user controlling gameplay from a supported input device should be able to earn achievements.</p>
+<h3>Sign-on</h3>
+<p>Your game should attempt to sign the user in on launch. If the player declines sign-in several times in a row, your game should stop asking.</p>
+<h3>Saving</h3>
+<p>We highly recommend using Play Services cloud save to store your game save. Your game should bind game saves to a specific Google account, so as to be uniquely identifiable even across devices: Whether the player is using a handset or a TV, the game should be able to pull the same game-save information from his or her account.</p>
+<p>You should also provide an option in your game's UI to prompt the player to destroy save data. You might put the option in the game's <code>Settings</code> screen.</p>
+<h3>Multiplayer experience</h3>
+<p>A game offering a multiplayer experience must allow at least two players to enter a room.</p>
+<h2>Web</h2>
+<p>Android TV games do not support a full web browser. You should therefore avoid using generic URLs in your game.</p>
+<p>Webviews will work for logins to services like Google+ and Facebook. </p>
+
diff --git a/docs/html/preview/tv/images/android-tv-remote.png b/docs/html/preview/tv/images/android-tv-remote.png
new file mode 100644
index 000000000000..d15fbc5e376f
--- /dev/null
+++ b/docs/html/preview/tv/images/android-tv-remote.png
Binary files differ
diff --git a/docs/html/preview/tv/images/home-recommendations.png b/docs/html/preview/tv/images/home-recommendations.png
new file mode 100644
index 000000000000..ef97145c5ac0
--- /dev/null
+++ b/docs/html/preview/tv/images/home-recommendations.png
Binary files differ
diff --git a/docs/html/preview/tv/index.jd b/docs/html/preview/tv/index.jd
new file mode 100644
index 000000000000..dd359085f08b
--- /dev/null
+++ b/docs/html/preview/tv/index.jd
@@ -0,0 +1,22 @@
+page.title=Android TV Apps
+
+@jd:body
+
+<p>Android offers a rich user experience that's optimized for apps running on large screen
+ devices, such as high-definition televisions. Apps on TV offer new opportunities to
+ delight your users from the comfort of their couch.</p>
+
+<p>This guide helps you build apps for TV devices, including:</p>
+
+<ul>
+ <li>How to set up your development environment</li>
+ <li>How to build user interfaces for TV</li>
+ <li>Guidelines for building games for TV</li>
+</ul>
+
+<p>Prepare your app for its big screen debut!</p>
+
+<p>
+ <strong><a href="{@docRoot}preview/tv/start/index.html">Get Started &gt;</a></strong>
+</p>
+
diff --git a/docs/html/preview/tv/start/hardware-features.jd b/docs/html/preview/tv/start/hardware-features.jd
new file mode 100644
index 000000000000..ddec49688ff9
--- /dev/null
+++ b/docs/html/preview/tv/start/hardware-features.jd
@@ -0,0 +1,183 @@
+page.title=Hardware Features on TV
+page.tags="unsupported"
+
+@jd:body
+
+<div id="qv-wrapper">
+<div id="qv">
+ <h2>In this document</h2>
+ <ol>
+ <li><a href="#unsupported-features">Unsupported Hardware Features</a></li>
+ <li><a href="#workaround-features">Handling Unsupported Features</a></li>
+ <li><a href="#check-features">Checking Available Features</a>
+ <ol>
+ <li><a href="#no-touchscreen">Touch screen</a></li>
+ <li><a href="#no-camera">Camera</a></li>
+ <li><a href="#no-gps">GPS</a></li>
+ </ol>
+
+ </li>
+ </ol>
+</div>
+</div>
+
+<p>TVs do not have some of the hardware features found on other Android devices.
+Touch screens, cameras, and GPS receivers are some of the most commonly used hardware features
+which are typically not available on a TV. When you build an app for TV, you must carefully
+consider if your app can handle not having these features and, if necessary, work around them.</p>
+
+<p>This guide discusses the hardware features not available on TV devices and shows you how to
+work around those limitations in your app. For more information on filtering and declaring
+features in the manifest, see the
+<a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">uses-feature</a> guide.</p>
+
+
+<h2 id="unsupported-features">Unsupported Hardware Features</h2>
+
+<p>TVs have a different purpose from other devices, and so they do not have hardware
+features that other Android-powered devices often have. For this reason, the Android system
+does not support the following features for a TV device:
+
+<table>
+<tr>
+<th>Hardware</th>
+<th>Android feature descriptor</th>
+</tr>
+<tr>
+<td>Camera</td>
+<td>android.hardware.camera</td>
+</tr>
+<tr>
+<td>GPS</td>
+<td>android.hardware.location.gps</td>
+</tr>
+<tr>
+<td>Microphone</td>
+<td>android.hardware.microphone</td>
+</tr>
+<tr>
+<td>Near Field Communications (NFC)</td>
+<td>android.hardware.nfc</td>
+</tr>
+<tr>
+<td>Telephony</td>
+<td>android.hardware.telephony</td>
+</tr>
+<tr>
+<td>Touchscreen</td>
+<td>android.hardware.touchscreen</td>
+</tr>
+</table>
+</p>
+
+
+<h2 id="check-features">Checking Available Features</h2>
+
+<p>To check if a feature is available at runtime, call {@link
+ android.content.pm.PackageManager#hasSystemFeature(String)}. This method takes a single string
+ argument that specifies the feature you want to check. For example, to check for a touch screen,
+ use {@link android.content.pm.PackageManager#hasSystemFeature(String)} with the argument
+ {@link android.content.pm.PackageManager#FEATURE_TOUCHSCREEN}.</p>
+
+<p>The following code example demonstrates how to detect the availability of a hardware features
+ at runtime:</p>
+
+<pre>
+// Check if the telephony hardware feature is available.
+if (getPackageManager().hasSystemFeature("android.hardware.telephony")) {
+ Log.d("Mobile Test", "Running on phone");
+// Check if android.hardware.touchscreen feature is available.
+} else if (getPackageManager().hasSystemFeature("android.hardware.touchscreen")) {
+ Log.d("Tablet Test", "Running on devices that don't support telephony but "+
+ "do have a touch screen.");
+} else {
+ Log.d("TV Test", "Running on a TV!");
+}
+</pre>
+
+<p class="note">
+ <strong>Note:</strong> You can also use the {@link android.app.UiModeManager#getCurrentModeType
+ UiModeManager.getCurrentModeType()} method to detect the current platform type. For TV devices,
+ this method returns a value of {@link android.content.res.Configuration#UI_MODE_TYPE_TELEVISION
+ Configuration.UI_MODE_TYPE_TELEVISION}.
+</p>
+
+
+<h2 id="workaround-features">Handling Unsupported Features</h2>
+
+<p>Depending on the design and functionality of your app, you may be able to work around certain
+ hardware features being unavailable. This section discusses how to work around specific hardware
+ features.</p>
+
+
+<h3 id="no-touchscreen">Touch screen</h3>
+
+<p>Android doesn't support touch screen interaction for TV devices, since most TVs don't have touch
+ screens, and using a touch screen is not consistent with a viewing environment where the user is
+ seated 10 feet away from the display.</p>
+
+<p>On TV devices, you should work around this limitation by supporting navigation using a directional
+ pad (D-pad) on TV remote control. For more information on properly supporting navigation using
+ TV-friendly controls, see <a href="{@docRoot}preview/tv/ui/navigation.html">Navigation for
+ TV</a>.</p>
+
+<p>You can explicitly declare if your application requires (or does not require) a touch screen
+ by including the following entry in your manifest:</p>
+
+<pre>
+&lt;uses-feature android:name="android.hardware.touchscreen"
+ android:required="false"/&gt;
+</pre>
+
+
+<h3 id="no-camera">Camera</h3>
+
+<p>Although a TV typically does not have a camera, you can still provide a photography-related
+ application on a TV. For example, if you have an app that takes, views and edits photos, you can
+ disable its picture-taking functionality for TVs and still allow users to view and even edit
+ photos. If you decide that you want to enable your camera-related application to work on a
+ TV device without a camera, you can add an attribute to your app manifest declaring that
+ a camera is not required by your app:</p>
+
+<pre>
+&lt;uses-feature android:name="android.hardware.camera" android:required="false" /&gt;
+</pre>
+
+<p>If you enable your application to run without a camera, you should add code to your application
+that detects if the camera feature is available and makes adjustments to the operation of your app.
+The following code example demonstrates how to detect the presence of a camera:</p>
+
+<pre>
+// Check if the camera hardware feature is available.
+if (getPackageManager().hasSystemFeature("android.hardware.camera")) {
+ Log.d("Camera test", "Camera available!");
+} else {
+ Log.d("Camera test", "No camera available. View and edit features only.");
+}
+</pre>
+
+
+<h3 id="no-gps">GPS</h3>
+
+<p>TVs are stationary, indoor devices, and do not have built-in global positioning system (GPS)
+ receivers. If your application uses location information, you can still allow users to search
+ for a location, or use a static location provider such as a zip code configured during the
+ TV device setup.</p>
+
+<pre>
+LocationManager locationManager = (LocationManager) this.getSystemService(
+ Context.LOCATION_SERVICE);
+Location location = locationManager.getLastKnownLocation("static");
+Geocoder geocoder = new Geocoder(this);
+Address address = null;
+
+try {
+ address = geocoder.getFromLocation(location.getLatitude(),
+ location.getLongitude(), 1).get(0);
+ Log.d("Zip code", address.getPostalCode());
+
+} catch (IOException e) {
+ Log.e(TAG, "Geocoder error", e);
+}
+</pre>
+
diff --git a/docs/html/preview/tv/start/index.jd b/docs/html/preview/tv/start/index.jd
new file mode 100644
index 000000000000..11d6ad3def40
--- /dev/null
+++ b/docs/html/preview/tv/start/index.jd
@@ -0,0 +1,233 @@
+page.title=Get Started with TV Apps
+page.tags="leanback","recyclerview","launcher"
+
+@jd:body
+
+<div id="qv-wrapper">
+<div id="qv">
+ <h2>In this document</h2>
+ <ol>
+ <li><a href="#prerequisites">Prerequisites</a></li>
+ <li><a href="#dev-project">Setup a TV Project</a>
+ <ul>
+ <li><a href="#tv-activity">Create a TV Activity</a></li>
+ <li><a href="#tv-libraries">Add TV Support Libraries</a></li>
+ </ul>
+ </li>
+ <li><a href="#build-it">Build TV Apps</a></li>
+ <li><a href="#run">Run TV Apps</a></li>
+
+ </ol>
+</div>
+</div>
+
+<p>This guide describes how to prepare your development environment and projects for building
+ TV apps, including updating your existing app to run on TV devices.</p>
+
+
+<h2 id="prerequisites">Prerequisites</h2>
+
+<p>Before you begin setting up to build apps for TV, you must:</p>
+
+<ul>
+ <li><strong><a href="{@docRoot}preview/setup-sdk.html">
+ Set up the Preview SDK</a></strong>
+ <br>
+ The preview SDK provides the developer tools needed to build and test apps for TV.
+ </li>
+ <li><strong><a href="{@docRoot}preview/setup-sdk.html#project">
+ Create a Preview SDK Project</a></strong>
+ <br>
+ In order to access new APIs for TV devices, you must create a project that targets the preview
+ release level or modify an existing project to target the preview release.
+ </li>
+</ul>
+
+
+<h2 id="dev-project">Set up a TV Project</h2>
+
+<p>TV apps use the same structure as those for phones and tablets. This means you can modify
+ your existing apps to also run on TV devices or create new apps based on what you already know
+ about building apps for Android. This section discusses how to modify an existing app, or create a
+ new one, to run on TV devices.</p>
+
+<p>These are the main steps to creating an app that runs on TV devices. Only the first
+ is required:</p>
+
+<ul>
+ <li><strong>Activity for TV</strong> - (Required) In your application manifest, you must
+ declare an activity that is intended to run on TV devices.</li>
+ <li><strong>TV Support Libraries</strong> - (Optional) There are several Support Libraries
+ available for TV devices that provide widgets for building user interfaces.</li>
+</ul>
+
+
+<h3 id="tv-activity">Create a TV Activity</h3>
+
+<p>An application intended to run on TV devices must declare a launcher activity for TV
+ in its manifest using a {@code android.intent.category.LEANBACK_LAUNCHER} intent filter.
+ This filter identifies your app as being built for TV, enabling it to be displayed in the
+ Google Play store app running on TV devices. Declaring this intent also identifies which activity
+ in your app should be launched when a user selects its icon on the TV home screen.</p>
+
+<p class="caution">
+ <strong>Caution:</strong> If you do not include the {@code LEANBACK_LAUNCHER} intent filter in
+ your app, it is not visible to users running the Google Play store on TV devices. Also, if your
+ app does not have this filter when you load it onto a TV device using developer tools, the app
+ does not appear in the TV user interface.
+</p>
+
+<p>The following code snippet shows how to include this intent filter in your manifest:</p>
+
+<pre>
+&lt;application&gt;
+ ...
+ &lt;activity
+ android:name=&quot;com.example.android.MainActivity&quot;
+ android:label=&quot;@string/app_name&quot; &gt;
+
+ &lt;intent-filter&gt;
+ &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
+ &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
+ &lt;/intent-filter&gt;
+ &lt;/activity&gt;
+
+ &lt;activity
+ android:name=&quot;com.example.android.<strong>TvActivity</strong>&quot;
+ android:label=&quot;&#64;string/app_name&quot;
+ android:theme=&quot;&#64;android:style/Theme.Leanback&quot;&gt;
+
+ &lt;intent-filter&gt;
+ &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
+ &lt;category android:name="<strong>android.intent.category.LEANBACK_LAUNCHER</strong>" /&gt;
+ &lt;/intent-filter&gt;
+
+ &lt;/activity&gt;
+&lt;/application&gt;
+</pre>
+
+<p>The second activity manifest entry in the example above specifies that activity as
+ the main one when your app launches on an TV device.</p>
+
+<p>If you have an existing app that you are modifying for TV use, your app should not use the same
+ activity layout for TV that it does for phones and tablets. The user interface of your TV app (or
+ TV portion of your existing app) should provide a simpler interface that can be easily navigated
+ using a remote control from a couch. For guidelines on designing an app for TV, see the
+ <a href="{@docRoot}design/tv/index.html">TV Design</a> guide. For more instructions on
+ developing a user interface appropriate to TV, see the
+ <a href="{@docRoot}preview/tv/ui/index.html">TV User Interface</a> guide.
+</p>
+
+
+<h3 id="tv-libraries">Add TV Support Libraries</h3>
+
+<p>The Preview SDK includes support libraries that are intended for use with TV apps. These
+ libraries provide APIs and user interface widgets for use on TV devices. The libraries are
+ located in the {@code &lt;sdk&gt;/extras/android/support/} directory where you installed the
+ Preview SDK. Here is a list of the libraries and their general purpose:</p>
+
+<ul>
+ <li><strong>v17 leanback library</strong> - Provides user interface widgets for TV, including
+ {@code BrowseFragment}, {@code DetailsFragment}, and {@code SearchFragment}.
+ <ul>
+ <li>SDK location: {@code &lt;sdk&gt;/extras/android/support/v17/leanback}</li>
+ <li>Gradle dependency: {@code com.android.support:leanback-v17:20.0.+}</li>
+ <li>Contains resources: Yes</li>
+ </ul>
+ </li>
+ <li><strong>v7 recyclerview library</strong> - Provides classes for managing display of long
+ lists in a memory efficient manner. Several classes in the v17 leanback library depend on the
+ classes in this library.
+ <ul>
+ <li>SDK location: {@code &lt;sdk&gt;/extras/android/support/v7/recyclerview}</li>
+ <li>Gradle dependency: {@code com.android.support:recyclerview-v7:20.0.+}</li>
+ <li>Contains resources: No</li>
+ </ul>
+ </li>
+</ul>
+
+<p class="note">
+ <strong>Note:</strong> You are not required to use these support libraries for your TV app.
+ However, we strongly recommend using them, particularly for apps that provide a media catalog
+ browsing interface.
+</p>
+
+<p>If you decide to use the v17 leanback library for your app, you should note that it is
+ dependent on the <a href="{@docRoot}tools/support-library/features.html#v7-appcompat">v7
+ appcompat library</a>, which is, in turn, dependent on the
+ <a href="{@docRoot}tools/support-library/features.html#v4">v4 support library</a>. This means
+ that apps that use the leanback support library should include all of these support
+ libraries:</p>
+
+<ul>
+ <li>v17 leanback support library</li>
+ <li>v7 recyclerview support library</li>
+ <li>v7 appcompat support library</li>
+ <li>v4 support library</li>
+</ul>
+
+<p>Two of these libraries (v17 leanback and v7 appcompat) contain resources, which require
+ you to take specific steps to include them in app projects. For instructions on
+ importing a support library with resources, see
+ <a href="http://developer.android.com/tools/support-library/setup.html#libs-with-res">
+ Support Library Setup</a>.
+</p>
+
+
+<h2 id="build-it">Build TV Apps</h2>
+
+<p>After you have completed the steps described above, it's time to start building apps for
+ the big screen! Check out these additional topics to help you build your app for TV:
+
+<ul>
+ <li><a href="{@docRoot}preview/tv/ui/index.html">User Interface</a> - The user interface of
+ TV devices is different from those of other Android devices. See this topic to find out how
+ to build TV user interfaces and to learn about the widgets provided to simplify that task.
+ </li>
+ <li><a href="{@docRoot}preview/tv/games/index.html">Games for TV</a> - TV devices are great
+ platforms for games. See this topic for information on building great game experiences for
+ TV.</li>
+ <li><a href="{@docRoot}preview/tv/start/hardware-features.html">Hardware features</a> - TV
+ devices do not contain hardware features normally found on other Android devices. See this
+ topic for information on unsupported hardware features and what to do about them.
+ </li>
+</ul>
+
+
+<h2 id="run">Run TV Apps</h2>
+
+<p>Running your app is an important part of the development process. The AVD Manager in the
+ Android SDK provides the device definitions that allows you to create virtual TV devices for
+ running and testing your applications.</p>
+
+<p>To create an virtual TV device:</p>
+
+<ol>
+ <li>Start the AVD Manager. For more information, see the
+ <a href="{@docRoot}tools/help/avd-manager.html">AVD Manager</a> help.</li>
+ <li>In the AVD Manager dialog, click the <strong>Device Definitions</strong> tab.</li>
+ <li>Select one of the Android TV device definitions, such as
+ <strong>Large Android TV</strong>, and click <strong>Create AVD</strong>.</li>
+ <li>Select the emulator options and click <strong>OK</strong> to create the AVD.
+ <p class="note">
+ <strong>Note:</strong> For best performance of the TV emulator device, enable the <strong>Use
+ Host GPU</strong> option and CPU platform image that supports hardware acceleration. For
+ more information on hardware acceleration of the emulator, see
+ <a href="{@docRoot}tools/devices/emulator.html#acceleration">Using the Emulator</a>.
+ </p>
+ </li>
+</ol>
+
+<p>To test your application on the virtual TV device:</p>
+
+<ol>
+ <li>Compile your TV application in your development environment.</li>
+ <li>Run the application from your development environment and choose the TV virtual device as
+ the target.</li>
+</ol>
+
+<p>For more information about using emulators see, <a href="{@docRoot}tools/devices/emulator.html">
+Using the Emulator</a>. For more information about deploying apps to emulators from
+Eclipse with ADT, see <a href="{@docRoot}http://developer.android.com/tools/building/building-eclipse.html">
+Building and Running from Eclipse with ADT</a>.</p>
+
diff --git a/docs/html/preview/tv/ui/browse.jd b/docs/html/preview/tv/ui/browse.jd
new file mode 100644
index 000000000000..d7a1fb685017
--- /dev/null
+++ b/docs/html/preview/tv/ui/browse.jd
@@ -0,0 +1,199 @@
+page.title=BrowseFragment
+
+@jd:body
+
+<div id="qv-wrapper">
+<div id="qv">
+ <h2>In this document</h2>
+ <ol>
+ <li><a href="#layout">Media Browse Layout</a></li>
+ <li><a href="#lists">Displaying Media Lists</a></li>
+ <li><a href="#background">Updating the Background</a></li>
+ </ol>
+
+</div>
+</div>
+
+<p>The <a href="{@docRoot}preview/tv/start/index.html#tv-libraries">Leanback support library</a>
+ provides several APIs for displaying and browsing media catalogs
+ on the TV devices. This guide discusses how to use the classes provided by this library to
+ implement a user interface for browsing music or videos from your app's media catalog.</p>
+
+
+<h2 id="layout">Media Browse Layout</h2>
+
+<p>The {@code BrowseFragment} class in the Leanback support library allows you to create a primary
+ layout for browsing categories and rows of media items with a minimum of code. The following
+ example shows how to create a layout that contains a {@code BrowseFragment}:</p>
+
+<pre>
+&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width=&quot;match_parent&quot;
+ android:layout_height=&quot;match_parent&quot;
+ android:orientation=&quot;vertical&quot;
+ &gt;
+
+ &lt;fragment
+ <strong>android:name="android.support.v17.leanback.app.BrowseFragment"</strong>
+ android:id=&quot;@+id/browse_fragment&quot;
+ android:layout_width=&quot;match_parent&quot;
+ android:layout_height=&quot;match_parent&quot;
+ /&gt;
+&lt;/LinearLayout&gt;
+</pre>
+
+<p>In order to work with this layout in an activity, retrieve the {@code BrowseFragment} element
+ from the layout. Use the methods in {@code BrowseFragment} to set display parameters such as the
+ icon, title and whether category headers are enabled. The following code sample demonstrates how
+ to set the layout parameters for a {@code BrowseFragment} in a layout:</p>
+
+<pre>
+public class BrowseMediaActivity extends Activity {
+
+ public static final String TAG ="BrowseActivity";
+
+ protected BrowseFragment mBrowseFragment;
+
+ &#64;Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.browse_fragment);
+
+ final FragmentManager fragmentManager = getFragmentManager();
+ <strong>mBrowseFragment = (BrowseFragment) fragmentManager.findFragmentById(
+ R.id.browse_fragment);</strong>
+
+ // Set display parameters for the BrowseFragment
+ mBrowseFragment.setHeadersState(BrowseFragment.HEADERS_ENABLED);
+ mBrowseFragment.setTitle(getString(R.string.app_name));
+ mBrowseFragment.setBadgeDrawable(getResources().getDrawable(R.drawable.ic_launcher));
+ mBrowseFragment.setBrowseParams(params);
+
+ }
+}
+</pre>
+
+
+<h2 id="lists">Displaying Media Lists</h2>
+
+<p>The {@code BrowseFragment} allows you to define and display browsable media content categories and
+ media items from a media catalog using adapters and presenters. Adapters enable you to connect to
+ local or online data sources that contain your media catalog information. Presenter classes hold
+ data about media items and provide layout information for displaying an item on screen.</p>
+
+<p>The following example code shows an implementation of a presenter for displaying string
+ data:</p>
+
+<pre>
+public class StringPresenter extends Presenter {
+ private static final String TAG = "StringPresenter";
+
+ public ViewHolder onCreateViewHolder(ViewGroup parent) {
+ TextView textView = new TextView(parent.getContext());
+ textView.setFocusable(true);
+ textView.setFocusableInTouchMode(true);
+ textView.setBackground(
+ parent.getContext().getResources().getDrawable(R.drawable.text_bg));
+ return new ViewHolder(textView);
+ }
+
+ public void onBindViewHolder(ViewHolder viewHolder, Object item) {
+ ((TextView) viewHolder.view).setText(item.toString());
+ }
+
+ public void onUnbindViewHolder(ViewHolder viewHolder) {
+ // no op
+ }
+}
+</pre>
+
+<p>Once you have constructed a presenter class for your media items, you can build and attach an
+ adapter to the {@code BrowseFragment} to display those items on screen for browsing by the user. The
+ following example code demonstrates how to construct an adapter to display categories and items
+ in those categories using the StringPresenter class shown in the previous code example:</p>
+
+<pre>
+private ArrayObjectAdapter mRowsAdapter;
+private static final int NUM_ROWS = 4;
+
+&#64;Override
+protected void onCreate(Bundle savedInstanceState) {
+ ...
+
+ buildRowsAdapter();
+}
+
+private void buildRowsAdapter() {
+ mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
+
+ for (int i = 0; i &lt; NUM_ROWS; ++i) {
+ ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(
+ new StringPresenter());
+ listRowAdapter.add("Media Item 1");
+ listRowAdapter.add("Media Item 2");
+ listRowAdapter.add("Media Item 3");
+ HeaderItem header = new HeaderItem(i, "Category " + i, null);
+ mRowsAdapter.add(new ListRow(header, listRowAdapter));
+ }
+
+ mBrowseFragment.setAdapter(mRowsAdapter);
+}
+</pre>
+
+<p>This example shows a static implementation of the adapters. A typical media browsing
+ application uses data from an online database or web service. For an example of a browsing
+ application that uses data retrieved from the web, see the
+ <a href="http://github.com/googlesamples/androidtv-leanback">Android TV</a> sample app.</p>
+
+
+<h2 id="background">Updating the Background</h2>
+
+<p>In order to add visual interest to a media-browsing app on TV, you can update the background
+ image as users browse through content. This technique can make interaction with your app feel more
+ cinematic and enjoyable for users.</p>
+
+<p>The Leanback support library provides a {@link
+ android.support.v17.leanback.app.BackgroundManager} class for changing the background of your TV
+ app activity. The following example shows how to create a simple method for updating the
+ background within your TV app activity:</p>
+
+<pre>
+protected void updateBackground(Drawable drawable) {
+ BackgroundManager.getInstance(this).setDrawable(drawable);
+}
+</pre>
+
+<p>Many of the existing media-browse apps automatically update the background as the user
+ navigates through media listings. In order to do this, you can set up a selection listener to
+ automatically update the background based on the user's current selection. The following example
+ shows you how to set up an {@link android.support.v17.leanback.widget.OnItemSelectedListener}
+ class to catch selection events and update the background:</p>
+
+<pre>
+protected void clearBackground() {
+ BackgroundManager.getInstance(this).setDrawable(mDefaultBackground);
+}
+
+protected OnItemSelectedListener getDefaultItemSelectedListener() {
+ return new OnItemSelectedListener() {
+ &#64;Override
+ public void onItemSelected(Object item, Row row) {
+ if (item instanceof Movie ) {
+ URI uri = ((Movie)item).getBackdropURI();
+ updateBackground(uri);
+ } else {
+ clearBackground();
+ }
+ }
+ };
+}
+</pre>
+
+<p class="note">
+ <strong>Note:</strong> The implementation above is a simple example shown for purposes of
+ illustration. When creating this function in your own app, you should consider running the
+ background update action in a separate thread for better performance. In addition, if you are
+ planning on updating the background in response to users scrolling through items, consider adding
+ a time to delay a background image update until the user settles on an item. This technique avoids
+ excessive background image updates.
+</p>
diff --git a/docs/html/preview/tv/ui/details.jd b/docs/html/preview/tv/ui/details.jd
new file mode 100644
index 000000000000..8b8fa8b5b4bd
--- /dev/null
+++ b/docs/html/preview/tv/ui/details.jd
@@ -0,0 +1,214 @@
+page.title=DetailFragment
+
+@jd:body
+
+<div id="qv-wrapper">
+<div id="qv">
+ <h2>In this document</h2>
+ <ol>
+ <li><a href="#details-presenter">Build a Details Presenter</a></li>
+ <li><a href="#details-fragment">Extend the Details Fragment</a>
+ <li><a href="#activity">Creating a Details Activity</a></li>
+ <li><a href="#item-listener">Listener for Clicked Items</a></li>
+ </li>
+ </ol>
+</div>
+</div>
+
+<p>The media browsing interface classes provided by the
+ <a href="{@docRoot}preview/tv/start/index.html#tv-libraries">Leanback support library</a>
+ include classes for displaying additional information about a media item, such as a description
+ or reviews, and for taking action on that item, such as purchasing it or playing its content. This
+ section discusses how to create a presenter class for media item details and extend the
+ {@code DetailsFragment} class to implement a details view for a media item when it
+ is selected by a user.
+</p>
+
+<p class="note">
+ <strong>Note:</strong> The implementation example shown here uses an additional activity to
+ contain the {@code DetailsFragment}. However, it is possible to avoid creating a second activity
+ by replacing the current {@code BrowseFragment} with a {@code DetailsFragment} within the <em>same</em>
+ activity using fragment transactions. For more information on using fragment transactions, see the
+ <a href="{@docRoot}training/basics/fragments/fragment-ui.html#Replace">Building a Dynamic
+ UI with Fragments</a> training.
+</p>
+
+
+<h2 id="details-presenter">Build a Details Presenter</h2>
+
+<p>In the media browsing framework provided for by the leanback support library, you use
+ presenter objects to control the display of data on screen, including media item details. The
+ framework provides the {@code AbstractDetailsDescriptionPresenter} class for this purpose, which
+ is a nearly complete implementation of the presenter for media item details. All you have to do is
+ implement the {@code onBindDescription()} method to bind the view fields to your data objects, as shown in
+ the following code sample:</p>
+
+<pre>
+public class DetailsDescriptionPresenter
+ extends AbstractDetailsDescriptionPresenter {
+
+ &#64;Override
+ protected void onBindDescription(ViewHolder viewHolder, Object itemData) {
+ MyMediaItemDetails details = (MyMediaItemDetails) itemData;
+ // In a production app, the itemData object contains the information
+ // needed to display details for the media item:
+ // viewHolder.getTitle().setText(details.getShortTitle());
+
+ // Here we provide static data for testing purposes:
+ viewHolder.getTitle().setText(itemData.toString());
+ viewHolder.getSubtitle().setText("2014 Drama TV-14");
+ viewHolder.getBody().setText("Lorem ipsum dolor sit amet, consectetur "
+ + "adipisicing elit, sed do eiusmod tempor incididunt ut labore "
+ + " et dolore magna aliqua. Ut enim ad minim veniam, quis "
+ + "nostrud exercitation ullamco laboris nisi ut aliquip ex ea "
+ + "commodo consequat.");
+ }
+}
+</pre>
+
+
+<h2 id="details-fragment">Extend the Details Fragment</h2>
+
+<p>When you use the {@code DetailsFragment} class for displaying your media item details, you
+ extend that class to provide additional content such as a preview image and actions for the media
+ item. You can also provide additional content, such as a list of related media items.</p>
+
+<p>The following example code demonstrates how to use the presenter class you created in the
+ previous section, add a preview image and actions for the media item being viewed. This example
+ also shows the addition of a related media items row, which appears below the details listing.</p>
+
+<pre>
+public class MediaItemDetailsFragment extends DetailsFragment {
+ private static final String TAG = "MediaItemDetailsFragment";
+ private ArrayObjectAdapter mRowsAdapter;
+
+ &#64;Override
+ public void onCreate(Bundle savedInstanceState) {
+ Log.i(TAG, "onCreate");
+ super.onCreate(savedInstanceState);
+
+ buildDetails();
+ }
+
+ private void buildDetails() {
+ ClassPresenterSelector selector = new ClassPresenterSelector();
+ // Attach your media item details presenter to the row presenter:
+ DetailsOverviewRowPresenter rowPresenter =
+ new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter());
+
+ selector.addClassPresenter(DetailsOverviewRow.class, rowPresenter);
+ selector.addClassPresenter(ListRow.class,
+ new ListRowPresenter());
+ mRowsAdapter = new ArrayObjectAdapter(selector);
+
+ Resources res = getActivity().getResources();
+ DetailsOverviewRow detailsOverview = new DetailsOverviewRow(
+ "Media Item Details");
+
+ // Add images and action buttons to the details view
+ detailsOverview.setImageDrawable(res.getDrawable(R.drawable.jelly_beans));
+ detailsOverview.addAction(new Action(1, "Buy $9.99"));
+ detailsOverview.addAction(new Action(2, "Rent $2.99"));
+ mRowsAdapter.add(detailsOverview);
+
+ // Add a Related items row
+ ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(
+ new StringPresenter());
+ listRowAdapter.add("Media Item 1");
+ listRowAdapter.add("Media Item 2");
+ listRowAdapter.add("Media Item 3");
+ HeaderItem header = new HeaderItem(0, "Related Items", null);
+ mRowsAdapter.add(new ListRow(header, listRowAdapter));
+
+ setAdapter(mRowsAdapter);
+ }
+}
+</pre>
+
+
+<h3 id="activity">Creating a Details Activity</h3>
+
+<p>Fragments such as the {@code DetailsFragment} must be contained within an activity in order
+ to be used for display. Creating an activity for your details view, separate from the browse
+ activity, enables you to invoke your details view using an Intent. This section explains how to
+ build an activity to contain your implementation of the detail view for your media items.</p>
+
+<p>Start creating the details activity by building a layout that references your implementation
+ of the {@code DetailsFragment}:</p>
+
+<pre>
+&lt;!-- file: res/layout/details.xml --&gt;
+
+&lt;fragment xmlns:android="http://schemas.android.com/apk/res/android"
+ <strong>android:name="com.example.android.mediabrowser.MediaItemDetailsFragment"</strong>
+ android:id="&#64;+id/details_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+/&gt;
+</pre>
+
+<p>Next, create an activity class that uses the layout shown in the previous code example:</p>
+
+<pre>
+public class DetailsActivity extends Activity
+{
+ &#64;Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ <strong>setContentView(R.layout.details);</strong>
+ }
+}
+</pre>
+
+<p>Finally, add this new activity to the manifest. Remember to apply the Leanback theme to
+ ensure that the user interface is consistent with the media browse activity:</p>
+
+<pre>
+&lt;application&gt;
+ ...
+
+ &lt;activity android:name=".DetailsActivity"
+ android:exported="true"
+ <strong>android:theme="@style/Theme.Leanback"/&gt;</strong>
+
+&lt;/application&gt;
+</pre>
+
+
+<h3 id="item-listener">Listener for Clicked Items</h3>
+
+<p>After you have implemented the {@code DetailsFragment}, you must modify your main media
+ browsing view to move to your details view when a user clicks on a media item. In order to enable
+ this behavior, add an {@code OnItemClickedListener} object to the BrowseFragment that fires an
+ intent to start the item details activity.</p>
+
+<p>The following example shows how to implement a listener to start the details view when a user
+ clicks a media item in the main media browsing activity:</p>
+
+<pre>
+public class BrowseMediaActivity extends Activity {
+ ...
+
+ &#64;Override
+ protected void onCreate(Bundle savedInstanceState) {
+ ...
+
+ // create the media item rows
+ buildRowsAdapter();
+
+ // add a listener for selected items
+ mBrowseFragment.setOnItemClickedListener(
+ new OnItemClickedListener() {
+ &#64;Override
+ public void onItemClicked(Object item, Row row) {
+ System.out.println("Media Item clicked: " + item.toString());
+ Intent intent = new Intent(BrowseMediaActivity.this,
+ DetailsActivity.class);
+ // pass the item information
+ intent.getExtras().putLong("id", item.getId());
+ startActivity(intent);
+ }
+ });
+ }
+}
+</pre>
diff --git a/docs/html/preview/tv/ui/in-app-search.jd b/docs/html/preview/tv/ui/in-app-search.jd
new file mode 100644
index 000000000000..3dbfcd293d15
--- /dev/null
+++ b/docs/html/preview/tv/ui/in-app-search.jd
@@ -0,0 +1,111 @@
+page.title=Adding Search to TV Apps
+
+@jd:body
+
+<div id="qv-wrapper">
+<div id="qv">
+ <h2>In this document</h2>
+ <ol>
+ <li><a href="#add-search-ui">Add Search User Interface</a></li>
+ </ol>
+
+</div>
+</div>
+
+
+<p>Users frequently have specific content in mind when using a media app. A search interface can
+ help your users get to the content they want faster than browsing. The Leanback library provides a
+ set of classes to enable a standard search interface within your app that is consistent with other
+ search functions on TV and provides features such as voice input.</p>
+
+<h2 id="add-search-ui">Add Search User Interface</h2>
+<p>When you use the BrowseFragment class for your media browsing interface, you can enable the
+ search icon by setting an OnClickListener to the BrowseFragment object. The following sample code
+ demonstrates this technique.</p>
+
+<pre>
+&#64;Override
+public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.browse_activity);
+
+ mBrowseFragment = (BrowseFragment)
+ getFragmentManager().findFragmentById(R.id.browse_fragment);
+
+ ...
+
+ mBrowseFragment.setOnSearchClickedListener(new View.OnClickListener() {
+ &#64;Override
+ public void onClick(View view) {
+ Intent intent = new Intent(BrowseActivity.this, SearchActivity.class);
+ startActivity(intent);
+ }
+ });
+
+ mBrowseFragment.setAdapter(buildAdapter());
+}
+</pre>
+
+<p class="note">
+ <strong>Note:</strong> You can set the color of the search icon using the
+ {@code setSearchAffordanceColor()} method of {@code BrowseFragment}.
+</p>
+
+<p>When a user selects the search icon, the system invokes a search activity via the defined
+ Intent. Your search activity should use a linear layout containing a SearchFragment. This fragment
+ must also implement the SearchFragment.SearchResultProvider interface in order to display the
+ results of a search. The following code sample shows how to extend the SearchFragment class to
+ provide a search interface and results:</p>
+
+<pre>
+public class MySearchFragment extends SearchFragment
+ implements SearchFragment.SearchResultProvider {
+
+ private static final int SEARCH_DELAY_MS = 300;
+ private ArrayObjectAdapter mRowsAdapter;
+ private Handler mHandler = new Handler();
+ private SearchRunnable mDelayedLoad;
+
+ &#64;Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
+ setSearchResultProvider(this);
+ setOnItemClickedListener(getDefaultItemClickedListener());
+ mDelayedLoad = new SearchRunnable();
+ }
+
+ &#64;Override
+ public ObjectAdapter getResultsAdapter() {
+ return mRowsAdapter;
+ }
+
+ &#64;Override
+ public boolean onQueryTextChange(String newQuery) {
+ mRowsAdapter.clear();
+ if (!TextUtils.isEmpty(newQuery)) {
+ mDelayedLoad.setSearchQuery(newQuery);
+ mHandler.removeCallbacks(mDelayedLoad);
+ mHandler.postDelayed(mDelayedLoad, SEARCH_DELAY_MS);
+ }
+ return true;
+ }
+
+ &#64;Override
+ public boolean onQueryTextSubmit(String query) {
+ mRowsAdapter.clear();
+ if (!TextUtils.isEmpty(query)) {
+ mDelayedLoad.setSearchQuery(query);
+ mHandler.removeCallbacks(mDelayedLoad);
+ mHandler.postDelayed(mDelayedLoad, SEARCH_DELAY_MS);
+ }
+ return true;
+ }
+}
+</pre>
+
+<p>This example code shown above is meant to be used with a separate {@code SearchRunnable}
+ class that runs the search query on a separate thread. This technique keeps potentially
+ slow-running queries from blocking the main user interface thread.</p>
+
diff --git a/docs/html/preview/tv/ui/index.jd b/docs/html/preview/tv/ui/index.jd
new file mode 100644
index 000000000000..c861ec233dcb
--- /dev/null
+++ b/docs/html/preview/tv/ui/index.jd
@@ -0,0 +1,40 @@
+page.title=User Interfaces for TV
+
+@jd:body
+
+
+<p>
+ Building an effective and engaging user interface for TV devices requires a firm understanding of what works well
+ in the context of a living room. Imagine a large screen that can be seen by many people at the
+ same time, controlled with a few buttons by users with limited attention, and you start to see the
+ challenges and opportunities of building an app for TV. Building apps for this environment
+ requires a different approach and different tools.</p>
+
+<p>This section discusses how to build a living room experience with your app, including
+ implementation instructions and creating user interface widgets built for TV. Also check out
+ <a href="{@docRoot}design/tv/index.html">Design for TV</a> for information and inspiration
+ on creating engaging user interfaces for TV devices.</p>
+
+<h2>Topics</h2>
+
+<dl>
+ <dt><b><a href="layouts.html">Layouts</a></b></dt>
+ <dd>Learn how to build app layouts for TV screens.</dd>
+
+ <dt><b><a href="navigation.html">Navigation</a></b></dt>
+ <dd>Learn how to build navigation for TV devices.</dd>
+
+ <dt><b><a href="browse.html">BrowseFragment</a></b></dt>
+ <dd>Learn how to use this fragment to build a browsing interface for media catalogs.</dd>
+
+ <dt><b><a href="details.html">DetailsFragment</a></b></dt>
+ <dd>Learn how to use this fragment to build a details page for media items.</dd>
+
+ <dt><b><a href="in-app-search.html">In-App Search</a></b></dt>
+ <dd>Learn how to use a built-for-TV user interface for searching within your app.</dd>
+
+ <dt><b><a href="recommendations.html">Recommendations</a></b></dt>
+ <dd>Learn how your app can contribute to the list of recommendations appearing on the home
+ screen and get your content noticed by users.</dd>
+</dl>
+
diff --git a/docs/html/preview/tv/ui/layouts.jd b/docs/html/preview/tv/ui/layouts.jd
new file mode 100644
index 000000000000..0659826b7dba
--- /dev/null
+++ b/docs/html/preview/tv/ui/layouts.jd
@@ -0,0 +1,298 @@
+page.title=Layouts for TV
+
+@jd:body
+
+<div id="qv-wrapper">
+<div id="qv">
+ <h2>In this document</h2>
+ <ol>
+ <li><a href="#themes">Themes</a>
+ <ol>
+ <li><a href="#leanback-theme">Leanback Theme</a></li>
+ <li><a href="#notitle-theme">NoTitleBar Theme</a></li>
+ </ol>
+ </li>
+ <li><a href="#structure">Layout Structure</a>
+ <ol>
+ <li><a href="#overscan">Overscan</a></li>
+ </ol>
+ </li>
+ <li><a href="#visibility">Text and Controls Visibility</a></li>
+ <li><a href="#density-resources">Screen Density and Image Resources</a></li>
+ <li><a href="#anti-patterns">Layout Anti-Patterns</a></li>
+ <li><a href="#large-bitmaps">Handling Large Bitmaps</a></li>
+ </ol>
+
+</div>
+</div>
+
+<p>
+ A TV screen is typically viewed from about 10 feet away, and while it is much larger than most
+ other Android device displays, this type of screen does not provide the same level of precise
+ detail and color as a smaller device. These factors require that you create app layouts with
+ TV devices in mind in order to create a useful and enjoyable user experience.</p>
+
+<p>This guide provides direction and implementation details for building effective layouts inN
+ TV apps.</p>
+
+
+<h2 id="themes">Themes</h2>
+
+<p>Android <a href="{@docRoot}guide/topics/ui/themes.html">Themes</a> can provide a basis for
+ layouts in your TV apps. You should use a theme to modify the display of your app activities
+ that are meant to run on a TV device. This section explains which themes you should use.</p>
+
+
+<h3 id="leanback-theme">Leanback Theme</h3>
+
+<p>The Leanback library provides a standard theme for TV activities, called {@code
+ Leanback.Theme}, which establishes a consistent visual style for TV apps. Use of this theme is
+ recommended for most apps. This theme is recommended for any TV app that uses the Leanback
+ library classes. The following code sample shows how to apply this theme to a given
+ activity within an app:</p>
+
+<pre>
+&lt;activity
+ android:name="com.example.android.TvActivity"
+ android:label="&#64;string/app_name"
+ <strong>android:theme="&#64;style/Theme.Leanback"</strong>&gt;
+</pre>
+
+
+<h3 id="notitle-theme">NoTitleBar Theme</h3>
+
+<p>The title bar is a standard user interface element for Android apps on phones and tablets,
+ but it is not appropriate for TV apps. If you are not using the Leanback library classes,
+ you should apply this theme to your TV activities. The following code example from a TV app
+ manifest demonstrates how to apply this theme to remove the display of a title bar:
+</p>
+
+<pre>
+&lt;application&gt;
+ ...
+
+ &lt;activity
+ android:name="com.example.android.TvActivity"
+ android:label="&#64;string/app_name"
+ <strong>android:theme="&#64;android:style/Theme.NoTitleBar"</strong>&gt;
+ ...
+
+ &lt;/activity&gt;
+&lt;/application&gt;
+</pre>
+
+
+<h2 id="structure">Layout Structure</h2>
+
+<p>Layouts for TV devices should follow some basic guidelines to ensure they are usable and
+ effective on large screens. Follow these tips to build landscape layouts optimized for TV screens:
+</p>
+
+<ul>
+ <li>Build layouts with a landscape orientation. TV screens always display in landscape.</li>
+ <li>Put on-screen navigation controls on the left or right side of the screen and save the
+ vertical space for content.</li>
+ <li>Create UIs that are divided into sections, using <a
+ href="{@docRoot}guide/components/fragments.html"
+ >Fragments</a>, and use view groups like {@link android.widget.GridView} instead of {@link
+ android.widget.ListView} to make better use of the horizontal screen space.
+ </li>
+ <li>Use view groups such as {@link android.widget.RelativeLayout} or {@link
+ android.widget.LinearLayout} to arrange views. This approach allows the system to adjust the
+ position of the views to the size, alignment, aspect ratio, and pixel density of a TV screen.</li>
+ <li>Add sufficient margins between layout controls to avoid a cluttered UI.</li>
+</ul>
+
+
+<h3 id="overscan">Overscan</h3>
+
+<p>Layouts for TV have some unique requirements due to the evolution of TV standards and the
+ desire to always present a full screen picture to viewers. For this reason, TV devices may
+ clip the outside edge of an app layout in order to ensure that the entire display is filled.
+ This behavior is generally referred to as Overscan.</p>
+
+<p>In order to account for the impact of overscan and make sure that all the user interface
+ elements you place in a layout are actually shown on screen, you should incorporate a 10% margin
+ on all sides of your layout. This translates into a 27dp margin on the left and right edges and
+ a 48dp margin on the top and bottom of your base layouts for activities. The following
+ example layout demonstrates how to set these margins in the root layout for a TV app:
+</p>
+
+<pre>
+&lt;?xml version="1.0" encoding="utf-8"?&gt;
+&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/base_layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:layout_marginTop="27dp"
+ android:layout_marginLeft="48dp"
+ android:layout_marginRight="48dp"
+ android:layout_marginBottom="27dp" &gt;
+&lt;/LinearLayout&gt;
+</pre>
+
+<p class="caution">
+ <strong>Caution:</strong> Do not apply overscan margins to your layout if you are using the
+ Leanback Support Library {@code BrowseFragment} or related widgets, as those layouts already
+ incorporate overscan-safe margins.
+</p>
+
+
+<h2 id="visibility">Text and Controls Visibility</h2>
+
+<p>
+The text and controls in a TV app layout should be easily visible and navigable from a distance.
+Follow these tips to make them easier to see from a distance :
+</p>
+
+<ul>
+ <li>Break text into small chunks that users can quickly scan.</li>
+ <li>Use light text on a dark background. This style is easier to read on a TV.</li>
+ <li>Avoid lightweight fonts or fonts that have both very narrow and very broad strokes.
+ Use simple sans-serif fonts and anti-aliasing to increase readability.</li>
+ <li>Use Android's standard font sizes:
+<pre>
+&lt;TextView
+ android:id="@+id/atext"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:singleLine="true"
+ android:textAppearance="?android:attr/textAppearanceMedium"/&gt;
+</pre>
+ </li>
+ <li>Ensure that all your view widgets are large enough to be clearly visible to someone
+ sitting 10 feet away from the screen (this distance is greater for very large screens). The
+ best way to do this is to use layout-relative sizing rather than absolute sizing, and
+ density-independent pixel units instead of absolute pixel units. For example, to set the
+ width of a widget, use wrap_content instead of a pixel measurement, and to set the margin
+ for a widget, use dip instead of px values.</li>
+</ul>
+
+
+<h2 id="density-resources">Screen Density and Image Resources</h2>
+
+<p>The common high-definition TV display resolutions are 720p, 1080i, and 1080p.
+ Your TV layout should target a screen size of 1920 x 1080 pixels, and then allow the Android
+ system to downscale your layout elements to 720p if necessary. In general, downscaling
+ (removing pixels) does not degrade your layout presentation quality. However, upscaling can
+ cause display artifacts that degrade the quality of your layout and have a negative impact on
+ the user experience of your app.</p>
+
+<p>
+ To get the best scaling results for images, provide them as
+ <a href="{@docRoot}tools/help/draw9patch.html">9-patch image</a> elements if possible. If you
+ provide low quality or small images in your layouts, they will appear pixelated, fuzzy, or
+ grainy. This is not a good experience for the user. Instead, use high-quality images.
+</p>
+
+<p>
+ For more information on optimizing layouts and resources for large screens see
+ <a href="{@docRoot}training/multiscreen/index.html">Designing for multiple screens</a>.
+</p>
+
+
+<h2 id="anti-patterns">Layout Anti-Patterns</h2>
+
+<p>There are a few approaches to building layouts for TV that you should avoid because they do not
+work well and lead to bad user experiences. Here are some user interface approaches you
+should specifically <em>not</em> use when developing a layout for TV.
+</p>
+
+<ul>
+ <li><strong>Re-using phone or tablet layouts</strong> - Do not reuse layouts from a phone or
+ tablet app without modification. Layouts built for other Android device form factors are not
+ well suited for TV devices and should be simplified for operation on a TV.</li>
+ <li><strong>ActionBar</strong> - While this user interface convention is recommended for use
+ on phones and tablets, it is not appropriate for a TV interface. In particular, using an
+ action bar options menu (or any pull-down menu for that matter) is strongly discouraged, due
+ to the difficulty in navigating such a menu with a remote control.</li>
+ <li><strong>ViewPager</strong> - Sliding between screens can work great on a phone or tablet,
+ but don't try this on a TV!</li>
+
+</ul>
+
+<p>For more information on designing layouts that are appropriate to TV, see the
+ <a href="{@docRoot}design/tv/index.html">TV Design</a> guide.</p>
+
+
+<h2 id="large-bitmaps">Handling Large Bitmaps</h2>
+
+<p>TV devices, like any other Android device, have a limited amount of memory. If you build your
+ app layout with very high-resolution images or use many high-resolution images in the operation
+ of your app, it can quickly run into memory limits and cause out of memory errors.
+ To avoid these types of problems, follow these tips:</p>
+
+<ul>
+ <li>Load images only when they're displayed on the screen. For example, when displaying multiple images in
+ a {@link android.widget.GridView} or
+ {@link android.widget.Gallery}, only load an image when
+ {@link android.widget.Adapter#getView(int, View, ViewGroup) getView()}
+ is called on the View's {@link android.widget.Adapter}.
+ </li>
+ <li>Call {@link android.graphics.Bitmap#recycle()} on
+ {@link android.graphics.Bitmap} views that are no longer needed.
+ </li>
+ <li>Use {@link java.lang.ref.WeakReference} for storing references
+ to {@link android.graphics.Bitmap} objects in an in-memory
+ {@link java.util.Collection}.</li>
+ <li>If you fetch images from the network, use {@link android.os.AsyncTask}
+ to fetch and store them on the device for faster access.
+ Never do network transactions on the application's UI thread.
+ </li>
+ <li>Scale down large images to a more appropriate size as you download them;
+ otherwise, downloading the image itself may cause an out of memory exception.
+ The following sample code demonstrates how to scale down images while downloading:
+<pre>
+ // Get the source image's dimensions
+ BitmapFactory.Options options = new BitmapFactory.Options();
+ // This does not download the actual image, just downloads headers.
+ options.inJustDecodeBounds = true;
+ BitmapFactory.decodeFile(IMAGE_FILE_URL, options);
+ // The actual width of the image.
+ int srcWidth = options.outWidth;
+ // The actual height of the image.
+ int srcHeight = options.outHeight;
+
+ // Only scale if the source is bigger than the width of the destination view.
+ if(desiredWidth > srcWidth)
+ desiredWidth = srcWidth;
+
+ // Calculate the correct inSampleSize/scale value. This approach helps reduce
+ // memory use. This value should be a power of 2.
+ int inSampleSize = 1;
+ while(srcWidth / 2 > desiredWidth){
+ srcWidth /= 2;
+ srcHeight /= 2;
+ inSampleSize *= 2;
+ }
+
+ float desiredScale = (float) desiredWidth / srcWidth;
+
+ // Decode with inSampleSize
+ options.inJustDecodeBounds = false;
+ options.inDither = false;
+ options.inSampleSize = inSampleSize;
+ options.inScaled = false;
+ // Ensures the image stays as a 32-bit ARGB_8888 image.
+ // This preserves image quality.
+ options.inPreferredConfig = Bitmap.Config.ARGB_8888;
+
+ Bitmap sampledSrcBitmap = BitmapFactory.decodeFile(IMAGE_FILE_URL, options);
+
+ // Resize
+ Matrix matrix = new Matrix();
+ matrix.postScale(desiredScale, desiredScale);
+ Bitmap scaledBitmap = Bitmap.createBitmap(sampledSrcBitmap, 0, 0,
+ sampledSrcBitmap.getWidth(), sampledSrcBitmap.getHeight(), matrix, true);
+ sampledSrcBitmap = null;
+
+ // Save
+ FileOutputStream out = new FileOutputStream(LOCAL_PATH_TO_STORE_IMAGE);
+ scaledBitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
+ scaledBitmap = null;
+</pre>
+ </li>
+</ul>
+
diff --git a/docs/html/preview/tv/ui/navigation.jd b/docs/html/preview/tv/ui/navigation.jd
new file mode 100644
index 000000000000..92b34cf4aa4a
--- /dev/null
+++ b/docs/html/preview/tv/ui/navigation.jd
@@ -0,0 +1,136 @@
+page.title=Navigation for TV
+
+@jd:body
+
+<div id="qv-wrapper">
+<div id="qv">
+ <h2>In this document</h2>
+ <ol>
+ <li><a href="#d-pad-navigation">D-pad Navigation</a></li>
+ <li><a href="#focus-selection">Focus and Selection</a></li>
+ </ol>
+
+</div>
+</div>
+
+<p>TV devices provide a limited set of navigation controls for apps. Creating an effective
+ navigation scheme for your TV app depends on understanding these limited controls and the limits
+ of users' perception while operating your app. As you build your Android app for TVs,
+ you should pay special attention to how the user actually navigates around your app
+ when using remote control buttons instead of a touch screen.</p>
+
+<p>This guide shows you how to build an effective navigation scheme for your TV app.</p>
+
+
+<h2 id="d-pad-navigation">D-pad Navigation</h2>
+
+<p>On a TV device, users navigate with controls on a remote control device, using either a
+ directional pad (D-pad) or arrow keys. This type of control limits movement to up, down, left,
+ and right. To build a great TV-optimized app, you must provide a navigation scheme where
+ the user can quickly learn how to navigate your app using these limited controls.</p>
+
+<p>Follow these guidelines to build a navigation system that works well with a D-pad on a TV device:
+</p>
+
+<ul>
+ <li>Ensure that the D-pad can navigate to all the visible controls on the screen.</li>
+ <li>For scrolling lists with focus, D-pad up/down keys scroll the list, and the Enter key selects
+ an item in the list. Ensure that users can select an element in the list and that the list still
+ scrolls when an element is selected.</li>
+ <li>Ensure that movement between controls is straightforward and predictable.</li>
+</ul>
+
+<p>The Android framework handles directional navigation between layout elements automatically, so
+ you typically do not need to do anything extra for your app. However, you should thoroughly test
+ navigation with a D-pad control to discover any navigation problems. If you discover that your
+ screen layout makes navigation difficult, or if you want users to move through the layout in a
+ specific way, you can set up explicit directional navigation for your controls. The following
+ code sample shows how to define the next control to receive focus for a
+ {@link android.widget.TextView} layout object:</p>
+
+<pre>
+&lt;TextView android:id="&#64;+id/Category1"
+ android:nextFocusDown="&#64;+id/Category2"\&gt;
+</pre>
+
+<p>The following table lists all of the available navigation attributes for Android user interface
+widgets:</p>
+
+<table>
+ <tr>
+ <th>Attribute</th>
+ <th>Function</th>
+ </tr>
+ <tr>
+ <td>{@link android.R.attr#nextFocusDown}</td>
+ <td>Defines the next view to receive focus when the user navigates down.</td>
+ </tr>
+ <tr>
+ <td>{@link android.R.attr#nextFocusLeft}</td>
+ <td>Defines the next view to receive focus when the user navigates left.</td>
+ </tr>
+ <tr>
+ <td>{@link android.R.attr#nextFocusRight}</td>
+ <td>Defines the next view to receive focus when the user navigates right.</td>
+ </tr>
+ <tr>
+ <td>{@link android.R.attr#nextFocusUp}</td>
+ <td>Defines the next view to receive focus when the user navigates up.</td>
+ </tr>
+</table>
+
+<p>To use one of these explicit navigation attributes, set the value to the ID ({@code android:id}
+ value) of another widget in the layout. You should set up the navigation order as a loop, so that
+ the last control directs focus back to the first one.</p>
+
+<p class="note">
+ <strong>Note:</strong> You should only use these attributes to modify the navigation order if the
+ default order that the system applies does not work well.
+</p>
+
+
+<h2 id="focus-selection">Focus and Selection</h2>
+
+<p>The success of a navigation scheme on TV devices is strongly dependent on how easy it is for a
+ user to determine what user interface element is in focus on screen. If you do not provide clear
+ indications of what is in focus on screen (and therefore what item they can take action on),
+ users can quickly become frustrated and exit your app. By the same token, it is important
+ to always have an item in focus that a user can take action on immediately after your app starts,
+ and any time your app is not playing content.</p>
+
+<p>Your app layout and implementation should use color, size, animation, or a combination of
+ these attributes to help users easily determine what actions they can take next. Use a uniform
+ scheme for indicating focus across your application.</p>
+
+<p>Android provides <a href="{@docRoot}guide/topics/resources/drawable-resource.html#StateList">
+Drawable State List Resources</a> to implement highlights for selected and focused controls. The
+following code example demonstates how to indicate selection of a button object:
+</p>
+
+<pre>
+&lt;!-- res/drawable/button.xml --&gt;
+&lt;?xml version="1.0" encoding="utf-8"?&gt;
+&lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
+ &lt;item android:state_pressed="true"
+ android:drawable="@drawable/button_pressed" /&gt; &lt;!-- pressed --&gt;
+ &lt;item android:state_focused="true"
+ android:drawable="@drawable/button_focused" /&gt; &lt;!-- focused --&gt;
+ &lt;item android:state_hovered="true"
+ android:drawable="@drawable/button_focused" /&gt; &lt;!-- hovered --&gt;
+ &lt;item android:drawable="@drawable/button_normal" /&gt; &lt;!-- default --&gt;
+&lt;/selector&gt;
+</pre>
+
+<p>
+This layout XML applies the above state list drawable to a {@link android.widget.Button}:
+</p>
+<pre>
+&lt;Button
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:background="@drawable/button" /&gt;
+</pre>
+
+<p>Make sure to provide sufficient padding within the focusable and selectable controls so that
+ the highlights around them are clearly visible.</p>
+
diff --git a/docs/html/preview/tv/ui/recommendations.jd b/docs/html/preview/tv/ui/recommendations.jd
new file mode 100644
index 000000000000..2c78064ea4cc
--- /dev/null
+++ b/docs/html/preview/tv/ui/recommendations.jd
@@ -0,0 +1,209 @@
+page.title=Making Recommendations
+
+@jd:body
+
+<div id="qv-wrapper">
+<div id="qv">
+ <h2>In this document</h2>
+ <ol>
+ <li><a href="#service">Create a Recommendations Service</a></li>
+ <li><a href="#build">Build Recommendations</a></li>
+ <li><a href="#run-service">Run Recommendations Service</a></li>
+ <li><a href="#DesignLandscapeLayouts">Design Landscape Layouts</a></li>
+ </ol>
+
+</div>
+</div>
+
+
+<p>Content recommendations appear as the first row of the TV launch screen after the first use
+ of the device. This row is intended to help users quickly find content they enjoy. Contributing
+ recommendations from your apps content catalog can help bring users back to your app.</p>
+
+
+<img src="{@docRoot}preview/tv/images/home-recommendations.png" alt="" id="figure1" />
+<p class="img-caption">
+ <strong>Figure 1.</strong> An example of the recommendations row.
+</p>
+
+
+<h2 id="service">Create a Recommendations Service</h2>
+
+<p>Content recommendations are created with background processing. In order for your application
+ to contribute to recommendations, you create a service that periodically adds listings from your
+ app's catalog to the system list of recommendations.</p>
+
+<p>The following code example illustrates how to extend the {@link android.app.IntentService} to
+ create a recommendation service for your application.</p>
+
+<pre>
+public class RecommendationsService extends IntentService {
+ private static final int MAX_RECOMMENDATIONS = 3;
+
+ public RecommendationsService() {
+ super("RecommendationService");
+ }
+
+ &#64;Override
+ protected void onHandleIntent(Intent intent) {
+ MovieDatabase database = MovieDatabase.instance(getApplicationContext());
+ List<Movie> recommendations = database.recommendations();
+
+ int count = 0;
+
+ try {
+ for (Movie movie : recommendations) {
+ // build the individual content recommendations
+ buildRecommendation(getApplicationContext(), movie);
+
+ if (++count >= MAX_RECOMMENDATIONS) {
+ break;
+ }
+ }
+ } catch (IOException e) {
+ Log.e(TAG, "Unable to update recommendation", e);
+ }
+ }
+}
+</pre>
+
+<p>In order for this class to be recognized and run as a service, you must register this service
+ using your app manifest. The following code snippet illustrates how to add this class as a
+ service:</p>
+
+<pre>
+&lt;manifest ... &gt;
+ &lt;application ... &gt;
+ ...
+
+ &lt;service android:name=&quot;.RecommendationsService&quot;
+ android:enabled=&quot;true&quot; android:exported=&quot;true&quot;/&gt;
+ &lt;/application&gt;
+&lt;/manifest&gt;
+</pre>
+
+<h2 id="build">Build Recommendations</h2>
+
+<p>Once it starts running, your service must create recommendations and pass them to the Android
+ framework. The framework receives the recommendations as {@link android.app.Notification} objects
+ that use a specific style and are marked with a specific category.</p>
+
+<p>The following code example demonstrates how to get an instance of the {@link
+ android.app.NotificationManager}, build a recommendation, and post it to the manager:</p>
+
+<pre>
+public class RecommendationsService extends IntentService {
+
+ ...
+
+ public Notification buildRecommendation(Context context, Movie movie)
+ throws IOException {
+
+ if (mNotificationManager == null) {
+ mNotificationManager = (NotificationManager)
+ mContext.getSystemService(Context.NOTIFICATION_SERVICE);
+ }
+
+ Bundle extras = new Bundle();
+ if (mBackgroundUri != movie.getBackgroundUri()) {
+ extras.putString(EXTRA_BACKGROUND_IMAGE_URL, movie.getBackgroundUri());
+ }
+
+ // build the recommendation as a Notification object
+ Notification notification = new NotificationCompat.BigPictureStyle(
+ new NotificationCompat.Builder(context)
+ .setContentTitle(movie.getTitle())
+ .setContentText(movie.getDescription())
+ .setPriority(movie.getPriority())
+ .setOngoing(true)
+ .setCategory("recommendation")
+ .setLargeIcon(movie.getImage())
+ .setSmallIcon(movie.getSmallIcon())
+ .setContentIntent(buildPendingIntent(movie.getId()))
+ .setExtras(extras))
+ .build();
+
+ // post the recommendation to the NotificationManager
+ mNotificationManager.notify(movie.getId(), notification);
+ mNotificationManager = null;
+ return notification;
+ }
+
+ private PendingIntent buildPendingIntent(long id) {
+ Intent detailsIntent = new Intent(this, DetailsActivity.class);
+ detailsIntent.putExtra("id", id);
+
+ TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
+ stackBuilder.addParentStack(DetailsActivity.class);
+ stackBuilder.addNextIntent(detailsIntent);
+ // Ensure each PendingIntent is unique
+ detailsIntent.setAction(Long.toString(id));
+
+ PendingIntent intent = stackBuilder.getPendingIntent(
+ 0, PendingIntent.FLAG_UPDATE_CURRENT);
+ return intent;
+ }
+}
+</pre>
+
+
+<h3 id="run-service">Run Recommendations Service</h3>
+
+<p>Your app's recommendation service must run periodically in order to create current
+ recommendations. In order to run your service, you should create a class that runs a timer and
+ invokes it at regular intervals. The following code example extends the {@link
+ android.content.BroadcastReceiver} class to start periodic execution of a recommendation service
+ every 12 hours:</p>
+
+<pre>
+public class BootupReceiver extends BroadcastReceiver {
+ private static final String TAG = "BootupActivity";
+
+ private static final long INITIAL_DELAY = 5000;
+
+ &#64;Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getAction().endsWith(Intent.ACTION_BOOT_COMPLETED)) {
+ scheduleRecommendationUpdate(context);
+ }
+ }
+
+ private void scheduleRecommendationUpdate(Context context) {
+ AlarmManager alarmManager = (AlarmManager)context.getSystemService(
+ Context.ALARM_SERVICE);
+ Intent recommendationIntent = new Intent(context,
+ UpdateRecommendationsService.class);
+ PendingIntent alarmIntent = PendingIntent.getService(context, 0,
+ recommendationIntent, 0);
+
+ alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
+ INITIAL_DELAY,
+ AlarmManager.INTERVAL_HALF_DAY,
+ alarmIntent);
+ }
+}
+</pre>
+
+<p>In order for the {@link android.content.BroadcastReceiver} class to execute after a TV
+ device starts up, you must register this class in your app manifest and attach an intent filter
+ in order for the device boot process to complete. This sample code demonstrates how to add this
+ configuration to the manifest:</p>
+
+<pre>
+&lt;manifest ... &gt;
+ &lt;application ... &gt;
+ &lt;receiver android:name=&quot;.BootupReceiver&quot; android:enabled=&quot;true&quot;
+ android:exported=&quot;false&quot;&gt;
+ &lt;intent-filter&gt;
+ &lt;action android:name=&quot;android.intent.action.BOOT_COMPLETED&quot;/&gt;
+ &lt;/intent-filter&gt;
+ &lt;/receiver&gt;
+ &lt;/application&gt;
+&lt;/manifest&gt;
+</pre>
+
+<p class="important">
+ <strong>Important:</strong> Receiving a boot completed notification requires that your app
+ request the {@link android.Manifest.permission#RECEIVE_BOOT_COMPLETED} permission.
+ For more information, see {@link android.content.Intent#ACTION_BOOT_COMPLETED}.
+</p>
diff --git a/docs/html/sdk/installing/create-project.jd b/docs/html/sdk/installing/create-project.jd
new file mode 100644
index 000000000000..c0d523acfd4d
--- /dev/null
+++ b/docs/html/sdk/installing/create-project.jd
@@ -0,0 +1,86 @@
+page.title=Creating a Project
+
+@jd:body
+
+<p>Android Studio makes it easy to create Android apps for several form factors, such as phone,
+tablet, TV, Wear, and Google Glass. The <em>New Project</em> wizard lets you choose the form factors
+for your app and populates the project structure with everything you need to get started.</p>
+
+<p>Follow the steps in this section to create a project in Android Studio.</p>
+
+<h2>Step 1: Create a New Project</h2>
+
+<p>If you didn't have a project opened, Android Studio shows the Welcome screen.
+To create a new project, click <strong>New Project</strong>.</p>
+
+<p>If you had a project opened, Android Studio shows the development environment.
+To create a new project, click <strong>File</strong> > <strong>New Project</strong>.</p>
+
+<p>The next window lets you configure the name of your app, the package name, and the location
+of your project.</p>
+
+<img src="{@docRoot}images/tools/wizard2.png" alt="" width="500" height="381">
+<p class="img-caption"><strong>Figure 1.</strong> Choose a name for your project.</p>
+
+<p>Enter the values for your project and click <strong>Next</strong>.</p>
+
+
+<h2>Step 2: Select Form Factors and API Level</h2>
+
+<p>The next window lets you select the form factors supported by your app, such as phone, tablet,
+TV, Wear, and Google Glass. For each form factor, you can also select the API
+Level that your app requires. To get more information, click <strong>Help me choose</strong>.</p>
+
+<img src="{@docRoot}images/tools/wizard4.png" alt="" width="750" height="510">
+<p class="img-caption"><strong>Figure 2.</strong> Select the API Level.</p>
+
+<p>The API Level window shows the distribution of mobile devices running each version of Android,
+as shown in Figure 2. Click on an API level to see a list of features introduced in the corresponding
+version of Android. This helps you choose the minimum API Level that has all the features that
+your apps needs, so you can reach as many devices as possible. Then click <strong>OK</strong>.</p>
+
+<img src="{@docRoot}images/tools/wizard3.png" alt="" width="500" height="480">
+<p class="img-caption"><strong>Figure 3.</strong> Choose form factors for your app.</p>
+
+<p>Then, on the Form Factors Window, click <strong>Next</strong>.</p>
+
+
+<h2>Step 3: Add an Activity</h2>
+
+<p>The next screen lets you select an activity type to add to your app, as shown in Figure 4.
+This screen depends on the form factors you selected earlier.</p>
+
+<img src="{@docRoot}images/tools/wizard5.png" alt="" width="720" height="504">
+<p class="img-caption"><strong>Figure 4.</strong> Add an activity to your app.</p>
+
+<p>Choose an activity type and click <strong>Next</strong>.</p>
+
+
+<h2>Step 4: Configure Your Activity</h2>
+
+<p>The next screen lets you configure the activity to add to your app, as shown in Figure 6.</p>
+
+<img src="{@docRoot}images/tools/wizard6.png" alt="" width="450" height="385">
+<p class="img-caption"><strong>Figure 6.</strong> Choose a name for your activity.</p>
+
+<p>Enter the activity name, the layout name, and the activity title. Then click
+<strong>Finish</strong>.</p>
+
+
+<h2>Step 5: Develop Your App</h2>
+
+<p>Android Studio creates the default structure for your project and opens the development
+environment. If your app supports more than one form factor, Android Studio creates a module for
+each of them, as shown in Figure 7.</p>
+
+<img src="{@docRoot}images/tools/wizard7.png" alt="" width="750" height="509">
+<p class="img-caption"><strong>Figure 7.</strong> The default project structure for a mobile app.</p>
+
+<p>Now you are ready to develop your app. Fore more information, see the following links:</p>
+
+<ul>
+<li><a href="{@docRoot}training/">Training Lessons</a></li>
+<li><a href="{@docRoot}training/building-wearables.html">Building Apps for Wearables</a></li>
+<li><a href="{@docRoot}tv/">Android TV</a></li>
+<li><a href="https://developers.google.com/glass/">Google Glass</a></li>
+</ul>
diff --git a/docs/html/tools/tools_toc.cs b/docs/html/tools/tools_toc.cs
index fb4659f01fe8..93e59769a95c 100644
--- a/docs/html/tools/tools_toc.cs
+++ b/docs/html/tools/tools_toc.cs
@@ -11,7 +11,7 @@
<span class="en">Adding SDK Packages</span></a></li>
</ul>
</li>
-
+
<li class="nav-section">
<div class="nav-section-header">
@@ -20,6 +20,8 @@
<ul>
<li><a href="<?cs var:toroot ?>sdk/installing/migrate.html">
Migrating from Eclipse</a></li>
+ <li><a href="<?cs var:toroot ?>sdk/installing/create-project.html">
+ Creating a Project</a></li>
<li><a href="<?cs var:toroot ?>sdk/installing/studio-tips.html">
Tips and Tricks</a></li>
<li><a href="<?cs var:toroot ?>sdk/installing/studio-layout.html">
diff --git a/docs/html/training/tv/index.jd b/docs/html/training/tv/index.jd
new file mode 100644
index 000000000000..54f7016a8b29
--- /dev/null
+++ b/docs/html/training/tv/index.jd
@@ -0,0 +1,59 @@
+page.title=Designing for TV
+page.tags="input","screens"
+
+trainingnavtop=true
+startpage=true
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<!-- Required platform, tools, add-ons, devices, knowledge, etc. -->
+<h2>Dependencies and prerequisites</h2>
+<ul>
+ <li>Android 2.0 (API Level 5) or higher</li>
+</ul>
+
+</div>
+</div>
+
+<a class="notice-developers-video wide" href="http://www.youtube.com/watch?v=zsRnRLh-O34">
+<div>
+ <h3>Video</h3>
+ <p>DevBytes: Design for Large Displays - Part 1</p>
+</div>
+</a>
+
+<p>
+ Smart TVs powered by Android bring your favorite Android apps to the best screen in your house.
+ Thousands of apps in the Google Play Store are already optimized for TVs. This class shows how
+ you can optimize your Android app for TVs, including how to build a layout that
+ works great when the user is ten feet away and navigating with a remote control.
+</p>
+
+<h2>Lessons</h2>
+
+<dl>
+ <dt><b><a href="optimizing-layouts-tv.html">Optimizing Layouts for TV</a></b></dt>
+ <dd>Shows you how to optimize app layouts for TV screens, which have some unique characteristics such as:
+ <ul>
+ <li>permanent "landscape" mode</li>
+ <li>high-resolution displays</li>
+ <li>"10 foot UI" environment.</li>
+ </ul>
+ </dd>
+
+ <dt><b><a href="optimizing-navigation-tv.html">Optimizing Navigation for TV</a></b></dt>
+ <dd>Shows you how to design navigation for TVs, including:
+ <ul>
+ <li>handling D-pad navigation</li>
+ <li>providing navigational feedback</li>
+ <li>providing easily-accessible controls on the screen.</li>
+ </ul>
+ </dd>
+
+ <dt><b><a href="unsupported-features-tv.html">Handling features not supported on TV</a></b></dt>
+ <dd>Lists the hardware features that are usually not available on TVs. This lesson also shows you how to
+ provide alternatives for missing features or check for missing features and disable code at run time.</dd>
+</dl>
diff --git a/docs/html/training/tv/optimizing-layouts-tv.jd b/docs/html/training/tv/optimizing-layouts-tv.jd
new file mode 100644
index 000000000000..a6db05212fd1
--- /dev/null
+++ b/docs/html/training/tv/optimizing-layouts-tv.jd
@@ -0,0 +1,246 @@
+page.title=Optimizing Layouts for TV
+parent.title=Designing for TV
+parent.link=index.html
+
+trainingnavtop=true
+next.title=Optimizing Navigation for TV
+next.link=optimizing-navigation-tv.html
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="#DesignLandscapeLayouts">Design Landscape Layouts</a></li>
+ <li><a href="#MakeTextControlsEasyToSee">Make Text and Controls Easy to See</a></li>
+ <li><a href="#DesignForLargeScreens">Design for High-Density Large Screens</a></li>
+ <li><a href="#HandleLargeBitmaps">Design to Handle Large Bitmaps</a></li>
+</ol>
+
+<h2>You should also read</h2>
+<ul>
+ <li><a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a></li>
+</ul>
+
+</div>
+</div>
+
+<p>
+When your application is running on a television set, you should assume that the user is sitting about
+ten feet away from the screen. This user environment is referred to as the
+<a href="http://en.wikipedia.org/wiki/10-foot_user_interface">10-foot UI</a>. To provide your
+users with a usable and enjoyable experience, you should style and lay out your UI accordingly..
+</p>
+<p>
+This lesson shows you how to optimize layouts for TV by:
+</p>
+<ul>
+ <li>Providing appropriate layout resources for landscape mode.</li>
+ <li>Ensuring that text and controls are large enough to be visible from a distance.</li>
+ <li>Providing high resolution bitmaps and icons for HD TV screens.</li>
+</ul>
+
+<h2 id="DesignLandscapeLayouts">Design Landscape Layouts</h2>
+
+<p>
+TV screens are always in landscape orientation. Follow these tips to build landscape layouts optimized for TV screens:
+</p>
+<ul>
+ <li>Put on-screen navigational controls on the left or right side of the screen and save the
+ vertical space for content.</li>
+ <li>Create UIs that are divided into sections, by using <a href="{@docRoot}guide/components/fragments.html">Fragments</a>
+ and use view groups like {@link android.widget.GridView} instead
+ of {@link android.widget.ListView} to make better use of the
+ horizontal screen space.</li>
+ <li>Use view groups such as {@link android.widget.RelativeLayout}
+ or {@link android.widget.LinearLayout} to arrange views.
+ This allows the Android system to adjust the position of the views to the size, alignment,
+ aspect ratio, and pixel density of the TV screen.</li>
+ <li>Add sufficient margins between layout controls to avoid a cluttered UI.</li>
+</ul>
+
+<p>
+For example, the following layout is optimized for TV:
+</p>
+
+<img src="{@docRoot}images/training/panoramio-grid.png" />
+
+<p>
+In this layout, the controls are on the lefthand side. The UI is displayed within a
+{@link android.widget.GridView}, which is well-suited to landscape orientation.
+In this layout both GridView and Fragment have the width and height set
+dynamically, so they can adjust to the screen resolution. Controls are added to the left side Fragment programatically at runtime.
+The layout file for this UI is {@code res/layout-land-large/photogrid_tv.xml}.
+(This layout file is placed in {@code layout-land-large} because TVs have large screens with landscape orientation. For details refer to
+<a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a>.)</p>
+
+res/layout-land-large/photogrid_tv.xml
+<pre>
+&lt;RelativeLayout
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent" &gt;
+
+ &lt;fragment
+ android:id="@+id/leftsidecontrols"
+ android:layout_width="0dip"
+ android:layout_marginLeft="5dip"
+ android:layout_height="match_parent" /&gt;
+
+ &lt;GridView
+ android:id="@+id/gridview"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" /&gt;
+
+&lt;/RelativeLayout>
+</pre>
+
+<p>
+To set up action bar items on the left side of the screen, you can also include the <a
+href="http://code.google.com/p/googletv-android-samples/source/browse/#git%2FLeftNavBarLibrary">
+Left navigation bar library</a> in your application to set up action items on the left side
+of the screen, instead of creating a custom Fragment to add controls:
+</p>
+
+<pre>
+LeftNavBar bar = (LeftNavBarService.instance()).getLeftNavBar(this);
+</pre>
+
+<p>
+When you have an activity in which the content scrolls vertically, always use a left navigation bar;
+otherwise, your users have to scroll to the top of the content to switch between the content view and
+the ActionBar. Look at the
+<a href="http://code.google.com/p/googletv-android-samples/source/browse/#git%2FLeftNavBarDemo">
+Left navigation bar sample app</a> to see how to simple it is to include the left navigation bar in your app.
+</p>
+
+<h2 id="MakeTextControlsEasyToSee">Make Text and Controls Easy to See</h2>
+<p>
+The text and controls in a TV application's UI should be easily visible and navigable from a distance.
+Follow these tips to make them easier to see from a distance :
+</p>
+
+<ul>
+ <li>Break text into small chunks that users can quickly scan.</li>
+ <li>Use light text on a dark background. This style is easier to read on a TV.</li>
+ <li>Avoid lightweight fonts or fonts that have both very narrow and very broad strokes. Use simple sans-serif
+ fonts and use anti-aliasing to increase readability.</li>
+ <li>Use Android's standard font sizes:
+ <pre>
+ &lt;TextView
+ android:id="@+id/atext"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:singleLine="true"
+ android:textAppearance="?android:attr/textAppearanceMedium"/&gt;
+ </pre></li>
+ <li>Ensure that all your view widgets are large enough to be clearly visible to someone sitting 10 feet away
+ from the screen (this distance is greater for very large screens). The best way to do this is to use
+ layout-relative sizing rather than absolute sizing, and density-independent pixel units instead of absolute
+ pixel units. For example, to set the width of a widget, use wrap_content instead of a pixel measurement,
+ and to set the margin for a widget, use dip instead of px values.
+ </li>
+</ul>
+<p>
+
+</p>
+
+<h2 id="DesignForLargeScreens">Design for High-Density Large Screens</h2>
+
+<p>
+The common HDTV display resolutions are 720p, 1080i, and 1080p. Design your UI for 1080p, and then
+allow the Android system to downscale your UI to 720p if necessary. In general, downscaling (removing pixels)
+does not degrade the UI (Notice that the converse is not true; you should avoid upscaling because it degrades
+UI quality).
+</p>
+
+<p>
+To get the best scaling results for images, provide them as <a href="{@docRoot}tools/help/draw9patch.html">
+9-patch image</a> elements if possible.
+If you provide low quality or small images in your layouts, they will appear pixelated, fuzzy, or grainy. This
+is not a good experience for the user. Instead, use high-quality images.
+</p>
+
+<p>
+For more information on optimizing apps for large screens see <a href="{@docRoot}training/multiscreen/index.html">
+Designing for multiple screens</a>.
+</p>
+
+<h2 id="HandleLargeBitmaps">Design to Handle Large Bitmaps</h2>
+
+<p>
+The Android system has a limited amount of memory, so downloading and storing high-resolution images can often
+cause out-of-memory errors in your app. To avoid this, follow these tips:
+</p>
+
+<ul>
+ <li>Load images only when they're displayed on the screen. For example, when displaying multiple images in
+ a {@link android.widget.GridView} or
+ {@link android.widget.Gallery}, only load an image when
+ {@link android.widget.Adapter#getView(int, View, ViewGroup) getView()}
+ is called on the View's {@link android.widget.Adapter}.
+ </li>
+ <li>Call {@link android.graphics.Bitmap#recycle()} on
+ {@link android.graphics.Bitmap} views that are no longer needed.
+ </li>
+ <li>Use {@link java.lang.ref.WeakReference} for storing references
+ to {@link android.graphics.Bitmap} objects in an in-memory
+ {@link java.util.Collection}.</li>
+ <li>If you fetch images from the network, use {@link android.os.AsyncTask}
+ to fetch them and store them on the SD card for faster access.
+ Never do network transactions on the application's UI thread.
+ </li>
+ <li>Scale down really large images to a more appropriate size as you download them; otherwise, downloading the image
+ itself may cause an "Out of Memory" exception. Here is sample code that scales down images while downloading:
+
+ <pre>
+ // Get the source image's dimensions
+ BitmapFactory.Options options = new BitmapFactory.Options();
+ // This does not download the actual image, just downloads headers.
+ options.inJustDecodeBounds = true;
+ BitmapFactory.decodeFile(IMAGE_FILE_URL, options);
+ // The actual width of the image.
+ int srcWidth = options.outWidth;
+ // The actual height of the image.
+ int srcHeight = options.outHeight;
+
+ // Only scale if the source is bigger than the width of the destination view.
+ if(desiredWidth > srcWidth)
+ desiredWidth = srcWidth;
+
+ // Calculate the correct inSampleSize/scale value. This helps reduce memory use. It should be a power of 2.
+ int inSampleSize = 1;
+ while(srcWidth / 2 > desiredWidth){
+ srcWidth /= 2;
+ srcHeight /= 2;
+ inSampleSize *= 2;
+ }
+
+ float desiredScale = (float) desiredWidth / srcWidth;
+
+ // Decode with inSampleSize
+ options.inJustDecodeBounds = false;
+ options.inDither = false;
+ options.inSampleSize = inSampleSize;
+ options.inScaled = false;
+ // Ensures the image stays as a 32-bit ARGB_8888 image.
+ // This preserves image quality.
+ options.inPreferredConfig = Bitmap.Config.ARGB_8888;
+
+ Bitmap sampledSrcBitmap = BitmapFactory.decodeFile(IMAGE_FILE_URL, options);
+
+ // Resize
+ Matrix matrix = new Matrix();
+ matrix.postScale(desiredScale, desiredScale);
+ Bitmap scaledBitmap = Bitmap.createBitmap(sampledSrcBitmap, 0, 0,
+ sampledSrcBitmap.getWidth(), sampledSrcBitmap.getHeight(), matrix, true);
+ sampledSrcBitmap = null;
+
+ // Save
+ FileOutputStream out = new FileOutputStream(LOCAL_PATH_TO_STORE_IMAGE);
+ scaledBitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
+ scaledBitmap = null;
+ </pre>
+ </li> </ul> \ No newline at end of file
diff --git a/docs/html/training/tv/optimizing-navigation-tv.jd b/docs/html/training/tv/optimizing-navigation-tv.jd
new file mode 100644
index 000000000000..bb78258e70e0
--- /dev/null
+++ b/docs/html/training/tv/optimizing-navigation-tv.jd
@@ -0,0 +1,206 @@
+page.title=Optimizing Navigation for TV
+parent.title=Designing for TV
+parent.link=index.html
+
+trainingnavtop=true
+previous.title=Optimizing Layouts for TV
+previous.link=optimizing-layouts-tv.html
+next.title=Handling Features Not Supported on TV
+next.link=unsupported-features-tv.html
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="#HandleDpadNavigation">Handle D-pad Navigation</a></li>
+ <li><a href="#HandleFocusSelection">Provide Clear Visual Indication for Focus and Selection</a></li>
+ <li><a href="#DesignForEasyNavigation">Design for Easy Navigation</a></li>
+</ol>
+
+<h2>You should also read</h2>
+<ul>
+ <li><a href="{@docRoot}training/design-navigation/index.html">Designing Effective Navigation</a></li>
+</ul>
+
+</div>
+</div>
+
+<p>
+An important aspect of the user experience when operating a TV is the direct human interface: a remote control.
+As you optimize your Android application for TVs, you should pay special attention to how the user actually navigates
+around your application when using a remote control instead of a touchscreen.
+</p>
+<p>
+This lesson shows you how to optimize navigation for TV by:
+</p>
+
+<ul>
+ <li>Ensuring all layout controls are D-pad navigable.</li>
+ <li>Providing highly obvious feedback for UI navigation.</li>
+ <li>Placing layout controls for easy access.</li>
+</ul>
+
+<h2 id="HandleDpadNavigation">Handle D-pad Navigation</h2>
+
+<p>
+On a TV, users navigate with controls on a TV remote, using either a D-pad or arrow keys.
+This limits movement to up, down, left, and right.
+To build a great TV-optimized app, you must provide a navigation scheme in which the user can
+quickly learn how to navigate your app using the remote.
+</p>
+
+<p>
+When you design navigation for D-pad, follow these guidelines:
+</p>
+
+<ul>
+ <li>Ensure that the D-pad can navigate to all the visible controls on the screen.</li>
+ <li>For scrolling lists with focus, D-pad up/down keys scroll the list and Enter key selects an item in the list. Ensure that users can
+ select an element in the list and that the list still scrolls when an element is selected.</li>
+ <li>Ensure that movement between controls is straightforward and predictable.</li>
+</ul>
+
+<p>
+Android usually handles navigation order between layout elements automatically, so you don't need to do anything extra. If the screen layout
+makes navigation difficult, or if you want users to move through the layout in a specific way, you can set up explicit navigation for your
+controls.
+For example, for an {@code android.widget.EditText}, to define the next control to receive focus, use:
+<pre>
+&lt;EditText android:id="@+id/LastNameField" android:nextFocusDown="@+id/FirstNameField"\&gt;
+</pre>
+The following table lists all of the available navigation attributes:
+</p>
+
+<table>
+<tr>
+<th>Attribute</th>
+<th>Function</th>
+</tr>
+<tr>
+<td>{@link android.R.attr#nextFocusDown}</td>
+<td>Defines the next view to receive focus when the user navigates down.</td>
+</tr>
+<tr>
+<td>{@link android.R.attr#nextFocusLeft}</td>
+<td>Defines the next view to receive focus when the user navigates left.</td>
+</tr>
+<tr>
+<td>{@link android.R.attr#nextFocusRight}</td>
+<td>Defines the next view to receive focus when the user navigates right.</td>
+</tr>
+<tr>
+<td>{@link android.R.attr#nextFocusUp}</td>
+<td>Defines the next view to receive focus when the user navigates up.</td>
+</tr>
+</table>
+
+<p>
+To use one of these explicit navigation attributes, set the value to the ID (android:id value) of another widget in the layout. You should set
+up the navigation order as a loop, so that the last control directs focus back to the first one.
+</p>
+
+<p>
+Note: You should only use these attributes to modify the navigation order if the default order that the system applies does not work well.
+</p>
+
+<h2 id="HandleFocusSelection">Provide Clear Visual Indication for Focus and Selection</h2>
+
+<p>
+Use appropriate color highlights for all navigable and selectable elements in the UI. This makes it easy for users to know whether the control
+is currently focused or selected when they navigate with a D-pad. Also, use uniform highlight scheme across your application.
+</p>
+
+<p>
+Android provides <a href="{@docRoot}guide/topics/resources/drawable-resource.html#StateList">Drawable State List Resources</a> to implement highlights
+for selected and focused controls. For example:
+</p>
+
+res/drawable/button.xml:
+<pre>
+&lt;?xml version="1.0" encoding="utf-8"?&gt;
+&lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
+ &lt;item android:state_pressed="true"
+ android:drawable="@drawable/button_pressed" /&gt; &lt;!-- pressed --&gt;
+ &lt;item android:state_focused="true"
+ android:drawable="@drawable/button_focused" /&gt; &lt;!-- focused --&gt;
+ &lt;item android:state_hovered="true"
+ android:drawable="@drawable/button_focused" /&gt; &lt;!-- hovered --&gt;
+ &lt;item android:drawable="@drawable/button_normal" /&gt; &lt;!-- default --&gt;
+&lt;/selector&gt;
+</pre>
+
+<p>
+This layout XML applies the above state list drawable to a {@link android.widget.Button}:
+</p>
+<pre>
+&lt;Button
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:background="@drawable/button" /&gt;
+</pre>
+
+<p>
+Provide sufficient padding within the focusable and selectable controls so that the highlights around them are clearly visible.
+</p>
+
+<h2 id="DesignForEasyNavigation">Design for Easy Navigation</h2>
+
+<p>
+Users should be able to navigate to any UI control with a couple of D-pad clicks. Navigation should be easy and intuitive to
+understand. For any non-intuitive actions, provide users with written help, using a dialog triggered by a help button or action bar icon.
+</p>
+
+<p>
+Predict the next screen that the user will want to navigate to and provide one click navigation to it. If the current screen UI is very sparse,
+consider making it a multi pane screen. Use fragments for making multi-pane screens. For example, consider the multi-pane UI below with continent names
+on the left and list of cool places in each continent on the right.
+</p>
+
+<img src="{@docRoot}images/training/cool-places.png" alt="" />
+
+<p>
+The above UI consists of three Fragments - <code>left_side_action_controls</code>, <code>continents</code> and
+<code>places</code> - as shown in its layout
+xml file below. Such multi-pane UIs make D-pad navigation easier and make good use of the horizontal screen space for
+TVs.
+</p>
+res/layout/cool_places.xml
+<pre>
+&lt;LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="horizontal"
+ &gt;
+ &lt;fragment
+ android:id="@+id/left_side_action_controls"
+ android:layout_width="0px"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="10dip"
+ android:layout_weight="0.2"/&gt;
+ &lt;fragment
+ android:id="@+id/continents"
+ android:layout_width="0px"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="10dip"
+ android:layout_weight="0.2"/&gt;
+
+ &lt;fragment
+ android:id="@+id/places"
+ android:layout_width="0px"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="10dip"
+ android:layout_weight="0.6"/&gt;
+
+&lt;/LinearLayout&gt;
+</pre>
+
+<p>
+Also, notice in the UI layout above action controls are on the left hand side of a vertically scrolling list to make
+them easily accessible using D-pad.
+In general, for layouts with horizontally scrolling components, place action controls on left or right hand side and
+vice versa for vertically scrolling components.
+</p>
+
diff --git a/docs/html/training/tv/unsupported-features-tv.jd b/docs/html/training/tv/unsupported-features-tv.jd
new file mode 100644
index 000000000000..a9f090bfe1e2
--- /dev/null
+++ b/docs/html/training/tv/unsupported-features-tv.jd
@@ -0,0 +1,157 @@
+page.title=Handling Features Not Supported on TV
+parent.title=Designing for TV
+parent.link=index.html
+
+trainingnavtop=true
+previous.title=Optimizing Navigation for TV
+previous.link=optimizing-navigation-tv.html
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="#WorkaroundUnsupportedFeatures">Work Around Features Not Supported on TV</a></li>
+ <li><a href="#CheckAvailableFeatures">Check for Available Features at Runtime</a></li>
+</ol>
+
+</div>
+</div>
+
+<p>
+TVs are much different from other Android-powered devices:
+</p>
+<ul>
+ <li>They're not mobile.</li>
+ <li>Out of habit, people use them for watching media with little or no interaction.</li>
+ <li>People interact with them from a distance.</li>
+</ul>
+
+<p>
+Because TVs have a different purpose from other devices, they usually don't have hardware features
+that other Android-powered devices often have. For this reason, the Android system does not
+support the following features for a TV device:
+<table>
+<tr>
+<th>Hardware</th>
+<th>Android feature descriptor</th>
+</tr>
+<tr>
+<td>Camera</td>
+<td>android.hardware.camera</td>
+</tr>
+<tr>
+<td>GPS</td>
+<td>android.hardware.location.gps</td>
+</tr>
+<tr>
+<td>Microphone</td>
+<td>android.hardware.microphone</td>
+</tr>
+<tr>
+<td>Near Field Communications (NFC)</td>
+<td>android.hardware.nfc</td>
+</tr>
+<tr>
+<td>Telephony</td>
+<td>android.hardware.telephony</td>
+</tr>
+<tr>
+<td>Touchscreen</td>
+<td>android.hardware.touchscreen</td>
+</tr>
+</table>
+</p>
+
+<p>
+This lesson shows you how to work around features that are not available on TV by:
+<ul>
+ <li>Providing work arounds for some non-supported features.</li>
+ <li>Checking for available features at runtime and conditionally activating/deactivating certain code
+ paths based on availability of those features.</li>
+</ul>
+</p>
+
+
+<h2 id="WorkaroundUnsupportedFeatures">Work Around Features Not Supported on TV</h2>
+
+<p>
+Android doesn't support touchscreen interaction for TV devices, most TVs don't have touch screens,
+and interacting with a TV using a touchscreen is not consistent with the 10 foot environment. For
+these reasons, users interact with Android-powered TVs using a remote. In consideration of this,
+ensure that every control in your app can be accessed with the D-pad. Refer back to the previous two lessons
+<a href="{@docRoot}training/tv/optimizing-layouts-tv.html">Optimizing Layouts for TV</a> and
+<a href="{@docRoot}training/tv/optimizing-navigation-tv.html">Optimize Navigation for TV</a> for
+more details
+on this topic. The Android system assumes that a device has a touchscreen, so if you want your application
+to run on a TV, you must <strong>explicitly</strong> disable the touchscreen requirement in your manifest file:
+<pre>
+&lt;uses-feature android:name="android.hardware.touchscreen" android:required="false"/&gt;
+</pre>
+</p>
+
+<p>
+Although a TV doesn't have a camera, you can still provide a photography-related application on a TV.
+For example, if you have an app that takes, views and edits photos, you can disable its picture-taking
+functionality for TVs and still allow users to view and even edit photos. The next section talks about how to
+deactivate or activate specific functions in the application based on runtime device type detection.
+</p>
+
+<p>
+Because TVs are stationary, indoor devices, they don't have built-in GPS. If your application uses location
+information, allow users to search for a location or use a "static" location provider to get
+a location from the zip code configured during the TV setup.
+<pre>
+LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
+Location location = locationManager.getLastKnownLocation("static");
+Geocoder geocoder = new Geocoder(this);
+Address address = null;
+
+try {
+ address = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1).get(0);
+ Log.d("Zip code", address.getPostalCode());
+
+} catch (IOException e) {
+ Log.e(TAG, "Geocoder error", e);
+}
+</pre>
+</p>
+
+<p>
+TVs usually don't support microphones, but if you have an application that uses voice control,
+you can create a mobile device app that takes voice input and then acts as a remote control for a TV.
+</p>
+
+<h2 id="CheckAvailableFeatures">Check for Available Features at Runtime</h2>
+
+<p>
+To check if a feature is available at runtime, call
+{@link android.content.pm.PackageManager#hasSystemFeature(String)}.
+ This method takes a single argument : a string corresponding to the
+feature you want to check. For example, to check for touchscreen, use
+{@link android.content.pm.PackageManager#hasSystemFeature(String)} with the argument
+{@link android.content.pm.PackageManager#FEATURE_TOUCHSCREEN}.
+</p>
+
+<p>
+The following code snippet demonstrates how to detect device type at runtime based on supported features:
+
+<pre>
+// Check if android.hardware.telephony feature is available.
+if (getPackageManager().hasSystemFeature("android.hardware.telephony")) {
+ Log.d("Mobile Test", "Running on phone");
+// Check if android.hardware.touchscreen feature is available.
+} else if (getPackageManager().hasSystemFeature("android.hardware.touchscreen")) {
+ Log.d("Tablet Test", "Running on devices that don't support telphony but have a touchscreen.");
+} else {
+ Log.d("TV Test", "Running on a TV!");
+}
+</pre>
+</p>
+
+<p>
+This is just one example of using runtime checks to deactivate app functionality that depends on features
+that aren't available on TVs.
+</p> \ No newline at end of file
diff --git a/docs/html/wear/images/hero.jpg b/docs/html/wear/images/hero.jpg
index 7850a8118a04..0b4debb02922 100644
--- a/docs/html/wear/images/hero.jpg
+++ b/docs/html/wear/images/hero.jpg
Binary files differ
diff --git a/docs/html/wear/images/partners/arm.png b/docs/html/wear/images/partners/arm.png
deleted file mode 100644
index 27214d1d63e4..000000000000
--- a/docs/html/wear/images/partners/arm.png
+++ /dev/null
Binary files differ
diff --git a/docs/html/wear/index.jd b/docs/html/wear/index.jd
index d4cab4125ea6..bc08aa00e865 100644
--- a/docs/html/wear/index.jd
+++ b/docs/html/wear/index.jd
@@ -227,9 +227,6 @@ page.type=about
<div class="col-4">
<img src="/wear/images/partners/samsung.png" alt="Samsung">
</div>
- <div class="col-4">
- <img src="/wear/images/partners/arm.png" alt="ARM">
- </div>
</div>
</div> <!-- end .wrap -->
</div>