From 4afc3f2951df1eb34b3e28b097ab2a1881440c8e Mon Sep 17 00:00:00 2001 From: Daniel Nishi Date: Tue, 20 Jun 2017 13:56:04 -0700 Subject: [PATCH] Don't accordion the progress bar out. This stops an animation from triggering on the storage settings screen when entering it. Because we don't load the screen until data has loaded, we run no risk of showing an uninitialized progress bar. Thus, we can just always show the progress bar. Change-Id: I31814a12b9c39a33fa0fbbc4826eb4138cf09a74 Fixes: 62549522 Test: Manual --- res/layout/storage_item.xml | 1 - .../settings/deviceinfo/StorageItemPreference.java | 12 ++++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/res/layout/storage_item.xml b/res/layout/storage_item.xml index a234dc01213..72c8ee3184b 100644 --- a/res/layout/storage_item.xml +++ b/res/layout/storage_item.xml @@ -81,7 +81,6 @@ android:layout_marginStart="72dp" android:layout_marginTop="16dp" android:layout_marginBottom="8dp" - android:visibility="gone" android:max="100" style="?android:attr/progressBarStyleHorizontal" /> diff --git a/src/com/android/settings/deviceinfo/StorageItemPreference.java b/src/com/android/settings/deviceinfo/StorageItemPreference.java index 6ae6c1adc4e..3dcf935aba7 100644 --- a/src/com/android/settings/deviceinfo/StorageItemPreference.java +++ b/src/com/android/settings/deviceinfo/StorageItemPreference.java @@ -30,9 +30,11 @@ import com.android.settings.utils.FileSizeFormatter; public class StorageItemPreference extends Preference { public int userHandle; + private static final int UNINITIALIZED = -1; + private ProgressBar mProgressBar; private static final int PROGRESS_MAX = 100; - private int mProgressPercent = -1; + private int mProgressPercent = UNINITIALIZED; public StorageItemPreference(Context context) { this(context, null); @@ -60,15 +62,9 @@ public class StorageItemPreference extends Preference { } protected void updateProgressBar() { - if (mProgressBar == null) + if (mProgressBar == null || mProgressPercent == UNINITIALIZED) return; - if (mProgressPercent == -1) { - mProgressBar.setVisibility(View.GONE); - return; - } - - mProgressBar.setVisibility(View.VISIBLE); mProgressBar.setMax(PROGRESS_MAX); mProgressBar.setProgress(mProgressPercent); }