Handle no peeking in app info pages

Bug: 20496400
Change-Id: Icdcb997f35497c7664af948ad7ada722835e42b4
This commit is contained in:
Jason Monk
2015-04-30 11:16:06 -04:00
parent 28c3ba156f
commit 25f9e326ab
7 changed files with 59 additions and 21 deletions

View File

@@ -71,7 +71,7 @@ public class AppOpsDetails extends InstrumentedFragment {
TextView label = (TextView) appSnippet.findViewById(R.id.app_name);
label.setText(mPm.getApplicationLabel(pkgInfo.applicationInfo));
// Version number of application
mAppVersion = (TextView) appSnippet.findViewById(R.id.app_size);
mAppVersion = (TextView) appSnippet.findViewById(R.id.app_summary);
if (pkgInfo.versionName != null) {
mAppVersion.setVisibility(View.VISIBLE);

View File

@@ -87,4 +87,15 @@ public class AppStateNotificationBridge extends AppStateBaseBridge {
return info.extraInfo != null && ((AppRow) info.extraInfo).sensitive;
}
};
public static final AppFilter FILTER_APP_NOTIFICATION_NO_PEEK = new AppFilter() {
@Override
public void init() {
}
@Override
public boolean filterApp(AppEntry info) {
return info.extraInfo != null && !((AppRow) info.extraInfo).peekable;
}
};
}

View File

@@ -45,7 +45,7 @@ public class AppViewHolder {
holder.rootView = convertView;
holder.appName = (TextView) convertView.findViewById(R.id.app_name);
holder.appIcon = (ImageView) convertView.findViewById(R.id.app_icon);
holder.summary = (TextView) convertView.findViewById(R.id.app_size);
holder.summary = (TextView) convertView.findViewById(R.id.app_summary);
holder.disabled = (TextView) convertView.findViewById(R.id.app_disabled);
holder.checkBox = (CheckBox) convertView.findViewById(R.id.app_on_sdcard);
convertView.setTag(holder);

View File

@@ -364,7 +364,7 @@ public class InstalledAppDetails extends AppInfoBase
TextView label = (TextView) appSnippet.findViewById(R.id.app_name);
label.setText(mAppEntry.label);
// Version number of application
mAppVersion = (TextView) appSnippet.findViewById(R.id.app_size);
mAppVersion = (TextView) appSnippet.findViewById(R.id.app_summary);
if (pkgInfo != null && pkgInfo.versionName != null) {
mAppVersion.setVisibility(View.VISIBLE);
@@ -675,15 +675,29 @@ public class InstalledAppDetails extends AppInfoBase
public static CharSequence getNotificationSummary(AppRow appRow, Context context) {
if (appRow.banned) {
return context.getString(R.string.notifications_disabled);
} else if (appRow.priority) {
if (appRow.sensitive) {
return context.getString(R.string.notifications_priority_sensitive);
}
return context.getString(R.string.notifications_priority);
} else if (appRow.sensitive) {
return context.getString(R.string.notifications_sensitive);
}
return context.getString(R.string.notifications_enabled);
ArrayList<CharSequence> notifSummary = new ArrayList<>();
if (appRow.priority) {
notifSummary.add(context.getString(R.string.notifications_priority));
}
if (appRow.sensitive) {
notifSummary.add(context.getString(R.string.notifications_sensitive));
}
if (!appRow.peekable) {
notifSummary.add(context.getString(R.string.notifications_no_peeking));
}
switch (notifSummary.size()) {
case 3:
return context.getString(R.string.notifications_three_items,
notifSummary.get(0), notifSummary.get(1), notifSummary.get(2));
case 2:
return context.getString(R.string.notifications_two_items,
notifSummary.get(0), notifSummary.get(1));
case 1:
return notifSummary.get(0);
default:
return context.getString(R.string.notifications_enabled);
}
}
static class DisableChanger extends AsyncTask<Object, Object, Object> {

View File

@@ -111,11 +111,12 @@ public class ManageApplications extends InstrumentedFragment
public static final int FILTER_APPS_DISABLED = 2;
public static final int FILTER_APPS_BLOCKED = 3;
public static final int FILTER_APPS_PRIORITY = 4;
public static final int FILTER_APPS_SENSITIVE = 5;
public static final int FILTER_APPS_PERSONAL = 6;
public static final int FILTER_APPS_WORK = 7;
public static final int FILTER_APPS_WITH_DOMAIN_URLS = 8;
public static final int FILTER_APPS_USAGE_ACCESS = 9;
public static final int FILTER_APPS_NO_PEEKING = 5;
public static final int FILTER_APPS_SENSITIVE = 6;
public static final int FILTER_APPS_PERSONAL = 7;
public static final int FILTER_APPS_WORK = 8;
public static final int FILTER_APPS_WITH_DOMAIN_URLS = 9;
public static final int FILTER_APPS_USAGE_ACCESS = 10;
// This is the string labels for the filter modes above, the order must be kept in sync.
public static final int[] FILTER_LABELS = new int[] {
@@ -124,6 +125,7 @@ public class ManageApplications extends InstrumentedFragment
R.string.filter_apps_disabled, // Disabled
R.string.filter_notif_blocked_apps, // Blocked Notifications
R.string.filter_notif_priority_apps, // Priority Notifications
R.string.filter_notif_no_peeking, // No peeking Notifications
R.string.filter_notif_sensitive_apps, // Sensitive Notifications
R.string.filter_personal_apps, // Personal
R.string.filter_work_apps, // Work
@@ -138,6 +140,7 @@ public class ManageApplications extends InstrumentedFragment
ApplicationsState.FILTER_DISABLED, // Disabled
AppStateNotificationBridge.FILTER_APP_NOTIFICATION_BLOCKED, // Blocked Notifications
AppStateNotificationBridge.FILTER_APP_NOTIFICATION_PRIORITY, // Priority Notifications
AppStateNotificationBridge.FILTER_APP_NOTIFICATION_NO_PEEK, // No peeking Notifications
AppStateNotificationBridge.FILTER_APP_NOTIFICATION_SENSITIVE, // Sensitive Notifications
ApplicationsState.FILTER_PERSONAL, // Personal
ApplicationsState.FILTER_WORK, // Work
@@ -305,6 +308,7 @@ public class ManageApplications extends InstrumentedFragment
mFilterAdapter.enableFilter(FILTER_APPS_BLOCKED);
mFilterAdapter.enableFilter(FILTER_APPS_PRIORITY);
mFilterAdapter.enableFilter(FILTER_APPS_SENSITIVE);
mFilterAdapter.enableFilter(FILTER_APPS_NO_PEEKING);
}
if (mListType == LIST_TYPE_STORAGE) {
mApplications.setOverrideFilter(new VolumeFilter(mVolumeUuid));