Example usage for android.provider BlockedNumberContract canCurrentUserBlockNumbers

List of usage examples for android.provider BlockedNumberContract canCurrentUserBlockNumbers

Introduction

In this page you can find the example usage for android.provider BlockedNumberContract canCurrentUserBlockNumbers.

Prototype

public static boolean canCurrentUserBlockNumbers(Context context) 

Source Link

Document

Checks if blocking numbers is supported for the current user.

Usage

From source file:com.android.contacts.preference.DisplayOptionsPreferenceFragment.java

private void removeUnsupportedPreferences() {
    // Disable sort order for CJK locales where it is not supported
    final Resources resources = getResources();
    if (!resources.getBoolean(R.bool.config_sort_order_user_changeable)) {
        getPreferenceScreen().removePreference(findPreference(KEY_SORT_ORDER));
    }//from www .jav a2  s  .  c o m

    if (!resources.getBoolean(R.bool.config_phonetic_name_display_user_changeable)) {
        getPreferenceScreen().removePreference(findPreference(KEY_PHONETIC_NAME_DISPLAY));
    }

    if (HelpUtils.isHelpAndFeedbackAvailable()) {
        getPreferenceScreen().removePreference(findPreference(KEY_ABOUT));
    }

    // Disable display order for CJK locales as well
    if (!resources.getBoolean(R.bool.config_display_order_user_changeable)) {
        getPreferenceScreen().removePreference(findPreference(KEY_DISPLAY_ORDER));
    }

    final boolean isPhone = TelephonyManagerCompat
            .isVoiceCapable((TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE));
    final boolean showBlockedNumbers = isPhone && ContactsUtils.FLAG_N_FEATURE
            && BlockedNumberContract.canCurrentUserBlockNumbers(getContext());
    if (!showBlockedNumbers) {
        getPreferenceScreen().removePreference(findPreference(KEY_BLOCKED_NUMBERS));
    }

    if (!mAreContactsAvailable) {
        getPreferenceScreen().removePreference(findPreference(KEY_EXPORT));
    }
}