[ML22] Improve the language on spacebar for SLS

Bug: 11230254
Change-Id: Ib54be1a2a77b6e80cdff1af89a7b4203ea859716
This commit is contained in:
Jean Chalard 2014-10-09 17:50:42 +09:00
parent 229f354fdc
commit 5d2d852eb0

View file

@ -28,6 +28,7 @@ import android.graphics.Paint;
import android.graphics.Paint.Align; import android.graphics.Paint.Align;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -57,8 +58,10 @@ import com.android.inputmethod.latin.RichInputMethodSubtype;
import com.android.inputmethod.latin.SuggestedWords; import com.android.inputmethod.latin.SuggestedWords;
import com.android.inputmethod.latin.settings.DebugSettings; import com.android.inputmethod.latin.settings.DebugSettings;
import com.android.inputmethod.latin.utils.CoordinateUtils; import com.android.inputmethod.latin.utils.CoordinateUtils;
import com.android.inputmethod.latin.utils.StringUtils;
import com.android.inputmethod.latin.utils.TypefaceUtils; import com.android.inputmethod.latin.utils.TypefaceUtils;
import java.util.Locale;
import java.util.WeakHashMap; import java.util.WeakHashMap;
/** /**
@ -855,8 +858,13 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
private String layoutLanguageOnSpacebar(final Paint paint, private String layoutLanguageOnSpacebar(final Paint paint,
final RichInputMethodSubtype subtype, final int width) { final RichInputMethodSubtype subtype, final int width) {
if (mLanguageOnSpacebarFormatType == LanguageOnSpacebarHelper.FORMAT_TYPE_MULTIPLE) { if (mLanguageOnSpacebarFormatType == LanguageOnSpacebarHelper.FORMAT_TYPE_MULTIPLE) {
// TODO: return an appropriate string final Locale[] locales = subtype.getLocales();
return ""; final String[] languages = new String[locales.length];
for (int i = 0; i < locales.length; ++i) {
languages[i] = StringUtils.toUpperCaseOfStringForLocale(
locales[i].getLanguage(), true /* needsToUpperCase */, Locale.ROOT);
}
return TextUtils.join(" / ", languages);
} }
// Choose appropriate language name to fit into the width. // Choose appropriate language name to fit into the width.