Merge "Smoothing out transitions when adding from AllAppsCustomize"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c0df443..a3c263d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -33,6 +33,12 @@
<string name="uid_name">Android Core Apps</string>
<!-- Default folder name -->
<string name="folder_name"></string>
+ <!-- Title of dialog that appears after user selects Wallpaper from menu -->
+ <string name="chooser_wallpaper">Select wallpaper from</string>
+ <!-- Button label on Wallpaper Gallery screen; user selects this button to set a specific wallpaper -->
+ <string name="wallpaper_instructions">Set wallpaper</string>
+ <!-- Option in "Select wallpaper from" dialog box -->
+ <string name="pick_wallpaper">Wallpapers</string>
<!-- Displayed when user selects a shortcut for an app that was uninstalled [CHAR_LIMIT=none]-->
<string name="activity_not_found">Application is not installed.</string>
<!-- Labels for the tabs in the customize drawer -->
diff --git a/res/xml/default_workspace.xml b/res/xml/default_workspace.xml
index 9189c76..0e96a67 100644
--- a/res/xml/default_workspace.xml
+++ b/res/xml/default_workspace.xml
@@ -45,21 +45,21 @@
launcher:className="com.android.contacts.activities.DialtactsActivity"
launcher:container="-101"
launcher:screen="1"
- launcher:x="0"
+ launcher:x="1"
launcher:y="0" />
<favorite
launcher:packageName="com.android.contacts"
launcher:className="com.android.contacts.activities.PeopleActivity"
launcher:container="-101"
launcher:screen="2"
- launcher:x="0"
+ launcher:x="2"
launcher:y="0" />
<favorite
launcher:packageName="com.android.browser"
launcher:className="com.android.browser.BrowserActivity"
launcher:container="-101"
launcher:screen="3"
- launcher:x="0"
+ launcher:x="3"
launcher:y="0" />
</favorites>
diff --git a/src/com/android/launcher2/BubbleTextView.java b/src/com/android/launcher2/BubbleTextView.java
index 57a6584..476d063 100644
--- a/src/com/android/launcher2/BubbleTextView.java
+++ b/src/com/android/launcher2/BubbleTextView.java
@@ -330,16 +330,4 @@
}
return true;
}
-
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- return FocusHelper.handleBubbleTextViewKeyEvent(this, keyCode, event)
- || super.onKeyDown(keyCode, event);
- }
-
- @Override
- public boolean onKeyUp(int keyCode, KeyEvent event) {
- return FocusHelper.handleBubbleTextViewKeyEvent(this, keyCode, event)
- || super.onKeyUp(keyCode, event);
- }
}
diff --git a/src/com/android/launcher2/FocusHelper.java b/src/com/android/launcher2/FocusHelper.java
index 233fd6f..3783d56 100644
--- a/src/com/android/launcher2/FocusHelper.java
+++ b/src/com/android/launcher2/FocusHelper.java
@@ -31,9 +31,19 @@
import java.util.Comparator;
/**
+ * A keyboard listener we set on all the workspace icons.
+ */
+class BubbleTextViewKeyEventListener implements View.OnKeyListener {
+ @Override
+ public boolean onKey(View v, int keyCode, KeyEvent event) {
+ return FocusHelper.handleBubbleTextViewKeyEvent((BubbleTextView) v, keyCode, event);
+ }
+}
+
+/**
* A keyboard listener we set on all the hotseat buttons.
*/
-class HotseatKeyEventListener implements View.OnKeyListener {
+class HotseatBubbleTextViewKeyEventListener implements View.OnKeyListener {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
final Configuration configuration = v.getResources().getConfiguration();
@@ -612,6 +622,7 @@
final Workspace workspace = (Workspace) layout.getParent();
final ViewGroup launcher = (ViewGroup) workspace.getParent();
final ViewGroup tabs = (ViewGroup) launcher.findViewById(R.id.qsb_bar);
+ final ViewGroup hotseat = (ViewGroup) launcher.findViewById(R.id.hotseat);
int iconIndex = parent.indexOfChild(v);
int iconCount = parent.getChildCount();
int pageIndex = workspace.indexOfChild(layout);
@@ -678,11 +689,13 @@
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
if (handleKeyEvent) {
- // Select the closest icon in the next line, otherwise select the tab bar
+ // Select the closest icon in the next line, otherwise select the button bar
View newIcon = getClosestBubbleTextViewOnLine(layout, parent, v, 1);
if (newIcon != null) {
newIcon.requestFocus();
wasHandled = true;
+ } else if (hotseat != null) {
+ hotseat.requestFocus();
}
}
break;
diff --git a/src/com/android/launcher2/Hotseat.java b/src/com/android/launcher2/Hotseat.java
index deab131..491691e 100644
--- a/src/com/android/launcher2/Hotseat.java
+++ b/src/com/android/launcher2/Hotseat.java
@@ -57,6 +57,7 @@
public void setup(Launcher launcher) {
mLauncher = launcher;
+ setOnKeyListener(new HotseatBubbleTextViewKeyEventListener());
}
CellLayout getLayout() {
@@ -96,11 +97,14 @@
inflater.inflate(R.layout.application, mContent, false);
allAppsButton.setCompoundDrawablesWithIntrinsicBounds(null,
context.getResources().getDrawable(R.drawable.apps_hotseat_button), null, null);
- // button.setText(context.getString(R.string.all_apps_button_label));
+ // allAppsButton.setText(context.getString(R.string.all_apps_button_label));
+ allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));
allAppsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(android.view.View v) {
- mLauncher.showAllApps(true);
+ if (mLauncher != null) {
+ mLauncher.showAllApps(true);
+ }
}
});
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 0abdec0..3050be4 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2874,6 +2874,13 @@
final Workspace workspace = mWorkspace;
for (int i=start; i<end; i++) {
final ItemInfo item = shortcuts.get(i);
+
+ // Short circuit if we are loading dock items for a configuration which has no dock
+ if (item.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT &&
+ mHotseat == null) {
+ continue;
+ }
+
switch (item.itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index bddaccc..66bb2ab 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -477,6 +477,7 @@
final CellLayout layout;
if (container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
layout = mLauncher.getHotseat().getLayout();
+ child.setOnKeyListener(null);
if (screen < 0) {
screen = mLauncher.getHotseat().getOrderInHotseat(x, y);
@@ -488,6 +489,7 @@
}
} else {
layout = (CellLayout) getChildAt(screen);
+ child.setOnKeyListener(new BubbleTextViewKeyEventListener());
}
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
@@ -2142,8 +2144,12 @@
boolean createUserFolderIfNecessary(View newView, long container, CellLayout target,
int[] targetCell, boolean external, DragView dragView, Runnable postAnimationRunnable) {
View v = target.getChildAt(targetCell[0], targetCell[1]);
- boolean hasntMoved = mDragInfo != null
- && (mDragInfo.cellX == targetCell[0] && mDragInfo.cellY == targetCell[1]);
+ boolean hasntMoved = false;
+ if (mDragInfo != null) {
+ CellLayout cellParent = getParentCellLayoutForView(mDragInfo.cell);
+ hasntMoved = (mDragInfo.cellX == targetCell[0] &&
+ mDragInfo.cellY == targetCell[1]) && (cellParent == target);
+ }
if (v == null || hasntMoved || !mCreateUserFolderOnDrop) return false;
mCreateUserFolderOnDrop = false;