diff options
author | Michael Jurka <mikejurka@google.com> | 2010-08-06 20:19:41 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-08-06 20:19:41 -0700 |
commit | 9cf976350b8f07af80884938d539ac538896a583 (patch) | |
tree | 30c859807562c547ace3691a501f7ac9a2fc7bd2 /src | |
parent | ecf403f6de6ac232d148c869a7d7968fef615a6c (diff) | |
parent | 4bb4f735c80ba6baca6678f6508b3862da61313a (diff) | |
download | android_packages_apps_Trebuchet-9cf976350b8f07af80884938d539ac538896a583.tar.gz android_packages_apps_Trebuchet-9cf976350b8f07af80884938d539ac538896a583.tar.bz2 android_packages_apps_Trebuchet-9cf976350b8f07af80884938d539ac538896a583.zip |
Merge "small fixes to Launcher"
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher2/IntentListAdapter.java | 16 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 15 | ||||
-rw-r--r-- | src/com/android/launcher2/WidgetChooser.java | 17 | ||||
-rw-r--r-- | src/com/android/launcher2/WidgetListAdapter.java | 20 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 5 |
5 files changed, 57 insertions, 16 deletions
diff --git a/src/com/android/launcher2/IntentListAdapter.java b/src/com/android/launcher2/IntentListAdapter.java index 7ebffd4f8..f8447388e 100644 --- a/src/com/android/launcher2/IntentListAdapter.java +++ b/src/com/android/launcher2/IntentListAdapter.java @@ -1,3 +1,19 @@ +/* + * 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. + */ + package com.android.launcher2; import com.android.launcher.R; diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 855724117..5a508abfc 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -1040,7 +1040,6 @@ public final class Launcher extends Activity } closeAllApps(alreadyOnHome && allAppsVisible); hideCustomizationDrawer(); - mWorkspace.unshrink(); final View v = getWindow().peekDecorView(); if (v != null && v.getWindowToken() != null) { @@ -1512,7 +1511,6 @@ public final class Launcher extends Activity closeAllApps(true); } else if (isCustomizationDrawerVisible()) { hideCustomizationDrawer(); - mWorkspace.unshrink(); } else { closeFolder(); } @@ -1590,7 +1588,6 @@ public final class Launcher extends Activity // this is an intercepted event being forwarded from mWorkspace; // clicking anywhere on the workspace causes the drawer to slide down hideCustomizationDrawer(); - mWorkspace.unshrink(); return false; } @@ -2062,7 +2059,8 @@ public final class Launcher extends Activity } void showAllApps(boolean animated) { - hideCustomizationDrawer(); + boolean unshrinkWorkspace = false; + hideCustomizationDrawer(unshrinkWorkspace); if (LauncherApplication.isScreenXLarge()) { mWorkspace.shrinkToBottom(animated); @@ -2213,7 +2211,11 @@ public final class Launcher extends Activity AnimationUtils.loadAnimation(this, R.anim.home_customization_drawer_slide_up)); } - private void hideCustomizationDrawer() { + void hideCustomizationDrawer() { + hideCustomizationDrawer(true); + } + + void hideCustomizationDrawer(boolean unshrinkWorkspace) { if (isCustomizationDrawerVisible()) { Animation slideDownAnimation = AnimationUtils.loadAnimation( this, R.anim.home_customization_drawer_slide_down); @@ -2225,6 +2227,9 @@ public final class Launcher extends Activity public void onAnimationStart(Animation animation) {} }); mHomeCustomizationDrawer.startAnimation(slideDownAnimation); + if (unshrinkWorkspace) { + mWorkspace.unshrink(); + } } } diff --git a/src/com/android/launcher2/WidgetChooser.java b/src/com/android/launcher2/WidgetChooser.java index ea6888e14..2218e6dce 100644 --- a/src/com/android/launcher2/WidgetChooser.java +++ b/src/com/android/launcher2/WidgetChooser.java @@ -1,3 +1,19 @@ +/* + * 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. + */ + package com.android.launcher2; import android.appwidget.AppWidgetProviderInfo; @@ -38,6 +54,7 @@ public class WidgetChooser extends HomeCustomizationItemGallery implements DragS dragInfo.minHeight = info.minHeight; mDragController.startDrag(bmp, screenX, screenY, 0, 0, w, h, this, dragInfo, DragController.DRAG_ACTION_COPY); + mLauncher.hideCustomizationDrawer(); return true; } diff --git a/src/com/android/launcher2/WidgetListAdapter.java b/src/com/android/launcher2/WidgetListAdapter.java index 7ec011296..61e7c894f 100644 --- a/src/com/android/launcher2/WidgetListAdapter.java +++ b/src/com/android/launcher2/WidgetListAdapter.java @@ -109,14 +109,18 @@ public class WidgetListAdapter extends BaseAdapter { background.draw(mCanvas); // Draw the icon vertically centered, flush left - Drawable icon = packageManager.getDrawable(packageName, info.icon, null); - background.getPadding(mTempRect); - - final int left = mTempRect.left; - final int top = (height - icon.getIntrinsicHeight()) / 2; - icon.setBounds( - left, top, left + icon.getIntrinsicWidth(), top + icon.getIntrinsicHeight()); - icon.draw(mCanvas); + try { + Drawable icon = packageManager.getDrawable(packageName, info.icon, null); + background.getPadding(mTempRect); + + final int left = mTempRect.left; + final int top = (height - icon.getIntrinsicHeight()) / 2; + icon.setBounds( + left, top, left + icon.getIntrinsicWidth(), top + icon.getIntrinsicHeight()); + icon.draw(mCanvas); + } catch (Resources.NotFoundException e) { + // if we can't find the icon, then just don't draw it + } drawable = new BitmapDrawable(resources, bitmap); } diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 2bb1b7f12..202158095 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -1171,7 +1171,6 @@ public class Workspace extends ViewGroup public void unshrink() { if (mIsSmall) { - final int screenWidth = getWidth(); Sequencer s = new Sequencer(); final int screenCount = getChildCount(); for (int i = 0; i < screenCount; i++) { @@ -1179,8 +1178,8 @@ public class Workspace extends ViewGroup final int duration = getResources().getInteger(R.integer.config_workspaceUnshrinkTime); s.playTogether( - new PropertyAnimator(duration, cl, "x", (float) screenWidth * i), - new PropertyAnimator(duration, cl, "y", 0.0f), + new PropertyAnimator(duration, cl, "translationX", 0.0f), + new PropertyAnimator(duration, cl, "translationY", 0.0f), new PropertyAnimator(duration, cl, "scaleX", 1.0f), new PropertyAnimator(duration, cl, "scaleY", cl.getScaleY(), 1.0f), new PropertyAnimator(duration, cl, "dimmedBitmapAlpha", 0.0f)); |