diff options
author | Michael Jurka <mikejurka@google.com> | 2012-01-12 10:43:21 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-01-12 10:43:21 -0800 |
commit | 298ce02189ef73088bab2550db42116a0a7db75d (patch) | |
tree | a0d0c906f202ea1b6aaa4e2e762336b0870c1f66 /src/com/android/launcher2/AppsCustomizePagedView.java | |
parent | efcb54052b0c8dfef2fe0251ab9cb5ee7bd5a051 (diff) | |
parent | 82369a16126a1030c1c9203dc62b33c2598add89 (diff) | |
download | android_packages_apps_Trebuchet-298ce02189ef73088bab2550db42116a0a7db75d.tar.gz android_packages_apps_Trebuchet-298ce02189ef73088bab2550db42116a0a7db75d.tar.bz2 android_packages_apps_Trebuchet-298ce02189ef73088bab2550db42116a0a7db75d.zip |
Merge "Delete dead code"
Diffstat (limited to 'src/com/android/launcher2/AppsCustomizePagedView.java')
-rw-r--r-- | src/com/android/launcher2/AppsCustomizePagedView.java | 120 |
1 files changed, 4 insertions, 116 deletions
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java index 94b92d197..aeb276a65 100644 --- a/src/com/android/launcher2/AppsCustomizePagedView.java +++ b/src/com/android/launcher2/AppsCustomizePagedView.java @@ -75,8 +75,7 @@ interface AsyncTaskCallback { */ class AsyncTaskPageData { enum Type { - LoadWidgetPreviewData, - LoadHolographicIconsData + LoadWidgetPreviewData } AsyncTaskPageData(int p, ArrayList<Object> l, ArrayList<Bitmap> si, AsyncTaskCallback bgR, @@ -226,7 +225,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen // Previews & outlines ArrayList<AppsCustomizeAsyncTask> mRunningTasks; - private HolographicOutlineHelper mHolographicOutlineHelper; private static final int sPageSleepDelay = 200; public AppsCustomizePagedView(Context context, AttributeSet attrs) { @@ -236,7 +234,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen mApps = new ArrayList<ApplicationInfo>(); mWidgets = new ArrayList<Object>(); mIconCache = ((LauncherApplication) context.getApplicationContext()).getIconCache(); - mHolographicOutlineHelper = new HolographicOutlineHelper(); mCanvas = new Canvas(); mRunningTasks = new ArrayList<AppsCustomizeAsyncTask>(); @@ -759,7 +756,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen ApplicationInfo info = mApps.get(i); PagedViewIcon icon = (PagedViewIcon) mLayoutInflater.inflate( R.layout.apps_customize_application, layout, false); - icon.applyFromApplicationInfo(info, true, mHolographicOutlineHelper); + icon.applyFromApplicationInfo(info, true); icon.setOnClickListener(this); icon.setOnLongClickListener(this); icon.setOnTouchListener(this); @@ -775,12 +772,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } layout.createHardwareLayers(); - - /* TEMPORARILY DISABLE HOLOGRAPHIC ICONS - if (mFadeInAdjacentScreens) { - prepareGenerateHoloOutlinesTask(page, items, images); - } - */ } /** @@ -883,79 +874,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen t.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, pageData); mRunningTasks.add(t); } - /** - * Creates and executes a new AsyncTask to load the outlines for a page of content. - */ - private void prepareGenerateHoloOutlinesTask(int page, ArrayList<Object> items, - ArrayList<Bitmap> images) { - // Prune old tasks for this page - Iterator<AppsCustomizeAsyncTask> iter = mRunningTasks.iterator(); - while (iter.hasNext()) { - AppsCustomizeAsyncTask task = (AppsCustomizeAsyncTask) iter.next(); - int taskPage = task.page; - if ((taskPage == page) && - (task.dataType == AsyncTaskPageData.Type.LoadHolographicIconsData)) { - task.cancel(false); - iter.remove(); - } - } - - AsyncTaskPageData pageData = new AsyncTaskPageData(page, items, images, - new AsyncTaskCallback() { - @Override - public void run(AppsCustomizeAsyncTask task, AsyncTaskPageData data) { - try { - // Ensure that this task starts running at the correct priority - task.syncThreadPriority(); - - ArrayList<Bitmap> images = data.generatedImages; - ArrayList<Bitmap> srcImages = data.sourceImages; - int count = srcImages.size(); - Canvas c = new Canvas(); - for (int i = 0; i < count && !task.isCancelled(); ++i) { - // Before work on each item, ensure that this task is running at the correct - // priority - task.syncThreadPriority(); - - Bitmap b = srcImages.get(i); - Bitmap outline = Bitmap.createBitmap(b.getWidth(), b.getHeight(), - Bitmap.Config.ARGB_8888); - - c.setBitmap(outline); - c.save(); - c.drawBitmap(b, 0, 0, null); - c.restore(); - c.setBitmap(null); - - images.add(outline); - } - } finally { - if (task.isCancelled()) { - data.cleanup(true); - } - } - } - }, - new AsyncTaskCallback() { - @Override - public void run(AppsCustomizeAsyncTask task, AsyncTaskPageData data) { - try { - mRunningTasks.remove(task); - if (task.isCancelled()) return; - onHolographicPageItemsLoaded(data); - } finally { - data.cleanup(task.isCancelled()); - } - } - }); - - // Ensure that the outline task always runs in the background, serially - AppsCustomizeAsyncTask t = - new AppsCustomizeAsyncTask(page, AsyncTaskPageData.Type.LoadHolographicIconsData); - t.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); - t.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, pageData); - mRunningTasks.add(t); - } /* * Widgets PagedView implementation @@ -1120,8 +1038,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen AppWidgetProviderInfo info = (AppWidgetProviderInfo) rawInfo; createItemInfo = new PendingAddWidgetInfo(info, null, null); int[] cellSpans = mLauncher.getSpanForWidget(info, null); - widget.applyFromAppWidgetProviderInfo(info, -1, cellSpans, - mHolographicOutlineHelper); + widget.applyFromAppWidgetProviderInfo(info, -1, cellSpans); widget.setTag(createItemInfo); } else if (rawInfo instanceof ResolveInfo) { // Fill in the shortcuts information @@ -1130,7 +1047,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen createItemInfo.itemType = LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT; createItemInfo.componentName = new ComponentName(info.activityInfo.packageName, info.activityInfo.name); - widget.applyFromResolveInfo(mPackageManager, info, mHolographicOutlineHelper); + widget.applyFromResolveInfo(mPackageManager, info); widget.setTag(createItemInfo); } widget.setOnClickListener(this); @@ -1231,12 +1148,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen layout.createHardwareLayer(); invalidate(); - /* TEMPORARILY DISABLE HOLOGRAPHIC ICONS - if (mFadeInAdjacentScreens) { - prepareGenerateHoloOutlinesTask(data.page, data.items, data.generatedImages); - } - */ - // Update all thread priorities Iterator<AppsCustomizeAsyncTask> iter = mRunningTasks.iterator(); while (iter.hasNext()) { @@ -1245,29 +1156,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen task.setThreadPriority(getThreadPriorityForPage(pageIndex)); } } - private void onHolographicPageItemsLoaded(AsyncTaskPageData data) { - // Invalidate early to short-circuit children invalidates - invalidate(); - - int page = data.page; - ViewGroup layout = (ViewGroup) getPageAt(page); - if (layout instanceof PagedViewCellLayout) { - PagedViewCellLayout cl = (PagedViewCellLayout) layout; - int count = cl.getPageChildCount(); - if (count != data.generatedImages.size()) return; - for (int i = 0; i < count; ++i) { - PagedViewIcon icon = (PagedViewIcon) cl.getChildOnPageAt(i); - icon.setHolographicOutline(data.generatedImages.get(i)); - } - } else { - int count = layout.getChildCount(); - if (count != data.generatedImages.size()) return; - for (int i = 0; i < count; ++i) { - View v = layout.getChildAt(i); - ((PagedViewWidget) v).setHolographicOutline(data.generatedImages.get(i)); - } - } - } @Override public void syncPages() { |