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

@@ -59,13 +59,15 @@
android:duplicateParentState="true" />
<TextView
android:id="@+id/app_size"
android:id="@+id/app_summary"
android:layout_column="1"
android:layout_row="1"
android:layout_gravity="fill_horizontal|top"
android:textAppearance="@android:style/TextAppearance.Material.Body1"
android:textColor="?android:attr/textColorSecondary"
android:textAlignment="viewStart"
android:singleLine="true"
android:ellipsize="marquee"
android:duplicateParentState="true" />
<TextView

View File

@@ -6423,11 +6423,16 @@
<!-- App notification summary with notifications disabled [CHAR LIMIT=40] -->
<string name="notifications_disabled">Block</string>
<!-- App notification summary with notifications sensitive [CHAR LIMIT=40] -->
<string name="notifications_sensitive">Sensitive</string>
<string name="notifications_sensitive">Sensitive content hidden</string>
<!-- App notification summary with notifications priority [CHAR LIMIT=40] -->
<string name="notifications_priority">Priority</string>
<!-- App notification summary with notifications priority and sensitive [CHAR LIMIT=40] -->
<string name="notifications_priority_sensitive">Priority &amp; Sensitive</string>
<!-- App notification summary with notification peeking disabled [CHAR LIMIT=40] -->
<string name="notifications_no_peeking">No peeking</string>
<!-- App notification summary with 2 items [CHAR LIMIT=15] -->
<string name="notifications_two_items"><xliff:g id="notif_state" example="Priority">%1$s</xliff:g> / <xliff:g id="notif_state" example="Priority">%2$s</xliff:g></string>
<!-- App notification summary with 3 items [CHAR LIMIT=15] -->
<string name="notifications_three_items"><xliff:g id="notif_state" example="Priority">%1$s</xliff:g> / <xliff:g id="notif_state" example="Priority">%2$s</xliff:g> / <xliff:g id="notif_state" example="Priority">%3$s</xliff:g></string>
<!-- Permissions preference summary [CHAR LIMIT=40] -->
<plurals name="permissions_summary">
@@ -6459,7 +6464,9 @@
<!-- Label for showing apps with priority notifications in list [CHAR LIMIT=30] -->
<string name="filter_notif_priority_apps">Priority</string>
<!-- Label for showing apps with sensitive notifications in list [CHAR LIMIT=30] -->
<string name="filter_notif_sensitive_apps">Sensitive</string>
<string name="filter_notif_sensitive_apps">Sensitive content hidden</string>
<!-- Label for showing apps with peeking disabled in list [CHAR LIMIT=30] -->
<string name="filter_notif_no_peeking">No peeking</string>
<!-- Label for showing apps with domain URLs (data URI with http or https) in list [CHAR LIMIT=30] -->
<string name="filter_with_domain_urls_apps">With domain URLs</string>

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,16 +675,30 @@ 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) {
}
ArrayList<CharSequence> notifSummary = new ArrayList<>();
if (appRow.priority) {
notifSummary.add(context.getString(R.string.notifications_priority));
}
if (appRow.sensitive) {
return context.getString(R.string.notifications_priority_sensitive);
notifSummary.add(context.getString(R.string.notifications_sensitive));
}
return context.getString(R.string.notifications_priority);
} else if (appRow.sensitive) {
return 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> {
final PackageManager mPm;

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));