Merge "Update recently opened app string and "see all" summary"
This commit is contained in:
committed by
Android (Google) Code Review
commit
61eb68dae9
@@ -2530,8 +2530,6 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data android:name="com.android.settings.category"
|
<meta-data android:name="com.android.settings.category"
|
||||||
android:value="com.android.settings.category.ia.apps"/>
|
android:value="com.android.settings.category.ia.apps"/>
|
||||||
<meta-data android:name="com.android.settings.summary"
|
|
||||||
android:resource="@string/summary_empty"/>
|
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.notification.ConfigureNotificationSettings" />
|
android:value="com.android.settings.notification.ConfigureNotificationSettings" />
|
||||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||||
|
@@ -3521,9 +3521,9 @@
|
|||||||
<!-- Applications settings screen, setting check box title. If checked, the system allows installation of applications that are downloaded from random places, such as web sites. [CHAR LIMIT=30] -->
|
<!-- Applications settings screen, setting check box title. If checked, the system allows installation of applications that are downloaded from random places, such as web sites. [CHAR LIMIT=30] -->
|
||||||
<string name="install_applications_title">Allow all app sources</string>
|
<string name="install_applications_title">Allow all app sources</string>
|
||||||
<!-- Category title listing recently used apps [CHAR_LIMIT=50]-->
|
<!-- Category title listing recently used apps [CHAR_LIMIT=50]-->
|
||||||
<string name="recent_app_category_title">Recently used apps</string>
|
<string name="recent_app_category_title">Recently opened</string>
|
||||||
<!-- Preference title for showing all apps on device [CHAR_LIMIT=50]-->
|
<!-- Preference title for showing all apps on device [CHAR_LIMIT=50]-->
|
||||||
<string name="see_all_apps_title">See all apps</string>
|
<string name="see_all_apps_title">See all <xliff:g>%1$d</xliff:g> installed apps</string>
|
||||||
|
|
||||||
<!-- Warning that appears below the unknown sources switch in settings -->
|
<!-- Warning that appears below the unknown sources switch in settings -->
|
||||||
<string name="install_all_warning" product="tablet">
|
<string name="install_all_warning" product="tablet">
|
||||||
|
@@ -30,7 +30,6 @@
|
|||||||
<Preference
|
<Preference
|
||||||
android:title="@string/applications_settings"
|
android:title="@string/applications_settings"
|
||||||
android:key="all_app_info"
|
android:key="all_app_info"
|
||||||
android:summary="@string/summary_placeholder"
|
|
||||||
android:order="20">
|
android:order="20">
|
||||||
<intent
|
<intent
|
||||||
android:action="android.intent.action.MAIN"
|
android:action="android.intent.action.MAIN"
|
||||||
|
@@ -77,6 +77,7 @@ public class RecentAppsPreferenceController extends PreferenceController
|
|||||||
|
|
||||||
private PreferenceCategory mCategory;
|
private PreferenceCategory mCategory;
|
||||||
private Preference mSeeAllPref;
|
private Preference mSeeAllPref;
|
||||||
|
private boolean mHasRecentApps;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
SKIP_SYSTEM_PACKAGES.addAll(Arrays.asList(
|
SKIP_SYSTEM_PACKAGES.addAll(Arrays.asList(
|
||||||
@@ -133,15 +134,20 @@ public class RecentAppsPreferenceController extends PreferenceController
|
|||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
super.updateState(preference);
|
super.updateState(preference);
|
||||||
|
refreshUi(mCategory.getContext());
|
||||||
// Show total number of installed apps as See all's summary.
|
// Show total number of installed apps as See all's summary.
|
||||||
new InstalledAppCounter(mContext, InstalledAppCounter.IGNORE_INSTALL_REASON,
|
new InstalledAppCounter(mContext, InstalledAppCounter.IGNORE_INSTALL_REASON,
|
||||||
new PackageManagerWrapperImpl(mContext.getPackageManager())) {
|
new PackageManagerWrapperImpl(mContext.getPackageManager())) {
|
||||||
@Override
|
@Override
|
||||||
protected void onCountComplete(int num) {
|
protected void onCountComplete(int num) {
|
||||||
mSeeAllPref.setSummary(mContext.getString(R.string.apps_summary, num));
|
if (mHasRecentApps) {
|
||||||
|
mSeeAllPref.setTitle(mContext.getString(R.string.see_all_apps_title, num));
|
||||||
|
} else {
|
||||||
|
mSeeAllPref.setSummary(mContext.getString(R.string.apps_summary, num));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.execute();
|
}.execute();
|
||||||
refreshUi(mCategory.getContext());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -155,8 +161,10 @@ public class RecentAppsPreferenceController extends PreferenceController
|
|||||||
reloadData();
|
reloadData();
|
||||||
final List<UsageStats> recentApps = getDisplayableRecentAppList();
|
final List<UsageStats> recentApps = getDisplayableRecentAppList();
|
||||||
if (recentApps != null && !recentApps.isEmpty()) {
|
if (recentApps != null && !recentApps.isEmpty()) {
|
||||||
|
mHasRecentApps = true;
|
||||||
displayRecentApps(prefContext, recentApps);
|
displayRecentApps(prefContext, recentApps);
|
||||||
} else {
|
} else {
|
||||||
|
mHasRecentApps = false;
|
||||||
displayOnlyAppInfo();
|
displayOnlyAppInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -185,7 +193,7 @@ public class RecentAppsPreferenceController extends PreferenceController
|
|||||||
|
|
||||||
private void displayRecentApps(Context prefContext, List<UsageStats> recentApps) {
|
private void displayRecentApps(Context prefContext, List<UsageStats> recentApps) {
|
||||||
mCategory.setTitle(R.string.recent_app_category_title);
|
mCategory.setTitle(R.string.recent_app_category_title);
|
||||||
mSeeAllPref.setTitle(R.string.see_all_apps_title);
|
mSeeAllPref.setSummary(null);
|
||||||
mSeeAllPref.setIcon(R.drawable.ic_chevron_right_24dp);
|
mSeeAllPref.setIcon(R.drawable.ic_chevron_right_24dp);
|
||||||
|
|
||||||
// Rebind prefs/avoid adding new prefs if possible. Adding/removing prefs causes jank.
|
// Rebind prefs/avoid adding new prefs if possible. Adding/removing prefs causes jank.
|
||||||
|
@@ -178,7 +178,7 @@ public class RecentAppsPreferenceControllerTest {
|
|||||||
// it's invalid app.
|
// it's invalid app.
|
||||||
verify(mCategory, times(1)).addPreference(any(Preference.class));
|
verify(mCategory, times(1)).addPreference(any(Preference.class));
|
||||||
|
|
||||||
verify(mSeeAllPref).setTitle(R.string.see_all_apps_title);
|
verify(mSeeAllPref).setSummary(null);
|
||||||
verify(mSeeAllPref).setIcon(R.drawable.ic_chevron_right_24dp);
|
verify(mSeeAllPref).setIcon(R.drawable.ic_chevron_right_24dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user