Remove the locale spinner and show the current language
Bug: 8976598 Change-Id: I092141d0cc5c6d7af499ab8ceb69275923180e37
This commit is contained in:
@@ -62,22 +62,6 @@
|
||||
android:imeOptions="flagNoFullscreen"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:maxLength="@integer/maximum_user_dictionary_word_length" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_dictionary_add_locale_label"
|
||||
style="?android:attr/textAppearanceSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="@string/user_dict_settings_add_locale_option_name" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/user_dictionary_add_locale"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_gravity="fill_horizontal|center_vertical"
|
||||
android:layout_marginBottom="8dip"
|
||||
android:layout_marginStart="8dip"
|
||||
android:layout_marginTop="8dip" />
|
||||
</GridLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@@ -38,6 +38,7 @@ import android.widget.SimpleCursorAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.settings.inputmethod.UserDictionaryAddWordContents;
|
||||
import com.android.settings.inputmethod.UserDictionarySettingsUtils;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
@@ -115,7 +116,9 @@ public class UserDictionarySettings extends ListFragment {
|
||||
listView.setEmptyView(emptyView);
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
// Show the language as a subtitle of the action bar
|
||||
getActivity().getActionBar().setSubtitle(
|
||||
UserDictionarySettingsUtils.getLocaleDisplayName(getActivity(), mLocale));
|
||||
}
|
||||
|
||||
private Cursor createCursor(final String locale) {
|
||||
|
@@ -239,4 +239,8 @@ public class UserDictionaryAddWordContents {
|
||||
localesList.add(new LocaleRenderer(activity, null)); // meaning: select another locale
|
||||
return localesList;
|
||||
}
|
||||
|
||||
public String getCurrentUserDictionaryLocale() {
|
||||
return mLocale;
|
||||
}
|
||||
}
|
||||
|
@@ -54,6 +54,7 @@ public class UserDictionaryAddWordFragment extends Fragment
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
getActivity().getActionBar().setTitle(R.string.user_dict_settings_title);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,6 +64,8 @@ public class UserDictionaryAddWordFragment extends Fragment
|
||||
if (null == mContents) {
|
||||
mContents = new UserDictionaryAddWordContents(mRootView, getArguments());
|
||||
}
|
||||
getActivity().getActionBar().setSubtitle(UserDictionarySettingsUtils.getLocaleDisplayName(
|
||||
getActivity(), mContents.getCurrentUserDictionaryLocale()));
|
||||
return mRootView;
|
||||
}
|
||||
|
||||
@@ -102,13 +105,9 @@ public class UserDictionaryAddWordFragment extends Fragment
|
||||
private void updateSpinner() {
|
||||
final ArrayList<LocaleRenderer> localesList = mContents.getLocalesList(getActivity());
|
||||
|
||||
final Spinner localeSpinner =
|
||||
(Spinner)mRootView.findViewById(R.id.user_dictionary_add_locale);
|
||||
final ArrayAdapter<LocaleRenderer> adapter = new ArrayAdapter<LocaleRenderer>(getActivity(),
|
||||
android.R.layout.simple_spinner_item, localesList);
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
localeSpinner.setAdapter(adapter);
|
||||
localeSpinner.setOnItemSelectedListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -26,18 +26,13 @@ import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceGroup;
|
||||
import android.provider.UserDictionary;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.inputmethod.InputMethodInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.view.inputmethod.InputMethodSubtype;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.TreeSet;
|
||||
|
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2013 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.inputmethod;
|
||||
|
||||
import com.android.settings.Utils;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Utilities of the user dictionary settings
|
||||
*/
|
||||
public class UserDictionarySettingsUtils {
|
||||
public static String getLocaleDisplayName(Context context, String localeStr) {
|
||||
final Locale locale = Utils.createLocaleFromString(localeStr);
|
||||
final Locale systemLocale = context.getResources().getConfiguration().locale;
|
||||
return locale.getDisplayName(systemLocale);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user