$(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
-# ************************************************
\ No newline at end of file
+# ************************************************
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-
-<!-- Sapphire gets 2D all apps view -->
-<com.android.launcher2.AllApps2D
- xmlns:android="http://schemas.android.com/apk/res/android"
-
- android:id="@+id/all_apps_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:padding="2dip"
- android:background="#FF000000">
-
- <GridView android:id="@+id/all_apps_2d_grid"
- android:tag="all_apps_2d_grid"
- android:scrollbars="none"
- android:drawSelectorOnTop="false"
- android:listSelector="@drawable/grid_selector"
- android:verticalSpacing="10dip"
- android:numColumns="6"
- android:fadingEdgeLength="48dip"
- android:cacheColorHint="#FF000000"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_alignParentRight="true"
- android:layout_marginRight="@dimen/button_bar_height_portrait"
- android:nextFocusRight="@+id/all_apps_2d_home"
- android:nextFocusUp="@null"
- android:nextFocusLeft="@null"
- android:nextFocusDown="@null"
- />
-
- <view
- class="com.android.launcher2.AllApps2D$HomeButton"
- android:id="@+id/all_apps_2d_home"
- android:tag="all_apps_2d_home"
- android:src="@drawable/home_button"
- android:background="#FF000000"
- android:layout_alignParentRight="true"
- android:layout_centerVertical="true"
- android:layout_height="wrap_content"
- android:layout_width="@dimen/button_bar_height_portrait"
- android:paddingBottom="@dimen/status_bar_height"
- android:nextFocusLeft="@+id/all_apps_2d_grid"
- android:nextFocusDown="@null"
- android:nextFocusUp="@null"
- android:nextFocusRight="@null"
- />
-
-</com.android.launcher2.AllApps2D>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-
-<!-- Sapphire gets 2D all apps view -->
-<com.android.launcher2.AllApps2D
- xmlns:android="http://schemas.android.com/apk/res/android"
-
- android:id="@+id/all_apps_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:padding="2dip"
- android:background="#FF000000">
-
- <GridView android:id="@+id/all_apps_2d_grid"
- android:tag="all_apps_2d_grid"
- android:scrollbars="none"
- android:drawSelectorOnTop="false"
- android:listSelector="@drawable/grid_selector"
- android:verticalSpacing="10dip"
- android:numColumns="4"
- android:fadingEdgeLength="48dip"
- android:cacheColorHint="#FF000000"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_alignParentBottom="true"
- android:layout_marginBottom="@dimen/button_bar_height"
- android:layout_marginTop="8dip"
- android:nextFocusDown="@+id/all_apps_2d_home"
- android:nextFocusUp="@null"
- android:nextFocusLeft="@null"
- android:nextFocusRight="@null"
- />
-
- <view
- class="com.android.launcher2.AllApps2D$HomeButton"
- android:id="@+id/all_apps_2d_home"
- android:tag="all_apps_2d_home"
- android:src="@drawable/home_button"
- android:background="#FF000000"
- android:layout_centerHorizontal="true"
- android:layout_alignParentBottom="true"
- android:layout_width="wrap_content"
- android:layout_height="@dimen/button_bar_height"
- android:nextFocusUp="@+id/all_apps_2d_grid"
- android:nextFocusDown="@null"
- android:nextFocusLeft="@null"
- android:nextFocusRight="@null"
- />
-
-</com.android.launcher2.AllApps2D>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-
-<!-- switch to all_apps_3d on devices that support RenderScript -->
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
- <include layout="@layout/all_apps_2d" />
-</merge>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-
-<!-- Replace with AllAppsView to use 2D version -->
-<com.android.launcher2.AllApps3D
- xmlns:android="http://schemas.android.com/apk/res/android"
-
- android:id="@+id/all_apps_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
-
- android:scrollbarStyle="outsideInset"
- android:drawSelectorOnTop="false"
- android:listSelector="@drawable/grid_selector"
- android:verticalSpacing="10dip"
- android:numColumns="4"
- android:fadingEdgeLength="20dip"
- android:padding="2dip"
- android:cacheColorHint="#FF000000"
- />
@Override
public void syncPageItems(int page) {
// Ensure that we have the right number of items on the pages
+ final int numPages = getPageCount();
final int cellsPerPage = mCellCountX * mCellCountY;
final int startIndex = page * cellsPerPage;
final int endIndex = Math.min(startIndex + cellsPerPage, mFilteredApps.size());
// Add any necessary items
for (int i = curNumPageItems; i < numPageItems; ++i) {
+ final boolean createHolographicOutlines = isHardwareAccelerated() && (numPages > 1);
TextView text = (TextView) mInflater.inflate(
R.layout.all_apps_paged_view_application, layout, false);
text.setOnClickListener(this);
text.setOnTouchListener(this);
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
- final int numPages = getPageCount();
for (int i = startIndex; i < endIndex; ++i) {
final int index = i - startIndex;
final ApplicationInfo info = mFilteredApps.get(i);
+ final boolean createHolographicOutlines = isHardwareAccelerated() && (numPages > 1);
PagedViewIcon icon = (PagedViewIcon) layout.getChildOnPageAt(index);
icon.applyFromApplicationInfo(
- info, mPageViewIconCache, true, isHardwareAccelerated() && (numPages > 1));
+ info, mPageViewIconCache, true, createHolographicOutlines);
PagedViewCellLayout.LayoutParams params =
(PagedViewCellLayout.LayoutParams) icon.getLayoutParams();
}
// Center-align the message
+ final boolean createHolographicOutlines = isHardwareAccelerated() && (numPages > 1);
layout.enableCenteredContent(true);
layout.removeAllViewsOnPage();
layout.addViewToCellLayout(icon, -1, 0,
- new PagedViewCellLayout.LayoutParams(0, 0, 4, 1));
+ new PagedViewCellLayout.LayoutParams(0, 0, 4, 1), createHolographicOutlines);
}
layout.createHardwareLayers();
}
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LinearInterpolator;
import android.widget.FrameLayout;
/*
* 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) {
layout.setCellCount(mCellCountX, mCellCountY);
layout.setGap(mPageLayoutWidthGap, mPageLayoutHeightGap);
layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop,
mPageLayoutPaddingRight, mPageLayoutPaddingBottom);
- // 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.
+ // 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.measure(widthSpec, heightSpec);
+ setVisibilityOnChildren(layout, View.VISIBLE);
}
public void syncAppsPages() {
// Ensure that we have the right number of pages
int index = i - startIndex;
int x = 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));
}
}
/*
layout.setGravity(Gravity.LEFT);
layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop,
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.measure(widthSpec, heightSpec);
+ setVisibilityOnChildren(layout, View.VISIBLE);
}
private void renderDrawableToBitmap(Drawable d, Bitmap bitmap, int x, int y, int w, int h,
float scaleX, float scaleY) {
// These arrays are used to implement the drag visualization on x-large screens.
// 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 InterruptibleInOutAnimator[] mDragOutlineAnims =
new InterruptibleInOutAnimator[mDragOutlines.length];
final int[] cellSpans = CellLayout.rectToCell(getResources(), info.minWidth,
info.minHeight, null);
final FastBitmapDrawable icon = getWidgetPreview(info);
+ final boolean createHolographicOutlines = isHardwareAccelerated() && (numPages > 1);
PagedViewWidget l = (PagedViewWidget) mInflater.inflate(
R.layout.customize_paged_view_widget, layout, false);
l.applyFromAppWidgetProviderInfo(info, icon, mMaxWidgetWidth, cellSpans,
- mPageViewIconCache, (numPages > 1));
+ mPageViewIconCache, createHolographicOutlines);
l.setTag(createItemInfo);
l.setOnClickListener(this);
l.setOnTouchListener(this);
for (int i = startIndex; i < endIndex; ++i) {
final ResolveInfo info = mWallpaperList.get(i);
final FastBitmapDrawable icon = getWallpaperPreview(info);
+ final boolean createHolographicOutlines = isHardwareAccelerated() && (numPages > 1);
PagedViewWidget l = (PagedViewWidget) mInflater.inflate(
R.layout.customize_paged_view_wallpaper, layout, false);
l.applyFromWallpaperInfo(info, mPackageManager, icon, mMaxWidgetWidth,
- mPageViewIconCache, (numPages > 1));
+ mPageViewIconCache, createHolographicOutlines);
l.setTag(info);
l.setOnClickListener(this);
for (int i = startIndex; i < endIndex; ++i) {
ResolveInfo info = list.get(i);
PendingAddItemInfo createItemInfo = new PendingAddItemInfo();
+ final boolean createHolographicOutlines = isHardwareAccelerated() && (numPages > 1);
PagedViewIcon icon = (PagedViewIcon) mInflater.inflate(
R.layout.customize_paged_view_item, layout, false);
icon.applyFromResolveInfo(info, mPackageManager, mPageViewIconCache,
((LauncherApplication) mLauncher.getApplication()).getIconCache(),
- (numPages > 1));
+ createHolographicOutlines);
switch (mCustomizationType) {
case WallpaperCustomization:
icon.setOnClickListener(this);
final int x = index % mCellCountX;
final 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),
+ createHolographicOutlines);
}
}
layout.removeAllViewsOnPage();
for (int i = startIndex; i < endIndex; ++i) {
final ApplicationInfo info = mApps.get(i);
+ final boolean createHolographicOutlines = isHardwareAccelerated() && (numPages > 1);
PagedViewIcon icon = (PagedViewIcon) mInflater.inflate(
R.layout.all_apps_paged_view_application, layout, false);
icon.applyFromApplicationInfo(
- info, mPageViewIconCache, true, isHardwareAccelerated() && (numPages > 1));
+ info, mPageViewIconCache, true, createHolographicOutlines);
icon.setOnClickListener(this);
icon.setOnTouchListener(this);
icon.setOnLongClickListener(this);
final int x = index % mCellCountX;
final 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),
+ createHolographicOutlines);
}
}
dragLayer.setDragController(dragController);
if (LauncherApplication.isScreenXLarge()) {
- mAllAppsGrid = (AllAppsView)dragLayer.findViewById(R.id.all_apps_view);
+ mAllAppsGrid = (AllAppsView) dragLayer.findViewById(R.id.all_apps_view);
mAllAppsGrid.setup(this, dragController);
// We don't want a hole punched in our window.
((View) mAllAppsGrid).setWillNotDraw(false);
mLoaderTask = null;
}
}
-
- // Trigger a gc to try to clean up after the stuff is done, since the
- // renderscript allocations aren't charged to the java heap.
- if (mStopped) {
- mHandler.post(new Runnable() {
- public void run() {
- System.gc();
- }
- });
- } else {
- mHandler.postIdle(new Runnable() {
- public void run() {
- System.gc();
- }
- });
- }
}
public void stopLocked() {
protected void updateAdjacentPagesAlpha() {
if (mFadeInAdjacentScreens) {
if (mDirtyPageAlpha || (mTouchState == TOUCH_STATE_SCROLLING) || !mScroller.isFinished()) {
- int halfScreenSize = getMeasuredWidth() / 2;
+ int screenWidth = getMeasuredWidth();
+ int halfScreenSize = screenWidth / 2;
int screenCenter = mScrollX + halfScreenSize;
final int childCount = getChildCount();
for (int i = 0; i < childCount; ++i) {
// we should just assume full page width (and calculate the offset according to
// that).
if (childWidth <= 0) {
- childWidth = getMeasuredWidth();
+ childWidth = screenWidth;
childCenter = (i * childWidth) + (childWidth / 2);
}
}
protected int getChildWidth(int index) {
- return Math.max(mMinimumWidth, getChildAt(index).getMeasuredWidth());
+ // This functions are called enough times that it actually makes a difference in the
+ // profiler -- so just inline the max() here
+ final int measuredWidth = getChildAt(index).getMeasuredWidth();
+ final int minWidth = mMinimumWidth;
+ return (minWidth > measuredWidth) ? minWidth : measuredWidth;
}
protected int getRelativeChildOffset(int index) {
}
protected int getScaledMeasuredWidth(View child) {
- return (int) (Math.max(mMinimumWidth, child.getMeasuredWidth()) * mLayoutScale + 0.5f);
+ // This functions are called enough times that it actually makes a difference in the
+ // profiler -- so just inline the max() here
+ final int measuredWidth = child.getMeasuredWidth();
+ final int minWidth = mMinimumWidth;
+ final int maxWidth = (minWidth > measuredWidth) ? minWidth : measuredWidth;
+ return (int) (maxWidth * mLayoutScale + 0.5f);
}
int getPageNearestToCenterOfScreen() {
}
public boolean addViewToCellLayout(View child, int index, int childId,
- PagedViewCellLayout.LayoutParams params) {
+ PagedViewCellLayout.LayoutParams params, boolean createHolographicOutlines) {
final PagedViewCellLayout.LayoutParams lp = params;
// Generate an id for each view, this assumes we have at most 256x256 cells
if (mAllowHardwareLayerCreation) {
pagedViewIcon.disableCache();
}
- mHolographicChildren.addView(pagedViewIcon.getHolographicOutlineView(), index, lp);
+ if (createHolographicOutlines) {
+ mHolographicChildren.addView(pagedViewIcon.getHolographicOutlineView(),
+ index, lp);
+ }
}
return true;
}
package com.android.launcher2;
-import com.android.launcher.R;
-
import android.animation.ObjectAnimator;
import android.content.ComponentName;
import android.content.Context;
import android.os.Message;
import android.util.AttributeSet;
import android.view.KeyEvent;
+import android.view.View;
import android.widget.Checkable;
+import com.android.launcher.R;
/**
private PagedViewIconCache.Key mIconCacheKey;
private PagedViewIconCache mIconCache;
+ private String mDimensionsFormatString;
private int mAlpha = 255;
private int mHolographicAlpha;
mCheckedFadeOutDuration =
r.getInteger(R.integer.config_dragAppsCustomizeIconFadeOutDuration);
}
+ mDimensionsFormatString = r.getString(R.string.widget_dims_format);
setWillNotDraw(false);
setClipToPadding(false);
name.setText(info.label);
name.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
final TextView dims = (TextView) findViewById(R.id.widget_dims);
- dims.setText(mContext.getString(R.string.widget_dims_format, cellSpan[0], cellSpan[1]));
+ dims.setText(String.format(mDimensionsFormatString, cellSpan[0], cellSpan[1]));
dims.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
if (createHolographicOutline) {
name.setText(info.loadLabel(pm));
name.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
final TextView dims = (TextView) findViewById(R.id.widget_dims);
- dims.setText(mContext.getString(R.string.widget_dims_format, 1, 1));
+ dims.setText(String.format(mDimensionsFormatString, 1, 1));
dims.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
if (createHolographicOutline) {
((i == mCurrentPage) && (mShrinkState != ShrinkState.SPRING_LOADED)) ?
0.0f : 1.0f;
- float translation = getOffsetXForRotation(rotation, cl.getWidth(), cl.getHeight());
+ float translation = 0f;
+
+ // If the screen is not xlarge, then don't rotate the CellLayouts
+ // NOTE: If we don't update the side pages alpha, then we should not hide the side
+ // pages. see unshrink().
+ if (LauncherApplication.isScreenXLarge()) {
+ translation = getOffsetXForRotation(rotation, cl.getWidth(), cl.getHeight());
+ }
oldAlphas[i] = cl.getAlpha();
newAlphas[i] = finalAlphaValue;
ValueAnimator.ofFloat(0f, 1f).setDuration(duration);
animWithInterpolator.setInterpolator(mZoomInInterpolator);
- final float oldHorizontalWallpaperOffset = getHorizontalWallpaperOffset();
- final float oldVerticalWallpaperOffset = getVerticalWallpaperOffset();
- final float newHorizontalWallpaperOffset = wallpaperOffsetForCurrentScroll();
- final float newVerticalWallpaperOffset = 0.5f;
+ final float oldHorizontalWallpaperOffset = enableWallpaperEffects ?
+ getHorizontalWallpaperOffset() : 0;
+ final float oldVerticalWallpaperOffset = enableWallpaperEffects ?
+ getVerticalWallpaperOffset() : 0;
+ final float newHorizontalWallpaperOffset = enableWallpaperEffects ?
+ wallpaperOffsetForCurrentScroll() : 0;
+ final float newVerticalWallpaperOffset = enableWallpaperEffects ? 0.5f : 0;
animWithInterpolator.addUpdateListener(new LauncherAnimatorUpdateListener() {
public void onAnimationUpdate(float a, float b) {
if (b == 0f) {