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

Commit fc4007fd authored by Bert McMeen's avatar Bert McMeen Committed by android-build-merger
Browse files

Merge "Docs: Iterating on Wear docs - Bridger API" into mnc-io-docs am: 1e2739e6 am: cb62df2b

am: 30de7979

* commit '30de7979':
  Updated documentation for Input Method Framework Wear 2.0

Change-Id: Ib14950f270b8c62325f473201a7659446dc5bda8
parents 45dde71e 30de7979
Loading
Loading
Loading
Loading
+29 −33
Original line number Diff line number Diff line
@@ -13,7 +13,6 @@ page.tags="wear"
      <li><a href="#creating">Creating an Input Method for Wear</a></li>
      <li><a href="#invoking">Invoking IME</a></li>
      <li><a href="#considerations">General IME Considerations</a></li>
      <li><a href="#test">Testing your IME</a></li>
    </ol>

</div>
@@ -28,17 +27,24 @@ Input Method Framework (IMF) to Android Wear. IMF allows for virtual, on-screen

<p>Wear 2.0 comes with the system default Input Method Editor (IME) 
and opens up the IMF APIs for third-party developers to create custom input 
methods for Wear.
</p>
methods for Wear.</p>

<p><img src="{@docRoot}wear/preview/images/new_input_methods.png"></p>
<p><b>Figure 1</b>. Sample input methods </p>

<h2 id="creating">Creating an Input Method for Wear</h2>
<p>The Android platform provides a standard framework for creating IMEs. To create
 a wear-specific IME, you need to optimize your IME for limited screen size.
  </p>

<p>To create an input method for Wear, 
see <a href="http://developer.android.com/guide/topics/text/creating-input-method.html">Creating an Input Method</a>.
<p>This document provides guidance that can help you create a wear-specific IME.
Before you continue with this guide, it's important that you first read the
documentation for <a href="{@docRoot}guide/topics/text/creating-input-method.html">Creating an Input Method</a>
 on handsets.
</p>

<h2 id="invoking">Invoking IME</h2>

<h2 id="invoking">Invoking an Input Method</h2>
If you are developing an IME for Wear, remember that the 
feature is supported only on Android 6.0 (API level 23) and higher versions of 
the platform. 
@@ -48,8 +54,8 @@ methods beyond voice, add the following to your application's manifest:
&lt;uses-sdk android:minSdkVersion="23" />
</pre>
This indicates that your application requires Android 6.0 or higher. 
For more information, see <a href="http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels">API Levels</a>
 and the documentation for the <a href="http://developer.android.com/guide/topics/manifest/uses-sdk-element.html">&lt;uses-sdk></a> 
For more information, see <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels">API Levels</a>
 and the documentation for the <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">&lt;uses-sdk></a> 
element.
<p>
To control how your application is filtered from devices that do not support Wear
@@ -64,9 +70,9 @@ IMEs (for example, on Phone), add the following to your application's manifest:
 can invoke your IME from:</p>
<ul>
<li>A notification or an app using the 
<a href="http://developer.android.com/reference/android/support/v4/app/RemoteInput.html">RemoteInput</a></code> API.</li>
<a href="{@docRoot}reference/android/support/v4/app/RemoteInput.html">RemoteInput</a></code> API.</li>
<li>Wear apps with an 
<a href="http://developer.android.com/reference/android/widget/EditText.html">EditText</a>
<a href="{@docRoot}reference/android/widget/EditText.html">EditText</a>
 field. Touching a text field places the cursor in the field and automatically 
 displays the IME on focus.</li>
</ul>
@@ -81,34 +87,32 @@ IMEs (for example, on Phone), add the following to your application's manifest:
<p>
<a href="http://developer.android.com/reference/android/support/v4/app/RemoteInput.html">{@code RemoteInput}</a> 
and Wear apps expect only single-line text entry. The ENTER key should always trigger
 a call to <a href="http://developer.android.com/reference/android/inputmethodservice/InputMethodService.html#sendDefaultEditorAction(boolean)">sendDefaultEditorAction</a>,
 a call to <a href="{@docRoot}reference/android/inputmethodservice/InputMethodService.html#sendDefaultEditorAction(boolean)">sendDefaultEditorAction</a>,
  which causes the app to dismiss the keyboard and continue on to the next step 
  or action.</p>
</li>

<li><Strong>Use full screen mode IME</strong>
<p>
Most on-screen input methods will consume most of the screen, leaving very little
 of the app visible; hence, we discourage Android Wear apps from presenting a 
 visible {@code EditTextView}. Instead, a full-screen IME uses 
 <a href="http://developer.android.com/reference/android/inputmethodservice/ExtractEditText.html">ExtractEditText</a>
  to render its own view of the attached editor, also providing control over the
   styling of this view. You can ignore all editor-related events that the IME 
   doesn't generate.
For more details on full-screen mode, see 
<a href="http://developer.android.com/reference/android/inputmethodservice/InputMethodService.html">InputMethodService</a>.
Input methods on Wear will consume most of the screen, leaving very little of the
 app visible; Using full-screen mode ensures an optimal user experience regardless
  of the application UI.  In full screen mode, an 
  <a href="{@docRoot}reference/android/view/inputmethod/ExtractedText.html">{@code ExtractEditText}</a> provides a mirrored
   view of the text field being edited and can be styled to blend with the rest of
    the input method UI. For more details on full-screen mode, see 
    <a href="{@docRoot}reference/android/inputmethodservice/InputMethodService.html">InputMethodService</a>.
</p>
</li>

<li><strong>Handle inputType flags</strong>
<li><strong>Handle InputType flags</strong>
<p>
For privacy reasons, at a minimum you should handle the {@code inputType} 
For privacy reasons, at a minimum you should handle the {@code InputType} 
flag {@code TYPE_TEXT_VARIATION_PASSWORD} in your IME. When your IME is in 
password mode, make sure that your keyboard is optimized for single key press 
(auto spelling correction, auto completion and gesture input are disabled). 
Most importantly, keyboard in password mode should support ASCII symbols 
regardless of the input language.  For more details, see 
<a href="http://developer.android.com/training/keyboard-input/style.html">Specifying The Input Method Type</a>.
<a href="{@docRoot}training/keyboard-input/style.html">Specifying The Input Method Type</a>.
</p>
</li>

@@ -116,7 +120,7 @@ regardless of the input language. For more details, see
<p>
Android allows users to easily switch between all IMEs supported by the platform.
 In your IME implementation, set the boolean 
 <a href="http://developer.android.com/guide/topics/text/creating-input-method.html#Switching">supportsSwitchingToNextInputMethod = true</a>
 <a href="{@docRoot}guide/topics/text/creating-input-method.html#Switching">supportsSwitchingToNextInputMethod = true</a>
 to enable your IME to support switching mechanism 
 (so that apps can switch to the next platform-supported IME).
</p>
@@ -124,13 +128,5 @@ Android allows users to easily switch between all IMEs supported by the platform
</ul>


<h2 id="test">Test your IME</h2>

<p>To test your IME, install the 
<a href="https://drive.google.com/a/google.com/file/d/0ByOeMdiY1arvWUk5QXU1V0E3cFU/view?usp=sharing">Input Box</a>
 app which has a simple <i><code>EditText</i></code> field. 
 When responding to messages from chat apps, you can also use the IME on the 
 watch.</p>


+51.2 KiB
Loading image diff...