Android Open Source - translationKeyboard Auto Summary List Preference






From Project

Back to project page translationKeyboard.

License

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.

Java Source Code

/**
 *//  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();
    }
}




Java Source Code List

org.distantshoresmedia.translationkeyboard.AutoDictionary.java
org.distantshoresmedia.translationkeyboard.AutoSummaryEditTextPreference.java
org.distantshoresmedia.translationkeyboard.AutoSummaryListPreference.java
org.distantshoresmedia.translationkeyboard.BinaryDictionary.java
org.distantshoresmedia.translationkeyboard.CandidateView.java
org.distantshoresmedia.translationkeyboard.ComposeBase.java
org.distantshoresmedia.translationkeyboard.ComposeSequence.java
org.distantshoresmedia.translationkeyboard.ContactsDictionary.java
org.distantshoresmedia.translationkeyboard.DeadAccentSequence.java
org.distantshoresmedia.translationkeyboard.Dictionary.java
org.distantshoresmedia.translationkeyboard.EditingUtil.java
org.distantshoresmedia.translationkeyboard.ExpandableDictionary.java
org.distantshoresmedia.translationkeyboard.GlobalKeyboardSettings.java
org.distantshoresmedia.translationkeyboard.InputLanguageSelection.java
org.distantshoresmedia.translationkeyboard.KeyDetector.java
org.distantshoresmedia.translationkeyboard.KeyboardSwitcher.java
org.distantshoresmedia.translationkeyboard.Keyboard.java
org.distantshoresmedia.translationkeyboard.LanguageSwitcher.java
org.distantshoresmedia.translationkeyboard.LatinIMEBackupAgent.java
org.distantshoresmedia.translationkeyboard.LatinIMEDebugSettings.java
org.distantshoresmedia.translationkeyboard.LatinIMESettings.java
org.distantshoresmedia.translationkeyboard.LatinIMEUtil.java
org.distantshoresmedia.translationkeyboard.LatinIME.java
org.distantshoresmedia.translationkeyboard.LatinImeLogger.java
org.distantshoresmedia.translationkeyboard.LatinKeyboardBaseView.java
org.distantshoresmedia.translationkeyboard.LatinKeyboardView.java
org.distantshoresmedia.translationkeyboard.LatinKeyboard.java
org.distantshoresmedia.translationkeyboard.Main.java
org.distantshoresmedia.translationkeyboard.MiniKeyboardKeyDetector.java
org.distantshoresmedia.translationkeyboard.ModifierKeyState.java
org.distantshoresmedia.translationkeyboard.NotificationReceiver.java
org.distantshoresmedia.translationkeyboard.PluginManager.java
org.distantshoresmedia.translationkeyboard.PointerTracker.java
org.distantshoresmedia.translationkeyboard.PrefScreenActions.java
org.distantshoresmedia.translationkeyboard.PrefScreenFeedback.java
org.distantshoresmedia.translationkeyboard.PrefScreenView.java
org.distantshoresmedia.translationkeyboard.ProximityKeyDetector.java
org.distantshoresmedia.translationkeyboard.SeekBarPreferenceString.java
org.distantshoresmedia.translationkeyboard.SeekBarPreference.java
org.distantshoresmedia.translationkeyboard.SharedPreferencesCompat.java
org.distantshoresmedia.translationkeyboard.Suggest.java
org.distantshoresmedia.translationkeyboard.SwipeTracker.java
org.distantshoresmedia.translationkeyboard.TextEntryState.java
org.distantshoresmedia.translationkeyboard.Tutorial.java
org.distantshoresmedia.translationkeyboard.UserBigramDictionary.java
org.distantshoresmedia.translationkeyboard.UserDictionary.java
org.distantshoresmedia.translationkeyboard.VibratePreference.java
org.distantshoresmedia.translationkeyboard.WordComposer.java