当前位置: 首页>>代码示例>>Java>>正文


Java Preference.setEnabled方法代码示例

本文整理汇总了Java中android.preference.Preference.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java Preference.setEnabled方法的具体用法?Java Preference.setEnabled怎么用?Java Preference.setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.preference.Preference的用法示例。


在下文中一共展示了Preference.setEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onResume

import android.preference.Preference; //导入方法依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    refreshNotificationListeners();
    lookupRingtoneNames();
    updateNotificationPreferenceState();
    mSettingsObserver.register(true);
    mReceiver.register(true);
    updateRingPreference();
    updateEffectsSuppressor();
    for (VolumeSeekBarPreference volumePref : mVolumePrefs) {
        volumePref.onActivityResume();
    }
    if (mIncreasingRingVolume != null) {
        mIncreasingRingVolume.onActivityResume();
    }
    boolean isRestricted = mUserManager.hasUserRestriction(UserManager.DISALLOW_ADJUST_VOLUME);
    for (String key : RESTRICTED_KEYS) {
        Preference pref = findPreference(key);
        if (pref != null) {
            pref.setEnabled(!isRestricted);
        }
    }
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:25,代码来源:SoundSettings.java

示例2: disableOnlyFullAppPrefs

import android.preference.Preference; //导入方法依赖的package包/类
private void disableOnlyFullAppPrefs() {
    String fullOnly = " FULL ONLY ";
    int color = Utils.adjustAlpha(CurrentTheme.getColorAccent(getActivity()), 100);

    for (String name : AppPrefs.ONLY_FULL_APP_PREFS) {
        Preference preference = findPreference(name);
        if (preference != null) {
            preference.setEnabled(false);

            CharSequence summary = TextUtils.isEmpty(preference.getTitle()) ? "" : preference.getTitle();
            summary = fullOnly + " " + summary;

            Spannable spannable = SpannableStringBuilder.valueOf(summary);

            BackgroundColorSpan span = new BackgroundColorSpan(color);
            ForegroundColorSpan span1 = new ForegroundColorSpan(Color.WHITE);

            spannable.setSpan(span, 0, fullOnly.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            spannable.setSpan(span1, 0, fullOnly.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            preference.setTitle(spannable);
        }
    }
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:24,代码来源:PreferencesFragment.java

示例3: UpgradePro

import android.preference.Preference; //导入方法依赖的package包/类
private void UpgradePro() {
    Preference darkKey = findPreference("DARK_THEME_KEY");
        darkKey.setEnabled(true);
        darkKey.setTitle(R.string.DarkThemePro);
    Preference SmallFonts = findPreference("EXTRA_SMALL_FONT");
        SmallFonts.setEnabled(true);
        SmallFonts.setTitle(R.string.ExtraSmallFontTPro);
    Preference Rounding = findPreference("ROUNDIND_INFO");
        Rounding.setTitle(R.string.EnableRoundingPro);
        Rounding.setEnabled(true);
    Preference Max = findPreference("MAX_INT");
        Max.setEnabled(true);
        Max.setTitle(R.string.MaximumTPro);
    Preference Min = findPreference("MIN_INT_KEY");
        Min.setTitle(R.string.MinimumTPro);
        Min.setEnabled(true);
}
 
开发者ID:coder3101,项目名称:Matrix-Calculator-for-Android,代码行数:18,代码来源:Settings.java

示例4: onCreate

import android.preference.Preference; //导入方法依赖的package包/类
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    addPreferencesFromResource(R.xml.preference_settings);

    backgroundThread = new HandlerThread("backgroundThread", Process.THREAD_PRIORITY_BACKGROUND);
    backgroundThread.start();
    backgroundHandler = new Handler(backgroundThread.getLooper());

    btcPrecisionPreference = findPreference(Configuration.PREFS_KEY_BTC_PRECISION);
    btcPrecisionPreference.setOnPreferenceChangeListener(this);

    trustedPeerPreference = findPreference(Configuration.PREFS_KEY_TRUSTED_PEER);
    ((EditTextPreference) trustedPeerPreference).getEditText().setSingleLine();
    trustedPeerPreference.setOnPreferenceChangeListener(this);

    trustedPeerOnlyPreference = findPreference(Configuration.PREFS_KEY_TRUSTED_PEER_ONLY);
    trustedPeerOnlyPreference.setOnPreferenceChangeListener(this);

    final Preference dataUsagePreference = findPreference(Configuration.PREFS_KEY_DATA_USAGE);
    dataUsagePreference.setEnabled(pm.resolveActivity(dataUsagePreference.getIntent(), 0) != null);

    updateTrustedPeer();
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:26,代码来源:SettingsFragment.java

示例5: onSharedPreferenceChanged

import android.preference.Preference; //导入方法依赖的package包/类
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
    Preference        connectionPref;
    SharedPreferences pref = getPreferenceScreen().getSharedPreferences();

    switch (key) {
        case "pref_key_qr_autofade":
            connectionPref = findPreference("pref_key_qr_autofade_time");
            connectionPref.setEnabled(sharedPreferences.getBoolean(key, false));
            break;
        case "pref_key_filter_subst":
            findPreference("pref_key_filterby_level").setEnabled(pref.getBoolean("pref_key_filter_subst", false));
            findPreference("pref_key_filterby_schedule").setEnabled(pref.getBoolean("pref_key_filter_subst", false));
            break;
    }
}
 
开发者ID:LCA311,项目名称:leoapp-sources,代码行数:17,代码来源:PreferenceActivity.java

示例6: setPreferenceEnabled

import android.preference.Preference; //导入方法依赖的package包/类
static void setPreferenceEnabled(final String prefKey, final boolean enabled,
        final PreferenceScreen screen) {
    final Preference preference = screen.findPreference(prefKey);
    if (preference != null) {
        preference.setEnabled(enabled);
    }
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:8,代码来源:SubScreenFragment.java

示例7: onCreate

import android.preference.Preference; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    appPreferences = App.getAppPreferences();
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.settings);
    context = getActivity();

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
    prefs.registerOnSharedPreferenceChangeListener(this);

    prefCustomPath = (EditTextPreference) findPreference(getString(R.string.pref_custom_path));
    prefCustomFile = (ListPreference) findPreference(getString(R.string.pref_custom_file));
    prefSortMethod = (ListPreference) findPreference(getString(R.string.pref_sort_method));
    prefTheme = (ListPreference) findPreference(getString(R.string.pref_theme));

    // removes settings that wont work on lower versions
    Preference prefNavigationColor = findPreference(getString(R.string.pref_navigation_color));
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        prefNavigationColor.setEnabled(false);
    }

    Preference prefReset = findPreference(getString(R.string.pref_reset));
    prefReset.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
            sharedPreferences.edit().clear().apply();
            return true;
        }
    });

    setSortModeSummary();
    setThemeSummary();
    setCustomPathSummary();
    setFilenameSummary();
}
 
开发者ID:dkanada,项目名称:OpenAPK,代码行数:37,代码来源:SettingsFragment.java

示例8: setVideoBitrateEnable

import android.preference.Preference; //导入方法依赖的package包/类
private void setVideoBitrateEnable(SharedPreferences sharedPreferences) {
  Preference bitratePreferenceValue =
      settingsFragment.findPreference(keyprefMaxVideoBitrateValue);
  String bitrateTypeDefault = getString(R.string.pref_maxvideobitrate_default);
  String bitrateType =
      sharedPreferences.getString(keyprefMaxVideoBitrateType, bitrateTypeDefault);
  if (bitrateType.equals(bitrateTypeDefault)) {
    bitratePreferenceValue.setEnabled(false);
  } else {
    bitratePreferenceValue.setEnabled(true);
  }
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:13,代码来源:SettingsActivity.java

示例9: setAudioBitrateEnable

import android.preference.Preference; //导入方法依赖的package包/类
private void setAudioBitrateEnable(SharedPreferences sharedPreferences) {
  Preference bitratePreferenceValue =
      settingsFragment.findPreference(keyprefStartAudioBitrateValue);
  String bitrateTypeDefault = getString(R.string.pref_startaudiobitrate_default);
  String bitrateType =
      sharedPreferences.getString(keyprefStartAudioBitrateType, bitrateTypeDefault);
  if (bitrateType.equals(bitrateTypeDefault)) {
    bitratePreferenceValue.setEnabled(false);
  } else {
    bitratePreferenceValue.setEnabled(true);
  }
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:13,代码来源:SettingsActivity.java

示例10: setVideoBitrateEnable

import android.preference.Preference; //导入方法依赖的package包/类
private void setVideoBitrateEnable(SharedPreferences sharedPreferences) {
    Preference bitratePreferenceValue =
            settingsFragment.findPreference(keyprefMaxVideoBitrateValue);
    String bitrateTypeDefault = getString(R.string.pref_maxvideobitrate_default);
    String bitrateType =
            sharedPreferences.getString(keyprefMaxVideoBitrateType, bitrateTypeDefault);
    if (bitrateType.equals(bitrateTypeDefault)) {
        bitratePreferenceValue.setEnabled(false);
    } else {
        bitratePreferenceValue.setEnabled(true);
    }
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:13,代码来源:SettingsActivity.java

示例11: setAudioBitrateEnable

import android.preference.Preference; //导入方法依赖的package包/类
private void setAudioBitrateEnable(SharedPreferences sharedPreferences) {
    Preference bitratePreferenceValue =
            settingsFragment.findPreference(keyprefStartAudioBitrateValue);
    String bitrateTypeDefault = getString(R.string.pref_startaudiobitrate_default);
    String bitrateType =
            sharedPreferences.getString(keyprefStartAudioBitrateType, bitrateTypeDefault);
    if (bitrateType.equals(bitrateTypeDefault)) {
        bitratePreferenceValue.setEnabled(false);
    } else {
        bitratePreferenceValue.setEnabled(true);
    }
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:13,代码来源:SettingsActivity.java

示例12: initPreferenceChanges

import android.preference.Preference; //导入方法依赖的package包/类
private void initPreferenceChanges() {
    getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);

    Preference qrtime = findPreference("pref_key_notification_time_foodmarks");
    qrtime.setEnabled(getPreferenceScreen().getSharedPreferences().getBoolean("pref_key_notification_essensqr", false));

    Preference testtime = findPreference("pref_key_notification_time_test");
    testtime.setEnabled(getPreferenceScreen().getSharedPreferences().getBoolean("pref_key_notification_test", false));

    Preference surveytime = findPreference("pref_key_notification_time_survey");
    surveytime.setEnabled(getPreferenceScreen().getSharedPreferences().getBoolean("pref_key_notification_survey", false));

    Preference scheduletime = findPreference("pref_key_notification_time_schedule");
    scheduletime.setEnabled(getPreferenceScreen().getSharedPreferences().getBoolean("pref_key_notification_schedule", false));
}
 
开发者ID:LCA311,项目名称:leoapp-sources,代码行数:16,代码来源:NotificationPreferenceActivity.java

示例13: onResume

import android.preference.Preference; //导入方法依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    final Preference voiceInputKeyOption = findPreference(Settings.PREF_VOICE_INPUT_KEY);
    if (voiceInputKeyOption != null) {
        RichInputMethodManager.getInstance().refreshSubtypeCaches();
        voiceInputKeyOption.setEnabled(VOICE_IME_ENABLED);
        voiceInputKeyOption.setSummary(VOICE_IME_ENABLED
                ? null : getText(R.string.voice_input_disabled_summary));
    }
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:12,代码来源:PreferencesSettingsFragment.java

示例14: setOreoSupportSum

import android.preference.Preference; //导入方法依赖的package包/类
private void setOreoSupportSum(Preference... preferences) {
    for (Preference preference : preferences) {
        preference.setEnabled(false);
        preference.setSummary(getString(R.string.android_O_only));
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:7,代码来源:SettingsActivity.java

示例15: createErrorMessage

import android.preference.Preference; //导入方法依赖的package包/类
private static Preference createErrorMessage(final Activity activity, final int messageResource) {
    final Preference message = new Preference(activity);
    message.setTitle(messageResource);
    message.setEnabled(false);
    return message;
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:7,代码来源:DictionarySettingsFragment.java


注:本文中的android.preference.Preference.setEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。