Search in sources :

Example 46 with FooterPreference

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

the class NotificationSettingsBase method setupBlockDesc.

protected void setupBlockDesc(int summaryResId) {
    mBlockedDesc = (FooterPreference) getPreferenceScreen().findPreference(KEY_BLOCKED_DESC);
    mBlockedDesc = new FooterPreference(getPrefContext());
    mBlockedDesc.setSelectable(false);
    mBlockedDesc.setTitle(summaryResId);
    mBlockedDesc.setEnabled(false);
    mBlockedDesc.setOrder(50);
    getPreferenceScreen().addPreference(mBlockedDesc);
}
Also used : FooterPreference(com.android.settingslib.widget.FooterPreference)

Example 47 with FooterPreference

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

the class AppNotificationSettings method populateChannelList.

private void populateChannelList() {
    if (!mChannelGroups.isEmpty()) {
        // If there's anything in mChannelGroups, we've called populateChannelList twice.
        // Clear out existing channels and log.
        Log.w(TAG, "Notification channel group posted twice to settings - old size " + mChannelGroups.size() + ", new size " + mChannelGroupList.size());
        for (Preference p : mChannelGroups) {
            getPreferenceScreen().removePreference(p);
        }
    }
    if (mChannelGroupList.isEmpty()) {
        PreferenceCategory groupCategory = new PreferenceCategory(getPrefContext());
        groupCategory.setTitle(R.string.notification_channels);
        groupCategory.setKey(KEY_GENERAL_CATEGORY);
        getPreferenceScreen().addPreference(groupCategory);
        mChannelGroups.add(groupCategory);
        Preference empty = new Preference(getPrefContext());
        empty.setTitle(R.string.no_channels);
        empty.setEnabled(false);
        groupCategory.addPreference(empty);
    } else {
        for (NotificationChannelGroup group : mChannelGroupList) {
            PreferenceCategory groupCategory = new PreferenceCategory(getPrefContext());
            if (group.getId() == null) {
                groupCategory.setTitle(mChannelGroupList.size() > 1 ? R.string.notification_channels_other : R.string.notification_channels);
                groupCategory.setKey(KEY_GENERAL_CATEGORY);
            } else {
                groupCategory.setTitle(group.getName());
                groupCategory.setKey(group.getId());
            }
            groupCategory.setOrderingAsAdded(true);
            getPreferenceScreen().addPreference(groupCategory);
            mChannelGroups.add(groupCategory);
            final List<NotificationChannel> channels = group.getChannels();
            Collections.sort(channels, mChannelComparator);
            int N = channels.size();
            for (int i = 0; i < N; i++) {
                final NotificationChannel channel = channels.get(i);
                populateSingleChannelPrefs(groupCategory, channel);
            }
        }
        int deletedChannelCount = mBackend.getDeletedChannelCount(mAppRow.pkg, mAppRow.uid);
        if (deletedChannelCount > 0 && getPreferenceScreen().findPreference(KEY_DELETED) == null) {
            mDeletedChannels = new FooterPreference(getPrefContext());
            mDeletedChannels.setSelectable(false);
            mDeletedChannels.setTitle(getResources().getQuantityString(R.plurals.deleted_channels, deletedChannelCount, deletedChannelCount));
            mDeletedChannels.setEnabled(false);
            mDeletedChannels.setKey(KEY_DELETED);
            mDeletedChannels.setOrder(ORDER_LAST);
            getPreferenceScreen().addPreference(mDeletedChannels);
        }
    }
    updateDependents(mAppRow.banned);
}
Also used : NotificationChannel(android.app.NotificationChannel) NotificationChannelGroup(android.app.NotificationChannelGroup) LayoutPreference(com.android.settings.applications.LayoutPreference) ColorSelectPreference(org.omnirom.omnigears.preference.ColorSelectPreference) RestrictedSwitchPreference(com.android.settingslib.RestrictedSwitchPreference) SeekBarPreference(org.omnirom.omnigears.preference.SeekBarPreference) MasterSwitchPreference(com.android.settings.widget.MasterSwitchPreference) FooterPreference(com.android.settingslib.widget.FooterPreference) Preference(android.support.v7.preference.Preference) SwitchPreference(android.support.v14.preference.SwitchPreference) PreferenceCategory(android.support.v7.preference.PreferenceCategory) FooterPreference(com.android.settingslib.widget.FooterPreference)

Example 48 with FooterPreference

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

the class AppNotificationSettings method setupInfoDesc.

protected void setupInfoDesc(int summaryResId) {
    FooterPreference infoDesc = (FooterPreference) getPreferenceScreen().findPreference(KEY_INFO_DESC);
    infoDesc = new FooterPreference(getPrefContext());
    infoDesc.setSelectable(false);
    infoDesc.setTitle(summaryResId);
    infoDesc.setEnabled(false);
    infoDesc.setOrder(50);
    getPreferenceScreen().addPreference(infoDesc);
}
Also used : FooterPreference(com.android.settingslib.widget.FooterPreference)

Example 49 with FooterPreference

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

the class NotificationSettingsBase method setupBlockDesc.

protected void setupBlockDesc(int summaryResId) {
    mBlockedDesc = (FooterPreference) getPreferenceScreen().findPreference(KEY_BLOCKED_DESC);
    mBlockedDesc = new FooterPreference(getPrefContext());
    mBlockedDesc.setSelectable(false);
    mBlockedDesc.setTitle(summaryResId);
    mBlockedDesc.setEnabled(false);
    mBlockedDesc.setOrder(50);
    getPreferenceScreen().addPreference(mBlockedDesc);
}
Also used : FooterPreference(com.android.settingslib.widget.FooterPreference)

Example 50 with FooterPreference

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

the class NotificationSettingsBase method setupBlockDesc.

protected void setupBlockDesc(int summaryResId) {
    mBlockedDesc = (FooterPreference) getPreferenceScreen().findPreference(KEY_BLOCKED_DESC);
    mBlockedDesc = new FooterPreference(getPrefContext());
    mBlockedDesc.setSelectable(false);
    mBlockedDesc.setTitle(summaryResId);
    mBlockedDesc.setEnabled(false);
    mBlockedDesc.setOrder(50);
    getPreferenceScreen().addPreference(mBlockedDesc);
}
Also used : FooterPreference(com.android.settingslib.widget.FooterPreference)

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