Skip to content

Commit

Permalink
Minor changes to help address some hiccups when panning, changing tab…
Browse files Browse the repository at this point in the history
…s and rotating in AppsCustomize.

- Also removing references to old all-apps 2d/3d

Change-Id: Ibe07ad8b4facc5c57b3c82ccf0b55260be61a31b
  • Loading branch information
Winson Chung committed May 6, 2011
1 parent 563ed71 commit 63257c1
Show file tree
Hide file tree
Showing 16 changed files with 89 additions and 227 deletions.
3 changes: 2 additions & 1 deletion CleanSpec.mk
Expand Up @@ -44,9 +44,10 @@
#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) #$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) #$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)


$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/Launcher2_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/Launcher2_intermediates) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/Launcher2_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/Launcher2_intermediates) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/Launcher2_intermediates)


# ************************************************ # ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************ # ************************************************
63 changes: 0 additions & 63 deletions res/layout-land/all_apps_2d.xml

This file was deleted.

63 changes: 0 additions & 63 deletions res/layout-port/all_apps_2d.xml

This file was deleted.

20 changes: 0 additions & 20 deletions res/layout/all_apps.xml

This file was deleted.

33 changes: 0 additions & 33 deletions res/layout/all_apps_3d.xml

This file was deleted.

11 changes: 7 additions & 4 deletions src/com/android/launcher2/AllAppsPagedView.java
Expand Up @@ -508,6 +508,7 @@ public void syncPages() {
@Override @Override
public void syncPageItems(int page) { public void syncPageItems(int page) {
// Ensure that we have the right number of items on the pages // Ensure that we have the right number of items on the pages
final int numPages = getPageCount();
final int cellsPerPage = mCellCountX * mCellCountY; final int cellsPerPage = mCellCountX * mCellCountY;
final int startIndex = page * cellsPerPage; final int startIndex = page * cellsPerPage;
final int endIndex = Math.min(startIndex + cellsPerPage, mFilteredApps.size()); final int endIndex = Math.min(startIndex + cellsPerPage, mFilteredApps.size());
Expand Down Expand Up @@ -540,24 +541,25 @@ public void syncPageItems(int page) {


// Add any necessary items // Add any necessary items
for (int i = curNumPageItems; i < numPageItems; ++i) { for (int i = curNumPageItems; i < numPageItems; ++i) {
final boolean createHolographicOutlines = isHardwareAccelerated() && (numPages > 1);
TextView text = (TextView) mInflater.inflate( TextView text = (TextView) mInflater.inflate(
R.layout.all_apps_paged_view_application, layout, false); R.layout.all_apps_paged_view_application, layout, false);
text.setOnClickListener(this); text.setOnClickListener(this);
text.setOnLongClickListener(this); text.setOnLongClickListener(this);
text.setOnTouchListener(this); text.setOnTouchListener(this);


layout.addViewToCellLayout(text, -1, i, layout.addViewToCellLayout(text, -1, i,
new PagedViewCellLayout.LayoutParams(0, 0, 1, 1)); new PagedViewCellLayout.LayoutParams(0, 0, 1, 1), createHolographicOutlines);
} }


// Actually reapply to the existing text views // Actually reapply to the existing text views
final int numPages = getPageCount();
for (int i = startIndex; i < endIndex; ++i) { for (int i = startIndex; i < endIndex; ++i) {
final int index = i - startIndex; final int index = i - startIndex;
final ApplicationInfo info = mFilteredApps.get(i); final ApplicationInfo info = mFilteredApps.get(i);
final boolean createHolographicOutlines = isHardwareAccelerated() && (numPages > 1);
PagedViewIcon icon = (PagedViewIcon) layout.getChildOnPageAt(index); PagedViewIcon icon = (PagedViewIcon) layout.getChildOnPageAt(index);
icon.applyFromApplicationInfo( icon.applyFromApplicationInfo(
info, mPageViewIconCache, true, isHardwareAccelerated() && (numPages > 1)); info, mPageViewIconCache, true, createHolographicOutlines);


PagedViewCellLayout.LayoutParams params = PagedViewCellLayout.LayoutParams params =
(PagedViewCellLayout.LayoutParams) icon.getLayoutParams(); (PagedViewCellLayout.LayoutParams) icon.getLayoutParams();
Expand All @@ -579,10 +581,11 @@ public void syncPageItems(int page) {
} }


// Center-align the message // Center-align the message
final boolean createHolographicOutlines = isHardwareAccelerated() && (numPages > 1);
layout.enableCenteredContent(true); layout.enableCenteredContent(true);
layout.removeAllViewsOnPage(); layout.removeAllViewsOnPage();
layout.addViewToCellLayout(icon, -1, 0, layout.addViewToCellLayout(icon, -1, 0,
new PagedViewCellLayout.LayoutParams(0, 0, 4, 1)); new PagedViewCellLayout.LayoutParams(0, 0, 4, 1), createHolographicOutlines);
} }
layout.createHardwareLayers(); layout.createHardwareLayers();
} }
Expand Down
30 changes: 26 additions & 4 deletions src/com/android/launcher2/AppsCustomizePagedView.java
Expand Up @@ -44,6 +44,7 @@
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator; import android.view.animation.DecelerateInterpolator;
import android.view.animation.LinearInterpolator; import android.view.animation.LinearInterpolator;
import android.widget.FrameLayout; import android.widget.FrameLayout;
Expand Down Expand Up @@ -471,17 +472,28 @@ public void setContentType(ContentType type) {
/* /*
* Apps PagedView implementation * Apps PagedView implementation
*/ */
private void setVisibilityOnChildren(ViewGroup layout, int visibility) {
int childCount = layout.getChildCount();
for (int i = 0; i < childCount; ++i) {
layout.getChildAt(i).setVisibility(visibility);
}
}
private void setupPage(PagedViewCellLayout layout) { private void setupPage(PagedViewCellLayout layout) {
layout.setCellCount(mCellCountX, mCellCountY); layout.setCellCount(mCellCountX, mCellCountY);
layout.setGap(mPageLayoutWidthGap, mPageLayoutHeightGap); layout.setGap(mPageLayoutWidthGap, mPageLayoutHeightGap);
layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop, layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop,
mPageLayoutPaddingRight, mPageLayoutPaddingBottom); mPageLayoutPaddingRight, mPageLayoutPaddingBottom);


// We force a measure here to get around the fact that when we do layout calculations // Note: We force a measure here to get around the fact that when we do layout calculations
// immediately after syncing, we don't have a proper width. // immediately after syncing, we don't have a proper width. That said, we already know the
// expected page width, so we can actually optimize by hiding all the TextView-based
// children that are expensive to measure, and let that happen naturally later.
setVisibilityOnChildren(layout, View.GONE);
int widthSpec = MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.AT_MOST); int widthSpec = MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.AT_MOST);
int heightSpec = MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.AT_MOST); int heightSpec = MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.AT_MOST);
layout.setMinimumWidth(getPageContentWidth());
layout.measure(widthSpec, heightSpec); layout.measure(widthSpec, heightSpec);
setVisibilityOnChildren(layout, View.VISIBLE);
} }
public void syncAppsPages() { public void syncAppsPages() {
// Ensure that we have the right number of pages // Ensure that we have the right number of pages
Expand Down Expand Up @@ -514,8 +526,8 @@ public void syncAppsPageItems(int page) {
int index = i - startIndex; int index = i - startIndex;
int x = index % mCellCountX; int x = index % mCellCountX;
int y = index / mCellCountX; int y = index / mCellCountX;
setupPage(layout); layout.addViewToCellLayout(icon, -1, i, new PagedViewCellLayout.LayoutParams(x,y, 1,1),
layout.addViewToCellLayout(icon, -1, i, new PagedViewCellLayout.LayoutParams(x,y, 1,1)); isHardwareAccelerated() && (numPages > 1));
} }
} }
/* /*
Expand All @@ -525,7 +537,17 @@ private void setupPage(PagedViewExtendedLayout layout) {
layout.setGravity(Gravity.LEFT); layout.setGravity(Gravity.LEFT);
layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop, layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop,
mPageLayoutPaddingRight, mPageLayoutPaddingBottom); mPageLayoutPaddingRight, mPageLayoutPaddingBottom);

// Note: We force a measure here to get around the fact that when we do layout calculations
// immediately after syncing, we don't have a proper width. That said, we already know the
// expected page width, so we can actually optimize by hiding all the TextView-based
// children that are expensive to measure, and let that happen naturally later.
setVisibilityOnChildren(layout, View.GONE);
int widthSpec = MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.AT_MOST);
int heightSpec = MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.AT_MOST);
layout.setMinimumWidth(getPageContentWidth()); layout.setMinimumWidth(getPageContentWidth());
layout.measure(widthSpec, heightSpec);
setVisibilityOnChildren(layout, View.VISIBLE);
} }
private void renderDrawableToBitmap(Drawable d, Bitmap bitmap, int x, int y, int w, int h, private void renderDrawableToBitmap(Drawable d, Bitmap bitmap, int x, int y, int w, int h,
float scaleX, float scaleY) { float scaleX, float scaleY) {
Expand Down
2 changes: 1 addition & 1 deletion src/com/android/launcher2/CellLayout.java
Expand Up @@ -103,7 +103,7 @@ public class CellLayout extends ViewGroup {


// These arrays are used to implement the drag visualization on x-large screens. // These arrays are used to implement the drag visualization on x-large screens.
// They are used as circular arrays, indexed by mDragOutlineCurrent. // They are used as circular arrays, indexed by mDragOutlineCurrent.
private Point[] mDragOutlines = new Point[8]; private Point[] mDragOutlines = new Point[4];
private float[] mDragOutlineAlphas = new float[mDragOutlines.length]; private float[] mDragOutlineAlphas = new float[mDragOutlines.length];
private InterruptibleInOutAnimator[] mDragOutlineAnims = private InterruptibleInOutAnimator[] mDragOutlineAnims =
new InterruptibleInOutAnimator[mDragOutlines.length]; new InterruptibleInOutAnimator[mDragOutlines.length];
Expand Down
18 changes: 12 additions & 6 deletions src/com/android/launcher2/CustomizePagedView.java
Expand Up @@ -929,12 +929,13 @@ private void syncWidgetPageItems(int page) {
final int[] cellSpans = CellLayout.rectToCell(getResources(), info.minWidth, final int[] cellSpans = CellLayout.rectToCell(getResources(), info.minWidth,
info.minHeight, null); info.minHeight, null);
final FastBitmapDrawable icon = getWidgetPreview(info); final FastBitmapDrawable icon = getWidgetPreview(info);
final boolean createHolographicOutlines = isHardwareAccelerated() && (numPages > 1);


PagedViewWidget l = (PagedViewWidget) mInflater.inflate( PagedViewWidget l = (PagedViewWidget) mInflater.inflate(
R.layout.customize_paged_view_widget, layout, false); R.layout.customize_paged_view_widget, layout, false);


l.applyFromAppWidgetProviderInfo(info, icon, mMaxWidgetWidth, cellSpans, l.applyFromAppWidgetProviderInfo(info, icon, mMaxWidgetWidth, cellSpans,
mPageViewIconCache, (numPages > 1)); mPageViewIconCache, createHolographicOutlines);
l.setTag(createItemInfo); l.setTag(createItemInfo);
l.setOnClickListener(this); l.setOnClickListener(this);
l.setOnTouchListener(this); l.setOnTouchListener(this);
Expand Down Expand Up @@ -975,11 +976,12 @@ private void syncWallpaperPageItems(int page) {
for (int i = startIndex; i < endIndex; ++i) { for (int i = startIndex; i < endIndex; ++i) {
final ResolveInfo info = mWallpaperList.get(i); final ResolveInfo info = mWallpaperList.get(i);
final FastBitmapDrawable icon = getWallpaperPreview(info); final FastBitmapDrawable icon = getWallpaperPreview(info);
final boolean createHolographicOutlines = isHardwareAccelerated() && (numPages > 1);


PagedViewWidget l = (PagedViewWidget) mInflater.inflate( PagedViewWidget l = (PagedViewWidget) mInflater.inflate(
R.layout.customize_paged_view_wallpaper, layout, false); R.layout.customize_paged_view_wallpaper, layout, false);
l.applyFromWallpaperInfo(info, mPackageManager, icon, mMaxWidgetWidth, l.applyFromWallpaperInfo(info, mPackageManager, icon, mMaxWidgetWidth,
mPageViewIconCache, (numPages > 1)); mPageViewIconCache, createHolographicOutlines);
l.setTag(info); l.setTag(info);
l.setOnClickListener(this); l.setOnClickListener(this);


Expand Down Expand Up @@ -1012,12 +1014,13 @@ private void syncListPageItems(int page, List<ResolveInfo> list) {
for (int i = startIndex; i < endIndex; ++i) { for (int i = startIndex; i < endIndex; ++i) {
ResolveInfo info = list.get(i); ResolveInfo info = list.get(i);
PendingAddItemInfo createItemInfo = new PendingAddItemInfo(); PendingAddItemInfo createItemInfo = new PendingAddItemInfo();
final boolean createHolographicOutlines = isHardwareAccelerated() && (numPages > 1);


PagedViewIcon icon = (PagedViewIcon) mInflater.inflate( PagedViewIcon icon = (PagedViewIcon) mInflater.inflate(
R.layout.customize_paged_view_item, layout, false); R.layout.customize_paged_view_item, layout, false);
icon.applyFromResolveInfo(info, mPackageManager, mPageViewIconCache, icon.applyFromResolveInfo(info, mPackageManager, mPageViewIconCache,
((LauncherApplication) mLauncher.getApplication()).getIconCache(), ((LauncherApplication) mLauncher.getApplication()).getIconCache(),
(numPages > 1)); createHolographicOutlines);
switch (mCustomizationType) { switch (mCustomizationType) {
case WallpaperCustomization: case WallpaperCustomization:
icon.setOnClickListener(this); icon.setOnClickListener(this);
Expand All @@ -1039,7 +1042,8 @@ private void syncListPageItems(int page, List<ResolveInfo> list) {
final int x = index % mCellCountX; final int x = index % mCellCountX;
final int y = index / mCellCountX; final int y = index / mCellCountX;
setupPage(layout); setupPage(layout);
layout.addViewToCellLayout(icon, -1, i, new PagedViewCellLayout.LayoutParams(x,y, 1,1)); layout.addViewToCellLayout(icon, -1, i, new PagedViewCellLayout.LayoutParams(x,y, 1,1),
createHolographicOutlines);
} }
} }


Expand Down Expand Up @@ -1071,10 +1075,11 @@ private void syncAppPageItems(int page) {
layout.removeAllViewsOnPage(); layout.removeAllViewsOnPage();
for (int i = startIndex; i < endIndex; ++i) { for (int i = startIndex; i < endIndex; ++i) {
final ApplicationInfo info = mApps.get(i); final ApplicationInfo info = mApps.get(i);
final boolean createHolographicOutlines = isHardwareAccelerated() && (numPages > 1);
PagedViewIcon icon = (PagedViewIcon) mInflater.inflate( PagedViewIcon icon = (PagedViewIcon) mInflater.inflate(
R.layout.all_apps_paged_view_application, layout, false); R.layout.all_apps_paged_view_application, layout, false);
icon.applyFromApplicationInfo( icon.applyFromApplicationInfo(
info, mPageViewIconCache, true, isHardwareAccelerated() && (numPages > 1)); info, mPageViewIconCache, true, createHolographicOutlines);
icon.setOnClickListener(this); icon.setOnClickListener(this);
icon.setOnTouchListener(this); icon.setOnTouchListener(this);
icon.setOnLongClickListener(this); icon.setOnLongClickListener(this);
Expand All @@ -1083,7 +1088,8 @@ private void syncAppPageItems(int page) {
final int x = index % mCellCountX; final int x = index % mCellCountX;
final int y = index / mCellCountX; final int y = index / mCellCountX;
setupPage(layout); setupPage(layout);
layout.addViewToCellLayout(icon, -1, i, new PagedViewCellLayout.LayoutParams(x,y, 1,1)); layout.addViewToCellLayout(icon, -1, i, new PagedViewCellLayout.LayoutParams(x,y, 1,1),
createHolographicOutlines);
} }
} }


Expand Down

0 comments on commit 63257c1

Please sign in to comment.