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

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

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

Preference.setEnabled介绍

暂无

代码示例

代码示例来源:origin: cSploit/android

private void onMsfPathChanged() {
  measureMsfSize();
  boolean haveMsf = false;
  File dir;
  File[] content;
  if ((dir = new File(System.getRubyPath())).isDirectory() ||
      (dir = new File(System.getMsfPath())).isDirectory()) {
    content = dir.listFiles();
    haveMsf = content != null && content.length > 2;
  }
  mWipeMSF.setEnabled(haveMsf);
}

代码示例来源:origin: westnordost/StreetComplete

@Override protected void onPreExecute()
{
  Preference pref = preference.get();
  if(pref != null) pref.setEnabled(false);
}

代码示例来源:origin: westnordost/StreetComplete

@Override protected void onPostExecute(Void result)
{
  Preference pref = preference.get();
  if(pref != null) pref.setEnabled(true);
}

代码示例来源:origin: jruesga/rview

private void enableNotificationsSupport() {
    if (mNotificationsAdvise != null) {
      mNotificationsCategory.removePreference(mNotificationsAdvise);
      mNotificationsAdvise = null;
    }
    mNotificationsEnabled.setEnabled(true);
    mNotificationsEvents.setEnabled(true);
  }
}

代码示例来源:origin: KDE/kdeconnect-android

private void updateFilePickerStatus(boolean enabled) {
  filePicker.setEnabled(enabled);
  String path = PreferenceManager
      .getDefaultSharedPreferences(requireContext())
      .getString(PREFERENCE_DESTINATION, null);
  if (enabled && path != null) {
    filePicker.setSummary(Uri.parse(path).getPath());
  } else {
    filePicker.setSummary(getDefaultDestinationDirectory().getAbsolutePath());
  }
}

代码示例来源:origin: TUM-Dev/Campus-Android

/**
 * Disable setting for non-employees.
 */
private void setUpEmployeeSettings() {
  boolean isEmployee = !Utils.getSetting(mContext, Const.TUMO_EMPLOYEE_ID, "").isEmpty();
  Preference checkbox = findPreference(Const.EMPLOYEE_MODE);
  if (!isEmployee && checkbox != null) {
    findPreference(Const.EMPLOYEE_MODE).setEnabled(false);
  }
}

代码示例来源:origin: jruesga/rview

@Override
public boolean onPreferenceClick(Preference preference) {
  if (preference.equals(mNotificationsAdvise)) {
    ActivityHelper.openUriInCustomTabs(
        getActivity(), getString(R.string.link_cloud_notifications_plugin));
    return true;
  } else if (preference.equals(mSearchHistoryClear)) {
    Preferences.clearAccountSearchHistory(getContext(), mAccount);
    mSearchHistoryClear.setEnabled(false);
    Toast.makeText(getContext(), R.string.account_settings_search_clear_message,
        Toast.LENGTH_SHORT).show();
    return true;
  }
  return false;
}

代码示例来源:origin: jruesga/rview

private void configureSearch() {
  mSearchHistoryClear = findPreference(PREF_ACCOUNT_SEARCH_CLEAR);
  mSearchHistoryClear.setOnPreferenceClickListener(this);
  mSearchHistoryClear.setEnabled(Preferences.hasAccountSearchHistory(getContext(), mAccount));
}

代码示例来源:origin: morogoku/MTweaks-KernelAdiutorMOD

private void deletePasswordDialog(final String password) {
  if (password.isEmpty()) {
    Utils.toast(getString(R.string.set_password_first), getActivity());
    return;
  }
  mDeletePassword = password;
  LinearLayout linearLayout = new LinearLayout(getActivity());
  linearLayout.setOrientation(LinearLayout.VERTICAL);
  linearLayout.setGravity(Gravity.CENTER);
  int padding = Math.round(getResources().getDimension(R.dimen.dialog_padding));
  linearLayout.setPadding(padding, padding, padding, padding);
  final AppCompatEditText mPassword = new AppCompatEditText(getActivity());
  mPassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
  mPassword.setHint(getString(R.string.password));
  linearLayout.addView(mPassword);
  new Dialog(getActivity()).setView(linearLayout)
      .setPositiveButton(getString(R.string.ok), (dialogInterface, i) -> {
        if (!mPassword.getText().toString().equals(Utils.decodeString(password))) {
          Utils.toast(getString(R.string.password_wrong), getActivity());
          return;
        }
        AppSettings.resetPassword(getActivity());
        if (mFingerprint != null) {
          mFingerprint.setEnabled(false);
        }
      })
      .setOnDismissListener(dialogInterface -> mDeletePassword = null).show();
}

代码示例来源:origin: KDE/kdeconnect-android

@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
  super.onCreatePreferences(savedInstanceState, rootKey);
  PreferenceScreen preferenceScreen = getPreferenceScreen();
  final CheckBoxPreference customDownloads = (CheckBoxPreference) preferenceScreen.findPreference("share_destination_custom");
  filePicker = preferenceScreen.findPreference("share_destination_folder_preference");
  if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)) {
    customDownloads.setOnPreferenceChangeListener((preference, newValue) -> {
      updateFilePickerStatus((Boolean) newValue);
      return true;
    });
    filePicker.setOnPreferenceClickListener(preference -> {
      Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
      startActivityForResult(intent, RESULT_PICKER);
      return true;
    });
  } else {
    customDownloads.setEnabled(false);
    filePicker.setEnabled(false);
  }
  boolean customized = PreferenceManager
      .getDefaultSharedPreferences(requireContext())
      .getBoolean(PREFERENCE_CUSTOMIZE_DESTINATION, false);
  updateFilePickerStatus(customized);
}

代码示例来源:origin: morogoku/MTweaks-KernelAdiutorMOD

.toString()), getActivity());
if (mFingerprint != null) {
  mFingerprint.setEnabled(true);

代码示例来源:origin: andstatus/andstatus

preference.setEnabled(false);
DialogFactory.showYesCancelDialog(this, R.string.check_and_fix_data,
    R.string.full_check, ActivityRequestCode.CHECK_DATA_INCLUDE_LONG);

代码示例来源:origin: morogoku/MTweaks-KernelAdiutorMOD

} else {
  mFingerprint = findPreference(KEY_FINGERPRINT);
  mFingerprint.setEnabled(!AppSettings.getPassword(getActivity()).isEmpty());

相关文章