Merge commit 'e6db3dd483747a8f3055c003c706b0c7e7f14db0' into HEAD

Change-Id: I1dc30ae47185eb72a0c0cda05b336c429c20d6de
main
Xin Li 2017-11-13 14:35:47 -08:00
commit e2a1657453
3 changed files with 57 additions and 3 deletions

View File

@ -35,6 +35,23 @@
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_USER_DICTIONARY" />
<!-- A signature-protected permission to ask AOSP Keyboard to close the software keyboard.
To use this, add the following line into calling application's AndroidManifest.xml
<pre>
{@code
<uses-permission android:name="com.android.inputmethod.latin.HIDE_SOFT_INPUT"/>
}
</pre>
then call {@link android.content.Context#sendBroadcast(Intent)} as follows:
<pre>
{@code
sendBroadcast(new Intent("com.android.inputmethod.latin.HIDE_SOFT_INPUT")
.setPackage("com.android.inputmethod.latin"));
}
</pre> -->
<permission android:name="com.android.inputmethod.latin.HIDE_SOFT_INPUT"
android:protectionLevel="signature" />
<application android:label="@string/english_ime_name"
android:icon="@drawable/ic_launcher_keyboard"
android:supportsRtl="true"

View File

@ -100,7 +100,7 @@
<string name="account_selected" msgid="2846876462199625974">"Trenutno koristite račun <xliff:g id="EMAIL_ADDRESS">%1$s</xliff:g>"</string>
<string name="account_select_ok" msgid="9141195141763227797">"Uredu"</string>
<string name="account_select_cancel" msgid="5181012062618504340">"Otkaži"</string>
<string name="account_select_sign_out" msgid="3299651159390187933">"Odjavi me"</string>
<string name="account_select_sign_out" msgid="3299651159390187933">"Odjava"</string>
<string name="account_select_title" msgid="6279711684772922649">"Odaberite račun koji ćete koristiti"</string>
<string name="subtype_en_GB" msgid="88170601942311355">"engleski (UK)"</string>
<string name="subtype_en_US" msgid="6160452336634534239">"engleski (SAD)"</string>
@ -140,7 +140,7 @@
<string name="prefs_enable_emoji_alt_physical_key" msgid="5963640002335470112">"Emoji za fizičku tastaturu"</string>
<string name="prefs_enable_emoji_alt_physical_key_summary" msgid="5259484820941627827">"Tipka Alt na fizičkoj tastaturi aktivira paletu za emoji"</string>
<string name="button_default" msgid="3988017840431881491">"Zadano"</string>
<string name="setup_welcome_title" msgid="6112821709832031715">"Dobrodošli u aplikaciju <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string>
<string name="setup_welcome_title" msgid="6112821709832031715">"Dobro došli u aplikaciju <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string>
<string name="setup_welcome_additional_description" msgid="8150252008545768953">"s kucanjem pokretima"</string>
<string name="setup_start_action" msgid="8936036460897347708">"Započnite"</string>
<string name="setup_next_action" msgid="371821437915144603">"Sljedeći korak"</string>
@ -153,7 +153,7 @@
<string name="setup_step2_instruction" msgid="9141481964870023336">"Zatim odaberite aplikaciju \"<xliff:g id="APPLICATION_NAME">%s</xliff:g>\" kao vaš aktivni način unosa teksta."</string>
<string name="setup_step2_action" msgid="1660330307159824337">"Zamijeni načine unosa"</string>
<string name="setup_step3_title" msgid="3154757183631490281">"Odlično, sve je spremno!"</string>
<string name="setup_step3_instruction" msgid="8025981829605426000">"Sada možete kucati u svim omiljenim aplikacijama pomoću aplikacije <xliff:g id="APPLICATION_NAME">%s</xliff:g>."</string>
<string name="setup_step3_instruction" msgid="8025981829605426000">"Sada možete upisivati u svim omiljenim aplikacijama pomoću aplikacije <xliff:g id="APPLICATION_NAME">%s</xliff:g>."</string>
<string name="setup_step3_action" msgid="600879797256942259">"Konfiguriraj dodatne jezike"</string>
<string name="setup_finish_action" msgid="276559243409465389">"Završeno"</string>
<string name="show_setup_wizard_icon" msgid="5008028590593710830">"Prikaži ikonu aplikacije"</string>

View File

@ -123,6 +123,18 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
static final long DELAY_WAIT_FOR_DICTIONARY_LOAD_MILLIS = TimeUnit.SECONDS.toMillis(2);
static final long DELAY_DEALLOCATE_MEMORY_MILLIS = TimeUnit.SECONDS.toMillis(10);
/**
* A broadcast intent action to hide the software keyboard.
*/
static final String ACTION_HIDE_SOFT_INPUT =
"com.android.inputmethod.latin.HIDE_SOFT_INPUT";
/**
* A custom permission for external apps to send {@link #ACTION_HIDE_SOFT_INPUT}.
*/
static final String PERMISSION_HIDE_SOFT_INPUT =
"com.android.inputmethod.latin.HIDE_SOFT_INPUT";
/**
* The name of the scheme used by the Package Manager to warn of a new package installation,
* replacement or removal.
@ -160,6 +172,25 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private final BroadcastReceiver mDictionaryDumpBroadcastReceiver =
new DictionaryDumpBroadcastReceiver(this);
final static class HideSoftInputReceiver extends BroadcastReceiver {
private final InputMethodService mIms;
public HideSoftInputReceiver(InputMethodService ims) {
mIms = ims;
}
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if (ACTION_HIDE_SOFT_INPUT.equals(action)) {
mIms.requestHideSelf(0 /* flags */);
} else {
Log.e(TAG, "Unexpected intent " + intent);
}
}
}
final HideSoftInputReceiver mHideSoftInputReceiver = new HideSoftInputReceiver(this);
private AlertDialog mOptionsDialog;
private final boolean mIsHardwareAcceleratedDrawingEnabled;
@ -595,6 +626,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
dictDumpFilter.addAction(DictionaryDumpBroadcastReceiver.DICTIONARY_DUMP_INTENT_ACTION);
registerReceiver(mDictionaryDumpBroadcastReceiver, dictDumpFilter);
final IntentFilter hideSoftInputFilter = new IntentFilter();
hideSoftInputFilter.addAction(ACTION_HIDE_SOFT_INPUT);
registerReceiver(mHideSoftInputReceiver, hideSoftInputFilter, PERMISSION_HIDE_SOFT_INPUT,
null /* scheduler */);
StatsUtils.onCreate(mSettings.getCurrent(), mRichImm);
}
@ -699,6 +735,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
public void onDestroy() {
mDictionaryFacilitator.closeDictionaries();
mSettings.onDestroy();
unregisterReceiver(mHideSoftInputReceiver);
unregisterReceiver(mRingerModeChangeReceiver);
unregisterReceiver(mDictionaryPackInstallReceiver);
unregisterReceiver(mDictionaryDumpBroadcastReceiver);