Add condition provider access to settings.

Pull NotificationAccessSettings out into a reusable base class
and reuse all of it for a new condition providers settings page.

As with notification listeners, the entire section is hidden if
no apps provide conditions.

Change-Id: Ib5273f3362e392d99647347c23a514e4590f7ac9
This commit is contained in:
John Spurlock
2014-04-29 18:07:23 -04:00
parent a0ceb908bf
commit c9afadb04b
12 changed files with 518 additions and 303 deletions

View File

@@ -225,21 +225,13 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
// === Notification listeners ===
private int getNumEnabledNotificationListeners() {
final String flat = Settings.Secure.getString(getContentResolver(),
Settings.Secure.ENABLED_NOTIFICATION_LISTENERS);
if (flat == null || "".equals(flat)) return 0;
final String[] components = flat.split(":");
return components.length;
}
private void refreshNotificationListeners() {
if (mNotificationAccess != null) {
final int total = NotificationAccessSettings.getListenersCount(mPM);
if (total == 0) {
getPreferenceScreen().removePreference(mNotificationAccess);
} else {
final int n = getNumEnabledNotificationListeners();
final int n = NotificationAccessSettings.getEnabledListenersCount(mContext);
if (n == 0) {
mNotificationAccess.setSummary(getResources().getString(
R.string.manage_notification_access_summary_zero));