Fix double divider in Apps & notifications page

- The second divider is shown after we set a background to the pinned
  header.
- Fix it by simply hiding the pinned header instead of its inner views.

Fixes: 133231218
Test: robotest, visual
Change-Id: I53add6f01930299425ce96d23350f9f066e85145
This commit is contained in:
Jason Chiu
2019-06-05 17:31:31 +08:00
parent 64fec889df
commit cfa36dbaeb
3 changed files with 29 additions and 15 deletions

View File

@@ -44,8 +44,6 @@ public class AppAndNotificationDashboardFragment extends DashboardFragment
private static final String TAG = "AppAndNotifDashboard";
private View mProgressHeader;
private View mProgressAnimation;
private RecentAppStatsMixin mRecentAppStatsMixin;
private RecentAppsPreferenceController mRecentAppsPreferenceController;
private AllAppsInfoPreferenceController mAllAppsInfoPreferenceController;
@@ -92,20 +90,19 @@ public class AppAndNotificationDashboardFragment extends DashboardFragment
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mProgressHeader = setPinnedHeaderView(R.layout.progress_header);
mProgressAnimation = mProgressHeader.findViewById(R.id.progress_bar_animation);
setLoadingEnabled(false);
setPinnedHeaderView(R.layout.progress_header);
showPinnedHeader(false);
}
@Override
public void onStart() {
super.onStart();
setLoadingEnabled(true);
showPinnedHeader(true);
}
@Override
public void onReloadDataCompleted(@NonNull List<UsageStats> recentApps) {
setLoadingEnabled(false);
showPinnedHeader(false);
if (!recentApps.isEmpty()) {
Utils.setActionBarShadowAnimation(getActivity(), getSettingsLifecycle(),
getListView());
@@ -117,13 +114,6 @@ public class AppAndNotificationDashboardFragment extends DashboardFragment
return buildPreferenceControllers(context);
}
private void setLoadingEnabled(boolean enabled) {
if (mProgressHeader != null && mProgressAnimation != null) {
mProgressHeader.setVisibility(enabled ? View.VISIBLE : View.INVISIBLE);
mProgressAnimation.setVisibility(enabled ? View.VISIBLE : View.INVISIBLE);
}
}
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new EmergencyBroadcastPreferenceController(context,