Java Code Examples for android.preference.ListPreference

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project andlytics, under directory /src/com/github/andlyticsproject/.

Source file: PreferenceActivity.java

  18 
vote

private void updatePrefSummary(Preference p){
  if (p instanceof ListPreference) {
    ListPreference listPref=(ListPreference)p;
    p.setSummary(listPref.getEntry());
  }
 else   if (p instanceof EditTextPreference) {
    EditTextPreference editTextPref=(EditTextPreference)p;
    p.setSummary(editTextPref.getText());
  }
}
 

Example 2

From project android-vpn-settings, under directory /src/com/android/settings/vpn/.

Source file: L2tpIpsecEditor.java

  18 
vote

private ListPreference createListPreference(Context c,int titleResId,String text,String[] keys,Preference.OnPreferenceChangeListener listener){
  ListPreference pref=new ListPreference(c);
  pref.setTitle(titleResId);
  pref.setDialogTitle(titleResId);
  pref.setPersistent(true);
  pref.setEntries(keys);
  pref.setEntryValues(keys);
  pref.setValue(text);
  pref.setOnPreferenceChangeListener(listener);
  return pref;
}
 

Example 3

From project AndroidDevWeekendDub-BookLibrary, under directory /src/org/curiouscreature/android/shelves/activity/.

Source file: SettingsActivity.java

  18 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getPreferenceManager().setSharedPreferencesName(Preferences.NAME);
  addPreferencesFromResource(R.xml.preferences);
  ListPreference preference=(ListPreference)findPreference(Preferences.KEY_BOOKSTORE);
  preference.setOnPreferenceChangeListener(this);
  preference.setValue(BookStoreFactory.get(this).getName());
  setBookStorePreferenceEntries(preference);
  setBookStorePreferenceSummary(preference,null);
  final Intent intent=findPreference(Preferences.KEY_IMPORT).getIntent();
  intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
}
 

Example 4

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/.

Source file: DisplaySettings.java

  18 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  ContentResolver resolver=getContentResolver();
  mWindowManager=IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
  addPreferencesFromResource(R.xml.display_settings);
  mAnimations=(ListPreference)findPreference(KEY_ANIMATIONS);
  mAnimations.setOnPreferenceChangeListener(this);
  mAccelerometer=(CheckBoxPreference)findPreference(KEY_ACCELEROMETER);
  mAccelerometer.setPersistent(false);
  ListPreference screenTimeoutPreference=(ListPreference)findPreference(KEY_SCREEN_TIMEOUT);
  screenTimeoutPreference.setValue(String.valueOf(Settings.System.getInt(resolver,SCREEN_OFF_TIMEOUT,FALLBACK_SCREEN_TIMEOUT_VALUE)));
  screenTimeoutPreference.setOnPreferenceChangeListener(this);
  disableUnusableTimeouts(screenTimeoutPreference);
}
 

Example 5

From project android_packages_apps_cmparts, under directory /src/com/cyanogenmod/cmparts/activities/.

Source file: SoundActivity.java

  18 
vote

public void handleMessage(Message msg){
switch (msg.what) {
case 0:
    if (msg.obj != null) {
      ListPreference p=(ListPreference)findPreference(msg.obj.toString());
      p.setSummary(p.getEntry());
    }
  break;
}
}
 

Example 6

From project android_packages_apps_phone, under directory /src/com/android/phone/.

Source file: CallFeaturesSetting.java

  18 
vote

private ListPreference getSipCallOptionPreference(){
  ListPreference wifiAnd3G=(ListPreference)findPreference(BUTTON_SIP_CALL_OPTIONS);
  ListPreference wifiOnly=(ListPreference)findPreference(BUTTON_SIP_CALL_OPTIONS_WIFI_ONLY);
  PreferenceGroup sipSettings=(PreferenceGroup)findPreference(SIP_SETTINGS_CATEGORY_KEY);
  if (SipManager.isSipWifiOnly(this)) {
    sipSettings.removePreference(wifiAnd3G);
    return wifiOnly;
  }
 else {
    sipSettings.removePreference(wifiOnly);
    return wifiAnd3G;
  }
}
 

Example 7

From project badgescanner, under directory /src/net/tjohns/badgescanner/.

Source file: Preferences.java

  18 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.preferences);
  ListPreference accountPreference=(ListPreference)getPreferenceScreen().findPreference(PREF_ACCOUNT);
  String[] accounts=Accounts.GetAccounts(getActivity());
  accountPreference.setEntries(accounts);
  accountPreference.setEntryValues(accounts);
}
 

Example 8

From project cicada, under directory /samples/tubestatus/src/org/cicadasong/samples/tubestatus/.

Source file: TubeStatusSettingsActivity.java

  18 
vote

private void updatePreferredLineList(){
  ListPreference p=(ListPreference)findPreference("PreferredLine");
  int lineCount=TubeLine.allLines.size();
  CharSequence[] titles=new CharSequence[lineCount];
  CharSequence[] values=new CharSequence[lineCount];
  for (int index=0; index < lineCount; index++) {
    titles[index]=TubeLine.allLines.get(index).name;
    values[index]=TubeLine.allLines.get(index).lineIdentifier;
  }
  p.setEntries(titles);
  p.setEntryValues(values);
}
 

Example 9

From project com.juick.android, under directory /src/com/juick/android/.

Source file: PreferencesActivity.java

  18 
vote

private void updateSummaries(PreferenceGroup pg){
  for (int i=0; i < pg.getPreferenceCount(); i++) {
    Preference p=pg.getPreference(i);
    if (p instanceof PreferenceGroup) {
      updateSummaries((PreferenceGroup)p);
    }
 else     if (p instanceof ListPreference) {
      ListPreference lp=(ListPreference)p;
      lp.setSummary(lp.getEntry());
    }
  }
}
 

Example 10

From project COSsettings, under directory /src/com/cyanogenmod/cmparts/activities/.

Source file: SoundActivity.java

  18 
vote

public void handleMessage(Message msg){
switch (msg.what) {
case 0:
    if (msg.obj != null) {
      ListPreference p=(ListPreference)findPreference(msg.obj.toString());
      p.setSummary(p.getEntry());
    }
  break;
}
}
 

Example 11

From project ElectricSleep, under directory /src/com/androsz/electricsleepbeta/app/.

Source file: SettingsActivity.java

  18 
vote

private void refresh(Context c){
  final CheckBoxPreference alarmInSilentModePref=(CheckBoxPreference)findPreference(KEY_ALARM_IN_SILENT_MODE);
  final int silentModeStreams=Settings.System.getInt(c.getContentResolver(),Settings.System.MODE_RINGER_STREAMS_AFFECTED,0);
  alarmInSilentModePref.setChecked((silentModeStreams & ALARM_STREAM_TYPE_BIT) == 0);
  final ListPreference snooze=(ListPreference)findPreference(KEY_ALARM_SNOOZE);
  snooze.setSummary(snooze.getEntry());
  snooze.setOnPreferenceChangeListener(this);
}
 

Example 12

From project friendica-for-android, under directory /mw-android-friendica-01/src/de/wikilab/android/friendica01/.

Source file: PreferencesActivity.java

  18 
vote

private void updatePrefSummary(Preference p){
  if (p instanceof ListPreference) {
    ListPreference listPref=(ListPreference)p;
    p.setSummary(listPref.getEntry());
  }
  if (p instanceof EditTextPreference) {
    EditTextPreference editTextPref=(EditTextPreference)p;
    String txt=editTextPref.getText();
    if (p.getKey().equals("login_password") && txt != null)     txt=repeatChar('*',txt.length());
    p.setSummary(txt);
  }
}
 

Example 13

From project gast-lib, under directory /app/src/root/gast/playground/pref/.

Source file: SummarizingEditPreferences.java

  18 
vote

private void updatePrefSummary(Preference p){
  if (p instanceof ListPreference) {
    ListPreference listPref=(ListPreference)p;
    p.setSummary(listPref.getEntry());
  }
  if (p instanceof EditTextPreference) {
    EditTextPreference editTextPref=(EditTextPreference)p;
    p.setSummary(editTextPref.getText());
  }
}
 

Example 14

From project GeekAlarm, under directory /android/src/com/geek_alarm/android/activities/.

Source file: PreferenceActivity.java

  18 
vote

private void initMuteTime(){
  initNumberPicker(MuteUtils.INITIAL_MUTE_TIME,MuteUtils.DEFAULT_INITIAL_MUTE_TIME,0,300,5,"%ds");
  initNumberPicker(MuteUtils.MUTE_TIME_STEP,MuteUtils.DEFAULT_MUTE_TIME_STEP,0,300,5,"%ds");
  ListPreference muteBehaviour=(ListPreference)findPreference(MuteUtils.MUTE_BEHAVIOUR);
  muteBehaviour.setEntryValues(MuteBehaviour.getNames());
  muteBehaviour.setValue(MuteUtils.getMuteBehaviour().name());
}
 

Example 15

From project k-9, under directory /src/com/fsck/k9/activity/.

Source file: K9PreferenceActivity.java

  18 
vote

/** 
 * Set up the  {@link ListPreference} instance identified by {@code key}.
 * @param key The key of the  {@link ListPreference} object.
 * @param value Initial value for the  {@link ListPreference} object.
 * @return The {@link ListPreference} instance identified by {@code key}.
 */
protected ListPreference setupListPreference(final String key,final String value){
  final ListPreference prefView=(ListPreference)findPreference(key);
  prefView.setValue(value);
  prefView.setSummary(prefView.getEntry());
  prefView.setOnPreferenceChangeListener(new PreferenceChangeListener(prefView));
  return prefView;
}
 

Example 16

From project mWater-Android-App, under directory /android/src/co/mwater/clientapp/ui/.

Source file: PrefActivity.java

  18 
vote

private void updatePrefSummary(Preference p){
  if (p instanceof ListPreference) {
    ListPreference listPref=(ListPreference)p;
    p.setSummary(listPref.getEntry());
  }
  if (p instanceof EditTextPreference) {
    EditTextPreference editTextPref=(EditTextPreference)p;
    p.setSummary(editTextPref.getText());
  }
}
 

Example 17

From project OneMoreDream, under directory /src/com/dixheure/.

Source file: SettingsActivity.java

  18 
vote

public boolean onPreferenceChange(Preference pref,Object newValue){
  final ListPreference listPref=(ListPreference)pref;
  final int idx=listPref.findIndexOfValue((String)newValue);
  listPref.setSummary(listPref.getEntries()[idx]);
  return true;
}
 

Example 18

From project packages_apps_Phone_1, under directory /src/com/android/phone/.

Source file: CallFeaturesSetting.java

  18 
vote

private ListPreference getSipCallOptionPreference(){
  ListPreference wifiAnd3G=(ListPreference)findPreference(BUTTON_SIP_CALL_OPTIONS);
  ListPreference wifiOnly=(ListPreference)findPreference(BUTTON_SIP_CALL_OPTIONS_WIFI_ONLY);
  PreferenceGroup sipSettings=(PreferenceGroup)findPreference(SIP_SETTINGS_CATEGORY_KEY);
  if (SipManager.isSipWifiOnly(this)) {
    sipSettings.removePreference(wifiAnd3G);
    return wifiOnly;
  }
 else {
    sipSettings.removePreference(wifiOnly);
    return wifiAnd3G;
  }
}
 

Example 19

From project platform_packages_apps_alarmclock, under directory /src/com/android/alarmclock/.

Source file: SettingsActivity.java

  18 
vote

public boolean onPreferenceChange(Preference pref,Object newValue){
  final ListPreference listPref=(ListPreference)pref;
  final int idx=listPref.findIndexOfValue((String)newValue);
  listPref.setSummary(listPref.getEntries()[idx]);
  return true;
}
 

Example 20

From project platform_packages_apps_browser, under directory /src/com/android/browser/preferences/.

Source file: GeneralPreferencesFragment.java

  18 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Resources res=getActivity().getResources();
  mChoices=res.getStringArray(R.array.pref_homepage_choices);
  mValues=res.getStringArray(R.array.pref_homepage_values);
  mCurrentPage=getActivity().getIntent().getStringExtra(BrowserPreferencesPage.CURRENT_PAGE);
  addPreferencesFromResource(R.xml.general_preferences);
  ListPreference pref=(ListPreference)findPreference(PREF_HOMEPAGE_PICKER);
  pref.setSummary(getHomepageSummary());
  pref.setPersistent(false);
  pref.setValue(getHomepageValue());
  pref.setOnPreferenceChangeListener(this);
}
 

Example 21

From project platform_packages_apps_CytownPhone, under directory /src/com/android/phone/.

Source file: CallFeaturesSetting.java

  18 
vote

private ListPreference getSipCallOptionPreference(){
  ListPreference wifiAnd3G=(ListPreference)findPreference(BUTTON_SIP_CALL_OPTIONS);
  ListPreference wifiOnly=(ListPreference)findPreference(BUTTON_SIP_CALL_OPTIONS_WIFI_ONLY);
  PreferenceGroup sipSettings=(PreferenceGroup)findPreference(SIP_SETTINGS_CATEGORY_KEY);
  if (SipManager.isSipWifiOnly(this)) {
    sipSettings.removePreference(wifiAnd3G);
    return wifiOnly;
  }
 else {
    sipSettings.removePreference(wifiOnly);
    return wifiAnd3G;
  }
}
 

Example 22

From project platform_packages_apps_phone, under directory /src/com/android/phone/.

Source file: CallFeaturesSetting.java

  18 
vote

private ListPreference getSipCallOptionPreference(){
  ListPreference wifiAnd3G=(ListPreference)findPreference(BUTTON_SIP_CALL_OPTIONS);
  ListPreference wifiOnly=(ListPreference)findPreference(BUTTON_SIP_CALL_OPTIONS_WIFI_ONLY);
  PreferenceGroup sipSettings=(PreferenceGroup)findPreference(SIP_SETTINGS_CATEGORY_KEY);
  if (SipManager.isSipWifiOnly(this)) {
    sipSettings.removePreference(wifiAnd3G);
    return wifiOnly;
  }
 else {
    sipSettings.removePreference(wifiOnly);
    return wifiAnd3G;
  }
}
 

Example 23

From project android-thaiime, under directory /latinime/src/com/sugree/inputmethod/latin/.

Source file: Settings.java

  17 
vote

@Override public void onSharedPreferenceChanged(SharedPreferences prefs,String key){
  (new BackupManager(getActivityInternal())).dataChanged();
  if (key.equals(PREF_VOICE_SETTINGS_KEY) && !mVoiceOn) {
    if (!prefs.getString(PREF_VOICE_SETTINGS_KEY,mVoiceModeOff).equals(mVoiceModeOff)) {
      showVoiceConfirmation();
    }
  }
 else   if (key.equals(PREF_KEY_PREVIEW_POPUP_ON)) {
    final ListPreference popupDismissDelay=(ListPreference)findPreference(PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY);
    if (null != popupDismissDelay) {
      popupDismissDelay.setEnabled(prefs.getBoolean(PREF_KEY_PREVIEW_POPUP_ON,true));
    }
  }
  ensureConsistencyOfAutoCorrectionSettings();
  mVoiceOn=!(prefs.getString(PREF_VOICE_SETTINGS_KEY,mVoiceModeOff).equals(mVoiceModeOff));
  updateVoiceModeSummary();
  updateShowCorrectionSuggestionsSummary();
  updateKeyPreviewPopupDelaySummary();
  refreshEnablingsOfKeypressSoundAndVibrationSettings(prefs,getResources());
}
 

Example 24

From project AndroidLab, under directory /src/src/de/tubs/ibr/android/ldap/core/activities/.

Source file: PrefActivity.java

  17 
vote

@Override protected void onResume(){
  super.onResume();
  addPreferencesFromResource(R.xml.choose_account_preferences);
  ListPreference list=(ListPreference)findPreference("selectedAccount");
  AccountManager accManager=AccountManager.get(this);
  Account[] accounts=accManager.getAccountsByType(getString(R.string.ACCOUNT_TYPE));
  CharSequence[] entries=new CharSequence[accounts.length];
  for (int i=0; i < entries.length; i++) {
    entries[i]=accounts[i].name;
  }
  SharedPreferences mPrefs=PreferenceManager.getDefaultSharedPreferences(this);
  String accountname=mPrefs.getString("selectedAccount","");
  list.setEntries(entries);
  list.setEntryValues(entries);
  list.setTitle(accountname);
  mPrefs.registerOnSharedPreferenceChangeListener(this);
}
 

Example 25

From project android_packages_apps_Gallery, under directory /src/com/android/camera/.

Source file: CameraSettings.java

  17 
vote

private void initPreference(PreferenceScreen screen){
  ListPreference videoDuration=(ListPreference)screen.findPreference(KEY_VIDEO_DURATION);
  ListPreference pictureSize=(ListPreference)screen.findPreference(KEY_PICTURE_SIZE);
  ListPreference whiteBalance=(ListPreference)screen.findPreference(KEY_WHITE_BALANCE);
  ListPreference colorEffect=(ListPreference)screen.findPreference(KEY_COLOR_EFFECT);
  ListPreference sceneMode=(ListPreference)screen.findPreference(KEY_SCENE_MODE);
  ListPreference flashMode=(ListPreference)screen.findPreference(KEY_FLASH_MODE);
  ListPreference focusMode=(ListPreference)screen.findPreference(KEY_FOCUS_MODE);
  if (videoDuration != null) {
    CharSequence[] entries=videoDuration.getEntries();
    entries[0]=String.format(entries[0].toString(),MMS_VIDEO_DURATION);
  }
  if (pictureSize != null) {
    filterUnsupportedOptions(screen,pictureSize,sizeListToStringList(mParameters.getSupportedPictureSizes()));
  }
  if (whiteBalance != null) {
    filterUnsupportedOptions(screen,whiteBalance,mParameters.getSupportedWhiteBalance());
  }
  if (colorEffect != null) {
    filterUnsupportedOptions(screen,colorEffect,mParameters.getSupportedColorEffects());
  }
  if (sceneMode != null) {
    filterUnsupportedOptions(screen,sceneMode,mParameters.getSupportedSceneModes());
  }
  if (flashMode != null) {
    filterUnsupportedOptions(screen,flashMode,mParameters.getSupportedFlashModes());
  }
  if (focusMode != null) {
    filterUnsupportedOptions(screen,focusMode,mParameters.getSupportedFocusModes());
  }
}
 

Example 26

From project android_packages_inputmethods_LatinIME, under directory /java/src/com/android/inputmethod/latin/.

Source file: Settings.java

  17 
vote

@Override public void onSharedPreferenceChanged(SharedPreferences prefs,String key){
  (new BackupManager(getActivityInternal())).dataChanged();
  if (key.equals(PREF_VOICE_SETTINGS_KEY) && !mVoiceOn) {
    if (!prefs.getString(PREF_VOICE_SETTINGS_KEY,mVoiceModeOff).equals(mVoiceModeOff)) {
      showVoiceConfirmation();
    }
  }
 else   if (key.equals(PREF_KEY_PREVIEW_POPUP_ON)) {
    final ListPreference popupDismissDelay=(ListPreference)findPreference(PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY);
    if (null != popupDismissDelay) {
      popupDismissDelay.setEnabled(prefs.getBoolean(PREF_KEY_PREVIEW_POPUP_ON,true));
    }
  }
  ensureConsistencyOfAutoCorrectionSettings();
  mVoiceOn=!(prefs.getString(PREF_VOICE_SETTINGS_KEY,mVoiceModeOff).equals(mVoiceModeOff));
  updateVoiceModeSummary();
  updateShowCorrectionSuggestionsSummary();
  updateKeyPreviewPopupDelaySummary();
  refreshEnablingsOfKeypressSoundAndVibrationSettings(prefs,getResources());
}
 

Example 27

From project andstatus, under directory /src/org/andstatus/app/data/.

Source file: MyPreferences.java

  17 
vote

/** 
 * @param pa Preference Activity
 * @param keyPreference android:key - Name of the preference key
 * @param entryValuesR android:entryValues
 * @param displayR Almost like android:entries but to show in the summary (may be the same as android:entries) 
 * @param summaryR
 */
public static void showListPreference(PreferenceActivity pa,String keyPreference,int entryValuesR,int displayR,int summaryR){
  String displayParm="";
  ListPreference lP=(ListPreference)pa.findPreference(keyPreference);
  if (lP != null) {
    String[] k=pa.getResources().getStringArray(entryValuesR);
    String[] d=pa.getResources().getStringArray(displayR);
    displayParm=d[0];
    String listValue=lP.getValue();
    for (int i=0; i < k.length; i++) {
      if (listValue.equals(k[i])) {
        displayParm=d[i];
        break;
      }
    }
  }
 else {
    displayParm=keyPreference + " was not found";
  }
  MessageFormat sf=new MessageFormat(pa.getText(summaryR).toString());
  lP.setSummary(sf.format(new Object[]{displayParm}));
}
 

Example 28

From project CoinFlip, under directory /src/com/banasiak/coinflip/.

Source file: Settings.java

  17 
vote

private void loadExtPkgCoins(){
  Log.d(TAG,"loadExtPkgCoins()");
  try {
    CharSequence[] currentEntries=getResources().getStringArray(R.array.coins);
    CharSequence[] currentEntryValues=getResources().getStringArray(R.array.coins_values);
    final List<PackageInfo> externalPackages=util.findExternalPackages();
    for (    final PackageInfo externalPackage : externalPackages) {
      final Resources extPkgResources=getPackageManager().getResourcesForApplication(externalPackage.applicationInfo);
      final int coinsId=extPkgResources.getIdentifier("coins","array",externalPackage.packageName);
      final int coinsValuesId=extPkgResources.getIdentifier("coins_values","array",externalPackage.packageName);
      final CharSequence[] newEntries=extPkgResources.getStringArray(coinsId);
      final CharSequence[] newEntryValues=extPkgResources.getStringArray(coinsValuesId);
      currentEntries=util.mergeArray(currentEntries,newEntries);
      currentEntryValues=util.mergeArray(currentEntryValues,newEntryValues);
    }
    if (!externalPackages.isEmpty()) {
      final CharSequence[] randomEntry={"Random Coin"};
      final CharSequence[] randomEntryValue={"random"};
      currentEntries=util.mergeArray(currentEntries,randomEntry);
      currentEntryValues=util.mergeArray(currentEntryValues,randomEntryValue);
    }
    final ListPreference coinPref=(ListPreference)findPreference("coin");
    coinPref.setEntries(currentEntries);
    coinPref.setEntryValues(currentEntryValues);
  }
 catch (  final NameNotFoundException e) {
    Log.e(TAG,"NameNotFoundException");
    e.printStackTrace();
  }
}
 

Example 29

From project connectbot, under directory /src/sk/vx/connectbot/.

Source file: HostEditorActivity.java

  17 
vote

private void updateSummaries(){
  for (  String key : this.pref.values.keySet()) {
    if (key.equals(HostDatabase.FIELD_HOST_POSTLOGIN))     continue;
    Preference pref=this.findPreference(key);
    if (pref == null)     continue;
    if (pref instanceof CheckBoxPreference)     continue;
    CharSequence value=this.pref.getString(key,"");
    if (key.equals(HostDatabase.FIELD_HOST_PUBKEYID)) {
      try {
        int pubkeyId=Integer.parseInt((String)value);
        if (pubkeyId >= 0)         pref.setSummary(pubkeydb.getNickname(pubkeyId));
 else         if (pubkeyId == HostDatabase.PUBKEYID_ANY)         pref.setSummary(R.string.list_pubkeyids_any);
 else         if (pubkeyId == HostDatabase.PUBKEYID_NEVER)         pref.setSummary(R.string.list_pubkeyids_none);
        continue;
      }
 catch (      NumberFormatException nfe) {
      }
    }
 else     if (pref instanceof ListPreference) {
      ListPreference listPref=(ListPreference)pref;
      int entryIndex=listPref.findIndexOfValue((String)value);
      if (entryIndex >= 0)       value=listPref.getEntries()[entryIndex];
    }
    pref.setSummary(value);
  }
}
 

Example 30

From project creamed_glacier_app_settings, under directory /src/com/android/settings/.

Source file: DevelopmentSettings.java

  17 
vote

private void updateHdcpValues(){
  int index=1;
  ListPreference hdcpChecking=(ListPreference)findPreference(HDCP_CHECKING_KEY);
  if (hdcpChecking != null) {
    String currentValue=SystemProperties.get(HDCP_CHECKING_PROPERTY);
    String[] values=getResources().getStringArray(R.array.hdcp_checking_values);
    String[] summaries=getResources().getStringArray(R.array.hdcp_checking_summaries);
    for (int i=0; i < values.length; i++) {
      if (currentValue.equals(values[i])) {
        index=i;
        break;
      }
    }
    hdcpChecking.setValue(values[index]);
    hdcpChecking.setSummary(summaries[index]);
    hdcpChecking.setOnPreferenceChangeListener(this);
  }
}
 

Example 31

From project danbooru-gallery-android, under directory /src/tw/idv/palatis/danboorugallery/.

Source file: DanbooruGalleryPreferenceActivity.java

  17 
vote

@Override protected void onStart(){
  if (preferences.contains("json_hosts"))   try {
    hosts=D.HostsFromJSONArray(new JSONArray(preferences.getString("json_hosts","")));
  }
 catch (  JSONException ex) {
    D.Log.wtf(ex);
  }
 else   hosts=new ArrayList<Host>();
  try {
    PackageInfo manager=getPackageManager().getPackageInfo(getPackageName(),0);
    findPreference("preferences_about_version").setSummary(manager.versionName);
  }
 catch (  NameNotFoundException e) {
  }
  ListPreference pref_hosts=(ListPreference)findPreference("preferences_hosts_select");
  pref_hosts.setOnPreferenceChangeListener(new OnPreferenceChangeListener(){
    @Override public boolean onPreferenceChange(    Preference preference,    Object newValue){
      String name=hosts.get(Integer.parseInt((String)newValue)).name;
      preference.setSummary(String.format(getString(R.string.preferences_hosts_selected_host),name));
      return true;
    }
  }
);
  CheckBoxPreference pref_aggressive=(CheckBoxPreference)findPreference("preferences_options_aggressive_prefetch");
  pref_aggressive.setChecked(preferences.getBoolean("aggressive_prefetch",false));
  CheckBoxPreference pref_hqimage=(CheckBoxPreference)findPreference("preferences_options_high_quality_image");
  pref_hqimage.setChecked(preferences.getBoolean("high_quality_image",false));
  notifyHostsChanged();
  super.onStart();
}
 

Example 32

From project gmarks-android, under directory /src/main/java/org/thomnichols/android/gmarks/.

Source file: SettingsActivity.java

  17 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.settings);
  Preference labelPref=findPreference(Prefs.KEY_BROWSER_SYNC_LABEL);
  labelPref.setOnPreferenceChangeListener(this);
  CheckBoxPreference backgroundEnabledPref=(CheckBoxPreference)findPreference(Prefs.KEY_BACKGROUND_SYNC_ENABLED);
  backgroundEnabledPref.setOnPreferenceChangeListener(this);
  ListPreference intervalPref=(ListPreference)findPreference(Prefs.KEY_SYNC_INTERVAL);
  int currentSetting=intervalPref.findIndexOfValue(intervalPref.getValue());
  intervalPref.setSummary(currentSetting < 0 ? getText(R.string.pref_not_set_label) : intervalPref.getEntries()[currentSetting]);
  intervalPref.setOnPreferenceChangeListener(this);
  findPreference(KEY_FULL_SYNC_ACTION).setOnPreferenceClickListener(this);
  findPreference(KEY_LOGOUT_ACTION).setOnPreferenceClickListener(this);
  findPreference(KEY_SEND_FEEDBACK_ACTION).setOnPreferenceClickListener(this);
  findPreference(KEY_HIDE_LABELS_ACTION).setOnPreferenceClickListener(this);
  findPreference(KEY_FAQ_ACTION).setOnPreferenceClickListener(this);
}
 

Example 33

From project GSM-Signal-Tracking-, under directory /gpstracker/src/nl/sogeti/android/gpstracker/logger/.

Source file: ApplicationPreferenceActivity.java

  17 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.layout.settings);
  ListPreference precision=(ListPreference)findPreference("precision");
  time=(EditTextPreference)findPreference("customprecisiontime");
  distance=(EditTextPreference)findPreference("customprecisiondistance");
  setEnabledCustomValues(precision.getValue());
  precision.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener(){
    public boolean onPreferenceChange(    Preference preference,    Object newValue){
      setEnabledCustomValues(newValue);
      return true;
    }
  }
);
}
 

Example 34

From project HarleyDroid, under directory /src/org/harleydroid/.

Source file: HarleyDroidSettings.java

  17 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.preferences);
  BluetoothAdapter bluetoothAdapter=null;
  ArrayList<CharSequence> bluetoothDevices=new ArrayList<CharSequence>();
  ArrayList<CharSequence> bluetoothAddresses=new ArrayList<CharSequence>();
  if (!HarleyDroid.EMULATOR) {
    bluetoothAdapter=BluetoothAdapter.getDefaultAdapter();
    Set<BluetoothDevice> pairedDevices=bluetoothAdapter.getBondedDevices();
    for (    BluetoothDevice dev : pairedDevices) {
      bluetoothDevices.add(dev.getAddress() + " - " + dev.getName());
      bluetoothAddresses.add(dev.getAddress());
    }
  }
 else {
    bluetoothDevices.add("0:0:0:0 - Zerro");
    bluetoothAddresses.add("0:0:0:0");
    bluetoothDevices.add("1:1:1:1 - One");
    bluetoothAddresses.add("1:1:1:1");
    bluetoothDevices.add("2:2:2:2 - Two");
    bluetoothAddresses.add("2:2:2:2");
    bluetoothDevices.add("3:3:3:3 - Three");
    bluetoothAddresses.add("3:3:3:3");
    bluetoothDevices.add("4:4:4:4 - Four");
    bluetoothAddresses.add("4:4:4:4");
  }
  ListPreference btlist=(ListPreference)findPreference("bluetoothid");
  btlist.setEntryValues(bluetoothAddresses.toArray(new CharSequence[0]));
  btlist.setEntries(bluetoothDevices.toArray(new CharSequence[0]));
}
 

Example 35

From project ICS_LatinIME_QHD, under directory /java/src/com/android/inputmethod/latin/.

Source file: Settings.java

  17 
vote

@Override public void onSharedPreferenceChanged(SharedPreferences prefs,String key){
  (new BackupManager(getActivityInternal())).dataChanged();
  if (key.equals(PREF_VOICE_SETTINGS_KEY) && !mVoiceOn) {
    if (!prefs.getString(PREF_VOICE_SETTINGS_KEY,mVoiceModeOff).equals(mVoiceModeOff)) {
      showVoiceConfirmation();
    }
  }
 else   if (key.equals(PREF_KEY_PREVIEW_POPUP_ON)) {
    final ListPreference popupDismissDelay=(ListPreference)findPreference(PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY);
    if (null != popupDismissDelay) {
      popupDismissDelay.setEnabled(prefs.getBoolean(PREF_KEY_PREVIEW_POPUP_ON,true));
    }
  }
  ensureConsistencyOfAutoCorrectionSettings();
  mVoiceOn=!(prefs.getString(PREF_VOICE_SETTINGS_KEY,mVoiceModeOff).equals(mVoiceModeOff));
  updateVoiceModeSummary();
  updateShowCorrectionSuggestionsSummary();
  updateKeyPreviewPopupDelaySummary();
  refreshEnablingsOfKeypressSoundAndVibrationSettings(prefs,getResources());
}
 

Example 36

From project K6nele, under directory /app/src/ee/ioc/phon/android/speak/.

Source file: Preferences.java

  17 
vote

public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,String key){
  Preference pref=findPreference(key);
  if (pref instanceof EditTextPreference) {
    EditTextPreference etp=(EditTextPreference)pref;
    pref.setSummary(etp.getText());
  }
 else   if (pref instanceof ListPreference) {
    ListPreference lp=(ListPreference)pref;
    if (lp.getTitle().equals(getString(R.string.titleAutoStopAfterTime))) {
      setSummary(pref,getString(R.string.summaryAutoStopAfterTime),lp.getValue());
    }
 else     if (lp.getTitle().equals(getString(R.string.titleRecordingRate))) {
      setSummary(pref,getString(R.string.summaryRecordingRate),lp.getValue());
    }
  }
}
 

Example 37

From project KeyboardTerm, under directory /src/com/roiding/rterm/.

Source file: EditFunctionButtonActivity.java

  17 
vote

private void updatePreferenceDisplay(){
  for (  String key : valuesMap.keySet()) {
    Preference pref=this.findPreference(key);
    if (pref != null) {
      String value=valuesMap.get(key);
      if (pref instanceof EditTextPreference) {
        EditTextPreference textPref=(EditTextPreference)pref;
        if (value != null && value.length() > 0)         textPref.setTitle(value);
        textPref.setText(value);
      }
 else       if (pref instanceof ListPreference) {
        ListPreference listPref=(ListPreference)pref;
        if (value != null && value.length() > 0)         listPref.setTitle(value);
        listPref.setValue(value);
      }
 else       if (pref instanceof CheckBoxPreference) {
        CheckBoxPreference checkPref=(CheckBoxPreference)pref;
        if (value != null && value.length() > 0)         checkPref.setChecked(value.toString().equals("1"));
      }
    }
  }
}
 

Example 38

From project Locast-Android, under directory /src/edu/mit/mobile/android/locast/.

Source file: SettingsActivity.java

  17 
vote

@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
switch (requestCode) {
case REQUEST_RESET_DB:
    if (resultCode == RESULT_OK) {
      setUrl(newUrl);
      finish();
    }
 else     if (resultCode == RESULT_CANCELED) {
      final ListPreference pref=(ListPreference)preferenceScreen.findPreference(NetworkClient.PREF_LOCAST_SITE);
      if (pref != null) {
        pref.setValue(preferenceScreen.getSharedPreferences().getString(NetworkClient.PREF_SERVER_URL,null));
      }
    }
  break;
default :
super.onActivityResult(requestCode,resultCode,data);
}
}
 

Example 39

From project LunaTerm, under directory /src/com/roiding/rterm/.

Source file: EditFunctionButtonActivity.java

  17 
vote

private void updatePreferenceDisplay(){
  for (  String key : valuesMap.keySet()) {
    Preference pref=this.findPreference(key);
    if (pref != null) {
      String value=valuesMap.get(key);
      if (pref instanceof EditTextPreference) {
        EditTextPreference textPref=(EditTextPreference)pref;
        if (value != null && value.length() > 0)         textPref.setTitle(value);
        textPref.setText(value);
      }
 else       if (pref instanceof ListPreference) {
        ListPreference listPref=(ListPreference)pref;
        if (value != null && value.length() > 0)         listPref.setTitle(value);
        listPref.setValue(value);
      }
    }
  }
}
 

Example 40

From project ohmagePhone, under directory /src/org/ohmage/triggers/types/location/.

Source file: LocTrigEditActivity.java

  17 
vote

private void initializeGUI(){
  ListPreference locPref=(ListPreference)getPreferenceScreen().findPreference(PREF_KEY_LOCATION);
  CheckBoxPreference rangePref=(CheckBoxPreference)getPreferenceScreen().findPreference(PREF_KEY_ENABLE_RANGE);
  CheckBoxPreference alwaysPref=(CheckBoxPreference)getPreferenceScreen().findPreference(PREF_KEY_TRIGGER_ALWAYS);
  TimePickerPreference startPref=(TimePickerPreference)getPreferenceScreen().findPreference(PREF_KEY_START_TIME);
  TimePickerPreference endPref=(TimePickerPreference)getPreferenceScreen().findPreference(PREF_KEY_END_TIME);
  Preference actionsPref=getPreferenceScreen().findPreference(PREF_KEY_ACTIONS);
  if (!mAdminMode && !TrigUserConfig.editTriggerActions) {
    actionsPref.setEnabled(false);
  }
  updateActionsPrefStatus();
  locPref.setValue(mTrigDesc.getLocation());
  locPref.setSummary(mTrigDesc.getLocation());
  if (mTrigDesc.isRangeEnabled()) {
    rangePref.setChecked(true);
    if (mTrigDesc.shouldTriggerAlways()) {
      alwaysPref.setChecked(true);
    }
    startPref.setTime(mTrigDesc.getStartTime());
    endPref.setTime(mTrigDesc.getEndTime());
  }
  locPref.setEnabled(mAdminMode || TrigUserConfig.editLocationTrigger);
  rangePref.setEnabled(mAdminMode || TrigUserConfig.editLocationTrigger);
  alwaysPref.setEnabled(mAdminMode || TrigUserConfig.editLocationTrigger);
  startPref.setEnabled(mAdminMode || TrigUserConfig.editLocationTrigger);
  endPref.setEnabled(mAdminMode || TrigUserConfig.editLocationTrigger);
  ((Button)findViewById(R.id.trig_edit_done)).setEnabled(mAdminMode || TrigUserConfig.editLocationTrigger);
}
 

Example 41

From project Ohmage_Phone, under directory /src/org/ohmage/triggers/types/location/.

Source file: LocTrigEditActivity.java

  17 
vote

private void initializeGUI(){
  ListPreference locPref=(ListPreference)getPreferenceScreen().findPreference(PREF_KEY_LOCATION);
  CheckBoxPreference rangePref=(CheckBoxPreference)getPreferenceScreen().findPreference(PREF_KEY_ENABLE_RANGE);
  CheckBoxPreference alwaysPref=(CheckBoxPreference)getPreferenceScreen().findPreference(PREF_KEY_TRIGGER_ALWAYS);
  TimePickerPreference startPref=(TimePickerPreference)getPreferenceScreen().findPreference(PREF_KEY_START_TIME);
  TimePickerPreference endPref=(TimePickerPreference)getPreferenceScreen().findPreference(PREF_KEY_END_TIME);
  Preference actionsPref=getPreferenceScreen().findPreference(PREF_KEY_ACTIONS);
  if (!mAdminMode && !TrigUserConfig.editTriggerActions) {
    actionsPref.setEnabled(false);
  }
  updateActionsPrefStatus();
  locPref.setValue(mTrigDesc.getLocation());
  locPref.setSummary(mTrigDesc.getLocation());
  if (mTrigDesc.isRangeEnabled()) {
    rangePref.setChecked(true);
    if (mTrigDesc.shouldTriggerAlways()) {
      alwaysPref.setChecked(true);
    }
    startPref.setTime(mTrigDesc.getStartTime());
    endPref.setTime(mTrigDesc.getEndTime());
  }
  locPref.setEnabled(mAdminMode || TrigUserConfig.editLocationTrigger);
  rangePref.setEnabled(mAdminMode || TrigUserConfig.editLocationTrigger);
  alwaysPref.setEnabled(mAdminMode || TrigUserConfig.editLocationTrigger);
  startPref.setEnabled(mAdminMode || TrigUserConfig.editLocationTrigger);
  endPref.setEnabled(mAdminMode || TrigUserConfig.editLocationTrigger);
  ((Button)findViewById(R.id.trig_edit_done)).setEnabled(mAdminMode || TrigUserConfig.editLocationTrigger);
}
 

Example 42

From project packages_apps_God_Mode, under directory /src/com/t3hh4xx0r/god_mode/.

Source file: SystemOptionsActivity.java

  17 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.system_settings);
  ListPreference btpref=(ListPreference)findPreference("pref_gps_source");
  ArrayList<CharSequence> entries=new ArrayList<CharSequence>();
  for (  String e : getResources().getStringArray(R.array.entries_gps_source)) {
    entries.add(e);
  }
  ArrayList<CharSequence> values=new ArrayList<CharSequence>();
  for (  String v : getResources().getStringArray(R.array.values_gps_source)) {
    values.add(v);
  }
  BluetoothAdapter mBluetoothAdapter=BluetoothAdapter.getDefaultAdapter();
  if ((mBluetoothAdapter != null) && (mBluetoothAdapter.isEnabled())) {
    for (    BluetoothDevice d : mBluetoothAdapter.getBondedDevices()) {
      String dname=d.getName() + " - " + d.getAddress();
      entries.add(dname);
      values.add(d.getAddress());
    }
  }
  btpref.setEntries(entries.toArray(new CharSequence[entries.size()]));
  btpref.setEntryValues(values.toArray(new CharSequence[values.size()]));
  btpref.setDefaultValue("0");
  btpref.setOnPreferenceChangeListener(this);
}
 

Example 43

From project platform_packages_apps_settings, under directory /src/com/android/settings/.

Source file: DevelopmentSettings.java

  17 
vote

private void updateHdcpValues(){
  int index=1;
  ListPreference hdcpChecking=(ListPreference)findPreference(HDCP_CHECKING_KEY);
  if (hdcpChecking != null) {
    String currentValue=SystemProperties.get(HDCP_CHECKING_PROPERTY);
    String[] values=getResources().getStringArray(R.array.hdcp_checking_values);
    String[] summaries=getResources().getStringArray(R.array.hdcp_checking_summaries);
    for (int i=0; i < values.length; i++) {
      if (currentValue.equals(values[i])) {
        index=i;
        break;
      }
    }
    hdcpChecking.setValue(values[index]);
    hdcpChecking.setSummary(summaries[index]);
    hdcpChecking.setOnPreferenceChangeListener(this);
  }
}
 

Example 44

From project Sage-Mobile-Calc, under directory /src/org/connectbot/.

Source file: HostEditorActivity.java

  17 
vote

private void updateSummaries(){
  for (  String key : this.pref.values.keySet()) {
    if (key.equals(HostDatabase.FIELD_HOST_POSTLOGIN))     continue;
    Preference pref=this.findPreference(key);
    if (pref == null)     continue;
    if (pref instanceof CheckBoxPreference)     continue;
    CharSequence value=this.pref.getString(key,"");
    if (key.equals(HostDatabase.FIELD_HOST_PUBKEYID)) {
      try {
        int pubkeyId=Integer.parseInt((String)value);
        if (pubkeyId >= 0)         pref.setSummary(pubkeydb.getNickname(pubkeyId));
 else         if (pubkeyId == HostDatabase.PUBKEYID_ANY)         pref.setSummary(R.string.list_pubkeyids_any);
 else         if (pubkeyId == HostDatabase.PUBKEYID_NEVER)         pref.setSummary(R.string.list_pubkeyids_none);
        continue;
      }
 catch (      NumberFormatException nfe) {
      }
    }
 else     if (pref instanceof ListPreference) {
      ListPreference listPref=(ListPreference)pref;
      int entryIndex=listPref.findIndexOfValue((String)value);
      if (entryIndex >= 0)       value=listPref.getEntries()[entryIndex];
    }
    pref.setSummary(value);
  }
}
 

Example 45

From project Android-Battery-Widget, under directory /src/com/em/batterywidget/.

Source file: OptionsManager.java

  15 
vote

@SuppressWarnings("deprecation") @Override protected void onCreate(Bundle bundle){
  super.onCreate(bundle);
  addPreferencesFromResource(R.xml.options);
  mVibrationCB=(CheckBoxPreference)getPreferenceScreen().findPreference(Constants.VIBRATION_CHECKBOX_KEY);
  mSoundCB=(CheckBoxPreference)getPreferenceScreen().findPreference(Constants.SOUND_CHECKBOX_KEY);
  mNotifyCB=(CheckBoxPreference)getPreferenceScreen().findPreference(Constants.NOTIFY_ICON_CHECKBOX_KEY);
  mThemeList=(ListPreference)getPreferenceScreen().findPreference(Constants.WIDGET_THEME_KEY);
  mColourList=(ListPreference)getPreferenceScreen().findPreference(Constants.TEXT_COLOUR_KEY);
  mTempList=(ListPreference)getPreferenceScreen().findPreference(Constants.TEMPERATURE_TYPE_KEY);
  mAboutPref=(Preference)getPreferenceScreen().findPreference(Constants.ABOUT_PREF_KEY);
  mPrefSettings=new Preferences(Constants.BATTERY_SETTINGS,this);
}
 

Example 46

From project android-ocr, under directory /android/src/edu/sfsu/cs/orange/ocr/.

Source file: PreferencesActivity.java

  15 
vote

/** 
 * Set the default preference values.
 * @param Bundle savedInstanceState the current Activity's state, as passed by Android
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.preferences);
  sharedPreferences=PreferenceManager.getDefaultSharedPreferences(this);
  listPreferenceSourceLanguage=(ListPreference)getPreferenceScreen().findPreference(KEY_SOURCE_LANGUAGE_PREFERENCE);
  listPreferenceTargetLanguage=(ListPreference)getPreferenceScreen().findPreference(KEY_TARGET_LANGUAGE_PREFERENCE);
  listPreferenceTranslator=(ListPreference)getPreferenceScreen().findPreference(KEY_TRANSLATOR);
  listPreferenceOcrEngineMode=(ListPreference)getPreferenceScreen().findPreference(KEY_OCR_ENGINE_MODE);
  editTextPreferenceCharacterBlacklist=(EditTextPreference)getPreferenceScreen().findPreference(KEY_CHARACTER_BLACKLIST);
  editTextPreferenceCharacterWhitelist=(EditTextPreference)getPreferenceScreen().findPreference(KEY_CHARACTER_WHITELIST);
  listPreferencePageSegmentationMode=(ListPreference)getPreferenceScreen().findPreference(KEY_PAGE_SEGMENTATION_MODE);
  initTranslationTargetList();
}
 

Example 47

From project android-shuffle, under directory /client/src/org/dodgybits/shuffle/android/preference/activity/.

Source file: PreferencesActivity.java

  15 
vote

private void setCalendarPreferenceEntries(){
  mPreference=(ListPreference)findPreference(Preferences.CALENDAR_ID_KEY);
  mPreference.setEnabled(false);
  mQueryHandler=new QueryHandler(getContentResolver());
  mQueryHandler.startQuery(0,null,CALENDAR_CONTENT_URI,CALENDARS_PROJECTION,CALENDARS_WHERE,null,CALENDARS_SORT);
}
 

Example 48

From project android_packages_apps_CMSettings, under directory /src/com/cyanogenmod/settings/activities/.

Source file: Backlight.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.backlight_settings);
  PreferenceScreen prefSet=getPreferenceScreen();
  ContentResolver cr=getContentResolver();
  mFilterEnabled=(CheckBoxPreference)prefSet.findPreference(FILTER_ENABLED);
  mFilterEnabled.setChecked(Settings.System.getInt(cr,Settings.System.LIGHT_FILTER,0) != 0);
  mFilterEnabled.setOnPreferenceChangeListener(this);
  mFilterReset=(ListPreference)prefSet.findPreference(FILTER_RESET);
  mFilterReset.setValue(String.valueOf(Settings.System.getInt(cr,Settings.System.LIGHT_FILTER_RESET,-1)));
  mFilterReset.setOnPreferenceChangeListener(this);
  mFilterWindow=(ListPreference)prefSet.findPreference(FILTER_WINDOW);
  mFilterWindow.setValue(String.valueOf(Settings.System.getInt(cr,Settings.System.LIGHT_FILTER_WINDOW,30000)));
  mFilterWindow.setOnPreferenceChangeListener(this);
  mFilterInterval=(ListPreference)prefSet.findPreference(FILTER_INTERVAL);
  mFilterInterval.setValue(String.valueOf(Settings.System.getInt(cr,Settings.System.LIGHT_FILTER_INTERVAL,1000)));
  mFilterInterval.setOnPreferenceChangeListener(this);
  mLevelsEnabled=(CheckBoxPreference)prefSet.findPreference(LEVELS_ENABLED);
  mLevelsEnabled.setChecked(Settings.System.getInt(cr,Settings.System.LIGHT_SENSOR_CUSTOM,0) != 0);
  mLevelsEnabled.setOnPreferenceChangeListener(this);
  mScreenDim=(ListPreference)prefSet.findPreference(SCREEN_DIM);
  mScreenDim.setValue(String.valueOf(Settings.System.getInt(cr,Settings.System.LIGHT_SCREEN_DIM,android.os.Power.BRIGHTNESS_DIM)));
  mScreenDim.setOnPreferenceChangeListener(this);
  mDecreaseEnabled=(CheckBoxPreference)prefSet.findPreference(DECREASE_ENABLED);
  mDecreaseEnabled.setChecked(Settings.System.getInt(cr,Settings.System.LIGHT_DECREASE,0) != 0);
  mDecreaseEnabled.setOnPreferenceChangeListener(this);
  mDecreaseHysteresis=(ListPreference)prefSet.findPreference(DECREASE_HYSTERESIS);
  mDecreaseHysteresis.setValue(String.valueOf(Settings.System.getInt(cr,Settings.System.LIGHT_HYSTERESIS,50)));
  mDecreaseHysteresis.setOnPreferenceChangeListener(this);
}
 

Example 49

From project android_packages_apps_FileManager, under directory /src/org/openintents/filemanager/.

Source file: PreferenceActivity.java

  15 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  addPreferencesFromResource(R.xml.preferences);
  Preference editBookmarks=findPreference("editbookmarks");
  editBookmarks.setOnPreferenceClickListener(new OnPreferenceClickListener(){
    public boolean onPreferenceClick(    Preference pref){
      showDialog(DIALOG_DELETE_BOOKMARKS);
      return false;
    }
  }
);
  getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
  changeListPreferenceSummaryToCurrentValue((ListPreference)findPreference("sortby"));
}
 

Example 50

From project android_packages_apps_SalvageParts, under directory /src/com/salvagemod/salvageparts/activities/.

Source file: LockscreenStyleActivity.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setTitle(R.string.lockscreen_settings_title_subhead);
  addPreferencesFromResource(R.xml.lockscreen_style_settings);
  PreferenceScreen prefSet=getPreferenceScreen();
  mLockscreenStylePref=(ListPreference)prefSet.findPreference(LOCKSCREEN_STYLE_PREF);
  int lockscreenStyle=Settings.System.getInt(getContentResolver(),Settings.System.LOCKSCREEN_STYLE_PREF,1);
  mLockscreenStylePref.setValue(String.valueOf(lockscreenStyle));
  mLockscreenStylePref.setOnPreferenceChangeListener(this);
  mRotaryUnlockDownToggle=(CheckBoxPreference)prefSet.findPreference(LOCKSCREEN_ROTARY_UNLOCK_DOWN_TOGGLE);
  mRotaryUnlockDownToggle.setChecked(Settings.System.getInt(getContentResolver(),Settings.System.LOCKSCREEN_ROTARY_UNLOCK_DOWN,0) == 1);
  mRotaryHideArrowsToggle=(CheckBoxPreference)prefSet.findPreference(LOCKSCREEN_ROTARY_HIDE_ARROWS_TOGGLE);
  mRotaryHideArrowsToggle.setChecked(Settings.System.getInt(getContentResolver(),Settings.System.LOCKSCREEN_ROTARY_HIDE_ARROWS,0) == 1);
  mCustomAppTogglePref=(CheckBoxPreference)prefSet.findPreference(LOCKSCREEN_CUSTOM_APP_TOGGLE);
  mCustomAppTogglePref.setChecked(Settings.System.getInt(getContentResolver(),Settings.System.LOCKSCREEN_CUSTOM_APP_TOGGLE,0) == 1);
  mCustomIconStyle=(CheckBoxPreference)prefSet.findPreference(LOCKSCREEN_CUSTOM_ICON_STYLE);
  mCustomIconStyle.setChecked(Settings.System.getInt(getContentResolver(),Settings.System.LOCKSCREEN_CUSTOM_ICON_STYLE,1) == 2);
  updateStylePrefs(lockscreenStyle);
  mCustomAppActivityPref=(Preference)prefSet.findPreference(LOCKSCREEN_CUSTOM_APP_ACTIVITY);
}
 

Example 51

From project andtweet, under directory /src/com/xorcode/andtweet/.

Source file: PreferencesActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.preferences);
  AndTweetPreferences.setDefaultValues(R.xml.preferences,false);
  if (!AndTweetPreferences.getSharedPreferences(PreferenceManager.KEY_HAS_SET_DEFAULT_VALUES,MODE_PRIVATE).getBoolean(PreferenceManager.KEY_HAS_SET_DEFAULT_VALUES,false)) {
    Log.e(TAG,"Default values were not set?!");
  }
  mHistorySizePreference=(ListPreference)findPreference(KEY_HISTORY_SIZE);
  mHistoryTimePreference=(ListPreference)findPreference(KEY_HISTORY_TIME);
  mFetchFrequencyPreference=(ListPreference)findPreference(KEY_FETCH_FREQUENCY);
  mNotificationRingtone=(RingtonePreference)findPreference(KEY_RINGTONE_PREFERENCE);
  mOAuth=(CheckBoxPreference)findPreference(KEY_OAUTH);
  mEditTextUsername=(EditTextPreference)findPreference(KEY_TWITTER_USERNAME_NEW);
  mEditTextPassword=(EditTextPreference)findPreference(KEY_TWITTER_PASSWORD);
  mVerifyCredentials=(Preference)findPreference(KEY_VERIFY_CREDENTIALS);
  mNotificationRingtone.setOnPreferenceChangeListener(this);
}
 

Example 52

From project AnySoftKeyboard, under directory /src/com/anysoftkeyboard/ui/settings/.

Source file: AddOnSelector.java

  15 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  addPreferencesFromResource(getPrefsLayoutResId());
  final Preference searcher=findPreference(SEARCH_MARKET_PACKS_PREF_KEY);
  searcher.setOnPreferenceClickListener(new OnPreferenceClickListener(){
    public boolean onPreferenceClick(    Preference preference){
      if (preference.getKey().equals(SEARCH_MARKET_PACKS_PREF_KEY)) {
        if (allowExternalPacks()) {
          try {
            MainForm.searchMarketForAddons(AddOnSelector.this.getApplicationContext(),getAdditionalMarketQueryString());
          }
 catch (          Exception ex) {
            Toast.makeText(getApplicationContext(),getText(R.string.no_market_store_available),Toast.LENGTH_LONG).show();
            Log.e("ASK-SETTINGS","Failed to launch market!",ex);
          }
        }
 else {
          showDialog(DIALOG_NO_EXTERNAL_PACKS_FOR_NOW);
        }
        return true;
      }
      return false;
    }
  }
);
  mAddonsList=(ListPreference)findPreference(getString(getAddonsListPrefKeyResId()));
}
 

Example 53

From project filemanager, under directory /FileManager/src/org/openintents/filemanager/.

Source file: PreferenceActivity.java

  15 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    HomeIconHelper.activity_actionbar_setDisplayHomeAsUpEnabled(this);
  }
  addPreferencesFromResource(R.xml.preferences);
  getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
  changeListPreferenceSummaryToCurrentValue((ListPreference)findPreference("sortby"));
  findPreference("clear_search_button").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener(){
    @Override public boolean onPreferenceClick(    Preference preference){
      new AlertDialog.Builder(PreferenceActivity.this).setTitle(R.string.preference_search_title).setMessage(R.string.preference_search_dialog_message).setIcon(android.R.drawable.ic_dialog_alert).setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
        public void onClick(        DialogInterface dialog,        int whichButton){
          SearchableActivity.clearSearchRecents(PreferenceActivity.this);
          Toast.makeText(PreferenceActivity.this,R.string.search_history_cleared,Toast.LENGTH_SHORT).show();
        }
      }
).setNegativeButton(android.R.string.cancel,null).show();
      return true;
    }
  }
);
}
 

Example 54

From project Gibberbot, under directory /src/info/guardianproject/otr/app/im/app/.

Source file: SettingActivity.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.preferences);
  mHideOfflineContacts=(CheckBoxPreference)findPreference(getString(R.string.pref_hide_offline_contacts));
  mOtrMode=(ListPreference)findPreference(getString(R.string.pref_security_otr_mode));
  mEnableNotification=(CheckBoxPreference)findPreference(getString(R.string.pref_enable_notification));
  mNotificationVibrate=(CheckBoxPreference)findPreference(getString(R.string.pref_notification_vibrate));
  mNotificationSound=(CheckBoxPreference)findPreference(getString(R.string.pref_notification_sound));
  mForegroundService=(CheckBoxPreference)findPreference(getString(R.string.pref_foreground_service));
  mHeartbeatInterval=(EditTextPreference)findPreference(getString(R.string.pref_heartbeat_interval));
}
 

Example 55

From project Gingerbread-Keyboard, under directory /src/com/android/inputmethod/latin/.

Source file: LatinIMESettings.java

  15 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  addPreferencesFromResource(R.xml.prefs);
  mQuickFixes=(CheckBoxPreference)findPreference(QUICK_FIXES_KEY);
  mVoicePreference=(ListPreference)findPreference(VOICE_SETTINGS_KEY);
  mSettingsKeyPreference=(ListPreference)findPreference(PREF_SETTINGS_KEY);
  SharedPreferences prefs=getPreferenceManager().getSharedPreferences();
  prefs.registerOnSharedPreferenceChangeListener(this);
  mVoiceModeOff=getString(R.string.voice_mode_off);
  mVoiceOn=!(prefs.getString(VOICE_SETTINGS_KEY,mVoiceModeOff).equals(mVoiceModeOff));
  mLogger=VoiceInputLogger.getLogger(this);
}
 

Example 56

From project Hawksword, under directory /src/com/bw/hawksword/ocr/.

Source file: PreferencesActivity.java

  15 
vote

/** 
 * Set the default preference values.
 * @param Bundle savedInstanceState the current Activity's state, as passed by Android
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.preferences);
  sharedPreferences=PreferenceManager.getDefaultSharedPreferences(this);
  listPreferenceDictionaryMode=(ListPreference)getPreferenceScreen().findPreference(KEY_DICTIONARY_MODE);
  listPreferenceFocusMode=(ListPreference)getPreferenceScreen().findPreference(KEY_FOCUS_MODE);
  listPreferenceSourceLanguage=(ListPreference)getPreferenceScreen().findPreference(KEY_SOURCE_LANGUAGE_PREFERENCE);
  listPreferenceTranslator=(ListPreference)getPreferenceScreen().findPreference(KEY_TRANSLATOR);
  listPreferenceOcrEngineMode=(ListPreference)getPreferenceScreen().findPreference(KEY_OCR_ENGINE_MODE);
  editTextPreferenceCharacterBlacklist=(EditTextPreference)getPreferenceScreen().findPreference(KEY_CHARACTER_BLACKLIST);
  editTextPreferenceCharacterWhitelist=(EditTextPreference)getPreferenceScreen().findPreference(KEY_CHARACTER_WHITELIST);
  listPreferencePageSegmentationMode=(ListPreference)getPreferenceScreen().findPreference(KEY_PAGE_SEGMENTATION_MODE);
}
 

Example 57

From project MyExpenses, under directory /src/org/totschnig/myexpenses/.

Source file: MyPreferenceActivity.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setTitle(getString(R.string.app_name) + " " + getString(R.string.menu_settings));
  addPreferencesFromResource(R.layout.preferences);
  PreferenceScreen prefs=getPreferenceScreen();
  mCurrencyInputFormat=(ListPreference)prefs.findPreference(MyApplication.PREFKEY_CURRENCY_DECIMAL_SEPARATOR);
  if (mCurrencyInputFormat.getValue() == null) {
    String sep=Utils.getDefaultDecimalSeparator();
    mCurrencyInputFormat.setValue(sep);
  }
  mShareTarget=(EditTextPreference)prefs.findPreference(MyApplication.PREFKEY_SHARE_TARGET);
  mShareTarget.setSummary(getString(R.string.pref_share_target_summary) + ":\n" + "ftp: \"ftp://login:[email protected]:port/my/directory/\"\n"+ "mailto: \"mailto:[email protected]\"");
  mShareTarget.setOnPreferenceChangeListener(this);
}
 

Example 58

From project NotePad, under directory /src/com/nononsenseapps/notepad/prefs/.

Source file: MainPrefs.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.app_pref_main);
  prefSortOrder=(ListPreference)findPreference(KEY_SORT_ORDER);
  prefSortType=(ListPreference)findPreference(KEY_SORT_TYPE);
  prefTheme=(ListPreference)findPreference(KEY_THEME);
  prefFontType=(ListPreference)findPreference(KEY_FONT_TYPE_EDITOR);
  prefWeekStart=(ListPreference)findPreference(KEY_WEEK_START_DAY);
  prefDefaultList=(ListPreference)findPreference(KEY_DEFAULT_LIST);
  SharedPreferences sharedPrefs=PreferenceManager.getDefaultSharedPreferences(activity);
  sharedPrefs.registerOnSharedPreferenceChangeListener(this);
  prefSortOrder.setSummary(prefSortOrder.getEntry());
  prefSortType.setSummary(prefSortType.getEntry());
  prefTheme.setSummary(prefTheme.getEntry());
  prefFontType.setSummary(prefFontType.getEntry());
  prefWeekStart.setSummary(prefWeekStart.getEntry());
  setEntries(prefDefaultList);
}
 

Example 59

From project OpenTripPlanner-for-Android, under directory /src/org/opentripplanner/android/.

Source file: SettingsActivity.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.preferences);
  mapTileProvider=(ListPreference)findPreference("map_tile_source");
  routingOptions=(PreferenceCategory)findPreference("routing_options");
  autoDetectServer=(CheckBoxPreference)findPreference("auto_detect_server");
  customServerURL=(EditTextPreference)findPreference("custom_server_url");
  ArrayList<CharSequence> names=new ArrayList<CharSequence>();
  ArrayList<ITileSource> tiles=TileSourceFactory.getTileSources();
  for (  ITileSource iTileSource : tiles) {
    names.add(iTileSource.name());
  }
  mapTileProvider.setEntries(names.toArray(new CharSequence[names.size()]));
  mapTileProvider.setEntryValues(names.toArray(new CharSequence[names.size()]));
  mapTileProvider.setDefaultValue("Mapnik");
  hideCustomURLPref(autoDetectServer.isChecked());
  autoDetectServer.setOnPreferenceChangeListener(new OnPreferenceChangeListener(){
    @Override public boolean onPreferenceChange(    Preference preference,    Object newValue){
      Boolean value=(Boolean)newValue;
      hideCustomURLPref(value);
      return true;
    }
  }
);
}
 

Example 60

From project packages_apps_BlackICEControl, under directory /src/com/blackice/control/fragments/.

Source file: DensityChanger.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.lcd_density_setup);
  String currentDensity=SystemProperties.get("ro.sf.lcd_density");
  PreferenceScreen prefs=getPreferenceScreen();
  mStockDensity=(ListPreference)findPreference("stock_density");
  mStockDensity.setOnPreferenceChangeListener(this);
  mReboot=findPreference("reboot");
  mClearMarketData=findPreference("clear_market_data");
  mOpenMarket=findPreference("open_market");
  mCustomDensity=(ListPreference)findPreference("lcd_density");
  mCustomDensity.setOnPreferenceChangeListener(this);
}
 

Example 61

From project packages_apps_ROMControl, under directory /src/com/aokp/romcontrol/fragments/.

Source file: DensityChanger.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.lcd_density_setup);
  String currentDensity=SystemProperties.get("ro.sf.lcd_density");
  PreferenceScreen prefs=getPreferenceScreen();
  mStockDensity=(ListPreference)findPreference("stock_density");
  mStockDensity.setOnPreferenceChangeListener(this);
  mReboot=findPreference("reboot");
  mClearMarketData=findPreference("clear_market_data");
  mOpenMarket=findPreference("open_market");
  mCustomDensity=(ListPreference)findPreference("lcd_density");
  mCustomDensity.setOnPreferenceChangeListener(this);
}
 

Example 62

From project platform_packages_apps_mms, under directory /src/com/android/mms/ui/.

Source file: MessagingPreferenceActivity.java

  15 
vote

private void loadPrefs(){
  addPreferencesFromResource(R.xml.preferences);
  mManageSimPref=findPreference("pref_key_manage_sim_messages");
  mSmsLimitPref=findPreference("pref_key_sms_delete_limit");
  mSmsDeliveryReportPref=findPreference("pref_key_sms_delivery_reports");
  mMmsDeliveryReportPref=findPreference("pref_key_mms_delivery_reports");
  mMmsReadReportPref=findPreference("pref_key_mms_read_reports");
  mMmsLimitPref=findPreference("pref_key_mms_delete_limit");
  mClearHistoryPref=findPreference("pref_key_mms_clear_history");
  mEnableNotificationsPref=(CheckBoxPreference)findPreference(NOTIFICATION_ENABLED);
  mVibrateWhenPref=(ListPreference)findPreference(NOTIFICATION_VIBRATE_WHEN);
  mVibrateEntries=getResources().getTextArray(R.array.prefEntries_vibrateWhen);
  mVibrateValues=getResources().getTextArray(R.array.prefValues_vibrateWhen);
  setMessagePreferences();
}