Merge "Change SettingsAppWidgetProvider export to be false" into jb-mr2-dev
diff --git a/res/layout/user_dictionary_add_word.xml b/res/layout/user_dictionary_add_word.xml
index d8b8694..3624dad 100644
--- a/res/layout/user_dictionary_add_word.xml
+++ b/res/layout/user_dictionary_add_word.xml
@@ -45,6 +45,7 @@
android:layout_marginStart="8dip"
android:layout_marginBottom="8dip"
android:layout_marginTop="8dip"
+ android:hint="@string/user_dict_settings_add_word_hint"
android:inputType="textNoSuggestions"
android:imeOptions="flagNoFullscreen">
<requestFocus />
diff --git a/res/layout/user_dictionary_add_word_fullscreen.xml b/res/layout/user_dictionary_add_word_fullscreen.xml
index f29c669..b72886f 100644
--- a/res/layout/user_dictionary_add_word_fullscreen.xml
+++ b/res/layout/user_dictionary_add_word_fullscreen.xml
@@ -33,6 +33,7 @@
android:layout_marginStart="8dip"
android:layout_marginBottom="8dip"
android:layout_marginTop="8dip"
+ android:hint="@string/user_dict_settings_add_word_hint"
android:inputType="textNoSuggestions"
android:imeOptions="flagNoFullscreen">
<requestFocus />
@@ -56,6 +57,7 @@
android:layout_marginStart="8dip"
android:layout_marginBottom="8dip"
android:layout_marginTop="8dip"
+ android:hint="@string/user_dict_settings_add_shortcut_hint"
android:inputType="textNoSuggestions"
android:imeOptions="flagNoFullscreen" />
<TextView android:id="@+id/user_dictionary_add_locale_label"
diff --git a/res/layout/wifi_ap_dialog.xml b/res/layout/wifi_ap_dialog.xml
index d458cd3..a2146c6 100644
--- a/res/layout/wifi_ap_dialog.xml
+++ b/res/layout/wifi_ap_dialog.xml
@@ -46,6 +46,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
+ android:hint="@string/wifi_ssid_hint"
android:inputType="textNoSuggestions"
android:maxLength="32" />
diff --git a/res/layout/wifi_config_ui_for_setup_wizard.xml b/res/layout/wifi_config_ui_for_setup_wizard.xml
index fef10b3..143d9ee 100644
--- a/res/layout/wifi_config_ui_for_setup_wizard.xml
+++ b/res/layout/wifi_config_ui_for_setup_wizard.xml
@@ -86,6 +86,7 @@
android:layout_width="368dip"
android:layout_height="wrap_content"
android:singleLine="true"
+ android:hint="@string/wifi_ssid_hint"
android:inputType="textNoSuggestions"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="20sp" />
diff --git a/res/layout/wifi_dialog.xml b/res/layout/wifi_dialog.xml
index 7a7d0b0..cd968b1 100644
--- a/res/layout/wifi_dialog.xml
+++ b/res/layout/wifi_dialog.xml
@@ -40,6 +40,7 @@
<EditText android:id="@+id/ssid"
style="@style/wifi_item_edit_content"
+ android:hint="@string/wifi_ssid_hint"
android:maxLength="32"
android:singleLine="true"
android:inputType="textNoSuggestions" />
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 32b30a0..93f936b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1385,6 +1385,8 @@
<string name="wifi_wps_failed_overlap">Another WPS session was detected. Please try again in a few minutes.</string>
<!-- Label for the SSID of the network -->
<string name="wifi_ssid">Network SSID</string>
+ <!-- Hint for a text field to enter the SSID of a hidden wifi network. [CHAR LIMIT=35] -->
+ <string name="wifi_ssid_hint">Enter the SSID</string>
<!-- Label for the security of the connection -->
<string name="wifi_security">Security</string>
<!-- Label for the signal strength of the connection -->
@@ -2949,6 +2951,10 @@
<string name="user_dict_settings_add_shortcut_option_name">Shortcut:</string>
<!-- User dictionary settings. Label to put before the language field. [CHAR LIMIT=20] -->
<string name="user_dict_settings_add_locale_option_name">Language:</string>
+ <!-- User dictionary settings. Hint for the text field to type the word to add to the user dictionary. [CHAR LIMIT=35] -->
+ <string name="user_dict_settings_add_word_hint">Type a word</string>
+ <!-- User dictionary settings. Hint for the text field to type the optional shortcut to add to the user dictionary. [CHAR LIMIT=35] -->
+ <string name="user_dict_settings_add_shortcut_hint">Optional shortcut</string>
<!-- User dictionary settings. The title of the dialog to edit an existing word in the user dictionary. -->
<string name="user_dict_settings_edit_dialog_title">Edit word</string>
<!-- User dictionary settings. The title of the context menu item to edit the current word -->
diff --git a/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java b/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java
index 13f4435..f3addf3 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java
@@ -36,10 +36,13 @@
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
+import java.text.Collator;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
public class InputMethodAndSubtypeEnabler extends SettingsPreferenceFragment {
private static final String TAG =InputMethodAndSubtypeEnabler.class.getSimpleName();
@@ -54,6 +57,7 @@
private String mInputMethodId;
private String mTitle;
private String mSystemLocale = "";
+ private Collator mCollator = Collator.getInstance();
@Override
public void onCreate(Bundle icicle) {
@@ -84,7 +88,9 @@
}
}
- mSystemLocale = config.locale.toString();
+ final Locale locale = config.locale;
+ mSystemLocale = locale.toString();
+ mCollator = Collator.getInstance(locale);
onCreateIMM();
setPreferenceScreen(createPreferenceHierarchy());
}
@@ -259,7 +265,7 @@
}
} else {
final CheckBoxPreference chkbxPref = new SubtypeCheckBoxPreference(
- context, subtype.getLocale(), mSystemLocale);
+ context, subtype.getLocale(), mSystemLocale, mCollator);
chkbxPref.setKey(imiId + subtype.hashCode());
chkbxPref.setTitle(subtypeLabel);
subtypePreferences.add(chkbxPref);
@@ -370,9 +376,10 @@
private static class SubtypeCheckBoxPreference extends CheckBoxPreference {
private final boolean mIsSystemLocale;
private final boolean mIsSystemLanguage;
+ private final Collator mCollator;
public SubtypeCheckBoxPreference(
- Context context, String subtypeLocale, String systemLocale) {
+ Context context, String subtypeLocale, String systemLocale, Collator collator) {
super(context);
if (TextUtils.isEmpty(subtypeLocale)) {
mIsSystemLocale = false;
@@ -382,6 +389,7 @@
mIsSystemLanguage = mIsSystemLocale
|| subtypeLocale.startsWith(systemLocale.substring(0, 2));
}
+ mCollator = collator;
}
@Override
@@ -411,10 +419,10 @@
if (TextUtils.isEmpty(t1)) {
return -1;
}
- return t0.toString().compareTo(t1.toString());
+ return mCollator.compare(t0.toString(), t1.toString());
} else {
Log.w(TAG, "Illegal preference type.");
- return -1;
+ return super.compareTo(p);
}
}
}
diff --git a/src/com/android/settings/inputmethod/InputMethodPreference.java b/src/com/android/settings/inputmethod/InputMethodPreference.java
index f064c08..56b6e67 100644
--- a/src/com/android/settings/inputmethod/InputMethodPreference.java
+++ b/src/com/android/settings/inputmethod/InputMethodPreference.java
@@ -28,6 +28,7 @@
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
+import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.provider.Settings;
import android.text.TextUtils;
@@ -42,11 +43,11 @@
import android.widget.TextView;
import android.widget.Toast;
+import java.text.Collator;
import java.util.Comparator;
import java.util.List;
-public class InputMethodPreference extends CheckBoxPreference
- implements Comparator<InputMethodPreference> {
+public class InputMethodPreference extends CheckBoxPreference {
private static final String TAG = InputMethodPreference.class.getSimpleName();
private final SettingsPreferenceFragment mFragment;
private final InputMethodInfo mImi;
@@ -54,6 +55,7 @@
private final Intent mSettingsIntent;
private final boolean mAlwaysChecked;
private final boolean mIsSystemIme;
+ private final Collator mCollator;
private AlertDialog mDialog = null;
private ImageView mInputMethodSettingsButton;
@@ -95,6 +97,7 @@
if (mAlwaysChecked) {
setEnabled(false);
}
+ mCollator = Collator.getInstance(fragment.getResources().getConfiguration().locale);
}
@Override
@@ -276,13 +279,26 @@
}
@Override
- public int compare(InputMethodPreference arg0, InputMethodPreference arg1) {
- if (arg0.isEnabled() == arg0.isEnabled()) {
- return arg0.mImi.getId().compareTo(arg1.mImi.getId());
- } else {
- // Prefer system IMEs
- return arg0.isEnabled() ? 1 : -1;
+ public int compareTo(Preference p) {
+ if (!(p instanceof InputMethodPreference)) {
+ return super.compareTo(p);
}
+ final InputMethodPreference imp = (InputMethodPreference) p;
+ final boolean priority0 = mIsSystemIme && mAlwaysChecked;
+ final boolean priority1 = imp.mIsSystemIme && imp.mAlwaysChecked;
+ if (priority0 == priority1) {
+ final CharSequence t0 = getTitle();
+ final CharSequence t1 = imp.getTitle();
+ if (TextUtils.isEmpty(t0)) {
+ return 1;
+ }
+ if (TextUtils.isEmpty(t1)) {
+ return -1;
+ }
+ return mCollator.compare(t0.toString(), t1.toString());
+ }
+ // Prefer always checked system IMEs
+ return priority0 ? -1 : 1;
}
private void saveImeSettings() {