android.support.v7.preference.Preference.setEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(182)

本文整理了Java中android.support.v7.preference.Preference.setEnabled()方法的一些代码示例,展示了Preference.setEnabled()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Preference.setEnabled()方法的具体详情如下:
包路径:android.support.v7.preference.Preference
类名称:Preference
方法名:setEnabled

Preference.setEnabled介绍

暂无

代码示例

代码示例来源:origin: jberkel/sms-backup-plus

private void updateImapSettings(boolean enabled) {
  findPreference(IMAP_SETTINGS.key).setEnabled(enabled);
}

代码示例来源:origin: jberkel/sms-backup-plus

@Override
  public void onChanged(DataType dataType, DataTypePreferences preferences) {
    if (dataType == DataType.CALLLOG) {
      findPreference(AdvancedSettings.Backup.CallLog.class.getName())
          .setEnabled(preferences.isBackupEnabled(dataType));
    }
  }
});

代码示例来源:origin: jberkel/sms-backup-plus

private void checkGCM() {
    if (!App.gcmAvailable) {
      final Preference preference = findPreference(USE_OLD_SCHEDULER.key);
      preference.setEnabled(false);
      preference.setSummary(R.string.pref_use_old_scheduler_no_gcm_summary);
    }
  }
}

代码示例来源:origin: jberkel/sms-backup-plus

private void updateAutoBackupPreferences() {
  final CheckBoxPreference autoBackup = findAutoBackupPreference();
  autoBackup.setSummary(summarizeAutoBackupSettings());
  autoBackup.setEnabled(!authPreferences.useXOAuth() || authPreferences.hasOAuth2Tokens());
  final Preference autoBackupSettings = findPreference(BACKUP_SETTINGS_SCREEN.key);
  autoBackupSettings.setSummary(summarizeBackupScheduleSettings(autoBackup.isChecked()));
  autoBackupSettings.setEnabled(autoBackup.isEnabled() && autoBackup.isChecked());
}

代码示例来源:origin: fgl27/isu

private void updatePrefs(boolean state) {
  mPerAppDontCare.setEnabled(state);
  mPerAppActive.setEnabled(state);
  mAutoRestartSU.setEnabled(state);
  mAutoRestartISU.setEnabled(state);
  mPerAppDeactive.setEnabled(state);
}

代码示例来源:origin: WangDaYeeeeee/GeometricWeather

private void initForecastPart(SharedPreferences sharedPreferences) {
  // set today forecast time & todayForecastType.
  Preference todayForecastTime = findPreference(getString(R.string.key_forecast_today_time));
  todayForecastTime.setSummary(
      sharedPreferences.getString(
          getString(R.string.key_forecast_today_time),
          GeometricWeather.DEFAULT_TODAY_FORECAST_TIME));
  // set tomorrow forecast time & tomorrowForecastType.
  Preference tomorrowForecastTime = findPreference(getString(R.string.key_forecast_tomorrow_time));
  tomorrowForecastTime.setSummary(
      sharedPreferences.getString(
          getString(R.string.key_forecast_tomorrow_time),
          GeometricWeather.DEFAULT_TOMORROW_FORECAST_TIME));
  if (sharedPreferences.getBoolean(getString(R.string.key_forecast_today), false)) {
    // open today forecast.
    // set item enable.
    todayForecastTime.setEnabled(true);
  } else {
    // set item enable.
    todayForecastTime.setEnabled(false);
  }
  if (sharedPreferences.getBoolean(getString(R.string.key_forecast_tomorrow), false)) {
    // open tomorrow forecast.
    tomorrowForecastTime.setEnabled(true);
  } else {
    tomorrowForecastTime.setEnabled(false);
  }
}

代码示例来源:origin: Calsign/APDE

protected void updateSketchbookDrivePref(ListPreference sketchbookDrive, Preference sketchbookLocation, ArrayList<APDE.StorageDrive> drives) {
  int selectedIndex = sketchbookDrive.findIndexOfValue(sketchbookDrive.getValue());
  
  if (selectedIndex == -1) {
    //Uh-oh
    return;
  }
  
  APDE.StorageDrive selected = drives.get(selectedIndex);
  
  sketchbookLocation.setEnabled(!(selected.type.equals(APDE.StorageDrive.StorageDriveType.INTERNAL) || selected.type.equals(APDE.StorageDrive.StorageDriveType.SECONDARY_EXTERNAL)));
  sketchbookDrive.setSummary(selected.space + " " + selected.type.title);
}

代码示例来源:origin: GrossumUA/TAS_Android_Boilerplate

private void initPrefs() {
  findPreference(getString(R.string.id_pref_logout)).setOnPreferenceClickListener(this);
  Preference switchBackgroundJob = findPreference(getString(R.string.id_pref_switcher));
  switchBackgroundJob.setOnPreferenceChangeListener(this);
  switchBackgroundJob.setEnabled(getArguments().getBoolean(AUTOLOGIN_ENABLED_ARGS));
}

代码示例来源:origin: WangDaYeeeeee/Mysplash

@Override
  public boolean onPreferenceChange(Preference preference, Object o) {
    if (preference.getKey().equals(getString(R.string.key_muzei_source))) {
      // muzei source.
      MuzeiOptionManager.getInstance(getActivity()).setSource((String) o);
      String sourceName = ValueUtils.getMuzeiSourceName(getActivity(), (String) o);
      preference.setSummary(getString(R.string.now) + " : " + sourceName);

      Preference collectionSource = findPreference(getString(R.string.key_muzei_collection_source));
      collectionSource.setEnabled(MuzeiOptionManager.getInstance(getActivity()).getSource().equals("collection"));
    }
    return true;
  }
}

代码示例来源:origin: WangDaYeeeeee/Mysplash

@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.perference_muzei);
  if (getActivity() != null) {
    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
    ListPreference source = (ListPreference) findPreference(getString(R.string.key_muzei_source));
    String sourceValue = sharedPreferences.getString(getString(R.string.key_muzei_source), "collection");
    String sourceName = ValueUtils.getMuzeiSourceName(getActivity(), sourceValue);
    source.setSummary(getString(R.string.now) + " : " + sourceName);
    source.setOnPreferenceChangeListener(this);
    Preference collectionSource = findPreference(getString(R.string.key_muzei_collection_source));
    collectionSource.setEnabled(MuzeiOptionManager.getInstance(getActivity()).getSource().equals("collection"));
  }
}

代码示例来源:origin: JBossOutreach/lead-management-android

signOut.setVisible(false);
  login.setVisible(true);
  login.setEnabled(true);
} else {
  signOut.setVisible(true);
  signOut.setEnabled(true);
  login.setVisible(false);

代码示例来源:origin: WangDaYeeeeee/Mysplash

nightStartTime.setSummary(getString(R.string.now) + " : " + ThemeManager.getInstance(getActivity()).getNightStartTime());
if (autoNightModeValue.equals("auto")) {
  nightStartTime.setEnabled(true);
} else {
  nightStartTime.setEnabled(false);
nightEndTime.setSummary(getString(R.string.now) + " : " + ThemeManager.getInstance(getActivity()).getNightEndTime());
if (autoNightModeValue.equals("auto")) {
  nightEndTime.setEnabled(true);
} else {
  nightEndTime.setEnabled(false);

代码示例来源:origin: WangDaYeeeeee/GeometricWeather

findPreference(getString(R.string.key_navigationBar_color)).setEnabled(false);
} else {
  findPreference(getString(R.string.key_navigationBar_color)).setEnabled(true);

代码示例来源:origin: WangDaYeeeeee/Mysplash

preference.setSummary(getString(R.string.now) + " : " + autoNightMode);
if (((String) o).equals("auto")) {
  findPreference(getString(R.string.key_night_start_time)).setEnabled(true);
  findPreference(getString(R.string.key_night_end_time)).setEnabled(true);
} else {
  findPreference(getString(R.string.key_night_start_time)).setEnabled(false);
  findPreference(getString(R.string.key_night_end_time)).setEnabled(false);

代码示例来源:origin: fgl27/isu

public void updateHidePref(Context context) {
  if (!rootAccess) {
    mHide.setEnabled(false);
    mHide.setSummary(getString(R.string.device_not_root));
  } else {

代码示例来源:origin: fgl27/isu

mDebug.setEnabled(false);
mDebugRoot.setEnabled(false);
mTasker.setEnabled(false);

相关文章