diff options
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/launcher2/AllAppsPagedView.java | 16 | ||||
-rw-r--r-- | src/com/android/launcher2/BubbleTextView.java | 7 | ||||
-rw-r--r-- | src/com/android/launcher2/CellLayoutChildren.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 16 | ||||
-rw-r--r-- | src/com/android/launcher2/PagedView.java | 5 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 23 |
6 files changed, 48 insertions, 22 deletions
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java index e9269743b..bfe6ec171 100644 --- a/src/com/android/launcher2/AllAppsPagedView.java +++ b/src/com/android/launcher2/AllAppsPagedView.java @@ -79,6 +79,8 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All mCellCountX = a.getInt(R.styleable.PagedView_cellCountX, 6); mCellCountY = a.getInt(R.styleable.PagedView_cellCountY, 4); mInflater = LayoutInflater.from(context); + mApps = new ArrayList<ApplicationInfo>(); + mFilteredApps = new ArrayList<ApplicationInfo>(); a.recycle(); setSoundEffectsEnabled(false); @@ -390,12 +392,14 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All } private int findAppByComponent(ArrayList<ApplicationInfo> list, ApplicationInfo item) { - ComponentName removeComponent = item.intent.getComponent(); - final int length = list.size(); - for (int i = 0; i < length; ++i) { - ApplicationInfo info = list.get(i); - if (info.intent.getComponent().equals(removeComponent)) { - return i; + if (item != null && item.intent != null) { + ComponentName removeComponent = item.intent.getComponent(); + final int length = list.size(); + for (int i = 0; i < length; ++i) { + ApplicationInfo info = list.get(i); + if (info.intent.getComponent().equals(removeComponent)) { + return i; + } } } return -1; diff --git a/src/com/android/launcher2/BubbleTextView.java b/src/com/android/launcher2/BubbleTextView.java index 3ef054637..203883eb5 100644 --- a/src/com/android/launcher2/BubbleTextView.java +++ b/src/com/android/launcher2/BubbleTextView.java @@ -128,8 +128,11 @@ public class BubbleTextView extends TextView implements VisibilityChangedBroadca private void invalidatePressedOrFocusedBackground() { int padding = HolographicOutlineHelper.MAX_OUTER_BLUR_RADIUS / 2; - ((View)getParent()).invalidate(getLeft() - padding, getTop() - padding, - getRight() + padding, getBottom() + padding); + View parent = (View) getParent(); + if (parent != null) { + parent.invalidate(getLeft() - padding, getTop() - padding, + getRight() + padding, getBottom() + padding); + } invalidate(); } diff --git a/src/com/android/launcher2/CellLayoutChildren.java b/src/com/android/launcher2/CellLayoutChildren.java index 0d0a33907..76a690094 100644 --- a/src/com/android/launcher2/CellLayoutChildren.java +++ b/src/com/android/launcher2/CellLayoutChildren.java @@ -45,9 +45,6 @@ public class CellLayoutChildren extends ViewGroup { super(context); mWallpaperManager = WallpaperManager.getInstance(context); setLayerType(LAYER_TYPE_HARDWARE, null); - - // Disable multitouch for the workspace - setMotionEventSplittingEnabled(false); } public void setCellDimensions(int cellWidth, int cellHeight, diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index a80833e10..792047287 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -1443,16 +1443,14 @@ public final class Launcher extends Activity boolean alreadyOnHome = ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); - // in all these cases, only animate if we're already on home + // In all these cases, only animate if we're already on home + if (LauncherApplication.isScreenXLarge()) { mWorkspace.unshrink(alreadyOnHome); } - if (!mWorkspace.isDefaultPageShowing()) { - // on the phone, we don't animate the change to the workspace if all apps is visible - boolean animate = alreadyOnHome && - (LauncherApplication.isScreenXLarge() || mState != State.ALL_APPS); - mWorkspace.moveToDefaultScreen(animate); - if (!animate) mWorkspace.updateWallpaperOffsetImmediately(); + + if (alreadyOnHome && mState == State.WORKSPACE && !mWorkspace.isDefaultPageShowing()) { + mWorkspace.moveToDefaultScreen(true); } showWorkspace(alreadyOnHome); @@ -2429,6 +2427,10 @@ public final class Launcher extends Activity return mWorkspace; } + TabHost getCustomizationDrawer() { + return mHomeCustomizationDrawer; + } + @Override protected Dialog onCreateDialog(int id) { switch (id) { diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index 511c960e7..41521041d 100644 --- a/src/com/android/launcher2/PagedView.java +++ b/src/com/android/launcher2/PagedView.java @@ -551,6 +551,11 @@ public abstract class PagedView extends ViewGroup { alpha = 1.0f; } + // Due to the way we're setting alpha on our children in PagedViewCellLayout, + // this optimization causes alpha to not be properly updated sometimes (repro + // case: in xlarge mode, swipe to second page in All Apps, then click on "My + // Apps" tab. the page will have alpha 0 until you swipe it). Removing + // optimization fixes the issue, but we should fix this in a better manner //if (Float.compare(alpha, layout.getAlpha()) != 0) { layout.setAlpha(alpha); //} diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index c2063abd6..fe54ae7b6 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -23,7 +23,6 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; -import android.animation.PropertyValuesHolder; import android.animation.TimeInterpolator; import android.animation.ValueAnimator; import android.animation.Animator.AnimatorListener; @@ -62,6 +61,8 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.animation.DecelerateInterpolator; +import android.widget.TabHost; +import android.widget.TabWidget; import android.widget.TextView; import android.widget.Toast; @@ -262,6 +263,9 @@ public class Workspace extends SmoothPagedView setHapticFeedbackEnabled(false); initWorkspace(); + + // Disable multitouch across the workspace/all apps/customize tray + setMotionEventSplittingEnabled(true); } /** @@ -1324,6 +1328,19 @@ public class Workspace extends SmoothPagedView shrink(shrinkState, true); } + private int getCustomizeDrawerHeight() { + TabHost customizationDrawer = mLauncher.getCustomizationDrawer(); + int height = customizationDrawer.getHeight(); + TabWidget tabWidget = (TabWidget) + customizationDrawer.findViewById(com.android.internal.R.id.tabs); + if (tabWidget.getTabCount() > 0) { + TextView tabText = (TextView) tabWidget.getChildTabViewAt(0); + // subtract the empty space above the tab text + height -= ((tabWidget.getHeight() - tabText.getLineHeight())) / 2; + } + return height; + } + // we use this to shrink the workspace for the all apps view and the customize view public void shrink(ShrinkState shrinkState, boolean animated) { // In the launcher interaction model, we're never in the state where we're shrunken and @@ -1400,9 +1417,7 @@ public class Workspace extends SmoothPagedView y = screenHeight / 2 - scaledPageHeight / 2; finalAlpha = 1.0f; } else if (shrinkState == ShrinkState.TOP) { - y = (isPortrait ? - getResources().getDimension(R.dimen.customizeSmallScreenVerticalMarginPortrait) : - getResources().getDimension(R.dimen.customizeSmallScreenVerticalMarginLandscape)); + y = (screenHeight - getCustomizeDrawerHeight() - scaledPageHeight) / 2; } int duration; |