summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/drawable/add_button.png (renamed from res/drawable-mdpi/add_button.png)bin2372 -> 2372 bytes
-rw-r--r--res/drawable/default_widget_preview.9.png (renamed from res/drawable-mdpi/default_widget_preview.9.png)bin541 -> 541 bytes
-rw-r--r--res/drawable/pressed_application_background.9.png (renamed from res/drawable-mdpi/pressed_application_background.9.png)bin1091 -> 1091 bytes
-rw-r--r--res/drawable/rounded_rect_green.9.png (renamed from res/drawable-mdpi/rounded_rect_green.9.png)bin361 -> 361 bytes
-rw-r--r--res/drawable/rounded_rect_red.9.png (renamed from res/drawable-mdpi/rounded_rect_red.9.png)bin342 -> 342 bytes
-rw-r--r--res/layout/home_customization_drawer_item.xml8
-rw-r--r--res/layout/home_customization_drawer_widget.xml24
-rw-r--r--src/com/android/launcher2/Launcher.java26
-rw-r--r--src/com/android/launcher2/ShortcutListAdapter.java26
-rw-r--r--src/com/android/launcher2/WidgetListAdapter.java2
-rw-r--r--src/com/android/launcher2/Workspace.java64
11 files changed, 94 insertions, 56 deletions
diff --git a/res/drawable-mdpi/add_button.png b/res/drawable/add_button.png
index 0edcfa380..0edcfa380 100644
--- a/res/drawable-mdpi/add_button.png
+++ b/res/drawable/add_button.png
Binary files differ
diff --git a/res/drawable-mdpi/default_widget_preview.9.png b/res/drawable/default_widget_preview.9.png
index e966b1b79..e966b1b79 100644
--- a/res/drawable-mdpi/default_widget_preview.9.png
+++ b/res/drawable/default_widget_preview.9.png
Binary files differ
diff --git a/res/drawable-mdpi/pressed_application_background.9.png b/res/drawable/pressed_application_background.9.png
index b09f595b7..b09f595b7 100644
--- a/res/drawable-mdpi/pressed_application_background.9.png
+++ b/res/drawable/pressed_application_background.9.png
Binary files differ
diff --git a/res/drawable-mdpi/rounded_rect_green.9.png b/res/drawable/rounded_rect_green.9.png
index 5787c3dc2..5787c3dc2 100644
--- a/res/drawable-mdpi/rounded_rect_green.9.png
+++ b/res/drawable/rounded_rect_green.9.png
Binary files differ
diff --git a/res/drawable-mdpi/rounded_rect_red.9.png b/res/drawable/rounded_rect_red.9.png
index 7a5fdeebc..7a5fdeebc 100644
--- a/res/drawable-mdpi/rounded_rect_red.9.png
+++ b/res/drawable/rounded_rect_red.9.png
Binary files differ
diff --git a/res/layout/home_customization_drawer_item.xml b/res/layout/home_customization_drawer_item.xml
index 2ef527daa..4d61dbfb4 100644
--- a/res/layout/home_customization_drawer_item.xml
+++ b/res/layout/home_customization_drawer_item.xml
@@ -15,10 +15,10 @@
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:background="?android:attr/galleryItemBackground"
- android:layout_width="600dip"
- android:layout_height="match_parent"
+ android:layout_width="200dip"
+ android:layout_height="200dip"
android:padding="20dip"
android:orientation="vertical"
android:gravity="center_horizontal|center_vertical|clip_vertical"
- android:textAppearance="?android:attr/textAppearanceMedium" /> \ No newline at end of file
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="#ffffffff" /> \ No newline at end of file
diff --git a/res/layout/home_customization_drawer_widget.xml b/res/layout/home_customization_drawer_widget.xml
new file mode 100644
index 000000000..1581308b6
--- /dev/null
+++ b/res/layout/home_customization_drawer_widget.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="600dip"
+ android:layout_height="match_parent"
+ android:padding="20dip"
+ android:orientation="vertical"
+ android:gravity="center_horizontal|center_vertical|clip_vertical"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="#ffffffff" /> \ No newline at end of file
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 1de318fc5..1a085a382 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -778,12 +778,14 @@ public final class Launcher extends Activity
widgetChooser.setLauncher(this);
FolderChooser folderChooser = (FolderChooser) findViewById(R.id.folder_chooser);
- IntentListAdapter folderTypes = new FolderListAdapter(this, LiveFolders.ACTION_CREATE_LIVE_FOLDER);
+ IntentListAdapter folderTypes = new FolderListAdapter(
+ this, LiveFolders.ACTION_CREATE_LIVE_FOLDER);
folderChooser.setAdapter(folderTypes);
folderChooser.setLauncher(this);
ShortcutChooser shortcutChooser = (ShortcutChooser) findViewById(R.id.shortcut_chooser);
- IntentListAdapter shortcutTypes = new ShortcutListAdapter(this, Intent.ACTION_CREATE_SHORTCUT);
+ IntentListAdapter shortcutTypes = new IntentListAdapter(
+ this, Intent.ACTION_CREATE_SHORTCUT);
shortcutChooser.setAdapter(shortcutTypes);
shortcutChooser.setLauncher(this);
} else {
@@ -813,7 +815,12 @@ public final class Launcher extends Activity
deleteZone.setLauncher(this);
deleteZone.setDragController(dragController);
- int deleteZoneHandleId = LauncherApplication.isScreenXLarge() ? R.id.add_button : R.id.all_apps_button_cluster;
+ int deleteZoneHandleId;
+ if (LauncherApplication.isScreenXLarge()) {
+ deleteZoneHandleId = R.id.add_button;
+ } else {
+ deleteZoneHandleId = R.id.all_apps_button_cluster;
+ }
deleteZone.setHandle(findViewById(deleteZoneHandleId));
dragController.setDragScoller(workspace);
@@ -2032,12 +2039,14 @@ public final class Launcher extends Activity
void showAllApps(boolean animated) {
hideCustomizationDrawer();
+ if (LauncherApplication.isScreenXLarge()) {
+ mWorkspace.shrinkToBottom(animated);
+ }
if (LauncherApplication.isScreenXLarge() && animated) {
// Not really a zoom -- this just makes the view visible
mAllAppsGrid.zoom(1.0f, false);
Animation anim = AnimationUtils.loadAnimation(this, R.anim.all_apps_zoom_in);
((View) mAllAppsGrid).startAnimation(anim);
- mWorkspace.shrinkToBottom();
} else {
mAllAppsGrid.zoom(1.0f, animated);
}
@@ -2119,7 +2128,8 @@ public final class Launcher extends Activity
}
private boolean isCustomizationDrawerVisible() {
- return mHomeCustomizationDrawer != null && mHomeCustomizationDrawer.getVisibility() == View.VISIBLE;
+ return mHomeCustomizationDrawer != null &&
+ mHomeCustomizationDrawer.getVisibility() == View.VISIBLE;
}
private void showCustomizationDrawer() {
@@ -2128,12 +2138,14 @@ public final class Launcher extends Activity
closeAllApps(false);
}
mHomeCustomizationDrawer.setVisibility(View.VISIBLE);
- mHomeCustomizationDrawer.startAnimation(AnimationUtils.loadAnimation(this, R.anim.home_customization_drawer_slide_up));
+ mHomeCustomizationDrawer.startAnimation(
+ AnimationUtils.loadAnimation(this, R.anim.home_customization_drawer_slide_up));
}
private void hideCustomizationDrawer() {
if (isCustomizationDrawerVisible()) {
- Animation slideDownAnimation = AnimationUtils.loadAnimation(this, R.anim.home_customization_drawer_slide_down);
+ Animation slideDownAnimation = AnimationUtils.loadAnimation(
+ this, R.anim.home_customization_drawer_slide_down);
slideDownAnimation.setAnimationListener(new Animation.AnimationListener() {
public void onAnimationEnd(Animation animation) {
mHomeCustomizationDrawer.setVisibility(View.GONE);
diff --git a/src/com/android/launcher2/ShortcutListAdapter.java b/src/com/android/launcher2/ShortcutListAdapter.java
deleted file mode 100644
index be05ca4bb..000000000
--- a/src/com/android/launcher2/ShortcutListAdapter.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.android.launcher2;
-
-import com.android.launcher.R;
-
-import android.content.Context;
-import android.content.Intent;
-import android.content.Intent.ShortcutIconResource;
-import android.content.pm.ResolveInfo;
-
-import java.util.ArrayList;
-
-
-public class ShortcutListAdapter extends IntentListAdapter {
-
- public ShortcutListAdapter(Context context, String actionFilter) {
- super(context, actionFilter);
-
- // Manually create a separate entry for creating an Application shortcut
- ResolveInfo folder = new ResolveInfo();
-
- folder.icon = R.drawable.ic_launcher_application;
- folder.labelRes = R.string.group_applications;
- folder.resolvePackageName = context.getPackageName();
- mIntentList.add(0, folder);
- }
-}
diff --git a/src/com/android/launcher2/WidgetListAdapter.java b/src/com/android/launcher2/WidgetListAdapter.java
index 597ecf947..7ec011296 100644
--- a/src/com/android/launcher2/WidgetListAdapter.java
+++ b/src/com/android/launcher2/WidgetListAdapter.java
@@ -73,7 +73,7 @@ public class WidgetListAdapter extends BaseAdapter {
LayoutInflater inflater =
(LayoutInflater)mLauncher.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
textView = (TextView) inflater.inflate(
- R.layout.home_customization_drawer_item, parent, false);
+ R.layout.home_customization_drawer_widget, parent, false);
} else {
textView = (TextView) convertView;
}
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 5200dbc87..536eba81b 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -86,6 +86,7 @@ public class Workspace extends ViewGroup
private int mDefaultScreen;
private boolean mFirstLayout = true;
+ private boolean mWaitingToShrinkToBottom = false;
private int mCurrentScreen;
private int mNextScreen = INVALID_SCREEN;
@@ -726,6 +727,13 @@ public class Workspace extends ViewGroup
}
}
+ // if shrinkToBottom() is called on initialization, it has to be deferred
+ // until after the first call to onLayout so that it has the correct width
+ if (mWaitingToShrinkToBottom) {
+ shrinkToBottom(false);
+ mWaitingToShrinkToBottom = false;
+ }
+
if (LauncherApplication.isInPlaceRotationEnabled()) {
// When the device is rotated, the scroll position of the current screen
// needs to be refreshed
@@ -1135,15 +1143,27 @@ public class Workspace extends ViewGroup
}
void shrinkToTop() {
- shrink(true);
+ shrink(true, true);
}
void shrinkToBottom() {
- shrink(false);
+ shrinkToBottom(true);
+ }
+
+ void shrinkToBottom(boolean animated) {
+ if (mFirstLayout) {
+ // (mFirstLayout == "first layout has not happened yet")
+ // if we get a call to shrink() as part of our initialization (for example, if
+ // Launcher is started in All Apps mode) then we need to wait for a layout call
+ // to get our width so we can layout the mini-screen views correctly
+ mWaitingToShrinkToBottom = true;
+ } else {
+ shrink(false, animated);
+ }
}
// we use this to shrink the workspace for the all apps view and the customize view
- private void shrink(boolean shrinkToTop) {
+ private void shrink(boolean shrinkToTop, boolean animated) {
mIsSmall = true;
final int screenWidth = getWidth();
final int screenHeight = getHeight();
@@ -1167,21 +1187,29 @@ public class Workspace extends ViewGroup
Sequencer s = new Sequencer();
for (int i = 0; i < screenCount; i++) {
CellLayout cl = (CellLayout) getChildAt(i);
- PropertyAnimator translateX = new PropertyAnimator(
- 500, cl, "x", cl.getX(), (int) newX);
- PropertyAnimator translateY = new PropertyAnimator(
- 500, cl, "y", cl.getY(), (int) newY);
- PropertyAnimator scaleX = new PropertyAnimator(
- 500, cl, "scaleX", cl.getScaleX(), SHRINK_FACTOR);
- PropertyAnimator scaleY = new PropertyAnimator(
- 500, cl, "scaleY", cl.getScaleY(), SHRINK_FACTOR);
- PropertyAnimator alpha = new PropertyAnimator(
- 500, cl, "dimmedBitmapAlpha", cl.getDimmedBitmapAlpha(), 1.0f);
- Sequencer.Builder b = s.play(translateX);
- b.with(translateY);
- b.with(scaleX);
- b.with(scaleY);
- b.with(alpha);
+ if (animated) {
+ PropertyAnimator translateX = new PropertyAnimator(
+ 500, cl, "x", cl.getX(), (int) newX);
+ PropertyAnimator translateY = new PropertyAnimator(
+ 500, cl, "y", cl.getY(), (int) newY);
+ PropertyAnimator scaleX = new PropertyAnimator(
+ 500, cl, "scaleX", cl.getScaleX(), SHRINK_FACTOR);
+ PropertyAnimator scaleY = new PropertyAnimator(
+ 500, cl, "scaleY", cl.getScaleY(), SHRINK_FACTOR);
+ PropertyAnimator alpha = new PropertyAnimator(
+ 500, cl, "dimmedBitmapAlpha", cl.getDimmedBitmapAlpha(), 1.0f);
+ Sequencer.Builder b = s.play(translateX);
+ b.with(translateY);
+ b.with(scaleX);
+ b.with(scaleY);
+ b.with(alpha);
+ } else {
+ cl.setX((int)newX);
+ cl.setY((int)newY);
+ cl.setScaleX(SHRINK_FACTOR);
+ cl.setScaleY(SHRINK_FACTOR);
+ cl.setDimmedBitmapAlpha(1.0f);
+ }
// increment newX for the next screen
newX += scaledScreenWidth + scaledSpacing;
cl.setOnInterceptTouchListener(this);