Merge "Fix docs for DragEvent" into nyc-dev
diff --git a/core/java/android/hardware/usb/UsbManager.java b/core/java/android/hardware/usb/UsbManager.java
index f9a7d19..ac968c8 100644
--- a/core/java/android/hardware/usb/UsbManager.java
+++ b/core/java/android/hardware/usb/UsbManager.java
@@ -42,7 +42,7 @@
* <div class="special reference">
* <h3>Developer Guides</h3>
* <p>For more information about communicating with USB hardware, read the
- * <a href="{@docRoot}guide/topics/usb/index.html">USB</a> developer guide.</p>
+ * <a href="{@docRoot}guide/topics/connectivity/usb/index.html">USB developer guide</a>.</p>
* </div>
*/
public class UsbManager {
diff --git a/docs/html-intl/intl/ja/training/basics/data-storage/files.jd b/docs/html-intl/intl/ja/training/basics/data-storage/files.jd
index dddfe37..b920c1a 100644
--- a/docs/html-intl/intl/ja/training/basics/data-storage/files.jd
+++ b/docs/html-intl/intl/ja/training/basics/data-storage/files.jd
@@ -183,7 +183,7 @@
try {
String fileName = Uri.parse(url).getLastPathSegment();
file = File.createTempFile(fileName, null, context.getCacheDir());
- catch (IOException e) {
+ } catch (IOException e) {
// Error while creating file
}
return file;
@@ -250,7 +250,7 @@
-
+
<p>たとえば、自分のアプリでダウンロードした追加のリソースや一時的なメディア ファイルです。</p>
</dd>
</dl>
@@ -265,7 +265,7 @@
<pre>
public File getAlbumStorageDir(String albumName) {
- // Get the directory for the user's public pictures directory.
+ // Get the directory for the user's public pictures directory.
File file = new File(Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES), albumName);
if (!file.mkdirs()) {
@@ -287,7 +287,7 @@
<pre>
public File getAlbumStorageDir(Context context, String albumName) {
- // Get the directory for the app's private pictures directory.
+ // Get the directory for the app's private pictures directory.
File file = new File(context.getExternalFilesDir(
Environment.DIRECTORY_PICTURES), albumName);
if (!file.mkdirs()) {
@@ -366,7 +366,7 @@
<div class="note">
<p><strong>注:</strong> ユーザーがアプリをアンインストールすると、Android システムは次を削除します。
-</p>
+</p>
<ul>
<li>内部ストレージに保存したすべてのファイル</li>
<li>{@link
diff --git a/docs/html-intl/intl/ko/training/basics/data-storage/files.jd b/docs/html-intl/intl/ko/training/basics/data-storage/files.jd
index 71652b5..0b717a8 100644
--- a/docs/html-intl/intl/ko/training/basics/data-storage/files.jd
+++ b/docs/html-intl/intl/ko/training/basics/data-storage/files.jd
@@ -183,7 +183,7 @@
try {
String fileName = Uri.parse(url).getLastPathSegment();
file = File.createTempFile(fileName, null, context.getCacheDir());
- catch (IOException e) {
+ } catch (IOException e) {
// Error while creating file
}
return file;
@@ -250,7 +250,7 @@
앱을 제거하면 같이 삭제됩니다. 이러한 파일은
엄밀히 말해 외부 저장소에 저장된 파일이기 때문에 사용자 및 다른 앱의 액세스가 가능하긴 하지만, 앱 외부에서
사용자에게 값을 실제로 제공하지는 않습니다. 사용자가 앱을 제거하면 앱의 외부 개인 디렉터리 내 모든 파일을 시스템에서
-삭제합니다.
+삭제합니다.
<p>예를 들어 앱에서 다운로드한 추가 리소스 또는 임시 미디어 파일이 이에 해당합니다.</p>
</dd>
</dl>
@@ -265,7 +265,7 @@
<pre>
public File getAlbumStorageDir(String albumName) {
- // Get the directory for the user's public pictures directory.
+ // Get the directory for the user's public pictures directory.
File file = new File(Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES), albumName);
if (!file.mkdirs()) {
@@ -287,7 +287,7 @@
<pre>
public File getAlbumStorageDir(Context context, String albumName) {
- // Get the directory for the app's private pictures directory.
+ // Get the directory for the app's private pictures directory.
File file = new File(context.getExternalFilesDir(
Environment.DIRECTORY_PICTURES), albumName);
if (!file.mkdirs()) {
@@ -357,7 +357,7 @@
myFile.delete();
</pre>
-<p>파일이 내부 저장소에 저장되어 있는 경우, {@link android.content.Context}에 위치를 요청하고 {@link android.content.Context#deleteFile deleteFile()}을 호출하여 파일을
+<p>파일이 내부 저장소에 저장되어 있는 경우, {@link android.content.Context}에 위치를 요청하고 {@link android.content.Context#deleteFile deleteFile()}을 호출하여 파일을
삭제할 수도 있습니다.</p>
<pre>
@@ -366,7 +366,7 @@
<div class="note">
<p><strong>참고:</strong> 사용자가 앱을 제거하면 Android 시스템이
-다음 항목을 삭제합니다.</p>
+다음 항목을 삭제합니다.</p>
<ul>
<li>내부 저장소에 저장한 모든 파일</li>
<li>{@link
diff --git a/docs/html-intl/intl/pt-br/training/basics/data-storage/files.jd b/docs/html-intl/intl/pt-br/training/basics/data-storage/files.jd
index d071d39..0e00645 100644
--- a/docs/html-intl/intl/pt-br/training/basics/data-storage/files.jd
+++ b/docs/html-intl/intl/pt-br/training/basics/data-storage/files.jd
@@ -183,7 +183,7 @@
try {
String fileName = Uri.parse(url).getLastPathSegment();
file = File.createTempFile(fileName, null, context.getCacheDir());
- catch (IOException e) {
+ } catch (IOException e) {
// Error while creating file
}
return file;
@@ -250,12 +250,12 @@
. Embora esses arquivos estejam teoricamente à disposição do usuário e de outros aplicativo por estarem
no armazenamento externo, na verdade são arquivos que não têm valor para o usuário
fora do aplicativo. Ao desinstalar o aplicativo, o sistema exclui
-todos os arquivos no diretório privado externo do aplicativo.
+todos os arquivos no diretório privado externo do aplicativo.
<p>Por exemplo, recursos adicionais baixados através do aplicativo ou arquivos de mídia temporários.</p>
</dd>
</dl>
-<p>Para salvar arquivos públicos no armazenamento externo, use o método
+<p>Para salvar arquivos públicos no armazenamento externo, use o método
{@link android.os.Environment#getExternalStoragePublicDirectory
getExternalStoragePublicDirectory()} para obter um {@link java.io.File} que representa
o diretório correto no armazenamento externo. O método exige um argumento que especifica
@@ -265,7 +265,7 @@
<pre>
public File getAlbumStorageDir(String albumName) {
- // Get the directory for the user's public pictures directory.
+ // Get the directory for the user's public pictures directory.
File file = new File(Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES), albumName);
if (!file.mkdirs()) {
@@ -287,7 +287,7 @@
<pre>
public File getAlbumStorageDir(Context context, String albumName) {
- // Get the directory for the app's private pictures directory.
+ // Get the directory for the app's private pictures directory.
File file = new File(context.getExternalFilesDir(
Environment.DIRECTORY_PICTURES), albumName);
if (!file.mkdirs()) {
@@ -366,7 +366,7 @@
<div class="note">
<p><strong>Observação:</strong> quando o usuário desinstala o aplicativo, o sistema Android também
-exclui:</p>
+exclui:</p>
<ul>
<li>Todos os arquivos salvos no armazenamento interno</li>
<li>Todos os arquivos salvos no armazenamento externo usando {@link
diff --git a/docs/html-intl/intl/ru/training/basics/data-storage/files.jd b/docs/html-intl/intl/ru/training/basics/data-storage/files.jd
index 2afecea..2b8f880 100644
--- a/docs/html-intl/intl/ru/training/basics/data-storage/files.jd
+++ b/docs/html-intl/intl/ru/training/basics/data-storage/files.jd
@@ -183,7 +183,7 @@
try {
String fileName = Uri.parse(url).getLastPathSegment();
file = File.createTempFile(fileName, null, context.getCacheDir());
- catch (IOException e) {
+ } catch (IOException e) {
// Error while creating file
}
return file;
@@ -250,7 +250,7 @@
вашего приложения пользователем. Хотя технически эти файлы доступны для пользователя и других приложений, поскольку находятся
во внешнем хранилище, они не имеют никакой ценности для пользователей
вне вашего приложения. Когда пользователь удаляет ваше приложение, система удаляет
-все файлы из каталога закрытых файлов вашего приложения во внешнем хранилище.
+все файлы из каталога закрытых файлов вашего приложения во внешнем хранилище.
<p>Например, к этой категории относятся дополнительные ресурсы, загруженные приложением, и временные мультимедийные файлы.</p>
</dd>
</dl>
@@ -265,7 +265,7 @@
<pre>
public File getAlbumStorageDir(String albumName) {
- // Get the directory for the user's public pictures directory.
+ // Get the directory for the user's public pictures directory.
File file = new File(Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES), albumName);
if (!file.mkdirs()) {
@@ -287,7 +287,7 @@
<pre>
public File getAlbumStorageDir(Context context, String albumName) {
- // Get the directory for the app's private pictures directory.
+ // Get the directory for the app's private pictures directory.
File file = new File(context.getExternalFilesDir(
Environment.DIRECTORY_PICTURES), albumName);
if (!file.mkdirs()) {
@@ -332,7 +332,7 @@
общее пространство в хранилище. Эта информация также позволять
избежать переполнения объема хранилища сверх определенного уровня.</p>
-<p>Однако система не гарантирует возможность записи такого же количества байт, как указано
+<p>Однако система не гарантирует возможность записи такого же количества байт, как указано
в {@link java.io.File#getFreeSpace}. Если выводимое число на
несколько мегабайт превышает размер данных, которые вы хотите сохранить, или если файловая система заполнена
менее, чем на 90%, дальше можно действовать спокойно.
@@ -366,13 +366,13 @@
<div class="note">
<p><strong>Примечание.</strong> При удалении пользователем вашего приложения система Android удаляет
-следующие элементы:</p>
+следующие элементы:</p>
<ul>
<li>Все файлы, сохраненные во внутреннем хранилище</li>
<li>Все файлы, сохраненные во внешнем хранилище с использованием {@link
android.content.Context#getExternalFilesDir getExternalFilesDir()}.</li>
</ul>
-<p>Однако вам следует регулярно вручную очищать кэш-память, чтобы удалить файлы, созданные с помощью
+<p>Однако вам следует регулярно вручную очищать кэш-память, чтобы удалить файлы, созданные с помощью
{@link android.content.Context#getCacheDir()}, а также удалять любые
другие ненужные файлы.</p>
</div>
diff --git a/docs/html-intl/intl/zh-cn/training/basics/data-storage/files.jd b/docs/html-intl/intl/zh-cn/training/basics/data-storage/files.jd
index 1442275..4ec1d68 100644
--- a/docs/html-intl/intl/zh-cn/training/basics/data-storage/files.jd
+++ b/docs/html-intl/intl/zh-cn/training/basics/data-storage/files.jd
@@ -183,7 +183,7 @@
try {
String fileName = Uri.parse(url).getLastPathSegment();
file = File.createTempFile(fileName, null, context.getCacheDir());
- catch (IOException e) {
+ } catch (IOException e) {
// Error while creating file
}
return file;
@@ -250,7 +250,7 @@
-
+
<p>例如,您的应用下载的其他资源或临时介质文件。</p>
</dd>
</dl>
@@ -265,7 +265,7 @@
<pre>
public File getAlbumStorageDir(String albumName) {
- // Get the directory for the user's public pictures directory.
+ // Get the directory for the user's public pictures directory.
File file = new File(Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES), albumName);
if (!file.mkdirs()) {
@@ -287,7 +287,7 @@
<pre>
public File getAlbumStorageDir(Context context, String albumName) {
- // Get the directory for the app's private pictures directory.
+ // Get the directory for the app's private pictures directory.
File file = new File(context.getExternalFilesDir(
Environment.DIRECTORY_PICTURES), albumName);
if (!file.mkdirs()) {
@@ -311,7 +311,7 @@
<p>无论您对于共享的文件使用 {@link
android.os.Environment#getExternalStoragePublicDirectory
-getExternalStoragePublicDirectory()} 还是对您的应用专用文件使用
+getExternalStoragePublicDirectory()} 还是对您的应用专用文件使用
{@link android.content.Context#getExternalFilesDir
getExternalFilesDir()} ,您使用诸如
{@link android.os.Environment#DIRECTORY_PICTURES} 的 API 常数提供的目录名称非常重要。
@@ -332,7 +332,7 @@
此信息也可用来避免填充存储卷以致超出特定阈值。
</p>
-<p>但是,系统并不保证您可以写入与 {@link java.io.File#getFreeSpace}
+<p>但是,系统并不保证您可以写入与 {@link java.io.File#getFreeSpace}
指示的一样多的字节。如果返回的数字比您要保存的数据大小大出几 MB,或如果文件系统所占空间不到 90%,则可安全继续操作。否则,您可能不应写入存储。
@@ -366,7 +366,7 @@
<div class="note">
<p><strong>注意:</strong>当用户卸载您的应用时,Android 系统会删除以下各项:
-</p>
+</p>
<ul>
<li>您保存在内部存储中的所有文件</li>
<li>您使用 {@link
diff --git a/docs/html-intl/intl/zh-tw/training/basics/data-storage/files.jd b/docs/html-intl/intl/zh-tw/training/basics/data-storage/files.jd
index 8b8d0a7..cda5864 100644
--- a/docs/html-intl/intl/zh-tw/training/basics/data-storage/files.jd
+++ b/docs/html-intl/intl/zh-tw/training/basics/data-storage/files.jd
@@ -40,7 +40,7 @@
該物件的用途很廣,例如非常適用於影像檔案或透過網路交換的項目。
</p>
-<p>本課程將顯示如何在您的應用程式中執行與檔案相關的基本任務。本課程假設您已熟悉 Linux 檔案系統的基本概念,以及
+<p>本課程將顯示如何在您的應用程式中執行與檔案相關的基本任務。本課程假設您已熟悉 Linux 檔案系統的基本概念,以及
{@link java.io} 中的標準檔案輸入/輸出 API。
</p>
@@ -183,7 +183,7 @@
try {
String fileName = Uri.parse(url).getLastPathSegment();
file = File.createTempFile(fileName, null, context.getCacheDir());
- catch (IOException e) {
+ } catch (IOException e) {
// Error while creating file
}
return file;
@@ -250,12 +250,12 @@
-
+
<p>例如,您的應用程式下載的附加資源,或暫存媒體檔案都是私用檔案。</p>
</dd>
</dl>
-<p>若您希望將公用檔案儲存在外部儲存空間,請使用
+<p>若您希望將公用檔案儲存在外部儲存空間,請使用
{@link android.os.Environment#getExternalStoragePublicDirectory
getExternalStoragePublicDirectory()} 方法取得代表外部儲存空間內相應目錄的 {@link java.io.File}。
該方法採用對要儲存的檔案類型進行指定 (以便能合理區分這些檔案與其他公用檔案) 的引數,諸如 {@link android.os.Environment#DIRECTORY_MUSIC} 或 {@link
@@ -265,7 +265,7 @@
<pre>
public File getAlbumStorageDir(String albumName) {
- // Get the directory for the user's public pictures directory.
+ // Get the directory for the user's public pictures directory.
File file = new File(Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES), albumName);
if (!file.mkdirs()) {
@@ -287,7 +287,7 @@
<pre>
public File getAlbumStorageDir(Context context, String albumName) {
- // Get the directory for the app's private pictures directory.
+ // Get the directory for the app's private pictures directory.
File file = new File(context.getExternalFilesDir(
Environment.DIRECTORY_PICTURES), albumName);
if (!file.mkdirs()) {
@@ -366,7 +366,7 @@
<div class="note">
<p><strong>注意:</strong>使用者解除安裝您的應用程式時,Android 系統會刪除以下檔案:
-</p>
+</p>
<ul>
<li>您在內部儲存空間儲存的所有檔案</li>
<li>您使用 {@link
diff --git a/docs/html/images/training/tv/tif/app-link-2x.png b/docs/html/images/training/tv/tif/app-link-2x.png
new file mode 100644
index 0000000..d9d0582
--- /dev/null
+++ b/docs/html/images/training/tv/tif/app-link-2x.png
Binary files differ
diff --git a/docs/html/images/training/tv/tif/app-link-diagram.png b/docs/html/images/training/tv/tif/app-link-diagram.png
new file mode 100644
index 0000000..92328ad
--- /dev/null
+++ b/docs/html/images/training/tv/tif/app-link-diagram.png
Binary files differ
diff --git a/docs/html/images/training/tv/tif/app-link.png b/docs/html/images/training/tv/tif/app-link.png
new file mode 100644
index 0000000..7573a18
--- /dev/null
+++ b/docs/html/images/training/tv/tif/app-link.png
Binary files differ
diff --git a/docs/html/topic/libraries/support-library/features.jd b/docs/html/topic/libraries/support-library/features.jd
index 584bef8..d648384 100755
--- a/docs/html/topic/libraries/support-library/features.jd
+++ b/docs/html/topic/libraries/support-library/features.jd
@@ -142,7 +142,7 @@
</p>
<p>After you download the Android Support Libraries, this library is located in the
-{@code <sdk>/extras/android/support/v4/} directory. The library does not contain user
+<code><sdk>/extras/android/support/v4/</code> directory. The library does not contain user
interface resources. To include it in your application project, follow the instructions for
<a href="{@docRoot}tools/support-library/setup.html#libs-without-res">Adding libraries without
resources</a>.</p>
@@ -169,7 +169,7 @@
<p>
After you download the Android Support Libraries, this library is located in the
- {@code <sdk>/extras/android/support/multidex/} directory. The library does not contain
+ <code><sdk>/extras/android/support/multidex/</code> directory. The library does not contain
user interface resources. To include it in your application project, follow the instructions
for
<a href= "{@docRoot}tools/support-library/setup.html#libs-without-res">Adding libraries without
@@ -229,7 +229,7 @@
</ul>
<p>After you download the Android Support Libraries, this library is located in the
-{@code <sdk>/extras/android/support/v7/appcompat/} directory. The library contains user
+<code><sdk>/extras/android/support/v7/appcompat/</code> directory. The library contains user
interface resources. To include it in your application project, follow the instructions for
<a href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries with
resources</a>.</p>
@@ -250,7 +250,7 @@
implementations, and are used extensively in layouts for TV apps.</p>
<p>After you download the Android Support Libraries, this library is located in the
-{@code <sdk>/extras/android/support/v7/cardview/} directory. The library contains user interface
+<code><sdk>/extras/android/support/v7/cardview/</code> directory. The library contains user interface
resources. To include it in your application project, follow the instructions
for <a href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding
libraries with resources</a>.</p>
@@ -271,7 +271,7 @@
For detailed information about the v7 gridlayout library APIs, see the
{@link android.support.v7.widget android.support.v7.widget} package in the API reference.</p>
-<p>This library is located in the {@code <sdk>/extras/android/support/v7/gridlayout/}
+<p>This library is located in the <code><sdk>/extras/android/support/v7/gridlayout/</code>
directory . The library contains user
interface resources. To include it in your application project, follow the instructions for
<a href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries with
@@ -332,7 +332,7 @@
title card.</p>
<p>After you download the Android Support Libraries, this library is located in the
-{@code <sdk>/extras/android/support/v7/palette/} directory. The library does not contain
+<code><sdk>/extras/android/support/v7/palette/</code> directory. The library does not contain
user interface resources. To include it in your application project, follow the instructions for
<a href="{@docRoot}tools/support-library/setup.html#libs-without-res">Adding libraries without
resources</a>.</p>
@@ -354,7 +354,7 @@
limited window of data items.</p>
<p>After you download the Android Support Libraries, this library is located in the
-{@code <sdk>/extras/android/support/v7/recyclerview/} directory. The library contains
+<code><sdk>/extras/android/support/v7/recyclerview/</code> directory. The library contains
user interface resources. To include it in your application project, follow the instructions
for <a href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding
libraries with resources</a>.</p>
@@ -383,7 +383,7 @@
<p>After you download the Android Support Libraries, this library is located in the
-{@code <sdk>/extras/android/support/v7/preference} directory. For more information
+<code><sdk>/extras/android/support/v7/preference</code> directory. For more information
on how to set up your project, follow the instructions in <a
href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries
with resources</a>. </p>
@@ -447,7 +447,7 @@
</p>
<p>After you download the Android Support Libraries, this library is located in the
-{@code <sdk>/extras/android/support/v13/} directory. The library does not contain user
+<code><sdk>/extras/android/support/v13/</code> directory. The library does not contain user
interface resources. To include it in your application project, follow the instructions for
<a href="{@docRoot}tools/support-library/setup.html#libs-without-res">Adding libraries without
resources</a>.</p>
@@ -479,7 +479,7 @@
</p>
<p>After you download the Android Support Libraries, this library is located in the
-{@code <sdk>/extras/android/support/v14/} directory. The library does not contain user
+<code><sdk>/extras/android/support/v14/</code> directory. The library does not contain user
interface resources. To include it in your application project, follow the instructions for
<a href="{@docRoot}tools/support-library/setup.html#libs-without-res">Adding libraries without
resources</a>.</p>
@@ -508,7 +508,7 @@
</p>
<p>After you download the Android Support Libraries, this library is located in the
-{@code <sdk>/extras/android/support/v17/} directory. The library does not contain user
+<code><sdk>/extras/android/support/v17/</code> directory. The library does not contain user
interface resources. To include it in your application project, follow the instructions for
<a href="{@docRoot}tools/support-library/setup.html#libs-without-res">Adding libraries without
resources</a>.</p>
@@ -550,7 +550,7 @@
</ul>
<p>After you download the Android Support Libraries, this library is located in the
-{@code <sdk>/extras/android/support/v17/leanback} directory. For more information
+<code><sdk>/extras/android/support/v17/leanback</code> directory. For more information
on how to set up your project, follow the instructions in <a
href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries
with resources</a>. </p>
@@ -571,7 +571,7 @@
<p></p>
<p>After you download the Android Support Libraries, this library is located in the
-{@code <sdk>/extras/android/support/annotations} directory. For more information
+<code><sdk>/extras/android/support/annotations</code> directory. For more information
on how to set up your project, follow the instructions in <a
href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries
with resources</a>. </p>
@@ -596,7 +596,7 @@
<p>After you download the Android Support Libraries, this library is located in the
-{@code <sdk>/extras/android/support/design} directory. For more information
+<code><sdk>/extras/android/support/design</code> directory. For more information
on how to set up your project, follow the instructions in <a
href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries
with resources</a>. </p>
@@ -624,7 +624,7 @@
<p>After you download the Android Support Libraries, this library is located in the
-{@code <sdk>/extras/android/support/customtabs} directory. For more information
+<code><sdk>/extras/android/support/customtabs</code> directory. For more information
on how to set up your project, follow the instructions in <a
href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries
with resources</a>. </p>
@@ -655,7 +655,7 @@
<p>After you download the Android Support Libraries, this library is located in the
-{@code <sdk>/extras/android/support/percent} directory. For more information
+<code><sdk>/extras/android/support/percent</code> directory. For more information
on how to set up your project, follow the instructions in <a
href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries
with resources</a>. </p>
@@ -685,7 +685,7 @@
<p>After you download the Android Support Libraries, this library is located in the
-{@code <sdk>/extras/android/support/recommendation} directory. For more information
+<code><sdk>/extras/android/support/recommendation</code> directory. For more information
on how to set up your project, follow the instructions in <a
href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries
with resources</a>. </p>
diff --git a/docs/html/training/articles/perf-tips.jd b/docs/html/training/articles/perf-tips.jd
index 4a3184c..82de69a 100644
--- a/docs/html/training/articles/perf-tips.jd
+++ b/docs/html/training/articles/perf-tips.jd
@@ -43,7 +43,7 @@
that you can simply say "device X is a factor F faster/slower than device Y",
and scale your results from one device to others. In particular, measurement
on the emulator tells you very little about performance on any device. There
-are also huge differences between devices with and without a
+are also huge differences between devices with and without a
<acronym title="Just In Time compiler">JIT</acronym>: the best
code for a device with a JIT is not always the best code for a device
without.</p>
@@ -88,7 +88,7 @@
but this also generalizes to the fact that two parallel arrays of ints
are also a <strong>lot</strong> more efficient than an array of {@code (int,int)}
objects. The same goes for any combination of primitive types.</li>
-
+
<li>If you need to implement a container that stores tuples of {@code (Foo,Bar)}
objects, try to remember that two parallel {@code Foo[]} and {@code Bar[]} arrays are
generally much better than a single array of custom {@code (Foo,Bar)} objects.
@@ -401,19 +401,6 @@
need to solve. Make sure you can accurately measure your existing performance,
or you won't be able to measure the benefit of the alternatives you try.</p>
-<p>Every claim made in this document is backed up by a benchmark. The source
-to these benchmarks can be found in the <a
-href="http://code.google.com/p/dalvik/source/browse/#svn/trunk/benchmarks">code.google.com
-"dalvik" project</a>.</p>
-
-<p>The benchmarks are built with the
-<a href="http://code.google.com/p/caliper/">Caliper</a> microbenchmarking
-framework for Java. Microbenchmarks are hard to get right, so Caliper goes out
-of its way to do the hard work for you, and even detect some cases where you're
-not measuring what you think you're measuring (because, say, the VM has
-managed to optimize all your code away). We highly recommend you use Caliper
-to run your own microbenchmarks.</p>
-
<p>You may also find
<a href="{@docRoot}tools/debugging/debugging-tracing.html">Traceview</a> useful
for profiling, but it's important to realize that it currently disables the JIT,
diff --git a/docs/html/training/basics/data-storage/files.jd b/docs/html/training/basics/data-storage/files.jd
index 58a1d5f..349af78 100644
--- a/docs/html/training/basics/data-storage/files.jd
+++ b/docs/html/training/basics/data-storage/files.jd
@@ -192,7 +192,7 @@
try {
String fileName = Uri.parse(url).getLastPathSegment();
file = File.createTempFile(fileName, null, context.getCacheDir());
- catch (IOException e) {
+ } catch (IOException e) {
// Error while creating file
}
return file;
@@ -259,7 +259,7 @@
your app. Although these files are technically accessible by the user and other apps because they
are on the external storage, they are files that realistically don't provide value to the user
outside your app. When the user uninstalls your app, the system deletes
- all files in your app's external private directory.
+ all files in your app's external private directory.
<p>For example, additional resources downloaded by your app or temporary media files.</p>
</dd>
</dl>
@@ -274,7 +274,7 @@
<pre>
public File getAlbumStorageDir(String albumName) {
- // Get the directory for the user's public pictures directory.
+ // Get the directory for the user's public pictures directory.
File file = new File(Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES), albumName);
if (!file.mkdirs()) {
@@ -296,7 +296,7 @@
<pre>
public File getAlbumStorageDir(Context context, String albumName) {
- // Get the directory for the app's private pictures directory.
+ // Get the directory for the app's private pictures directory.
File file = new File(context.getExternalFilesDir(
Environment.DIRECTORY_PICTURES), albumName);
if (!file.mkdirs()) {
@@ -375,7 +375,7 @@
<div class="note">
<p><strong>Note:</strong> When the user uninstalls your app, the Android system deletes
-the following:</p>
+the following:</p>
<ul>
<li>All files you saved on internal storage</li>
<li>All files you saved on external storage using {@link
diff --git a/docs/html/training/displaying-bitmaps/load-bitmap.jd b/docs/html/training/displaying-bitmaps/load-bitmap.jd
index f963baa..81eb1ab 100644
--- a/docs/html/training/displaying-bitmaps/load-bitmap.jd
+++ b/docs/html/training/displaying-bitmaps/load-bitmap.jd
@@ -115,8 +115,8 @@
// Calculate the largest inSampleSize value that is a power of 2 and keeps both
// height and width larger than the requested height and width.
- while ((halfHeight / inSampleSize) > reqHeight
- && (halfWidth / inSampleSize) > reqWidth) {
+ while ((halfHeight / inSampleSize) >= reqHeight
+ && (halfWidth / inSampleSize) >= reqWidth) {
inSampleSize *= 2;
}
}
diff --git a/docs/html/training/testing/ui-testing/uiautomator-testing.jd b/docs/html/training/testing/ui-testing/uiautomator-testing.jd
index 05ddc34..5d42107 100644
--- a/docs/html/training/testing/ui-testing/uiautomator-testing.jd
+++ b/docs/html/training/testing/ui-testing/uiautomator-testing.jd
@@ -26,7 +26,7 @@
<h2>You should also read</h2>
<ul>
- <li><a href="{@docRoot}reference/android/support/test/package-summary.html">
+ <li><a href="{@docRoot}reference/android/support/test/uiautomator/package-summary.html">
UI Automator API Reference</a></li>
</ul>
diff --git a/docs/html/training/tv/tif/channel.jd b/docs/html/training/tv/tif/channel.jd
index 999f1ca..59e357a 100644
--- a/docs/html/training/tv/tif/channel.jd
+++ b/docs/html/training/tv/tif/channel.jd
@@ -13,6 +13,7 @@
<li><a href="#permission">Get Permission</a></li>
<li><a href="#register">Register Channels in the Database</a></li>
<li><a href="#update">Update Channel Data</a></li>
+ <li><a href="#applink">Add App Link Information</a></li>
</ol>
<h2>Try It Out</h2>
<ul>
@@ -22,10 +23,13 @@
</div>
</div>
-<p>Your TV input must provide Electronic Program Guide (EPG) data for at least one channel in its
-setup activity. You should also periodically update that data, with consideration for the size of
-the update and the processing thread that handles it. This lesson discusses creating and updating
-channel and program data on the system database with these considerations in mind.</p>
+<p>Your TV input must provide Electronic Program Guide (EPG) data for at least
+one channel in its setup activity. You should also periodically update that
+data, with consideration for the size of the update and the processing thread
+that handles it. Additionally, you can provide app links for channels
+that guide the user to related content and activities.
+This lesson discusses creating and updating channel and program data on the
+system database with these considerations in mind.</p>
<p> </p>
@@ -70,6 +74,10 @@
ID</li>
</ul>
+<p>If you want to provide app link details for your channels, you need to
+update some additional fields. For more information on app link fields, see
+<a href="#applink">Add App Link Information</a>.
+
<p>For internet streaming based TV inputs, assign your own values to the above accordingly so that
each channel can be identified uniquely.</p>
@@ -236,4 +244,112 @@
<p>Other techniques to separate the data update tasks from the UI thread include using the
{@link android.os.HandlerThread} class, or you may implement your own using {@link android.os.Looper}
and {@link android.os.Handler} classes. See <a href="{@docRoot}guide/components/processes-and-threads.html">
-Processes and Threads</a> for more information.</p>
\ No newline at end of file
+Processes and Threads</a> for more information.</p>
+
+<h2 id="applink">Add App Link Information</h2>
+
+<p>Channels can use <em>app links</em> to let users easily launch a related
+activity while they are watching channel content. Channel apps use
+app links to extend user engagement by launching activities that show
+related information or additional content. For example, you can use app links
+to do the following:</p>
+
+<ul>
+<li>Guide the user to discover and purchase related content.</li>
+<li>Provide additional information about currently playing content.</li>
+<li>While viewing episodic content, start viewing the next episode in a
+series.</li>
+<li>Let the user interact with content—for example, rate or review
+content—without interrupting content playback.</li>
+</ul>
+
+<p>App links are displayed when the user presses <b>Select</b> to show the
+TV menu while watching channel content.</p>
+
+<img alt="" src="{@docRoot}images/training/tv/tif/app-link.png"
+srcset="{@docRoot}images/training/tv/tif/app-link.png 1x,
+{@docRoot}images/training/tv/tif/app-link-2x.png 2x" id="figure1"/>
+<p class="img-caption"><strong>Figure 1.</strong> An example app link
+displayed on the <b>Channels</b> row while channel content is shown.</p>
+
+<p>When the user selects the app link, the system starts an activity using
+an intent URI specified by the channel app. Channel content continues to play
+while the app link activity is active. The user can return to the channel
+content by pressing <b>Back</b>.</p>
+
+<h3 id="card">Provide App Link Channel Data</h4>
+
+<p>Android TV automatically creates an app link for each channel,
+using information from the channel data. To provide app link information,
+specify the following details in your
+{@link android.media.tv.TvContract.Channels} fields:
+</p>
+
+<ul>
+<li>{@link android.media.tv.TvContract.Channels#COLUMN_APP_LINK_COLOR} - The
+accent color of the app link for this channel. For an example accent color,
+see figure 2, callout 3.
+</li>
+<li>{@link android.media.tv.TvContract.Channels#COLUMN_APP_LINK_ICON_URI} -
+The URI for the app badge icon of the app link for this channel. For an
+example app badge icon, see figure 2, callout 2.
+</li>
+<li>{@link android.media.tv.TvContract.Channels#COLUMN_APP_LINK_INTENT_URI} -
+The intent URI of the app link for this channel. You can create the URI
+using {@link android.content.Intent#toUri(int) toUri(int)} with
+{@link android.content.Intent#URI_INTENT_SCHEME URI_INTENT_SCHEME} and
+convert the URI back to the original intent with
+{@link android.content.Intent#parseUri parseUri()}.
+</li>
+<li>{@link android.media.tv.TvContract.Channels#COLUMN_APP_LINK_POSTER_ART_URI}
+- The URI for the poster art used as the background of the app link
+for this channel. For an example poster image, see figure 2, callout 1.</li>
+<li>{@link android.media.tv.TvContract.Channels#COLUMN_APP_LINK_TEXT} -
+The descriptive link text of the app link for this channel. For an example
+app link description, see the text in figure 2, callout 3.</li>
+</ul>
+
+<img alt="" src="{@docRoot}images/training/tv/tif/app-link-diagram.png"/>
+<p class="img-caption"><strong>Figure 2.</strong> App link details.</p>
+
+<p>If the channel data doesn't specify app link information, the system
+creates a default app link. The system chooses default details as follows:</p>
+
+<ul>
+<li>For the intent URI
+({@link android.media.tv.TvContract.Channels#COLUMN_APP_LINK_INTENT_URI}),
+the system uses the {@link android.content.Intent#ACTION_MAIN ACTION_MAIN}
+activity for the {@link android.content.Intent#CATEGORY_LEANBACK_LAUNCHER
+CATEGORY_LEANBACK_LAUNCHER} category, typically defined in the app manifest.
+If this activity is not defined, a non-functioning app link appears—if
+the user clicks it, nothing happens.</li>
+<li>For the descriptive text
+({@link android.media.tv.TvContract.Channels#COLUMN_APP_LINK_TEXT}), the system
+uses "Open <var>app-name</var>". If no viable app link intent URI is defined,
+the system uses "No link available".</li>
+<li>For the accent color
+({@link android.media.tv.TvContract.Channels#COLUMN_APP_LINK_COLOR}),
+the system uses the default app color.</li>
+<li>For the poster image
+({@link android.media.tv.TvContract.Channels#COLUMN_APP_LINK_POSTER_ART_URI}),
+the system uses the app's home screen banner. If the app doesn't provide a
+banner, the system uses a default TV app image.</li>
+<li>For the badge icon
+({@link android.media.tv.TvContract.Channels#COLUMN_APP_LINK_ICON_URI}), the
+system uses a badge that shows the app name. If the system is also using the
+app banner or default app image for the poster image, no app badge is shown.
+</li>
+</ul>
+
+<p>You specify app link details for your channels in your app's
+setup activity. You can update these app link details at any point, so
+if an app link needs to match channel changes, update app
+link details and call
+{@link android.content.ContentResolver#update(android.net.Uri,
+android.content.ContentValues, java.lang.String, java.lang.String[])
+ContentResolver.update()} as needed. For more details on updating
+channel data, see <a href="#update">Update Channel Data</a>.
+</p>
+
+
+
diff --git a/docs/html/wear/preview/_book.yaml b/docs/html/wear/preview/_book.yaml
index a4acad0..3bea2fd 100644
--- a/docs/html/wear/preview/_book.yaml
+++ b/docs/html/wear/preview/_book.yaml
@@ -18,6 +18,8 @@
path: /wear/preview/features/ui-nav-actions.html
- title: Bridging for Notifications
path: /wear/preview/features/bridger.html
+ - title: Wrist Gestures
+ path: /wear/preview/features/gestures.html
- title: Get Started
path: /wear/preview/start.html
diff --git a/docs/html/wear/preview/api-overview.jd b/docs/html/wear/preview/api-overview.jd
index 11331a7..4233624 100644
--- a/docs/html/wear/preview/api-overview.jd
+++ b/docs/html/wear/preview/api-overview.jd
@@ -25,6 +25,7 @@
<li><a href="#remote-input">Remote Input</a></li>
<li><a href="#bridging">Bridging Mode</a></li>
<li><a href="#imf">Input Method Framework</a></li>
+ <li><a href="#wrist-gestures">Wrist Gestures</a></li>
</ol>
</li>
@@ -79,12 +80,11 @@
watch face using the API.
</p>
-<p>For examples of how to use this feature,
+<p>For information about this API,
see <a href="{@docRoot}wear/preview/features/complications.html">
Watch Face Complications</a>.
</p>
-
<h3 id="drawers">Navigation and Action drawers</h3>
<p>Wear 2.0 introduces two new widgets, navigation drawer and action drawer. These
@@ -233,6 +233,24 @@
Input Method Framework</a>.
</p>
+<h3 id="wrist-gestures">Wrist Gestures</h3>
+
+<p>
+ Wrist gestures can enable quick, one-handed interactions with your app
+ when use of a touch screen is inconvenient. The following
+ <a href="https://support.google.com/androidwear/answer/6312406">wrist gestures</a>
+ are available for use by apps:
+</p>
+
+<ul>
+ <li>Flick wrist out</li>
+ <li>Flick wrist in</li>
+</ul>
+
+<p>For more information, see
+<a href="{@docRoot}wear/preview/features/gestures.html">
+ Wrist Gestures</a>.
+</p>
<h2 id="stand-alone">Standalone Devices</h2>
diff --git a/docs/html/wear/preview/features/gestures.jd b/docs/html/wear/preview/features/gestures.jd
new file mode 100644
index 0000000..7806c4e
--- /dev/null
+++ b/docs/html/wear/preview/features/gestures.jd
@@ -0,0 +1,323 @@
+page.title=Wrist Gestures
+meta.keywords="wear-preview"
+page.tags="wear-preview"
+page.image=images/cards/card-n-sdk_2x.png
+
+@jd:body
+
+<div id="qv-wrapper">
+<div id="qv">
+
+<h2>In this document</h2>
+
+ <ul>
+ <li><a href="#using_wlv">Using a WearableListView</a></li>
+ <li><a href="#using_key_events">Using Key Events Directly</a></li>
+ <li><a href="#best_practices">Best Practices</a></li>
+ </ul>
+
+</div>
+</div>
+
+ <p>
+ Wrist gestures can enable quick, one-handed interactions with your app
+ when use of a touch screen is inconvenient. For example, a user can scroll
+ through notifications with one hand while holding a cup of water with the
+ other. Other examples of using wrist gestures when a touch screen would
+ be inconvenient include:
+ </p>
+
+ <ul>
+ <li>In an app for jogging, navigating through vertical screens that show
+ the steps taken, time elapsed, and current pace
+ </li>
+
+ <li>At the airport with luggage, scrolling through flight and gate
+ information
+ </li>
+
+ <li>Scrolling through news articles
+ </li>
+ </ul>
+
+ <p>
+ To review the wrist gestures on your watch, first confirm gestures are
+ turned on by selecting <strong>Settings > Gestures > Wrist Gestures
+ On</strong>. (Wrist gestures are on by default.) Then complete the
+ Gestures tutorial on the watch (<strong>Settings > Gestures >
+ Launch Tutorial</strong>).
+ </p>
+
+ <p>
+ The following gestures from the <a href=
+ "https://support.google.com/androidwear/answer/6312406">Android Wear
+ Help</a> are unavailable to apps:
+ </p>
+
+ <ul>
+ <li>Push wrist down
+ </li>
+
+ <li>Raise wrist up
+ </li>
+
+ <li>Shaking the wrist
+ </li>
+ </ul>
+
+ <p>
+ Wrist gestures can be used in these ways:
+ </p>
+
+ <ul>
+ <li>
+ <a href="#using_wlv">Using a WearableListView</a>, which
+ has predefined gesture actions
+ </li>
+
+ <li>
+ <a href="#using_key_events">Using key events directly</a> to
+ define new user actions
+ </li>
+ </ul>
+
+ <p>
+ Each wrist gesture is mapped to an <code>int</code> constant from the
+ <code><a href=
+ "{@docRoot}reference/android/view/KeyEvent.html">KeyEvent</a></code>
+ class, as shown in the following table:
+ </p>
+
+ <table>
+ <tr>
+ <th>
+ Gesture
+ </th>
+ <th>
+ KeyEvent
+ </th>
+ <th>
+ Description
+ </th>
+ </tr>
+
+ <tr>
+ <td>
+ Flick wrist out
+ </td>
+ <td>
+ <a href=
+ "{@docRoot}reference/android/view/KeyEvent.html#KEYCODE_NAVIGATE_NEXT">
+ KEYCODE_NAVIGATE_NEXT</a>
+ </td>
+ <td>
+ This key code goes to the next item.
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ Flick wrist in
+ </td>
+ <td>
+ <a href=
+ "{@docRoot}reference/android/view/KeyEvent.html#KEYCODE_NAVIGATE_PREVIOUS">
+ KEYCODE_NAVIGATE_PREVIOUS</a>
+ </td>
+ <td>
+ This key code goes to the previous item.
+ </td>
+ </tr>
+ </table>
+
+ <h2 id="using_wlv">
+ Using a WearableListView
+ </h2>
+
+ <p>
+ A <code><a href=
+ "{@docRoot}reference/android/support/wearable/view/WearableListView.html">
+ WearableListView</a></code> has predefined actions for occurrences of
+ wrist gestures when the View has the focus. For more information, see
+ <a href="#best_practices">Best Practices</a>. For information about using
+ <code>WearableListView</code>, see <a href=
+ "{@docRoot}training/wearables/ui/lists.html">Creating
+ Lists</a>.
+ </p>
+
+ <p>
+ Even if you use a <code>WearableListView</code>, you may want to use
+ constants from the <code><a href=
+ "{@docRoot}reference/android/view/KeyEvent.html">KeyEvent</a></code>
+ class. The predefined actions can be overridden by subclassing the
+ <code>WearableListView</code> and re-implementing the
+ <code>onKeyDown()</code> callback. The behavior can be disabled entirely
+ by using <code>setEnableGestureNavigation(false)</code>. Also see
+ <a href="{@docRoot}training/keyboard-input/commands.html">
+ Handling Keyboard Actions</a>.
+ </p>
+
+ <h2 id="using_key_events">
+ Using Key Events Directly
+ </h2>
+
+ <p>
+ You can use key events outside of a <code><a href=
+ "{@docRoot}reference/android/support/wearable/view/WearableListView.html">
+ WearableListView</a></code> to trigger new actions in response to gesture
+ events. Importantly, these gesture events:
+ </p>
+
+ <ul>
+ <li>Are recognized when a device is in Active mode
+ </li>
+
+ <li>Are delivered in the same way as all key events
+ </li>
+ </ul>
+
+ <p>
+ Specifically, these events are delivered to the top Activity, to the View
+ with keyboard focus. Just as any other key event, a class that relates to
+ user interaction (such as a View or an Activity) that implements
+ <code><a href=
+ "{@docRoot}reference/android/view/KeyEvent.Callback.html">
+ KeyEvent.Callback</a></code> can listen to key events that relate to
+ wrist gestures. The Android framework calls the View or Activity that has
+ the focus with the key events; for gestures, the <code>onKeyDown()</code>
+ method callback is called when gestures occur.
+ </p>
+
+ <p>
+ As an example, an app may override predefined actions in a View or
+ Activity (both implementing <code>KeyEvent.Callback</code>) as follows:
+ </p>
+
+ <pre>
+public final class GesturesActivity extends Activity {
+
+ @Override /* KeyEvent.Callback */
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
+ switch (keyCode) {
+ case KeyEvent.KEYCODE_NAVIGATE_NEXT:
+ // Do something that advances a user View to the next item in an ordered list.
+ return moveToNextItem();
+ case KeyEvent.KEYCODE_NAVIGATE_PREVIOUS:
+ // Do something that advances a user View to the previous item in an ordered list.
+ return moveToPreviousItem();
+ }
+ // If you did not handle it, let it be handled by the next possible element as deemed by the Activity.
+ return super.onKeyDown(keyCode, event);
+ }
+
+ /** Shows the next item in the custom list. */
+ private boolean moveToNextItem() {
+ boolean handled = false;
+ …
+ // Return true if handled successfully, otherwise return false.
+ return handled;
+ }
+
+ /** Shows the previous item in the custom list. */
+ private boolean moveToPreviousItem() {
+ boolean handled = false;
+ …
+ // Return true if handled successfully, otherwise return false.
+ return handled;
+ }
+}
+</pre>
+
+ <h2 id="best_practices">
+ Best Practices
+ </h2>
+
+ <ul>
+ <li>Review the <code><a href=
+ "{@docRoot}reference/android/view/KeyEvent.html">KeyEvent</a></code>
+ and <code><a href=
+ "{@docRoot}reference/android/view/KeyEvent.Callback.html">
+ KeyEvent.Callback</a></code> pages for the delivery of key events to
+ your View and Activity.
+ </li>
+
+ <li>Keep a consistent directional affordance:
+ <ul>
+ <li>Use "Flick wrist out" for next, "Flick wrist in" for previous
+ </li>
+ </ul>
+ </li>
+
+ <li>Have a touch parallel for a gesture.
+ </li>
+
+ <li>Provide visual feedback.
+ </li>
+
+ <li>Don't use a keycode to implement functionality that would be
+ counter-intuitive to the rest of the system. For example, do not use
+ <code>KEYCODE_NAVIGATE_NEXT</code> to cancel an action or to navigate the
+ left-right axis with flicks.
+ </li>
+
+ <li>Don't intercept the key events on elements that are not part of the
+ user interface, for example the Views that are offscreen or partially
+ covered. This is the same as any other key event.
+ </li>
+
+ <li>Don't reinterpret repeated flick gestures into your own, new gesture.
+ It may conflict with the system's "Shaking the wrist" gesture.
+ </li>
+
+ <li>For a View to receive gesture key events, it must have <a href=
+ "{@docRoot}reference/android/view/View.html#attr_android:focusable">
+ focus</a>; see <a href=
+ "{@docRoot}reference/android/view/View.html#setFocusable(boolean)">
+ View::setFocusable()</a>. Because gestures are treated as key events,
+ they trigger a transition out of "Touch mode" that may do unexpected
+ things. Therefore, since users may alternate between using touch and
+ gestures, the <a href=
+ "{@docRoot}reference/android/view/View.html#setFocusableInTouchMode(boolean)">
+ View::setFocusableInTouchmode()</a> method may be necessary. In some
+ cases, it also may be necessary to use
+ <code>setDescendantFocusability(FOCUS_BEFORE_DESCENDANTS)</code> so
+ that when focus changes after a change to or from "Touch mode," your
+ intended View gets the focus.
+ </li>
+
+ <li>Use <code>requestFocus()</code> and <code>clearFocus()</code>
+ carefully:
+ <ul>
+ <li>When calling <code><a href=
+ "{@docRoot}reference/android/view/View.html#requestFocus()">
+ requestFocus()</a></code>, be sure that the View really should have
+ focus. If the View is offscreen, or is covered by another View,
+ surprises can occur when gestures trigger callbacks.
+ </li>
+
+ <li>The <code><a href=
+ "{@docRoot}reference/android/view/View.html#clearFocus()">
+ clearFocus()</a></code> initiates a focus search to find another
+ suitable View. Depending on the View hierarchy, this search might
+ require non-trivial computation. It can also end up assigning focus
+ to a View you don’t expect to receive focus.
+ </li>
+ </ul>
+ </li>
+
+ <li>Key events are delivered first to the View with focus in the View
+ hierarchy. If the focused View does not handle the event (i.e., returns
+ <code>false</code>), the event is not delivered to the parent View, even
+ if it can receive focus and has a <a href=
+ "{@docRoot}reference/android/text/method/KeyListener.html">
+ KeyListener</a>. Rather, the event is delivered to the current Activity
+ holding the View hierarchy with focus. Thus, it may be necessary to
+ catch all events at the higher level and then pass relevant codes down.
+ Alternatively, you might subclass the Activity and override the
+ <code><a href=
+ "{@docRoot}reference/android/app/Activity.html#dispatchKeyEvent(android.view.KeyEvent)">
+ dispatchKeyEvent(KeyEvent event)</a></code> method to ensure that keys
+ are intercepted when necessary, or are handled when not handled at
+ lower layers.
+ </li>
+ </ul>
diff --git a/docs/html/wear/preview/features/ui-nav-actions.jd b/docs/html/wear/preview/features/ui-nav-actions.jd
index 1ba275f..fb14264 100644
--- a/docs/html/wear/preview/features/ui-nav-actions.jd
+++ b/docs/html/wear/preview/features/ui-nav-actions.jd
@@ -12,7 +12,7 @@
<ol>
<li><a href="#create a drawer">Create a Drawer Layout</a></li>
<li><a href="#initialize">Initialize the Drawer List</a></li>
- <li><a href="#creating">Create a Custom View Drawer</a></li>
+ <li><a href="#creating">Create a Custom Drawer View</a></li>
<li><a href="#listen to events">Listen for Drawer Events</a></li>
<li><a href=#peeking">Peeking Drawers</a></li>
</ol>
@@ -37,8 +37,8 @@
</div>
</div>
<p>As part of the <a href="http://www.google.com/design/spec-wear">Material Design</a>
- for Android Wear, Wear 2.0 adds interactive navigation and action drawers.
- The navigation drawer appears at the top of the screen and lets users jump to
+ for Android Wear, Wear 2.0 adds interactive navigation and action drawers.
+ The navigation drawer appears at the top of the screen and lets users jump to
different views within
the app, similar to the navigation drawer on a phone. The action drawer appears
at the bottom of the screen and provides context-specific actions for the user,
@@ -59,7 +59,8 @@
<div class="cols">
<p>This lesson describes how to implement action and navigation drawers in your
-app using the {@code WearableDrawerLayout} APIs.
+app using the {@code WearableDrawerLayout} APIs. For more information, see the
+downloadable <a href="{@docRoot}preview/setup-sdk.html#docs-dl">API reference</a>.
</p>
<h2 id="create a drawer">Create a Drawer Layout</h2>
@@ -99,41 +100,44 @@
</android.support.wearable.view.drawer.WearableDrawerLayout>
</pre>
+
<h2 id="initialize">Initialize the Drawer List</h2>
<p>One of the first things you need to do in your activity is to initialize the
drawers list of items. You should implement {@code WearableNavigationDrawerAdapter}
to populate the navigation drawer contents. To populate the action drawer with
-a list of actions, inflate an XML file into the Menu (via MenuInflater).</p>
+a list of actions, inflate an XML file into the Menu (via {@code MenuInflater}).
+</p>
<p>The following code snippet shows how to initialize the contents of your drawers:
</p>
+
<pre>
public class MainActivity extends WearableActivity implements
WearableActionDrawer.OnMenuItemClickListener{
private WearableDrawerLayout mwearableDrawerLayout;
private WearableNavigationDrawer mWearableNavigationDrawer;
private WearableActionDrawer mWearableActionDrawer;
-
+
...
-
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
-
+
......
-
-
+
+
// Main Wearable Drawer Layout that wraps all content
mWearableDrawerLayout = (WearableDrawerLayout) findViewById(R.id.drawer_layout);
-
+
// Top Navigation Drawer
mWearableNavigationDrawer = (WearableNavigationDrawer) findViewById(R.id.top_navigation_drawer);
mWearableNavigationDrawer.setAdapter(new YourImplementationNavigationAdapter(this));
// Peeks Navigation drawer on the top.
mWearableDrawerLayout.peekDrawer(Gravity.TOP);
-
+
// Bottom Action Drawer
mWearableActionDrawer = (WearableActionDrawer) findViewById(R.id.bottom_action_drawer);
@@ -149,44 +153,58 @@
}
</pre>
-<h2 id="creating">Create a Custom View Drawer</h2>
-<p>To use custom views in drawers, add <code>WearableDrawerView</code> to the
-<code>WearableDrawerLayout</code>. To set the contents of the drawer, call <code>
-<a href="https://x20web.corp.google.com/~psoulos/docs/reference/android/support/wearable/view/drawer/WearableDrawerView.html#setDrawerContent(android.view.View)">setDrawerContent(View)</a></code>
- instead of manually adding the view to the hierarchy. You must also specify the
- drawer position with the <code>android:layout_gravity</code> attribute. </p>
-<p> The following example specifies a top drawer:</p>
+<h2 id="creating">Create a Custom Drawer View</h2>
+
+<p>To use custom views in drawers, add <code>WearableDrawerView</code> to the
+<code>WearableDrawerLayout</code>. To set the peek view and drawer contents, add
+ them as children of the {@code WearableDrawerView} and specify their IDs in the
+ {@code peek_view} and {@code drawer_content} attributes respectively. You must
+ also specify the drawer position with the {@code android:layout_gravity}
+ attribute. </p>
+
+<p> The following example specifies a top drawer with peek view and drawer
+contents:</p>
+
<pre>
-<android.support.wearable.view.drawer.WearableDrawerLayout>
- <FrameLayout
- android:id=”@+id/content” />
-
- <WearableDrawerView
- android:layout_width=”match_parent”
- andndroid:layout_height=”match_parent”
- android:layout_gravity=”top”>
- <FrameLayout
- android:id=”@+id/top_drawer_content” />
- </WearableDrawerView>
-</android.support.wearable.view.drawer.WearableDrawerView>
+ <android.support.wearable.view.drawer.WearableDrawerView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="top"
+ android:background="@color/red"
+ app:drawer_content="@+id/drawer_content"
+ app:peek_view="@+id/peek_view">
+ <FrameLayout
+ android:id="@id/drawer_content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <!-- Drawer content goes here. -->
+ </FrameLayout>
+ <LinearLayout
+ android:id="@id/peek_view"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:orientation="horizontal">
+ <!-- Peek view content goes here. -->
+ <LinearLayout>
+ </android.support.wearable.view.drawer.WearableDrawerView>
</pre>
<h2 id="listen to events">Listen for Drawer Events</h2>
-<p>To listen for drawer events, call {@code setDrawerStateCallback()}on your
+<p>To listen for drawer events, call {@code setDrawerStateCallback()} on your
{@code WearableDrawerLayout} and pass it an implementation of
{@code WearableDrawerLayout.DrawerStateCallback}. This interface provides callbacks
for drawer events such as <code>onDrawerOpened()</code>,
<code>onDrawerClosed(),</code> and <code>onDrawerStatechanged()</code>.</p>
<h2 id="peeking">Peeking Drawers</h2>
-<p>To set the drawers to temporarily appear, call <code>peekDrawer()</code> on
+<p>To set the drawers to temporarily appear, call <code>peekDrawer()</code> on
your {@code WearableDrawerLayout} and pass it the {@code Gravity} of the drawer.
This feature is especially useful because it allows immediate access to the
- alternate drawer views or actions associated with it. </p>
+ alternate drawer views or actions associated with it: </p>
-<pre>{@code mWearableDrawerLayout.peekDrawer</code>(<code>Gravity.BOTTOM);}</pre>
+<pre>{@code mWearableDrawerLayout.peekDrawer(Gravity.BOTTOM);}</pre>
-<p>You can also call {@code setPeekContent()} on your drawer to display a custom
- view when the drawer is peeking.</p>
+
diff --git a/docs/image_sources/training/tv/tif/app-link-diagram.graffle.zip b/docs/image_sources/training/tv/tif/app-link-diagram.graffle.zip
new file mode 100644
index 0000000..8b6779d
--- /dev/null
+++ b/docs/image_sources/training/tv/tif/app-link-diagram.graffle.zip
Binary files differ