Search in sources :

Example 71 with FooterPreference

use of com.android.settingslib.widget.FooterPreference in project android_packages_apps_Settings by omnirom.

the class BugReportHandlerPicker method addStaticPreferences.

@Override
protected void addStaticPreferences(PreferenceScreen screen) {
    if (mFooter == null) {
        mFooter = new FooterPreference(screen.getContext());
        mFooter.setIcon(R.drawable.ic_info_outline_24dp);
        mFooter.setSingleLineTitle(false);
        mFooter.setTitle(R.string.bug_report_handler_picker_footer_text);
        mFooter.setSelectable(false);
    }
    screen.addPreference(mFooter);
}
Also used : FooterPreference(com.android.settingslib.widget.FooterPreference)

Example 72 with FooterPreference

use of com.android.settingslib.widget.FooterPreference in project android_packages_apps_Settings by omnirom.

the class PremiumSmsAccess method updatePrefs.

private void updatePrefs(ArrayList<AppEntry> apps) {
    if (apps == null)
        return;
    setEmptyText(R.string.premium_sms_none);
    setLoading(false, true);
    final PreferenceScreen screen = getPreferenceScreen();
    screen.removeAll();
    screen.setOrderingAsAdded(true);
    for (int i = 0; i < apps.size(); i++) {
        final PremiumSmsPreference smsPreference = new PremiumSmsPreference(apps.get(i), getPrefContext());
        smsPreference.setOnPreferenceChangeListener(this);
        screen.addPreference(smsPreference);
    }
    if (apps.size() != 0) {
        FooterPreference footer = new FooterPreference(getPrefContext());
        footer.setTitle(R.string.premium_sms_warning);
        screen.addPreference(footer);
    }
}
Also used : PreferenceScreen(androidx.preference.PreferenceScreen) FooterPreference(com.android.settingslib.widget.FooterPreference)

Example 73 with FooterPreference

use of com.android.settingslib.widget.FooterPreference in project android_packages_apps_Settings by omnirom.

the class WirelessDebuggingFragment method addPreferences.

private void addPreferences() {
    mDeviceNamePreference = (Preference) findPreference(PREF_KEY_ADB_DEVICE_NAME);
    mIpAddrPreference = (Preference) findPreference(PREF_KEY_ADB_IP_ADDR);
    mPairingMethodsCategory = (PreferenceCategory) findPreference(PREF_KEY_PAIRING_METHODS_CATEGORY);
    mCodePairingPreference = (Preference) findPreference(PREF_KEY_ADB_CODE_PAIRING);
    mCodePairingPreference.setOnPreferenceClickListener(preference -> {
        showDialog(AdbWirelessDialogUiBase.MODE_PAIRING);
        return true;
    });
    mPairedDevicesCategory = (PreferenceCategory) findPreference(PREF_KEY_PAIRED_DEVICES_CATEGORY);
    mFooterCategory = (PreferenceCategory) findPreference(PREF_KEY_FOOTER_CATEGORY);
    mOffMessagePreference = new FooterPreference(mFooterCategory.getContext());
    final CharSequence title = getText(R.string.adb_wireless_list_empty_off);
    mOffMessagePreference.setTitle(title);
    mFooterCategory.addPreference(mOffMessagePreference);
}
Also used : FooterPreference(com.android.settingslib.widget.FooterPreference)

Example 74 with FooterPreference

use of com.android.settingslib.widget.FooterPreference in project android_packages_apps_Settings by omnirom.

the class EnterpriseDisclosurePreferenceController method updateFooterPreference.

void updateFooterPreference(PreferenceScreen screen, CharSequence disclosure) {
    final FooterPreference footerPreference = screen.findPreference(getPreferenceKey());
    footerPreference.setTitle(disclosure);
    footerPreference.setLearnMoreAction(view -> {
        mContext.startActivity(new Intent(Settings.ACTION_ENTERPRISE_PRIVACY_SETTINGS));
    });
    final String learnMoreContentDescription = mContext.getString(R.string.footer_learn_more_content_description, getLabelName());
    footerPreference.setLearnMoreContentDescription(learnMoreContentDescription);
}
Also used : Intent(android.content.Intent) FooterPreference(com.android.settingslib.widget.FooterPreference)

Example 75 with FooterPreference

use of com.android.settingslib.widget.FooterPreference in project android_packages_apps_Settings by omnirom.

the class ScreenTimeoutSettings method setupDisabledFooterPreference.

@VisibleForTesting
void setupDisabledFooterPreference() {
    final String textDisabledByAdmin = getResources().getString(R.string.admin_disabled_other_options);
    final String textMoreDetails = getResources().getString(R.string.admin_more_details);
    final SpannableString spannableString = new SpannableString(textDisabledByAdmin + System.lineSeparator() + System.lineSeparator() + textMoreDetails);
    final ClickableSpan clickableSpan = new ClickableSpan() {

        @Override
        public void onClick(@NonNull View widget) {
            RestrictedLockUtils.sendShowAdminSupportDetailsIntent(getContext(), mAdmin);
        }
    };
    if (textDisabledByAdmin != null && textMoreDetails != null) {
        spannableString.setSpan(clickableSpan, textDisabledByAdmin.length() + 1, textDisabledByAdmin.length() + textMoreDetails.length() + 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    }
    mDisableOptionsPreference = new FooterPreference(getContext());
    mDisableOptionsPreference.setLayoutResource(R.layout.preference_footer);
    mDisableOptionsPreference.setTitle(spannableString);
    mDisableOptionsPreference.setSelectable(false);
    mDisableOptionsPreference.setIcon(R.drawable.ic_info_outline_24dp);
    // The 'disabled by admin' preference should always be at the end of the setting page.
    mDisableOptionsPreference.setOrder(DEFAULT_ORDER_OF_LOWEST_PREFERENCE);
    mPrivacyPreference.setOrder(DEFAULT_ORDER_OF_LOWEST_PREFERENCE - 1);
}
Also used : SpannableString(android.text.SpannableString) NonNull(androidx.annotation.NonNull) SpannableString(android.text.SpannableString) ClickableSpan(android.text.style.ClickableSpan) View(android.view.View) FooterPreference(com.android.settingslib.widget.FooterPreference) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

FooterPreference (com.android.settingslib.widget.FooterPreference)84 Test (org.junit.Test)22 Before (org.junit.Before)18 Intent (android.content.Intent)17 Preference (androidx.preference.Preference)10 View (android.view.View)8 PreferenceScreen (androidx.preference.PreferenceScreen)7 NotificationChannel (android.app.NotificationChannel)6 NotificationChannelGroup (android.app.NotificationChannelGroup)6 Preference (android.support.v7.preference.Preference)6 PreferenceCategory (android.support.v7.preference.PreferenceCategory)6 TextView (android.widget.TextView)6 LayoutPreference (com.android.settings.applications.LayoutPreference)6 MasterSwitchPreference (com.android.settings.widget.MasterSwitchPreference)6 RestrictedSwitchPreference (com.android.settingslib.RestrictedSwitchPreference)6 Context (android.content.Context)3 Drawable (android.graphics.drawable.Drawable)2 SpannableString (android.text.SpannableString)2 Pair (android.util.Pair)2 VisibleForTesting (androidx.annotation.VisibleForTesting)2