Fix double divider in Privacy page

The second divider is shown after we set a background to the pinned
header.

- Simply hide the pinned header instead of its inner views.
- Move setActionBarShadowAnimation to controller and just call it when
  the bar chart is available.

Fixes: 134652710
Test: robotest, visual
Change-Id: I4381e5ca1a042583d3e5874f5600719267b19786
This commit is contained in:
Jason Chiu
2019-06-14 17:24:26 +08:00
parent 5eb2c963c0
commit f3e3d7a46b
4 changed files with 15 additions and 53 deletions

View File

@@ -45,11 +45,6 @@ public class PrivacyDashboardFragment extends DashboardFragment {
private static final String KEY_NOTIFICATION_WORK_PROFILE_NOTIFICATIONS =
"privacy_lock_screen_work_profile_notifications";
@VisibleForTesting
View mProgressHeader;
@VisibleForTesting
View mProgressAnimation;
@Override
public int getMetricsCategory() {
return SettingsEnums.TOP_LEVEL_PRIVACY;
@@ -84,23 +79,13 @@ public class PrivacyDashboardFragment extends DashboardFragment {
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Utils.setActionBarShadowAnimation(getActivity(), getSettingsLifecycle(), getListView());
initLoadingBar();
}
@VisibleForTesting
void initLoadingBar() {
mProgressHeader = setPinnedHeaderView(R.layout.progress_header);
mProgressAnimation = mProgressHeader.findViewById(R.id.progress_bar_animation);
setLoadingEnabled(false);
}
@VisibleForTesting
void setLoadingEnabled(boolean enabled) {
if (mProgressHeader != null && mProgressAnimation != null) {
mProgressHeader.setVisibility(enabled ? View.VISIBLE : View.INVISIBLE);
mProgressAnimation.setVisibility(enabled ? View.VISIBLE : View.INVISIBLE);
}
setPinnedHeaderView(R.layout.progress_header);
showPinnedHeader(false);
}
private static List<AbstractPreferenceController> buildPreferenceControllers(