summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/Utils.java
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2015-03-31 12:59:33 -0400
committerJason Monk <jmonk@google.com>2015-04-13 14:23:37 -0400
commitb5aa73f46f812ba03518a6d1ac218e3af5975236 (patch)
treeb41b5119e9ae7689538a98a95e9dda3ac347ad3a /src/com/android/settings/Utils.java
parent5f937152a5b851a3a2d9e03208a4b4b5f16bae94 (diff)
downloadpackages_apps_Settings-b5aa73f46f812ba03518a6d1ac218e3af5975236.tar.gz
packages_apps_Settings-b5aa73f46f812ba03518a6d1ac218e3af5975236.tar.bz2
packages_apps_Settings-b5aa73f46f812ba03518a6d1ac218e3af5975236.zip
Fix loading screens for manage and running apps
Also add loading screen to manage permissions as this can take a long time to load in some circumstances. Build loading screens into Utils and SettingsPreferenceFragment so that it can be easily used other places in the future. Change-Id: I7febd06695487e02ced793a9fd418051b5f0eab8
Diffstat (limited to 'src/com/android/settings/Utils.java')
-rw-r--r--src/com/android/settings/Utils.java40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 23b2c8554..dc4b484d3 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -39,8 +39,8 @@ import android.content.pm.ResolveInfo;
import android.content.pm.Signature;
import android.content.pm.UserInfo;
import android.content.res.Resources;
-import android.content.res.TypedArray;
import android.content.res.Resources.NotFoundException;
+import android.content.res.TypedArray;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@@ -74,6 +74,9 @@ import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.view.animation.Animation;
+import android.view.animation.Animation.AnimationListener;
+import android.view.animation.AnimationUtils;
import android.widget.ListView;
import android.widget.TabWidget;
@@ -1158,4 +1161,39 @@ public final class Utils {
? R.string.launch_defaults_some
: R.string.launch_defaults_none);
}
+
+ 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);
+ }
+ }
}