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

Commit 1e2739e6 authored by Sreevani Sreejith's avatar Sreevani Sreejith Committed by Android (Google) Code Review
Browse files

Merge "Updated documentation for Input Method Framework Wear 2.0" into mnc-io-docs

parents ba803db9 1f23e74f
Loading
Loading
Loading
Loading
+29 −33
Original line number Original line 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="#creating">Creating an Input Method for Wear</a></li>
      <li><a href="#invoking">Invoking IME</a></li>
      <li><a href="#invoking">Invoking IME</a></li>
      <li><a href="#considerations">General IME Considerations</a></li>
      <li><a href="#considerations">General IME Considerations</a></li>
      <li><a href="#test">Testing your IME</a></li>
    </ol>
    </ol>


</div>
</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) 
<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 
and opens up the IMF APIs for third-party developers to create custom input 
methods for Wear.
methods for Wear.</p>
</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>
<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, 
<p>This document provides guidance that can help you create a wear-specific IME.
see <a href="http://developer.android.com/guide/topics/text/creating-input-method.html">Creating an Input Method</a>.
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>
</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 
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 
feature is supported only on Android 6.0 (API level 23) and higher versions of 
the platform. 
the platform. 
@@ -48,8 +54,8 @@ methods beyond voice, add the following to your application's manifest:
&lt;uses-sdk android:minSdkVersion="23" />
&lt;uses-sdk android:minSdkVersion="23" />
</pre>
</pre>
This indicates that your application requires Android 6.0 or higher. 
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>
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="http://developer.android.com/guide/topics/manifest/uses-sdk-element.html">&lt;uses-sdk></a> 
 and the documentation for the <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">&lt;uses-sdk></a> 
element.
element.
<p>
<p>
To control how your application is filtered from devices that do not support Wear
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>
 can invoke your IME from:</p>
<ul>
<ul>
<li>A notification or an app using the 
<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 
<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 
 field. Touching a text field places the cursor in the field and automatically 
 displays the IME on focus.</li>
 displays the IME on focus.</li>
</ul>
</ul>
@@ -81,34 +87,32 @@ IMEs (for example, on Phone), add the following to your application's manifest:
<p>
<p>
<a href="http://developer.android.com/reference/android/support/v4/app/RemoteInput.html">{@code RemoteInput}</a> 
<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
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 
  which causes the app to dismiss the keyboard and continue on to the next step 
  or action.</p>
  or action.</p>
</li>
</li>


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


<li><strong>Handle inputType flags</strong>
<li><strong>Handle InputType flags</strong>
<p>
<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 
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 
password mode, make sure that your keyboard is optimized for single key press 
(auto spelling correction, auto completion and gesture input are disabled). 
(auto spelling correction, auto completion and gesture input are disabled). 
Most importantly, keyboard in password mode should support ASCII symbols 
Most importantly, keyboard in password mode should support ASCII symbols 
regardless of the input language.  For more details, see 
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>
</p>
</li>
</li>


@@ -116,7 +120,7 @@ regardless of the input language. For more details, see
<p>
<p>
Android allows users to easily switch between all IMEs supported by the platform.
Android allows users to easily switch between all IMEs supported by the platform.
 In your IME implementation, set the boolean 
 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 
 to enable your IME to support switching mechanism 
 (so that apps can switch to the next platform-supported IME).
 (so that apps can switch to the next platform-supported IME).
</p>
</p>
@@ -124,13 +128,5 @@ Android allows users to easily switch between all IMEs supported by the platform
</ul>
</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...