Reduce jank around loading view when opening data usage UI

Change-Id: I3d23d8160b046de8fe125ba0697b7b3d7786453c
Fix: 28181319
Test: robotests
This commit is contained in:
Fan Zhang
2017-06-26 14:22:45 -07:00
parent c26ae0677e
commit 896f1b363c
8 changed files with 227 additions and 86 deletions

View File

@@ -949,43 +949,6 @@ public final class Utils extends com.android.settingslib.Utils {
return result;
}
// TODO: move this out of Utils to a mixin or a controller or a helper class.
@Deprecated
public static void handleLoadingContainer(View loading, View doneLoading, boolean done,
boolean animate) {
setViewShown(loading, !done, animate);
setViewShown(doneLoading, done, animate);
}
private static void setViewShown(final View view, boolean shown, boolean animate) {
if (animate) {
Animation animation = AnimationUtils.loadAnimation(view.getContext(),
shown ? android.R.anim.fade_in : android.R.anim.fade_out);
if (shown) {
view.setVisibility(View.VISIBLE);
} else {
animation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
view.setVisibility(View.INVISIBLE);
}
});
}
view.startAnimation(animation);
} else {
view.clearAnimation();
view.setVisibility(shown ? View.VISIBLE : View.INVISIBLE);
}
}
/**
* Returns the application info of the currently installed MDM package.
*/