Storage Settings hides categories when loading
To hide sorting animation. - Storage Settings always loads cache and updates UI, then loads storage size and updates UI. Remove the chche design because storage category preferences will hide during loading, it no meaning to load from cache and update UI. - Hides loading circle before storage category preferences become visible, it prevents flickers. - Remove Calculating... summary of StorageItemPreference. - Private storage category preferences and secondary user preference become visible at StorageItemPreferenceController#onLoadFinished. Bug: 188731179 Bug: 185547228 Bug: 188615591 Test: atest com.android.settings.deviceinfo atest com.android.settings.deviceinfo.storage make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.deviceinfo make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.deviceinfo.storage manual visual Change-Id: I3ebef5829ef4f806add07f58fa02520804768be5
This commit is contained in:
@@ -53,9 +53,11 @@ public class SecondaryUserController extends AbstractPreferenceController implem
|
||||
UserInfo mUser;
|
||||
private @Nullable
|
||||
StorageItemPreference mStoragePreference;
|
||||
private PreferenceGroup mPreferenceGroup;
|
||||
private Drawable mUserIcon;
|
||||
private long mSize;
|
||||
private long mTotalSizeBytes;
|
||||
private boolean mIsVisible;
|
||||
|
||||
/**
|
||||
* Adds the appropriate controllers to a controller list for handling all secondary users on
|
||||
@@ -115,16 +117,15 @@ public class SecondaryUserController extends AbstractPreferenceController implem
|
||||
if (mStoragePreference == null) {
|
||||
mStoragePreference = new StorageItemPreference(screen.getContext());
|
||||
|
||||
PreferenceGroup group =
|
||||
screen.findPreference(TARGET_PREFERENCE_GROUP_KEY);
|
||||
mPreferenceGroup = screen.findPreference(TARGET_PREFERENCE_GROUP_KEY);
|
||||
mStoragePreference.setTitle(mUser.name);
|
||||
mStoragePreference.setKey(PREFERENCE_KEY_BASE + mUser.id);
|
||||
if (mSize != SIZE_NOT_SET) {
|
||||
mStoragePreference.setStorageSize(mSize, mTotalSizeBytes);
|
||||
}
|
||||
|
||||
group.setVisible(true);
|
||||
group.addPreference(mStoragePreference);
|
||||
mPreferenceGroup.setVisible(mIsVisible);
|
||||
mPreferenceGroup.addPreference(mStoragePreference);
|
||||
maybeSetIcon();
|
||||
}
|
||||
}
|
||||
@@ -168,6 +169,18 @@ public class SecondaryUserController extends AbstractPreferenceController implem
|
||||
mTotalSizeBytes = totalSizeBytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets visibility of the PreferenceGroup of secondary user.
|
||||
*
|
||||
* @param visible Visibility of the PreferenceGroup.
|
||||
*/
|
||||
public void setPreferenceGroupVisible(boolean visible) {
|
||||
mIsVisible = visible;
|
||||
if (mPreferenceGroup != null) {
|
||||
mPreferenceGroup.setVisible(mIsVisible);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleResult(SparseArray<StorageAsyncLoader.StorageResult> stats) {
|
||||
final StorageAsyncLoader.StorageResult result = stats.get(getUser().id);
|
||||
|
Reference in New Issue
Block a user