Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83365ec6 authored by Fan Zhang's avatar Fan Zhang
Browse files

Update recently opened app string and "see all" summary

Change-Id: I84a01f01ac1c685db87970c3137f30ba58c800b3
Fix: 62040104
Test: make RunSettingsRoboTests
parent 3cad98f6
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -2530,8 +2530,6 @@
            </intent-filter>
            <meta-data android:name="com.android.settings.category"
                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"
                android:value="com.android.settings.notification.ConfigureNotificationSettings" />
            <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
+2 −2
Original line number Diff line number Diff line
@@ -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] -->
    <string name="install_applications_title">Allow all app sources</string>
    <!-- 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]-->
    <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 -->
    <string name="install_all_warning" product="tablet">
+0 −1
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@
        <Preference
            android:title="@string/applications_settings"
            android:key="all_app_info"
            android:summary="@string/summary_placeholder"
            android:order="20">
            <intent
                android:action="android.intent.action.MAIN"
+11 −3
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ public class RecentAppsPreferenceController extends PreferenceController

    private PreferenceCategory mCategory;
    private Preference mSeeAllPref;
    private boolean mHasRecentApps;

    static {
        SKIP_SYSTEM_PACKAGES.addAll(Arrays.asList(
@@ -133,15 +134,20 @@ public class RecentAppsPreferenceController extends PreferenceController
    @Override
    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 PackageManagerWrapperImpl(mContext.getPackageManager())) {
            @Override
            protected void onCountComplete(int 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();
        refreshUi(mCategory.getContext());

    }

    @Override
@@ -155,8 +161,10 @@ public class RecentAppsPreferenceController extends PreferenceController
        reloadData();
        final List<UsageStats> recentApps = getDisplayableRecentAppList();
        if (recentApps != null && !recentApps.isEmpty()) {
            mHasRecentApps = true;
            displayRecentApps(prefContext, recentApps);
        } else {
            mHasRecentApps = false;
            displayOnlyAppInfo();
        }
    }
@@ -185,7 +193,7 @@ public class RecentAppsPreferenceController extends PreferenceController

    private void displayRecentApps(Context prefContext, List<UsageStats> recentApps) {
        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);

        // Rebind prefs/avoid adding new prefs if possible. Adding/removing prefs causes jank.
+1 −1
Original line number Diff line number Diff line
@@ -178,7 +178,7 @@ public class RecentAppsPreferenceControllerTest {
        // it's invalid app.
        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);
    }