diff options
author | Michael Jurka <mikejurka@google.com> | 2011-08-09 22:02:20 -0700 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2011-08-09 22:36:01 -0700 |
commit | c57b7a8233d32c6dd8de5057c570afe3f50e3ef2 (patch) | |
tree | c6545d4d2f2f8adb888cc6abf99a5742a6aa94af | |
parent | 146eef2808de1ab5767e0a089a0e859010107f34 (diff) | |
download | packages_apps_trebuchet-c57b7a8233d32c6dd8de5057c570afe3f50e3ef2.zip packages_apps_trebuchet-c57b7a8233d32c6dd8de5057c570afe3f50e3ef2.tar.gz packages_apps_trebuchet-c57b7a8233d32c6dd8de5057c570afe3f50e3ef2.tar.bz2 |
Adding a progress bar while All Apps is loading
- also, removing some unused imports
Change-Id: Icf46beb9fa9d89bc06cba33c148ceb7d668cd402
-rw-r--r-- | res/layout/apps_customize_progressbar.xml | 24 | ||||
-rw-r--r-- | src/com/android/launcher2/AppsCustomizeTabHost.java | 5 | ||||
-rw-r--r-- | src/com/android/launcher2/BubbleTextView.java | 1 | ||||
-rw-r--r-- | src/com/android/launcher2/DragController.java | 1 | ||||
-rw-r--r-- | src/com/android/launcher2/FolderIcon.java | 1 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 28 | ||||
-rw-r--r-- | src/com/android/launcher2/LauncherModel.java | 4 | ||||
-rw-r--r-- | src/com/android/launcher2/Utilities.java | 6 |
8 files changed, 57 insertions, 13 deletions
diff --git a/res/layout/apps_customize_progressbar.xml b/res/layout/apps_customize_progressbar.xml new file mode 100644 index 0000000..d790f21 --- /dev/null +++ b/res/layout/apps_customize_progressbar.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<ProgressBar + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher" + style="?android:attr/progressBarStyleLarge" + android:id="@+id/apps_customize_progress_bar" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_marginRight="5dp" /> diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java index 8f067fa..dcf4441 100644 --- a/src/com/android/launcher2/AppsCustomizeTabHost.java +++ b/src/com/android/launcher2/AppsCustomizeTabHost.java @@ -133,6 +133,11 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona // it off here) mTabs.getLayoutParams().width = contentWidth; mTabsContainer.setAlpha(1f); + post(new Runnable() { + public void run() { + mTabs.requestLayout(); + } + }); } } super.onMeasure(widthMeasureSpec, heightMeasureSpec); diff --git a/src/com/android/launcher2/BubbleTextView.java b/src/com/android/launcher2/BubbleTextView.java index 08f337e..45f58a4 100644 --- a/src/com/android/launcher2/BubbleTextView.java +++ b/src/com/android/launcher2/BubbleTextView.java @@ -29,7 +29,6 @@ import android.graphics.Region; import android.graphics.Region.Op; import android.graphics.drawable.Drawable; import android.util.AttributeSet; -import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.widget.TextView; diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java index 647a425..afbf80d 100644 --- a/src/com/android/launcher2/DragController.java +++ b/src/com/android/launcher2/DragController.java @@ -31,7 +31,6 @@ import android.view.ViewConfiguration; import android.view.inputmethod.InputMethodManager; import com.android.launcher.R; -import com.android.launcher2.DropTarget.DragObject; import java.util.ArrayList; diff --git a/src/com/android/launcher2/FolderIcon.java b/src/com/android/launcher2/FolderIcon.java index b6b027a..6cd7847 100644 --- a/src/com/android/launcher2/FolderIcon.java +++ b/src/com/android/launcher2/FolderIcon.java @@ -24,7 +24,6 @@ import android.content.Context; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.Color; -import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.Rect; import android.graphics.drawable.Drawable; diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index f8e3e1c..b1f56d0 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -291,6 +291,11 @@ public final class Launcher extends Activity mModel.startLoader(this, true); } + if (!mModel.isAllAppsLoaded()) { + ViewGroup appsCustomizeContentParent = (ViewGroup) mAppsCustomizeContent.getParent(); + mInflater.inflate(R.layout.apps_customize_progressbar, appsCustomizeContentParent); + } + // For handling default keys mDefaultKeySsb = new SpannableStringBuilder(); Selection.setSelection(mDefaultKeySsb, 0); @@ -2771,10 +2776,25 @@ public final class Launcher extends Activity * * Implementation of the method from LauncherModel.Callbacks. */ - public void bindAllApplications(ArrayList<ApplicationInfo> apps) { - if (mAppsCustomizeContent != null) { - mAppsCustomizeContent.setApps(apps); - } + public void bindAllApplications(final ArrayList<ApplicationInfo> apps) { + // Remove the progress bar entirely; we could also make it GONE + // but better to remove it since we know it's not going to be used + View progressBar = mAppsCustomizeTabHost. + findViewById(R.id.apps_customize_progress_bar); + if (progressBar != null) { + ((ViewGroup)progressBar.getParent()).removeView(progressBar); + } + // We just post the call to setApps so the user sees the progress bar + // disappear-- otherwise, it just looks like the progress bar froze + // which doesn't look great + mAppsCustomizeTabHost.post(new Runnable() { + public void run() { + if (mAppsCustomizeContent != null) { + mAppsCustomizeContent.setApps(apps); + } + } + }); + updateIconsAffectedByPackageManagerChanges(); updateGlobalSearchIcon(); } diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index 206de14..c46e175 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -644,6 +644,10 @@ public class LauncherModel extends BroadcastReceiver { } } + public boolean isAllAppsLoaded() { + return mAllAppsLoaded; + } + /** * Runnable for the thread that loads the contents of the launcher: * - workspace icons diff --git a/src/com/android/launcher2/Utilities.java b/src/com/android/launcher2/Utilities.java index 1175fad..f7f97c5 100644 --- a/src/com/android/launcher2/Utilities.java +++ b/src/com/android/launcher2/Utilities.java @@ -29,17 +29,11 @@ import android.graphics.Paint; import android.graphics.PaintFlagsDrawFilter; import android.graphics.PorterDuff; import android.graphics.Rect; -import android.graphics.RectF; import android.graphics.TableMaskFilter; -import android.graphics.Typeface; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.PaintDrawable; -import android.text.StaticLayout; -import android.text.TextPaint; -import android.text.Layout.Alignment; import android.util.DisplayMetrics; -import android.util.Log; import com.android.launcher.R; |