Merge "Some launcher bugs:"
diff --git a/res/drawable-hdpi/portal_container_holo.9.png b/res/drawable-hdpi/portal_container_holo.9.png
index ab846f6..20e8808 100644
--- a/res/drawable-hdpi/portal_container_holo.9.png
+++ b/res/drawable-hdpi/portal_container_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/portal_ring_inner_holo.png b/res/drawable-hdpi/portal_ring_inner_holo.png
index cd40594..7f48e73 100644
--- a/res/drawable-hdpi/portal_ring_inner_holo.png
+++ b/res/drawable-hdpi/portal_ring_inner_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/portal_ring_outer_holo.png b/res/drawable-hdpi/portal_ring_outer_holo.png
index 1a66a44..4ad47bf 100644
--- a/res/drawable-hdpi/portal_ring_outer_holo.png
+++ b/res/drawable-hdpi/portal_ring_outer_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/portal_ring_rest.png b/res/drawable-hdpi/portal_ring_rest.png
new file mode 100644
index 0000000..5e215d3
--- /dev/null
+++ b/res/drawable-hdpi/portal_ring_rest.png
Binary files differ
diff --git a/res/drawable-mdpi/portal_container_holo.9.png b/res/drawable-mdpi/portal_container_holo.9.png
index 56a5b87..90fb1d1 100644
--- a/res/drawable-mdpi/portal_container_holo.9.png
+++ b/res/drawable-mdpi/portal_container_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/portal_ring_inner_holo.png b/res/drawable-mdpi/portal_ring_inner_holo.png
index 9addb30..4dbae06 100644
--- a/res/drawable-mdpi/portal_ring_inner_holo.png
+++ b/res/drawable-mdpi/portal_ring_inner_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/portal_ring_outer_holo.png b/res/drawable-mdpi/portal_ring_outer_holo.png
index 6103869..a70acf2 100644
--- a/res/drawable-mdpi/portal_ring_outer_holo.png
+++ b/res/drawable-mdpi/portal_ring_outer_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/portal_ring_rest.png b/res/drawable-mdpi/portal_ring_rest.png
new file mode 100644
index 0000000..c3203d9
--- /dev/null
+++ b/res/drawable-mdpi/portal_ring_rest.png
Binary files differ
diff --git a/res/drawable-xhdpi/portal_container_holo.9.png b/res/drawable-xhdpi/portal_container_holo.9.png
index 55c701b..3c8193b 100644
--- a/res/drawable-xhdpi/portal_container_holo.9.png
+++ b/res/drawable-xhdpi/portal_container_holo.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/portal_ring_inner_holo.png b/res/drawable-xhdpi/portal_ring_inner_holo.png
index dfdd622..fc3d3c0 100644
--- a/res/drawable-xhdpi/portal_ring_inner_holo.png
+++ b/res/drawable-xhdpi/portal_ring_inner_holo.png
Binary files differ
diff --git a/res/layout-land/folder_icon.xml b/res/layout-land/folder_icon.xml
index e9d2b96..15867c7 100644
--- a/res/layout-land/folder_icon.xml
+++ b/res/layout-land/folder_icon.xml
@@ -27,6 +27,6 @@
android:layout_height="@dimen/folder_preview_size"
android:src="@drawable/portal_ring_inner_holo"/>
<com.android.launcher2.BubbleTextView
- android:id="@+id/folder_name"
+ android:id="@+id/folder_icon_name"
style="@style/WorkspaceIcon.Landscape.Folder"/>
</com.android.launcher2.FolderIcon>
diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml
index 215f8db..9d394d0 100644
--- a/res/layout-land/launcher.xml
+++ b/res/layout-land/launcher.xml
@@ -22,9 +22,18 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
+ <!-- Keep these behind the workspace so that they are not visible when
+ we go into AllApps -->
+ <include
+ android:id="@+id/qsb_divider"
+ layout="@layout/workspace_divider"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="@dimen/qsb_bar_height"
+ android:layout_gravity="left" />
<include
android:id="@+id/dock_divider"
- layout="@layout/dock_divider"
+ layout="@layout/workspace_divider"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/button_bar_height"
diff --git a/res/layout-port/folder_icon.xml b/res/layout-port/folder_icon.xml
index adc0e6a..69e51e8 100644
--- a/res/layout-port/folder_icon.xml
+++ b/res/layout-port/folder_icon.xml
@@ -27,6 +27,6 @@
android:layout_height="@dimen/folder_preview_size"
android:src="@drawable/portal_ring_inner_holo"/>
<com.android.launcher2.BubbleTextView
- android:id="@+id/folder_name"
+ android:id="@+id/folder_icon_name"
style="@style/WorkspaceIcon.Portrait.Folder"/>
</com.android.launcher2.FolderIcon>
diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml
index f7e93f0..2f8d995 100644
--- a/res/layout-port/launcher.xml
+++ b/res/layout-port/launcher.xml
@@ -25,8 +25,15 @@
<!-- Keep these behind the workspace so that they are not visible when
we go into AllApps -->
<include
+ android:id="@+id/qsb_divider"
+ layout="@layout/workspace_divider"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/qsb_bar_height"
+ android:layout_gravity="top" />
+ <include
android:id="@+id/dock_divider"
- layout="@layout/dock_divider"
+ layout="@layout/workspace_divider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/button_bar_height"
@@ -48,8 +55,8 @@
launcher:cellCountX="4"
launcher:cellCountY="4"
launcher:pageSpacing="@dimen/workspace_page_spacing"
- launcher:scrollIndicatorPaddingLeft="@dimen/dock_divider_padding_left"
- launcher:scrollIndicatorPaddingRight="@dimen/dock_divider_padding_right">
+ launcher:scrollIndicatorPaddingLeft="@dimen/workspace_divider_padding_left"
+ launcher:scrollIndicatorPaddingRight="@dimen/workspace_divider_padding_right">
<include android:id="@+id/cell1" layout="@layout/workspace_screen" />
<include android:id="@+id/cell2" layout="@layout/workspace_screen" />
diff --git a/res/layout/qsb_bar.xml b/res/layout/qsb_bar.xml
index abcc941..cad81f5 100644
--- a/res/layout/qsb_bar.xml
+++ b/res/layout/qsb_bar.xml
@@ -28,28 +28,26 @@
android:id="@+id/drag_target_bar"
android:visibility="gone">
- <com.android.launcher2.DeleteDropTarget
+ <FrameLayout
style="@style/DropTargetButtonContainer"
- android:id="@+id/delete_target"
android:layout_weight="1">
<!-- Delete target -->
- <TextView
+ <com.android.launcher2.DeleteDropTarget
style="@style/DropTargetButton"
android:id="@+id/delete_target_text"
android:text="@string/delete_zone_label_workspace"
android:drawableLeft="@drawable/delete_target_selector" />
- </com.android.launcher2.DeleteDropTarget>
+ </FrameLayout>
- <com.android.launcher2.InfoDropTarget
+ <FrameLayout
style="@style/DropTargetButtonContainer"
- android:id="@+id/info_target"
android:layout_weight="1">
<!-- Info target -->
- <TextView
+ <com.android.launcher2.InfoDropTarget
style="@style/DropTargetButton"
android:id="@+id/info_target_text"
android:text="@string/info_target_label"
android:drawableLeft="@drawable/info_target_selector" />
- </com.android.launcher2.InfoDropTarget>
+ </FrameLayout>
</LinearLayout>
</com.android.launcher2.SearchDropTargetBar>
diff --git a/res/layout/user_folder.xml b/res/layout/user_folder.xml
index 6b19603..7597bc7 100644
--- a/res/layout/user_folder.xml
+++ b/res/layout/user_folder.xml
@@ -45,8 +45,9 @@
android:paddingTop="@dimen/folder_content_name_gap"
android:background="#00000000"
android:hint="@string/folder_hint_text"
- android:textSize="16sp"
- android:textColor="#FFF"
+ android:textSize="14sp"
+ android:textColor="#ff33b5e5"
+ android:textColorHighlight="#ff333333"
android:gravity="center_horizontal"
android:singleLine="true"/>
</com.android.launcher2.Folder>
diff --git a/res/layout/dock_divider.xml b/res/layout/workspace_divider.xml
similarity index 77%
rename from res/layout/dock_divider.xml
rename to res/layout/workspace_divider.xml
index c3cac52..257ea7c 100644
--- a/res/layout/dock_divider.xml
+++ b/res/layout/workspace_divider.xml
@@ -16,9 +16,9 @@
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
- android:paddingLeft="@dimen/dock_divider_padding_left"
- android:paddingRight="@dimen/dock_divider_padding_right"
- android:paddingTop="@dimen/dock_divider_padding_top"
- android:paddingBottom="@dimen/dock_divider_padding_bottom"
+ android:paddingLeft="@dimen/workspace_divider_padding_left"
+ android:paddingRight="@dimen/workspace_divider_padding_right"
+ android:paddingTop="@dimen/workspace_divider_padding_top"
+ android:paddingBottom="@dimen/workspace_divider_padding_bottom"
android:scaleType="fitXY"
android:src="@drawable/hotseat_track_holo" />
\ No newline at end of file
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index d8cc7ef..c715bfb 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -25,10 +25,10 @@
<dimen name="workspace_top_padding">0dp</dimen>
<dimen name="workspace_bottom_padding">0dp</dimen>
<dimen name="workspace_page_spacing">8dp</dimen>
- <dimen name="dock_divider_padding_left">0dp</dimen>
- <dimen name="dock_divider_padding_right">0dp</dimen>
- <dimen name="dock_divider_padding_top">12dp</dimen>
- <dimen name="dock_divider_padding_bottom">12dp</dimen>
+ <dimen name="workspace_divider_padding_left">0dp</dimen>
+ <dimen name="workspace_divider_padding_right">0dp</dimen>
+ <dimen name="workspace_divider_padding_top">12dp</dimen>
+ <dimen name="workspace_divider_padding_bottom">12dp</dimen>
<!-- AppsCustomize -->
<dimen name="apps_customize_cell_width">80dp</dimen>
diff --git a/res/values-large/styles.xml b/res/values-large/styles.xml
index bc21a3a..ea1a8e6 100644
--- a/res/values-large/styles.xml
+++ b/res/values-large/styles.xml
@@ -98,6 +98,8 @@
<item name="android:layout_gravity">center</item>
<item name="android:gravity">center_vertical</item>
<item name="android:drawablePadding">7.5dp</item>
+ <item name="android:paddingLeft">25dp</item>
+ <item name="android:paddingRight">25dp</item>
<item name="android:textColor">#FFFFFFFF</item>
<item name="android:textSize">16sp</item>
<item name="android:shadowColor">#393939</item>
diff --git a/res/values-port/dimens.xml b/res/values-port/dimens.xml
index e917c50..2d27321 100644
--- a/res/values-port/dimens.xml
+++ b/res/values-port/dimens.xml
@@ -28,8 +28,8 @@
<integer name="apps_customize_cellCountY">5</integer>
<dimen name="apps_customize_pageLayoutWidthGap">-1dp</dimen>
<dimen name="apps_customize_pageLayoutHeightGap">-1dp</dimen>
- <dimen name="apps_customize_pageLayoutPaddingTop">15dp</dimen>
- <dimen name="apps_customize_pageLayoutPaddingBottom">15dp</dimen>
+ <dimen name="apps_customize_pageLayoutPaddingTop">10dp</dimen>
+ <dimen name="apps_customize_pageLayoutPaddingBottom">10dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingLeft">5dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingRight">5dp</dimen>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 215f698..309bf6d 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -24,10 +24,10 @@
<dimen name="workspace_max_gap">8dp</dimen>
<dimen name="folder_cell_width">74dp</dimen>
<dimen name="folder_cell_height">80dp</dimen>
- <dimen name="dock_divider_padding_left">12dp</dimen>
- <dimen name="dock_divider_padding_right">12dp</dimen>
- <dimen name="dock_divider_padding_top">0dp</dimen>
- <dimen name="dock_divider_padding_bottom">0dp</dimen>
+ <dimen name="workspace_divider_padding_left">12dp</dimen>
+ <dimen name="workspace_divider_padding_right">12dp</dimen>
+ <dimen name="workspace_divider_padding_top">0dp</dimen>
+ <dimen name="workspace_divider_padding_bottom">0dp</dimen>
<!-- QSB -->
<dimen name="toolbar_button_vertical_padding">0dip</dimen>
@@ -53,7 +53,7 @@
<dimen name="button_bar_height_plus_padding">88dp</dimen>
<!-- Drag padding to add to the drop targets -->
- <dimen name="drop_target_drag_padding">20dp</dimen>
+ <dimen name="drop_target_drag_padding">40dp</dimen>
<!-- extra horizontal spacing between mini screen thumbnails ie. in all
apps and in customization mode -->
@@ -92,7 +92,7 @@
<dimen name="folder_preview_size">64dp</dimen>
<!-- The amount that the preview contents are inset from the preview background -->
<dimen name="folder_preview_padding">4dp</dimen>
- <dimen name="folder_content_name_gap">8dp</dimen>
+ <dimen name="folder_content_name_gap">4dp</dimen>
<dimen name="folder_width_gap">0dp</dimen>
<dimen name="folder_height_gap">0dp</dimen>
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 62244a6..b356a42 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -66,15 +66,18 @@
<style name="WorkspaceIcon.Portrait.AppsCustomize">
<item name="android:background">@null</item>
+ <item name="android:paddingTop">0dp</item>
+ <item name="android:paddingBottom">0dp</item>
<item name="android:paddingLeft">0dp</item>
<item name="android:paddingRight">0dp</item>
- <item name="android:drawablePadding">0dp</item>
+ <item name="android:drawablePadding">4dp</item>
<item name="android:includeFontPadding">false</item>
</style>
<style name="WorkspaceIcon.Landscape.AppsCustomize">
<item name="android:background">@null</item>
+ <item name="android:paddingTop">0dp</item>
<item name="android:paddingBottom">0dp</item>
- <item name="android:drawablePadding">0dp</item>
+ <item name="android:drawablePadding">2dp</item>
<item name="android:includeFontPadding">false</item>
</style>
@@ -105,6 +108,8 @@
<item name="android:layout_gravity">center</item>
<item name="android:gravity">center_vertical</item>
<item name="android:drawablePadding">7.5dp</item>
+ <item name="android:paddingLeft">25dp</item>
+ <item name="android:paddingRight">25dp</item>
<item name="android:textColor">#FFFFFFFF</item>
<item name="android:textSize">16sp</item>
<item name="android:shadowColor">#393939</item>
diff --git a/src/com/android/launcher2/ButtonDropTarget.java b/src/com/android/launcher2/ButtonDropTarget.java
index 138770a..868ede8 100644
--- a/src/com/android/launcher2/ButtonDropTarget.java
+++ b/src/com/android/launcher2/ButtonDropTarget.java
@@ -29,7 +29,7 @@
/**
* Implements a DropTarget.
*/
-public class ButtonDropTarget extends FrameLayout implements DropTarget, DragController.DragListener {
+public class ButtonDropTarget extends TextView implements DropTarget, DragController.DragListener {
protected final int mTransitionDuration;
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 65ca162..518c79f 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -85,6 +85,7 @@
private OnTouchListener mInterceptTouchListener;
private ArrayList<FolderRingAnimator> mFolderOuterRings = new ArrayList<FolderRingAnimator>();
+ private int[] mFolderLeaveBehindCell = {-1, -1};
private float mBackgroundAlpha;
private float mBackgroundAlphaMultiplier = 1.0f;
@@ -557,6 +558,22 @@
d.draw(canvas);
canvas.restore();
}
+
+ if (mFolderLeaveBehindCell[0] >= 0 && mFolderLeaveBehindCell[1] >= 0) {
+ Drawable d = FolderIcon.sSharedFolderLeaveBehind;
+ int width = d.getIntrinsicWidth();
+ int height = d.getIntrinsicHeight();
+
+ cellToPoint(mFolderLeaveBehindCell[0], mFolderLeaveBehindCell[1], mTempLocation);
+ int centerX = mTempLocation[0] + mCellWidth / 2;
+ int centerY = mTempLocation[1] + FolderRingAnimator.sPreviewSize / 2;
+
+ canvas.save();
+ canvas.translate(centerX - width / 2, centerY - width / 2);
+ d.setBounds(0, 0, width, height);
+ d.draw(canvas);
+ canvas.restore();
+ }
}
public void showFolderAccept(FolderRingAnimator fra) {
@@ -570,6 +587,18 @@
invalidate();
}
+ public void setFolderLeaveBehindCell(int x, int y) {
+ mFolderLeaveBehindCell[0] = x;
+ mFolderLeaveBehindCell[1] = y;
+ invalidate();
+ }
+
+ public void clearFolderLeaveBehind() {
+ mFolderLeaveBehindCell[0] = -1;
+ mFolderLeaveBehindCell[1] = -1;
+ invalidate();
+ }
+
@Override
public void cancelLongPress() {
super.cancelLongPress();
diff --git a/src/com/android/launcher2/DeleteDropTarget.java b/src/com/android/launcher2/DeleteDropTarget.java
index e76ab31..1553d3c 100644
--- a/src/com/android/launcher2/DeleteDropTarget.java
+++ b/src/com/android/launcher2/DeleteDropTarget.java
@@ -26,9 +26,8 @@
import android.graphics.drawable.TransitionDrawable;
import android.util.AttributeSet;
import android.view.View;
-import android.view.animation.AccelerateInterpolator;
+import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
-import android.widget.TextView;
import com.android.launcher.R;
@@ -52,22 +51,21 @@
super.onFinishInflate();
// Get the drawable
- mText = (TextView) findViewById(R.id.delete_target_text);
- mOriginalTextColor = mText.getTextColors();
+ mOriginalTextColor = getTextColors();
// Get the hover color
Resources r = getResources();
mHoverColor = r.getColor(R.color.delete_target_hover_tint);
mHoverPaint.setColorFilter(new PorterDuffColorFilter(
mHoverColor, PorterDuff.Mode.SRC_ATOP));
- mDrawable = (TransitionDrawable) mText.getCompoundDrawables()[0];
+ mDrawable = (TransitionDrawable) getCompoundDrawables()[0];
mDrawable.setCrossFadeEnabled(true);
// Remove the text in the Phone UI in landscape
int orientation = getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
if (!LauncherApplication.isScreenLarge()) {
- mText.setText("");
+ setText("");
}
}
}
@@ -120,10 +118,10 @@
mActive = isVisible;
mDrawable.resetTransition();
- mText.setTextColor(mOriginalTextColor);
- setVisibility(isVisible ? View.VISIBLE : View.GONE);
- if (mText.getText().length() > 0) {
- mText.setText(isUninstall ? R.string.delete_target_uninstall_label
+ setTextColor(mOriginalTextColor);
+ ((ViewGroup) getParent()).setVisibility(isVisible ? View.VISIBLE : View.GONE);
+ if (getText().length() > 0) {
+ setText(isUninstall ? R.string.delete_target_uninstall_label
: R.string.delete_target_label);
}
}
@@ -138,7 +136,7 @@
super.onDragEnter(d);
mDrawable.startTransition(mTransitionDuration);
- mText.setTextColor(mHoverColor);
+ setTextColor(mHoverColor);
}
public void onDragExit(DragObject d) {
@@ -146,7 +144,7 @@
if (!d.dragComplete) {
mDrawable.resetTransition();
- mText.setTextColor(mOriginalTextColor);
+ setTextColor(mOriginalTextColor);
}
}
@@ -155,11 +153,12 @@
Rect from = new Rect();
Rect to = new Rect();
dragLayer.getViewRectRelativeToSelf(d.dragView, from);
- dragLayer.getViewRectRelativeToSelf(mText, to);
+ dragLayer.getViewRectRelativeToSelf(this, to);
int width = mDrawable.getIntrinsicWidth();
int height = mDrawable.getIntrinsicHeight();
- to.set(to.left, to.top, to.left + width, to.bottom);
+ to.set(to.left + getPaddingLeft(), to.top + getPaddingTop(),
+ to.left + getPaddingLeft() + width, to.bottom);
// Center the destination rect about the trash icon
int xOffset = (int) -(d.dragView.getMeasuredWidth() - width) / 2;
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index 83f580c..780d0ed 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -27,6 +27,8 @@
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.text.InputType;
+import android.text.Selection;
+import android.text.Spannable;
import android.util.AttributeSet;
import android.view.ActionMode;
import android.view.KeyEvent;
@@ -244,6 +246,7 @@
LauncherModel.updateItemInDatabase(mLauncher, mInfo);
mFolderName.setCursorVisible(false);
mFolderName.clearFocus();
+ Selection.setSelection((Spannable) mFolderName.getText(), 0, 0);
mIsEditingName = false;
}
diff --git a/src/com/android/launcher2/FolderIcon.java b/src/com/android/launcher2/FolderIcon.java
index 949a25e..8cf3fa7 100644
--- a/src/com/android/launcher2/FolderIcon.java
+++ b/src/com/android/launcher2/FolderIcon.java
@@ -71,6 +71,8 @@
// (0 means it's not scaled at all, 1 means it's scaled to nothing)
private static final float PERSPECTIVE_SCALE_FACTOR = 0.35f;
+ public static Drawable sSharedFolderLeaveBehind = null;
+
private ImageView mPreviewBackground;
private BubbleTextView mFolderName;
@@ -116,7 +118,7 @@
FolderIcon icon = (FolderIcon) LayoutInflater.from(launcher).inflate(resId, group, false);
- icon.mFolderName = (BubbleTextView) icon.findViewById(R.id.folder_name);
+ icon.mFolderName = (BubbleTextView) icon.findViewById(R.id.folder_icon_name);
icon.mFolderName.setText(folderInfo.title);
icon.mPreviewBackground = (ImageView) icon.findViewById(R.id.preview_background);
icon.mPreviewBackground.setContentDescription(folderInfo.title);
@@ -135,6 +137,11 @@
folderInfo.addListener(icon);
+ Resources res = launcher.getResources();
+ if (sSharedFolderLeaveBehind == null) {
+ sSharedFolderLeaveBehind = res.getDrawable(R.drawable.portal_ring_rest);
+ }
+
return icon;
}
@@ -259,7 +266,7 @@
final int itemType = item.itemType;
return ((itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION ||
itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) &&
- !mFolder.isFull() && item != mInfo);
+ !mFolder.isFull() && item != mInfo && !mInfo.opened);
}
public boolean acceptDrop(Object dragInfo) {
diff --git a/src/com/android/launcher2/InfoDropTarget.java b/src/com/android/launcher2/InfoDropTarget.java
index 3507181..dba845b 100644
--- a/src/com/android/launcher2/InfoDropTarget.java
+++ b/src/com/android/launcher2/InfoDropTarget.java
@@ -26,7 +26,7 @@
import android.graphics.drawable.TransitionDrawable;
import android.util.AttributeSet;
import android.view.View;
-import android.widget.TextView;
+import android.view.ViewGroup;
import com.android.launcher.R;
@@ -48,22 +48,21 @@
protected void onFinishInflate() {
super.onFinishInflate();
- mText = (TextView) findViewById(R.id.info_target_text);
- mOriginalTextColor = mText.getTextColors();
+ mOriginalTextColor = getTextColors();
// Get the hover color
Resources r = getResources();
mHoverColor = r.getColor(R.color.info_target_hover_tint);
mHoverPaint.setColorFilter(new PorterDuffColorFilter(
mHoverColor, PorterDuff.Mode.SRC_ATOP));
- mDrawable = (TransitionDrawable) mText.getCompoundDrawables()[0];
+ mDrawable = (TransitionDrawable) getCompoundDrawables()[0];
mDrawable.setCrossFadeEnabled(true);
// Remove the text in the Phone UI in landscape
int orientation = getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
if (!LauncherApplication.isScreenLarge()) {
- mText.setText("");
+ setText("");
}
}
}
@@ -100,8 +99,8 @@
mActive = isVisible;
mDrawable.resetTransition();
- mText.setTextColor(mOriginalTextColor);
- setVisibility(isVisible ? View.VISIBLE : View.GONE);
+ setTextColor(mOriginalTextColor);
+ ((ViewGroup) getParent()).setVisibility(isVisible ? View.VISIBLE : View.GONE);
}
@Override
@@ -114,7 +113,7 @@
super.onDragEnter(d);
mDrawable.startTransition(mTransitionDuration);
- mText.setTextColor(mHoverColor);
+ setTextColor(mHoverColor);
}
public void onDragExit(DragObject d) {
@@ -122,7 +121,7 @@
if (!d.dragComplete) {
mDrawable.resetTransition();
- mText.setTextColor(mOriginalTextColor);
+ setTextColor(mOriginalTextColor);
}
}
}
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 339d7c8..cd62ee1 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -213,12 +213,6 @@
private static HashMap<Long, FolderInfo> sFolders = new HashMap<Long, FolderInfo>();
- // Hotseats (quick-launch icons next to AllApps)
- private String[] mHotseatConfig = null;
- private Intent[] mHotseats = null;
- private Drawable[] mHotseatIcons = null;
- private CharSequence[] mHotseatLabels = null;
-
private Intent mAppMarketIntent = null;
// Related to the auto-advancing of widgets
@@ -437,16 +431,6 @@
}
}
- // Note: This doesn't do all the client-id magic that BrowserProvider does
- // in Browser. (http://b/2425179)
- private Uri getDefaultBrowserUri() {
- String url = getString(R.string.default_browser_url);
- if (url.indexOf("{CID}") != -1) {
- url = url.replace("{CID}", "android-google");
- }
- return Uri.parse(url);
- }
-
/**
* Returns whether we should delay spring loaded mode -- for shortcuts and widgets that have
* a configuration step, this allows the proper animations to run after other transitions.
@@ -1754,6 +1738,12 @@
PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.5f);
PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.5f);
+ FolderInfo info = (FolderInfo) fi.getTag();
+ if (info.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
+ CellLayout cl = (CellLayout) fi.getParent().getParent();
+ cl.setFolderLeaveBehindCell(info.cellX, info.cellY);
+ }
+
ObjectAnimator oa = ObjectAnimator.ofPropertyValuesHolder(fi, alpha, scaleX, scaleY);
oa.setDuration(getResources().getInteger(R.integer.config_folderAnimDuration));
oa.start();
@@ -1764,8 +1754,23 @@
PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f);
PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f);
+ FolderInfo info = (FolderInfo) fi.getTag();
+ CellLayout cl = null;
+ if (info.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
+ cl = (CellLayout) fi.getParent().getParent();
+ }
+
+ final CellLayout layout = cl;
ObjectAnimator oa = ObjectAnimator.ofPropertyValuesHolder(fi, alpha, scaleX, scaleY);
oa.setDuration(getResources().getInteger(R.integer.config_folderAnimDuration));
+ oa.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ if (layout != null) {
+ layout.clearFolderLeaveBehind();
+ }
+ }
+ });
oa.start();
}
@@ -1901,27 +1906,6 @@
showDialog(DIALOG_CREATE_SHORTCUT);
}
- private void pickShortcut() {
- // Insert extra item to handle picking application
- Bundle bundle = new Bundle();
-
- ArrayList<String> shortcutNames = new ArrayList<String>();
- shortcutNames.add(getString(R.string.group_applications));
- bundle.putStringArrayList(Intent.EXTRA_SHORTCUT_NAME, shortcutNames);
-
- ArrayList<ShortcutIconResource> shortcutIcons = new ArrayList<ShortcutIconResource>();
- shortcutIcons.add(ShortcutIconResource.fromContext(Launcher.this,
- R.drawable.ic_launcher_application));
- bundle.putParcelableArrayList(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, shortcutIcons);
-
- Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
- pickIntent.putExtra(Intent.EXTRA_INTENT, new Intent(Intent.ACTION_CREATE_SHORTCUT));
- pickIntent.putExtra(Intent.EXTRA_TITLE, getText(R.string.title_select_shortcut));
- pickIntent.putExtras(bundle);
-
- startActivityForResult(pickIntent, REQUEST_PICK_SHORTCUT);
- }
-
private class RenameFolder {
private EditText mInput;
diff --git a/src/com/android/launcher2/LauncherSettings.java b/src/com/android/launcher2/LauncherSettings.java
index fcacdec..ee00371 100644
--- a/src/com/android/launcher2/LauncherSettings.java
+++ b/src/com/android/launcher2/LauncherSettings.java
@@ -143,7 +143,7 @@
/**
* The X coordinate of the cell holding the favorite
- * (if container is CONTAINER_DESKTOP or CONTAINER_DOCK)
+ * (if container is CONTAINER_HOTSEAT or CONTAINER_HOTSEAT)
* <P>Type: INTEGER</P>
*/
static final String CELLX = "cellX";
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 596ef50..292ccd7 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -163,14 +163,13 @@
// Scrolling indicator
private ValueAnimator mScrollIndicatorAnimator;
- private android.animation.ValueAnimator mDockDividerAnimator;
private ImageView mScrollIndicator;
private int mScrollIndicatorPaddingLeft;
private int mScrollIndicatorPaddingRight;
private boolean mHasScrollIndicator = true;
- private static final int sScrollIndicatorFadeInDuration = 150;
- private static final int sScrollIndicatorFadeOutDuration = 650;
- private static final int sScrollIndicatorFlashDuration = 650;
+ protected static final int sScrollIndicatorFadeInDuration = 150;
+ protected static final int sScrollIndicatorFadeOutDuration = 650;
+ protected static final int sScrollIndicatorFlashDuration = 650;
// If set, will defer loading associated pages until the scrolling settles
private boolean mDeferLoadAssociatedPagesUntilScrollCompletes;
@@ -1740,55 +1739,6 @@
}
}
- void showDockDivider(boolean immediately) {
- final ViewGroup parent = (ViewGroup) getParent();
- final View divider = (ImageView) (parent.findViewById(R.id.dock_divider));
- if (divider != null) {
- divider.setVisibility(View.VISIBLE);
- if (mDockDividerAnimator != null) {
- mDockDividerAnimator.cancel();
- }
- if (immediately) {
- divider.setAlpha(1f);
- } else {
- mDockDividerAnimator = ObjectAnimator.ofFloat(divider, "alpha", 1f);
- mDockDividerAnimator.setDuration(sScrollIndicatorFadeInDuration);
- mDockDividerAnimator.start();
- }
- }
- }
-
- void hideDockDivider(boolean immediately) {
- final ViewGroup parent = (ViewGroup) getParent();
- final View divider = (ImageView) (parent.findViewById(R.id.dock_divider));
- if (divider != null) {
- if (mDockDividerAnimator != null) {
- mDockDividerAnimator.cancel();
- }
- if (immediately) {
- divider.setVisibility(View.GONE);
- divider.setAlpha(0f);
- } else {
- mDockDividerAnimator = ObjectAnimator.ofFloat(divider, "alpha", 0f);
- mDockDividerAnimator.setDuration(sScrollIndicatorFadeOutDuration);
- mDockDividerAnimator.addListener(new AnimatorListenerAdapter() {
- private boolean cancelled = false;
- @Override
- public void onAnimationCancel(android.animation.Animator animation) {
- cancelled = true;
- }
- @Override
- public void onAnimationEnd(android.animation.Animator animation) {
- if (!cancelled) {
- divider.setVisibility(View.GONE);
- }
- }
- });
- mDockDividerAnimator.start();
- }
- }
- }
-
/**
* To be overridden by subclasses to determine whether the scroll indicator should stretch to
* fill its space on the track or not.
diff --git a/src/com/android/launcher2/SearchDropTargetBar.java b/src/com/android/launcher2/SearchDropTargetBar.java
index ee3ab18..69a1213 100644
--- a/src/com/android/launcher2/SearchDropTargetBar.java
+++ b/src/com/android/launcher2/SearchDropTargetBar.java
@@ -77,8 +77,8 @@
// Get the individual components
mQSBSearchBar = findViewById(R.id.qsb_search_bar);
mDropTargetBar = findViewById(R.id.drag_target_bar);
- mInfoDropTarget = (ButtonDropTarget) mDropTargetBar.findViewById(R.id.info_target);
- mDeleteDropTarget = (ButtonDropTarget) mDropTargetBar.findViewById(R.id.delete_target);
+ mInfoDropTarget = (ButtonDropTarget) mDropTargetBar.findViewById(R.id.info_target_text);
+ mDeleteDropTarget = (ButtonDropTarget) mDropTargetBar.findViewById(R.id.delete_target_text);
mBarHeight = getResources().getDimensionPixelSize(R.dimen.qsb_bar_height);
mInfoDropTarget.setSearchDropTargetBar(this);
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 23b8c2d..10b218a 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -58,6 +58,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
+import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
@@ -109,6 +110,7 @@
private float mBackgroundAlpha = 0;
private float mOverScrollMaxBackgroundAlpha = 0.0f;
private int mOverScrollPageIndex = -1;
+ private AnimatorSet mDividerAnimator;
private final WallpaperManager mWallpaperManager;
private IBinder mWindowToken;
@@ -140,7 +142,6 @@
private int[] mTempEstimate = new int[2];
private float[] mDragViewVisualCenter = new float[2];
private float[] mTempDragCoordinates = new float[2];
- private float[] mTempTouchCoordinates = new float[2];
private float[] mTempCellLayoutCenterCoordinates = new float[2];
private float[] mTempDragBottomRightCoordinates = new float[2];
private Matrix mTempInverseMatrix = new Matrix();
@@ -1288,12 +1289,6 @@
}
}
- private boolean childLayersEnabled() {
- boolean isSmallOrSpringloaded =
- isSmall() || mIsSwitchingState || mState == State.SPRING_LOADED;
- return isSmallOrSpringloaded || isPageMoving() || mIsDragOccuring;
- }
-
private void updateChildrenLayersEnabled() {
boolean small =
isSmall() || mIsSwitchingState || mState == State.SPRING_LOADED;
@@ -1711,6 +1706,14 @@
}
void unshrink(boolean animated, boolean springLoaded) {
+ if (mFirstLayout) {
+ // (mFirstLayout == "first layout has not happened yet")
+ // cancel any pending shrinks that were set earlier
+ mSwitchStateAfterFirstLayout = false;
+ mStateAfterFirstLayout = State.NORMAL;
+ return;
+ }
+
if (isSmall()) {
float finalScaleFactor = 1.0f;
float finalBackgroundAlpha = 0.0f;
@@ -2056,7 +2059,6 @@
final Bitmap b = createDragBitmap(child, new Canvas(), bitmapPadding);
final int bmpWidth = b.getWidth();
- final int bmpHeight = b.getHeight();
mLauncher.getDragLayer().getLocationInDragLayer(child, mTempXY);
final int dragLayerX = (int) mTempXY[0] + (child.getWidth() - bmpWidth) / 2;
@@ -2776,8 +2778,6 @@
// Identify whether we have dragged over a side page
if (isSmall()) {
- int left = d.x - d.xOffset;
- int top = d.y - d.yOffset;
layout = findMatchingPageForDragOver(d.dragView, mDragViewVisualCenter[0],
mDragViewVisualCenter[1], true);
if (layout != mDragTargetLayout) {
@@ -3107,7 +3107,6 @@
}
public void resetTransitionTransform(CellLayout layout) {
if (isSwitchingState()) {
- int index = indexOfChild(layout);
mCurrentScaleX = layout.getScaleX();
mCurrentScaleY = layout.getScaleY();
mCurrentTranslationX = layout.getTranslationX();
@@ -3338,7 +3337,6 @@
int count = layout.getChildCount();
for (int i = 0; i < count; i++) {
View child = layout.getChildAt(i);
- CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
if (child instanceof Folder) {
Folder f = (Folder) child;
if (f.getInfo() == tag && f.getInfo().opened) {
@@ -3378,7 +3376,6 @@
}
void removeItems(final ArrayList<ApplicationInfo> apps) {
- final int screenCount = getChildCount();
final AppWidgetManager widgets = AppWidgetManager.getInstance(getContext());
final HashSet<String> packageNames = new HashSet<String>();
@@ -3542,4 +3539,66 @@
protected boolean hasElasticScrollIndicator() {
return true;
}
+
+ void showDockDivider(boolean immediately) {
+ final ViewGroup parent = (ViewGroup) getParent();
+ final View qsbDivider = (ImageView) (parent.findViewById(R.id.qsb_divider));
+ final View dockDivider = (ImageView) (parent.findViewById(R.id.dock_divider));
+ if (qsbDivider != null && dockDivider != null) {
+ qsbDivider.setVisibility(View.VISIBLE);
+ dockDivider.setVisibility(View.VISIBLE);
+ if (mDividerAnimator != null) {
+ mDividerAnimator.cancel();
+ mDividerAnimator = null;
+ }
+ if (immediately) {
+ qsbDivider.setAlpha(1f);
+ dockDivider.setAlpha(1f);
+ } else {
+ mDividerAnimator = new AnimatorSet();
+ mDividerAnimator.playTogether(ObjectAnimator.ofFloat(qsbDivider, "alpha", 1f),
+ ObjectAnimator.ofFloat(dockDivider, "alpha", 1f));
+ mDividerAnimator.setDuration(sScrollIndicatorFadeInDuration);
+ mDividerAnimator.start();
+ }
+ }
+ }
+
+ void hideDockDivider(boolean immediately) {
+ final ViewGroup parent = (ViewGroup) getParent();
+ final View qsbDivider = (ImageView) (parent.findViewById(R.id.qsb_divider));
+ final View dockDivider = (ImageView) (parent.findViewById(R.id.dock_divider));
+ if (qsbDivider != null && dockDivider != null) {
+ if (mDividerAnimator != null) {
+ mDividerAnimator.cancel();
+ mDividerAnimator = null;
+ }
+ if (immediately) {
+ qsbDivider.setVisibility(View.GONE);
+ dockDivider.setVisibility(View.GONE);
+ qsbDivider.setAlpha(0f);
+ dockDivider.setAlpha(0f);
+ } else {
+ mDividerAnimator = new AnimatorSet();
+ mDividerAnimator.playTogether(ObjectAnimator.ofFloat(qsbDivider, "alpha", 0f),
+ ObjectAnimator.ofFloat(dockDivider, "alpha", 0f));
+ mDividerAnimator.addListener(new AnimatorListenerAdapter() {
+ private boolean cancelled = false;
+ @Override
+ public void onAnimationCancel(android.animation.Animator animation) {
+ cancelled = true;
+ }
+ @Override
+ public void onAnimationEnd(android.animation.Animator animation) {
+ if (!cancelled) {
+ qsbDivider.setVisibility(View.GONE);
+ dockDivider.setVisibility(View.GONE);
+ }
+ }
+ });
+ mDividerAnimator.setDuration(sScrollIndicatorFadeOutDuration);
+ mDividerAnimator.start();
+ }
+ }
+ }
}