當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。