diff --git a/res/values/strings.xml b/res/values/strings.xml
index d0556d30be3..6a68b8a24ca 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -7358,7 +7358,7 @@
Recently sent
- See all apps
+ See all from last 7 days
Advanced
diff --git a/src/com/android/settings/notification/NotificationAppPreference.java b/src/com/android/settings/notification/NotificationAppPreference.java
index a6bcdd6fd9b..e43c52b8fea 100644
--- a/src/com/android/settings/notification/NotificationAppPreference.java
+++ b/src/com/android/settings/notification/NotificationAppPreference.java
@@ -17,35 +17,38 @@ package com.android.settings.notification;
import android.content.Context;
import android.support.v7.preference.PreferenceViewHolder;
-import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
-import android.widget.ProgressBar;
import android.widget.Switch;
import com.android.settings.R;
+import com.android.settings.widget.MasterSwitchPreference;
import com.android.settingslib.RestrictedLockUtils;
-import com.android.settingslib.TwoTargetPreference;
/**
* Shows an app icon, title and summary. Has a second switch touch target.
*/
-public class NotificationAppPreference extends TwoTargetPreference {
+public class NotificationAppPreference extends MasterSwitchPreference {
- private int mProgress;
- private boolean mProgressVisible;
private Switch mSwitch;
private boolean mChecked;
private boolean mEnableSwitch = true;
public NotificationAppPreference(Context context) {
super(context);
- setLayoutResource(R.layout.preference_app);
}
public NotificationAppPreference(Context context, AttributeSet attrs) {
super(context, attrs);
- setLayoutResource(R.layout.preference_app);
+ }
+
+ public NotificationAppPreference(Context context, AttributeSet attrs,
+ int defStyleAttr, int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+ }
+
+ public NotificationAppPreference(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
}
@Override
@@ -53,26 +56,10 @@ public class NotificationAppPreference extends TwoTargetPreference {
return R.layout.preference_widget_master_switch;
}
- public void setProgress(int amount) {
- mProgress = amount;
- mProgressVisible = true;
- notifyChanged();
- }
-
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
super.onBindViewHolder(view);
- view.findViewById(R.id.summary_container)
- .setVisibility(TextUtils.isEmpty(getSummary()) ? View.GONE : View.VISIBLE);
- final ProgressBar progress = (ProgressBar) view.findViewById(android.R.id.progress);
- if (mProgressVisible) {
- progress.setProgress(mProgress);
- progress.setVisibility(View.VISIBLE);
- } else {
- progress.setVisibility(View.GONE);
- }
-
final View widgetView = view.findViewById(android.R.id.widget_frame);
if (widgetView != null) {
widgetView.setOnClickListener(new View.OnClickListener() {
diff --git a/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java b/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java
index 6cc99f742d9..3867640c86f 100644
--- a/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java
+++ b/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java
@@ -81,7 +81,6 @@ public class RecentNotifyingAppsPreferenceController extends AbstractPreferenceC
private PreferenceCategory mCategory;
private Preference mSeeAllPref;
private Preference mDivider;
- private boolean mHasRecentApps;
static {
SKIP_SYSTEM_PACKAGES.addAll(Arrays.asList(
@@ -142,20 +141,7 @@ public class RecentNotifyingAppsPreferenceController extends AbstractPreferenceC
public void updateState(Preference preference) {
super.updateState(preference);
refreshUi(mCategory.getContext());
- // Show total number of installed apps as See all's summary.
- new InstalledAppCounter(mContext, InstalledAppCounter.IGNORE_INSTALL_REASON,
- new PackageManagerWrapper(mContext.getPackageManager())) {
- @Override
- protected void onCountComplete(int num) {
- if (mHasRecentApps) {
- mSeeAllPref.setTitle(
- mContext.getString(R.string.recent_notifications_see_all_title));
- } else {
- mSeeAllPref.setSummary(mContext.getString(R.string.apps_summary, num));
- }
- }
- }.execute();
-
+ mSeeAllPref.setTitle(mContext.getString(R.string.recent_notifications_see_all_title));
}
@VisibleForTesting
@@ -163,10 +149,8 @@ public class RecentNotifyingAppsPreferenceController extends AbstractPreferenceC
reloadData();
final List recentApps = getDisplayableRecentAppList();
if (recentApps != null && !recentApps.isEmpty()) {
- mHasRecentApps = true;
displayRecentApps(prefContext, recentApps);
} else {
- mHasRecentApps = false;
displayOnlyAllAppsLink();
}
}
@@ -228,7 +212,7 @@ public class RecentNotifyingAppsPreferenceController extends AbstractPreferenceC
pref.setTitle(appEntry.label);
pref.setIcon(mIconDrawableFactory.getBadgedIcon(appEntry.info));
pref.setSummary(StringUtil.formatRelativeTime(mContext,
- System.currentTimeMillis() - app.getLastNotified(), false));
+ System.currentTimeMillis() - app.getLastNotified(), true));
pref.setOrder(i);
Bundle args = new Bundle();
args.putString(AppInfoBase.ARG_PACKAGE_NAME, pkgName);
diff --git a/tests/robotests/src/com/android/settings/notification/NotificationAppPreferenceTest.java b/tests/robotests/src/com/android/settings/notification/NotificationAppPreferenceTest.java
index 4ac7527f651..80780acc336 100644
--- a/tests/robotests/src/com/android/settings/notification/NotificationAppPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/notification/NotificationAppPreferenceTest.java
@@ -211,28 +211,4 @@ public class NotificationAppPreferenceTest {
assertThat(toggle.getContentDescription()).isEqualTo(label);
}
-
- @Test
- public void setSummary_showSummaryContainer() {
- final NotificationAppPreference preference = new NotificationAppPreference(mContext);
- View rootView = View.inflate(mContext, R.layout.preference_app, null /* parent */);
- PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(rootView);
- preference.setSummary("test");
- preference.onBindViewHolder(holder);
-
- assertThat(holder.findViewById(R.id.summary_container).getVisibility())
- .isEqualTo(View.VISIBLE);
- }
-
- @Test
- public void noSummary_hideSummaryContainer() {
- final NotificationAppPreference preference = new NotificationAppPreference(mContext);
- View rootView = View.inflate(mContext, R.layout.preference_app, null /* parent */);
- PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(rootView);
- preference.setSummary(null);
- preference.onBindViewHolder(holder);
-
- assertThat(holder.findViewById(R.id.summary_container).getVisibility())
- .isEqualTo(View.GONE);
- }
}
diff --git a/tests/robotests/src/com/android/settings/notification/RecentNotifyingAppsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/RecentNotifyingAppsPreferenceControllerTest.java
index 13826b2ac85..344770341b8 100644
--- a/tests/robotests/src/com/android/settings/notification/RecentNotifyingAppsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/RecentNotifyingAppsPreferenceControllerTest.java
@@ -290,7 +290,7 @@ public class RecentNotifyingAppsPreferenceControllerTest {
mController.displayPreference(mScreen);
- verify(mCategory).addPreference(argThat(summaryMatches("0 minutes ago")));
+ verify(mCategory).addPreference(argThat(summaryMatches("Just now")));
}
private static ArgumentMatcher summaryMatches(String expected) {