translate ListPreference lists

This commit is contained in:
Eric House 2014-05-05 06:03:33 -07:00
parent 477019757e
commit 3a7111c098

View file

@ -28,6 +28,7 @@ import android.content.res.Resources;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceGroup;
import android.preference.ListPreference;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.Menu;
@ -469,6 +470,15 @@ public class LocUtils {
pref.setTitle( str );
}
if ( pref instanceof ListPreference ) {
ListPreference lp = (ListPreference) pref;
CharSequence[] entries = lp.getEntries();
if ( null != entries ) {
CharSequence[] newEntries = xlateStrings( context, entries );
lp.setEntries( newEntries );
}
}
if ( pref instanceof PreferenceGroup ) {
PreferenceGroup group = (PreferenceGroup)pref;
int count = group.getPreferenceCount();