Back to project page translationKeyboard.
The source code is released under:
GNU General Public License
If you think the Android project translationKeyboard listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/** *// w ww. j ava 2 s .co m */ package org.distantshoresmedia.translationkeyboard; import android.content.Context; import android.preference.ListPreference; import android.util.AttributeSet; import android.util.Log; public class AutoSummaryListPreference extends ListPreference { private static final String TAG = "HK/AutoSummaryListPreference"; public AutoSummaryListPreference(Context context) { super(context); } public AutoSummaryListPreference(Context context, AttributeSet attrs) { super(context, attrs); } private void trySetSummary() { CharSequence entry = null; try { entry = getEntry(); } catch (ArrayIndexOutOfBoundsException e) { Log.i(TAG, "Malfunctioning ListPreference, can't get entry"); } if (entry != null) { //String percent = getResources().getString(R.string.percent); String percent = "percent"; setSummary(entry.toString().replace("%", " " + percent)); } } @Override public void setEntries(CharSequence[] entries) { super.setEntries(entries); trySetSummary(); } @Override public void setEntryValues(CharSequence[] entryValues) { super.setEntryValues(entryValues); trySetSummary(); } @Override public void setValue(String value) { super.setValue(value); trySetSummary(); } }