OSDN Git Service

merge in klp-release history after reset to master
authorThe Android Automerger <android-build@google.com>
Tue, 23 Jul 2013 13:01:53 +0000 (06:01 -0700)
committerThe Android Automerger <android-build@google.com>
Tue, 23 Jul 2013 13:01:53 +0000 (06:01 -0700)
res/layout/preference_app_restrictions.xml
src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
src/com/android/settings/inputmethod/UserDictionaryList.java

index a8a93d1..753099d 100644 (file)
@@ -19,8 +19,7 @@
     android:layout_height="wrap_content"
     android:minHeight="?android:attr/listPreferredItemHeight"
     android:gravity="center_vertical"
-    android:paddingStart="@*android:dimen/preference_item_padding_side"
-    android:paddingEnd="?android:attr/scrollbarSize">
+    android:paddingStart="@*android:dimen/preference_item_padding_side">
 
     <LinearLayout
         android:layout_width="wrap_content"
         android:id="@android:id/widget_frame"
         android:layout_width="wrap_content"
         android:layout_height="match_parent"
-        android:paddingRight="?android:attr/scrollbarSize"
         android:gravity="center_vertical"
         android:orientation="vertical" />
 </LinearLayout>
index 4658955..45b1182 100644 (file)
@@ -20,10 +20,12 @@ import com.android.settings.R;
 import com.android.settings.Settings.KeyboardLayoutPickerActivity;
 import com.android.settings.Settings.SpellCheckersSettingsActivity;
 import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.UserDictionarySettings;
 import com.android.settings.Utils;
 import com.android.settings.VoiceInputOutputSettings;
 
 import android.app.Activity;
+import android.app.Fragment;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
@@ -38,6 +40,7 @@ import android.os.Handler;
 import android.preference.CheckBoxPreference;
 import android.preference.ListPreference;
 import android.preference.Preference;
+import android.preference.Preference.OnPreferenceClickListener;
 import android.preference.PreferenceCategory;
 import android.preference.PreferenceScreen;
 import android.provider.Settings;
@@ -200,7 +203,35 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
             // not present or disabled. In this case we need to remove the preference.
             getPreferenceScreen().removePreference(userDictionaryPreference);
         } else {
-            userDictionaryPreference.setFragment(UserDictionaryList.class.getName());
+            userDictionaryPreference.setOnPreferenceClickListener(
+                    new OnPreferenceClickListener() {
+                        @Override
+                        public boolean onPreferenceClick(Preference arg0) {
+                            // Redirect to UserDictionarySettings if the user needs only one
+                            // language.
+                            final Bundle extras = new Bundle();
+                            final Class<? extends Fragment> targetFragment;
+                            if (localeSet.size() <= 1) {
+                                if (!localeSet.isEmpty()) {
+                                    // If the size of localeList is 0, we don't set the locale
+                                    // parameter in the extras. This will be interpreted by the
+                                    // UserDictionarySettings class as meaning
+                                    // "the current locale". Note that with the current code for
+                                    // UserDictionaryList#getUserDictionaryLocalesSet()
+                                    // the locale list always has at least one element, since it
+                                    // always includes the current locale explicitly.
+                                    // @see UserDictionaryList.getUserDictionaryLocalesSet().
+                                    extras.putString("locale", localeSet.first());
+                                }
+                                targetFragment = UserDictionarySettings.class;
+                            } else {
+                                targetFragment = UserDictionaryList.class;
+                            }
+                            startFragment(InputMethodAndLanguageSettings.this,
+                                    targetFragment.getCanonicalName(), -1, extras);
+                            return true;
+                        }
+                    });
         }
     }
 
index 89774d2..408ec03 100644 (file)
@@ -124,9 +124,8 @@ public class UserDictionaryList extends SettingsPreferenceFragment {
     /**
      * Creates the entries that allow the user to go into the user dictionary for each locale.
      * @param userDictGroup The group to put the settings in.
-     * @return the shown language set
      */
-    protected TreeSet<String> createUserDictSettingsAndReturnSet(PreferenceGroup userDictGroup) {
+    protected void createUserDictSettings(PreferenceGroup userDictGroup) {
         final Activity activity = getActivity();
         userDictGroup.removeAll();
         final TreeSet<String> localeSet =
@@ -144,7 +143,6 @@ public class UserDictionaryList extends SettingsPreferenceFragment {
                 userDictGroup.addPreference(createUserDictionaryPreference(locale, activity));
             }
         }
-        return localeSet;
     }
 
     /**
@@ -173,25 +171,6 @@ public class UserDictionaryList extends SettingsPreferenceFragment {
     @Override
     public void onResume() {
         super.onResume();
-        final TreeSet<String> localeSet = createUserDictSettingsAndReturnSet(getPreferenceScreen());
-        if (localeSet.size() <= 1) {
-            // Redirect to UserDictionarySettings if the user needs only one language.
-            final Bundle extras = new Bundle();
-            if (!localeSet.isEmpty()) {
-                // If the size of localeList is 0, we don't set the locale parameter in the
-                // extras. This will be interpreted by the UserDictionarySettings class as
-                // meaning "the current locale".
-                // Note that with the current code for
-                // UserDictionaryList#getUserDictionaryLocalesSet()
-                // the locale list always has at least one element, since it always includes
-                // the current locale explicitly.
-                // @see UserDictionaryList.getUserDictionaryLocalesSet().
-                extras.putString("locale", localeSet.first());
-            }
-            startFragment(this,
-                    com.android.settings.UserDictionarySettings.class.getCanonicalName(), -1,
-                    extras);
-            finish();
-        }
+        createUserDictSettings(getPreferenceScreen());
     }
 }