Loading res/xml/apps.xml +2 −2 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ settings:searchable="false"/> <Preference android:key="default_apps_v2" android:key="default_apps" android:title="@string/app_default_dashboard_title" android:order="-996" settings:controller="com.android.settings.applications.DefaultAppsPreferenceController"> Loading Loading @@ -85,7 +85,7 @@ </Preference> <Preference android:key="special_access_v2" android:key="special_access" android:fragment="com.android.settings.applications.specialaccess.SpecialAccessSettings" android:title="@string/special_access" android:order="20" Loading src/com/android/settings/applications/AppDashboardFragment.java +1 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ public class AppDashboardFragment extends DashboardFragment { use(SpecialAppAccessPreferenceController.class).setSession(getSettingsLifecycle()); mAppsPreferenceController = use(AppsPreferenceController.class); mAppsPreferenceController.setFragment(this /* fragment */); getSettingsLifecycle().addObserver(mAppsPreferenceController); final HibernatedAppsPreferenceController hibernatedAppsPreferenceController = use(HibernatedAppsPreferenceController.class); Loading src/com/android/settings/applications/AppsPreferenceController.java +22 −2 Original line number Diff line number Diff line Loading @@ -26,6 +26,9 @@ import android.util.ArrayMap; import androidx.annotation.VisibleForTesting; import androidx.fragment.app.Fragment; import androidx.lifecycle.Lifecycle; import androidx.lifecycle.LifecycleObserver; import androidx.lifecycle.OnLifecycleEvent; import androidx.preference.Preference; import androidx.preference.PreferenceCategory; import androidx.preference.PreferenceScreen; Loading @@ -45,7 +48,8 @@ import java.util.Map; * This controller displays up to four recently used apps. * If there is no recently used app, we only show up an "App Info" preference. */ public class AppsPreferenceController extends BasePreferenceController { public class AppsPreferenceController extends BasePreferenceController implements LifecycleObserver { public static final int SHOW_RECENT_APP_COUNT = 4; Loading Loading @@ -73,6 +77,7 @@ public class AppsPreferenceController extends BasePreferenceController { Preference mSeeAllPref; private Fragment mHost; private boolean mInitialLaunch = false; public AppsPreferenceController(Context context) { super(context, KEY_RECENT_APPS_CATEGORY); Loading @@ -95,13 +100,24 @@ public class AppsPreferenceController extends BasePreferenceController { super.displayPreference(screen); initPreferences(screen); refreshUi(); mInitialLaunch = true; } @Override public void updateState(Preference preference) { super.updateState(preference); if (!mInitialLaunch) { refreshUi(); } } /** * Called when the apps page pauses. */ @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE) public void onPause() { mInitialLaunch = false; } @VisibleForTesting void refreshUi() { Loading @@ -109,11 +125,15 @@ public class AppsPreferenceController extends BasePreferenceController { mRecentApps = loadRecentApps(); if (!mRecentApps.isEmpty()) { displayRecentApps(); mAllAppsInfoPref.setVisible(false); mRecentAppsCategory.setVisible(true); mGeneralCategory.setVisible(true); mSeeAllPref.setVisible(true); } else { mAllAppsInfoPref.setVisible(true); mRecentAppsCategory.setVisible(false); mGeneralCategory.setVisible(false); mSeeAllPref.setVisible(false); } } Loading Loading
res/xml/apps.xml +2 −2 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ settings:searchable="false"/> <Preference android:key="default_apps_v2" android:key="default_apps" android:title="@string/app_default_dashboard_title" android:order="-996" settings:controller="com.android.settings.applications.DefaultAppsPreferenceController"> Loading Loading @@ -85,7 +85,7 @@ </Preference> <Preference android:key="special_access_v2" android:key="special_access" android:fragment="com.android.settings.applications.specialaccess.SpecialAccessSettings" android:title="@string/special_access" android:order="20" Loading
src/com/android/settings/applications/AppDashboardFragment.java +1 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ public class AppDashboardFragment extends DashboardFragment { use(SpecialAppAccessPreferenceController.class).setSession(getSettingsLifecycle()); mAppsPreferenceController = use(AppsPreferenceController.class); mAppsPreferenceController.setFragment(this /* fragment */); getSettingsLifecycle().addObserver(mAppsPreferenceController); final HibernatedAppsPreferenceController hibernatedAppsPreferenceController = use(HibernatedAppsPreferenceController.class); Loading
src/com/android/settings/applications/AppsPreferenceController.java +22 −2 Original line number Diff line number Diff line Loading @@ -26,6 +26,9 @@ import android.util.ArrayMap; import androidx.annotation.VisibleForTesting; import androidx.fragment.app.Fragment; import androidx.lifecycle.Lifecycle; import androidx.lifecycle.LifecycleObserver; import androidx.lifecycle.OnLifecycleEvent; import androidx.preference.Preference; import androidx.preference.PreferenceCategory; import androidx.preference.PreferenceScreen; Loading @@ -45,7 +48,8 @@ import java.util.Map; * This controller displays up to four recently used apps. * If there is no recently used app, we only show up an "App Info" preference. */ public class AppsPreferenceController extends BasePreferenceController { public class AppsPreferenceController extends BasePreferenceController implements LifecycleObserver { public static final int SHOW_RECENT_APP_COUNT = 4; Loading Loading @@ -73,6 +77,7 @@ public class AppsPreferenceController extends BasePreferenceController { Preference mSeeAllPref; private Fragment mHost; private boolean mInitialLaunch = false; public AppsPreferenceController(Context context) { super(context, KEY_RECENT_APPS_CATEGORY); Loading @@ -95,13 +100,24 @@ public class AppsPreferenceController extends BasePreferenceController { super.displayPreference(screen); initPreferences(screen); refreshUi(); mInitialLaunch = true; } @Override public void updateState(Preference preference) { super.updateState(preference); if (!mInitialLaunch) { refreshUi(); } } /** * Called when the apps page pauses. */ @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE) public void onPause() { mInitialLaunch = false; } @VisibleForTesting void refreshUi() { Loading @@ -109,11 +125,15 @@ public class AppsPreferenceController extends BasePreferenceController { mRecentApps = loadRecentApps(); if (!mRecentApps.isEmpty()) { displayRecentApps(); mAllAppsInfoPref.setVisible(false); mRecentAppsCategory.setVisible(true); mGeneralCategory.setVisible(true); mSeeAllPref.setVisible(true); } else { mAllAppsInfoPref.setVisible(true); mRecentAppsCategory.setVisible(false); mGeneralCategory.setVisible(false); mSeeAllPref.setVisible(false); } } Loading