use of com.android.settingslib.widget.FooterPreference in project android_packages_apps_Settings by LineageOS.
the class BluetoothSettingsTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
FakeFeatureFactory.setupForTest(mContext);
mFeatureFactory = (FakeFeatureFactory) FakeFeatureFactory.getFactory(mContext);
mFragment = spy(new BluetoothSettings());
doReturn(mContext).when(mFragment).getContext();
doReturn(mResource).when(mFragment).getResources();
doReturn(mActivity).when(mFragment).getActivity();
mContainer = new View(mContext);
mEmptyMessage = new TextView(mContext);
doReturn(mContainer).when(mActivity).findViewById(android.R.id.list_container);
doReturn(mEmptyMessage).when(mActivity).findViewById(android.R.id.empty);
mFooterPreference = new FooterPreference(RuntimeEnvironment.application);
mFragment.setLocalBluetoothAdapter(mLocalAdapter);
mFragment.mPairingPrefController = mPairingPreferenceController;
}
use of com.android.settingslib.widget.FooterPreference in project android_packages_apps_Settings by LineageOS.
the class ChannelNotificationSettings method addFooterPref.
private void addFooterPref() {
if (!TextUtils.isEmpty(mChannel.getDescription())) {
FooterPreference descPref = new FooterPreference(getPrefContext());
descPref.setOrder(ORDER_LAST);
descPref.setSelectable(false);
descPref.setTitle(mChannel.getDescription());
getPreferenceScreen().addPreference(descPref);
}
}
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);
}
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);
}
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);
}
Aggregations