Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5980ae8f authored by Luan Nguyen's avatar Luan Nguyen Committed by Android (Google) Code Review
Browse files

Merge "docs: Update JavaDoc reference links for Create Wearable Apps class" into mnc-preview-docs

parents d548b29d aa3315d6
Loading
Loading
Loading
Loading
+32 −24
Original line number Diff line number Diff line
@@ -9,9 +9,9 @@ helpoutsWidget=true
<h2>This lesson teaches you to</h2>
<ol>
  <li><a href="#UpdateSDK">Update Your SDK</a></li>
  <li><a href="#SetupEmulator">Set Up an Android Wear Emulator</a></li>
  <li><a href="#SetupDevice">Set Up an Android Wear Device</a></li>
  <li><a href="#SetupEmulator">Set Up an Android Wear Emulator or Device</a></li>
  <li><a href="#CreateProject">Create a Project</a></li>
  <li><a href="#Install">Install the Wearable App</a></li>
  <li><a href="#Libraries">Include the Correct Libraries</a></li>
</ol>
</div>
@@ -112,18 +112,20 @@ types of screen shapes, which is useful for testing.</p>
    <li>Tap <strong>ADB Debugging</strong> to enable adb.</li>
  </ol>
  <li>Connect the wearable to your machine through USB, so you can install apps directly to it
  as you develop. A message appears on both the wearable and the Android Wear app prompting you to allow debugging.</li>
  <p class="note"><strong>Note:</strong> If you can not connect your wearable to your machine via USB,
  follow the directions on
  <a href="{@docRoot}training/wearables/apps/bt-debugging.html">Debugging over
  Bluetooth</a>.
  as you develop. A message appears on both the wearable and the Android Wear app prompting you to
  allow debugging.</li>

  <p class="note"><strong>Note:</strong> If you can not connect your wearable
  to your machine via USB, you can try
  <a href="{@docRoot}training/wearables/apps/bt-debugging.html">connecting over Bluetooth</a>.
  </p>

  <li>On the Android Wear app, check <strong>Always allow from this computer</strong> and tap
  <strong>OK</strong>.</li>
</ol>

<p>The <strong>Android</strong> tool window on Android Studio shows the system log from the wearable.
The wearable should also be listed when you run the <code>adb devices</code> command.</p>
<p>The <i>Android</i> tool window on Android Studio shows the system log from the
wearable. The wearable should also be listed when you run the <code>adb devices</code> command.</p>

<h2 id="CreateProject">Create a Project</h2>

@@ -147,18 +149,23 @@ Project</a>. As you follow the wizard, enter the following information:</p>
  <li>In the first <b>Add an Activity</b> window, add a blank activity for mobile.</li>
  <li>In the second <b>Add an Activity</b> window, add a blank activity for Wear.</li>
</ol>
  <p>When the wizard completes, Android Studio creates a new project with two modules, <b>mobile</b> and
  <b>wear</b>. You now have a project for both your handheld and wearable apps that you can create activities,
  services, custom layouts, and much more in. On the handheld app, you do most of the heavy lifting,
  such as network communications, intensive processing, or tasks that require long
  amounts of user interaction. When these are done,
  you usually notify the wearable of the results through notifications or by syncing and sending
  data to the wearable.</p>

  <p class="note"><b>Note:</b> The <b>wear</b> module also contains a "Hello World" activity that uses a
  <code>WatchViewStub</code> that inflates a layout based on whether the device's screen
  is round or square. The <code>WatchViewStub</code> class is one of the UI widgets that's provided
  by the <a href="{@docRoot}training/wearables/apps/layouts.html#UiLibrary">wearable support library</a>.</p>
  <p>When the wizard completes, Android Studio creates a new project with two modules, <b>mobile</b>
  and <b>wear</b>. You now have a project for both your handheld and wearable apps for which you can
  create activities, services, and custom layouts. The handheld app does most of
  the heavy lifting, such as network communications, intensive processing, or tasks that require
  long amounts of user interaction. When the app completes these operations, your app should
  notify the wearable of the results through notifications or by syncing and sending data to
  the wearable.</p>

  <p class="note"><b>Note:</b> The <b>wear</b> module also contains a "Hello World" activity that
  uses a
  <a href="{@docRoot}reference/android/support/wearable/view/WatchViewStub.html"><code>WatchViewStub</code></a>.
  This class inflates a layout based on whether the device's screen is round or square. The
  <a href="{@docRoot}reference/android/support/wearable/view/WatchViewStub.html"><code>WatchViewStub</code></a>
  class is one of the UI widgets that the
  <a href="{@docRoot}training/wearables/apps/layouts.html#UiLibrary">wearable support library</a>
  provides.
  </p>
</li>

<h2 id="Install">Install the Wearable App</h2>
@@ -167,8 +174,8 @@ Project</a>. As you follow the wizard, enter the following information:</p>
either <code>adb install</code> or the <b>Play</b> button on Android Studio.</p>

<p>When you're ready to publish your app to users, you embed the wearable app inside of the
handheld app. When users install the handheld app from Google Play, a connected wearable automatically
receives the wearable app.</p>
handheld app. When a user installs the handheld app from Google Play, a connected wearable
automatically receives the wearable app.</p>

<p class="note"><b>Note:</b> The automatic installation of wearable apps
does not work when you are signing apps with a debug key and only works with release keys. See
@@ -184,7 +191,8 @@ wearable and prints out "Hello world!"

<p>As part of the Project Wizard, the correct
dependencies are imported for you in the appropriate module's <code>build.gradle</code> file.
However, these dependencies are not required, so read the following descriptions to find out if you need them or not:</p>
However, these dependencies are not required, so read the following descriptions to find out if you
need them or not:</p>

<b>Notifications</b>
<p>The <a href="{@docRoot}tools/support-library/features.html#v4">Android
+85 −32
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ helpoutsWidget=true
<h2>This lesson teaches you to</h2>
<ol>
  <li><a href="#CustomNotifications">Create custom notifications</a></li>
  <li><a href="#UiLibrary">Create Layouts with the Wearable UI Library</li>
  <li><a href="#UiLibrary">Create Layouts with the Wearable UI Library</a></li>
</ol>

<h2>You should also read</h2>
@@ -73,8 +73,8 @@ public void onCreate(Bundle bundle){
  For example:
<pre>
Intent notificationIntent = new Intent(this, NotificationActivity.class);
PendingIntent notificationPendingIntent = PendingIntent.getActivity(this, 0, notificationIntent,
        PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent notificationPendingIntent = PendingIntent.getActivity(
        this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
</pre>
  </li>
  <li>Build a {@link android.app.Notification} and call
@@ -110,35 +110,88 @@ dependencies {

<p>Here are some of the major classes in the Wearable UI Library:</p>

<ul>
    <li><code>BoxInsetLayout</code> - A FrameLayout that's aware of screen shape and can box its
    children in the center square of a round screen.</li>
    <li><code>CardFragment</code> - A fragment that presents content within an expandable,
    vertically scrollable card.</li>
    <li><code>CircledImageView</code> - An image view surrounded by a circle.</li>
    <li><code>ConfirmationActivity</code> - An activity that displays confirmation animations after the user
    completes an action.</li>
    <li><code>CrossFadeDrawable</code> - A drawable that contains two child drawables and provides
    methods to directly adjust the blend between the two.</li>
    <li><code>DelayedConfirmationView</code> - A view that provides a circular countdown timer,
    typically used to automatically confirm an operation after a short delay has elapsed.</li>
    <li><code>DismissOverlayView</code> - A view for implementing long-press-to-dismiss.</li>
    <li><code>DotsPageIndicator</code> - A page indicator for GridViewPager that identifies the
    current page in relation to all available pages on the current row.</li>
    <li><code>GridViewPager</code> - A layout manager that allows the user to both vertically and
    horizontally through pages of data. You supply an implementation of a GridPagerAdapter to
    generate the pages that the view shows.</li>
    <li><code>GridPagerAdapter</code> - An adapter that supplies pages to a GridViewPager.</li>
    <li><code>FragmentGridPagerAdapter</code> - An implementation of GridPagerAdapter that
    represents each page as a fragment.</li>
    </li>
    <li><code>WatchViewStub</code> - A class that can inflate a specific layout,
    depending on the shape of the device's screen.</li>
    <li><code>WearableListView</code> - An alternative version of ListView that is optimized for
    ease of use on small screen wearable devices. It displays a vertically scrollable list of items,
    and automatically snaps to the nearest item when the user stops scrolling.
    </li>
</ul>
<dl>
  <dt><a href="{@docRoot}reference/android/support/wearable/view/BoxInsetLayout.html"><code>BoxInsetLayout</code></a>
  </dt>
  <dd>A {@link android.widget.FrameLayout} object
  that's aware of screen shape and can box its children in the center square of a round screen.
  </dd>

  <dt><a href="{@docRoot}reference/android/support/wearable/view/CardFragment.html"><code>CardFragment</code></a>
  </dt>
  <dd>A fragment that presents content within an expandable, vertically scrollable card.
  </dd>

  <dt><a href="{@docRoot}reference/android/support/wearable/view/CircledImageView.html"><code>CircledImageView</code></a>
  </dt>
  <dd>An image view surrounded by a circle.
  </dd>

  <dt><a href="{@docRoot}reference/android/support/wearable/activity/ConfirmationActivity.html"><code>ConfirmationActivity</code></a>
  </dt>
  <dd>An activity that displays confirmation animations after the user completes an action.
  </dd>

  <dt><a href="{@docRoot}reference/android/support/wearable/view/CrossfadeDrawable.html"><code>CrossFadeDrawable</code></a>
  </dt>
  <dd>A drawable that contains two child drawables and provides methods to directly adjust the blend
  between the two.
  </dd>

  <dt><a href="{@docRoot}reference/android/support/wearable/view/DelayedConfirmationView.html"><code>DelayedConfirmationView</code></a>
  </dt>
  <dd>A view that provides a circular countdown timer, typically used to automatically confirm an
  operation after a short delay has elapsed.
  </dd>

  <dt><a href="{@docRoot}reference/android/support/wearable/view/DismissOverlayView.html"><code>DismissOverlayView</code></a>
  </dt>
  <dd>A view for implementing long-press-to-dismiss.
  </dd>

  <dt><a href="{@docRoot}reference/android/support/wearable/view/GridViewPager.html"><code>GridViewPager</code></a>
  </dt>
  <dd>A layout manager that allows the user to navigate both vertically and
    horizontally through pages of data. You supply an implementation of a
    <a href="{@docRoot}reference/android/support/wearable/view/GridPagerAdapter.html"><code>GridPagerAdapter</code></a>
    instance to generate the pages that the view shows.
  </dd>

  <dt><a href="{@docRoot}reference/android/support/wearable/view/GridPagerAdapter.html"><code>GridPagerAdapter</code></a>
  </dt>
  <dd>An adapter that supplies pages to a
  <a href="{@docRoot}reference/android/support/wearable/view/GridViewPager.html"><code>GridViewPager</code></a>
  object.
  </dd>

  <dt><a href="{@docRoot}reference/android/support/wearable/view/FragmentGridPagerAdapter.html"><code>FragmentGridPagerAdapter</code></a>
  </dt>
  <dd>An implementation of a
  <a href="{@docRoot}reference/android/support/wearable/view/GridPagerAdapter.html"><code>GridPagerAdapter</code></a>
  instance that represents each page as a fragment.
  </dd>

  <dt><a href="{@docRoot}reference/android/support/wearable/view/DotsPageIndicator.html"><code>DotsPageIndicator</code></a>
  </dt>
  <dd>A page indicator for a
  <a href="{@docRoot}reference/android/support/wearable/view/GridViewPager.html"><code>GridViewPager</code></a>
  implementation that identifies the current page in relation to all available pages on the current
  row.
  </dd>

  <dt><a href="{@docRoot}reference/android/support/wearable/view/WatchViewStub.html"><code>WatchViewStub</code></a>
  </dt>
  <dd>A class that can inflate a specific layout, depending on the shape of the device's screen.
  </dd>

  <dt><a href="{@docRoot}reference/android/support/wearable/view/WearableListView.html"><code>WearableListView</code></a>
  </dt>
  <dd>An alternative version of a {@link android.widget.ListView}
  object that is optimized for ease of use on small screen wearable devices. It displays a
  vertically scrollable list of items, and automatically snaps to the nearest item when the user
  stops scrolling.
  </dd>
</dl>

<h3 id="UiLibReference">Wear UI library API reference</h3>