merge in honeycomb-release history after reset to master
diff --git a/res/drawable-xlarge-hdpi/trashcan.png b/res/drawable-xlarge-hdpi/trashcan.png
deleted file mode 100644
index a07f784..0000000
--- a/res/drawable-xlarge-hdpi/trashcan.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xlarge-hdpi/trashcan_hover.png b/res/drawable-xlarge-hdpi/trashcan_hover.png
deleted file mode 100644
index 6dbc8f3..0000000
--- a/res/drawable-xlarge-hdpi/trashcan_hover.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xlarge-mdpi/trashcan.png b/res/drawable-xlarge-mdpi/trashcan.png
deleted file mode 100644
index 839d4b8..0000000
--- a/res/drawable-xlarge-mdpi/trashcan.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xlarge-mdpi/trashcan_hover.png b/res/drawable-xlarge-mdpi/trashcan_hover.png
deleted file mode 100644
index cc2fde7..0000000
--- a/res/drawable-xlarge-mdpi/trashcan_hover.png
+++ /dev/null
Binary files differ
diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml
index 8d38a3d6..6e797f8 100644
--- a/res/layout-land/launcher.xml
+++ b/res/layout-land/launcher.xml
@@ -86,7 +86,7 @@
android:layout_gravity="right|center_vertical"
android:scaleType="center"
- android:src="@drawable/delete_zone_selector"
+ android:drawableLeft="@drawable/delete_zone_selector"
android:visibility="invisible"
launcher:direction="vertical"
/>
diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml
index c50dbca..b7c61d8 100644
--- a/res/layout-port/launcher.xml
+++ b/res/layout-port/launcher.xml
@@ -79,7 +79,7 @@
android:layout_gravity="bottom|center_horizontal"
android:scaleType="center"
- android:src="@drawable/delete_zone_selector"
+ android:drawableLeft="@drawable/delete_zone_selector"
android:visibility="invisible"
launcher:direction="horizontal"
/>
diff --git a/res/layout-xlarge-land/all_apps_tabbed.xml b/res/layout-xlarge-land/all_apps_tabbed.xml
index e1a37ff..fbe98b0 100644
--- a/res/layout-xlarge-land/all_apps_tabbed.xml
+++ b/res/layout-xlarge-land/all_apps_tabbed.xml
@@ -39,7 +39,7 @@
android:layout_centerVertical="true">
<com.android.launcher2.ApplicationInfoDropTarget
android:id="@+id/all_apps_info_target"
- android:src="@drawable/ic_home_info_holo_dark"
+ android:drawableRight="@drawable/ic_home_info_holo_dark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@@ -53,14 +53,24 @@
</FrameLayout>
<com.android.launcher2.DeleteZone
android:id="@+id/all_apps_delete_zone"
- android:src="@drawable/delete_zone_selector"
+ android:text="@string/delete_zone_label_all_apps"
+ android:drawablePadding="@dimen/all_apps_drawable_padding"
+ android:drawableLeft="@drawable/delete_zone_selector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/market_info_frame"
android:layout_centerVertical="true"
android:visibility="invisible"
android:paddingRight="22dp"
- launcher:direction="horizontal" />
+ launcher:direction="horizontal"
+
+ android:gravity="center_horizontal|center_vertical"
+ android:textColor="@color/workspace_all_apps_and_delete_zone_text_color"
+ android:textSize="18sp"
+ android:shadowColor="@color/workspace_all_apps_and_delete_zone_text_shadow_color"
+ android:shadowDx="0.0"
+ android:shadowDy="0.0"
+ android:shadowRadius="2.0" />
</RelativeLayout>
<FrameLayout
android:id="@android:id/tabcontent"
diff --git a/res/layout-xlarge-land/launcher.xml b/res/layout-xlarge-land/launcher.xml
index 327b572..b682317 100644
--- a/res/layout-xlarge-land/launcher.xml
+++ b/res/layout-xlarge-land/launcher.xml
@@ -149,10 +149,10 @@
android:textColor="#CCFFFFFF"
android:textSize="18sp"
- android:shadowColor="#A0000000"
+ android:shadowColor="#DA000000"
android:shadowDx="0.0"
android:shadowDy="0.0"
- android:shadowRadius="2.0"
+ android:shadowRadius="2.5"
android:onClick="onClickAllAppsButton"
android:focusable="true"
@@ -168,16 +168,26 @@
android:visibility="gone"/>
<com.android.launcher2.DeleteZone
android:id="@+id/delete_zone"
- android:src="@drawable/delete_zone_selector"
+ android:text="@string/delete_zone_label_workspace"
+ android:drawablePadding="@dimen/all_apps_drawable_padding"
+ android:drawableLeft="@drawable/delete_zone_selector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignLeft="@id/configure_button"
+ android:layout_alignRight="@id/configure_button"
android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
android:paddingRight="@dimen/toolbar_button_horizontal_padding"
android:paddingTop="@dimen/toolbar_button_vertical_padding"
android:paddingBottom="@dimen/toolbar_button_vertical_padding"
android:background="@drawable/button_bg"
+ android:gravity="center_horizontal|center_vertical"
+ android:textColor="@color/workspace_all_apps_and_delete_zone_text_color"
+ android:textSize="18sp"
+ android:shadowColor="@color/workspace_all_apps_and_delete_zone_text_shadow_color"
+ android:shadowDx="0.0"
+ android:shadowDy="0.0"
+ android:shadowRadius="2.0"
+
android:visibility="gone"
launcher:direction="horizontal" />
</RelativeLayout>
diff --git a/res/layout-xlarge-port/all_apps_tabbed.xml b/res/layout-xlarge-port/all_apps_tabbed.xml
index a593148..b90041c 100644
--- a/res/layout-xlarge-port/all_apps_tabbed.xml
+++ b/res/layout-xlarge-port/all_apps_tabbed.xml
@@ -39,7 +39,7 @@
android:layout_centerVertical="true">
<com.android.launcher2.ApplicationInfoDropTarget
android:id="@+id/all_apps_info_target"
- android:src="@drawable/ic_home_info_holo_dark"
+ android:drawableRight="@drawable/ic_home_info_holo_dark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@@ -53,14 +53,24 @@
</FrameLayout>
<com.android.launcher2.DeleteZone
android:id="@+id/all_apps_delete_zone"
- android:src="@drawable/delete_zone_selector"
+ android:text="@string/delete_zone_label_all_apps"
+ android:drawablePadding="@dimen/all_apps_drawable_padding"
+ android:drawableLeft="@drawable/delete_zone_selector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/market_info_frame"
android:layout_centerVertical="true"
android:visibility="invisible"
android:paddingRight="22dp"
- launcher:direction="horizontal" />
+ launcher:direction="horizontal"
+
+ android:gravity="center_horizontal|center_vertical"
+ android:textColor="@color/workspace_all_apps_and_delete_zone_text_color"
+ android:textSize="18sp"
+ android:shadowColor="@color/workspace_all_apps_and_delete_zone_text_shadow_color"
+ android:shadowDx="0.0"
+ android:shadowDy="0.0"
+ android:shadowRadius="2.0" />
</RelativeLayout>
<FrameLayout
android:id="@android:id/tabcontent"
diff --git a/res/layout-xlarge-port/launcher.xml b/res/layout-xlarge-port/launcher.xml
index 1989649..40b947e 100644
--- a/res/layout-xlarge-port/launcher.xml
+++ b/res/layout-xlarge-port/launcher.xml
@@ -147,10 +147,10 @@
android:textColor="#CCFFFFFF"
android:textSize="18sp"
- android:shadowColor="#A0000000"
+ android:shadowColor="#DA000000"
android:shadowDx="0.0"
android:shadowDy="0.0"
- android:shadowRadius="2.0"
+ android:shadowRadius="2.5"
android:onClick="onClickAllAppsButton"
android:focusable="true"
@@ -166,15 +166,25 @@
android:visibility="gone"/>
<com.android.launcher2.DeleteZone
android:id="@+id/delete_zone"
- android:src="@drawable/delete_zone_selector"
+ android:text="@string/delete_zone_label_workspace"
+ android:drawablePadding="@dimen/all_apps_drawable_padding"
+ android:drawableLeft="@drawable/delete_zone_selector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignLeft="@id/configure_button"
+ android:layout_alignRight="@id/configure_button"
android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
android:paddingRight="@dimen/toolbar_button_horizontal_padding"
android:paddingTop="@dimen/toolbar_button_vertical_padding"
android:paddingBottom="@dimen/toolbar_button_vertical_padding"
+ android:gravity="center_horizontal|center_vertical"
+ android:textColor="@color/workspace_all_apps_and_delete_zone_text_color"
+ android:textSize="18sp"
+ android:shadowColor="@color/workspace_all_apps_and_delete_zone_text_shadow_color"
+ android:shadowDx="0.0"
+ android:shadowDy="0.0"
+ android:shadowRadius="2.0"
+
android:visibility="gone"
launcher:direction="horizontal" />
</RelativeLayout>
diff --git a/res/values-xlarge/config.xml b/res/values-xlarge/config.xml
index 62f1671..d8ed214 100644
--- a/res/values-xlarge/config.xml
+++ b/res/values-xlarge/config.xml
@@ -1,6 +1,12 @@
<resources>
<!-- NOTE: Many of the all apps values here are also used for the customization drawer -->
+ <!-- Duration in milliseconds of the fade-in/out of the icons as they are being dragged
+ from the AllApps or Customization trays -->
+ <integer name="icon_allAppsCustomizeFadeInTime">150</integer>
+ <integer name="icon_allAppsCustomizeFadeOutTime">200</integer>
+ <integer name="icon_allAppsCustomizeFadeAlpha">102</integer>
+
<!-- Duration in milliseconds of the all apps / configuration zoom-in animation. -->
<!-- NB: This should be less than the workspaceShrinkTime as they happen together. -->
<integer name="config_allAppsZoomInTime">700</integer>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 4abbd50..91fe2c9 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -38,4 +38,8 @@
<color name="workspace_item_pressed_glow_color">#0997ff</color>
<color name="workspace_item_focused_outline_color">#6595f9</color>
<color name="workspace_item_focused_glow_color">#0997ff</color>
+
+ <color name="workspace_all_apps_and_delete_zone_text_color">#CCFFFFFF</color>
+ <color name="workspace_all_apps_and_delete_zone_text_shadow_color">#A0000000</color>
+ <color name="workspace_delete_zone_drag_text_color">#FFFF0000</color>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4879052..c56ee9e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -142,6 +142,13 @@
<!-- Label for button in all applications label to go back home (to the workspace / desktop)
for accessibilty (spoken when the button gets focus). -->
<string name="all_apps_home_button_label">Home</string>
+ <!-- Label for trash icon on workspace. Meant to communicate the idea of removing the
+ icon/widget from the home screen, but not permanently. Contrast with the label for trash
+ icon in All Apps [CHAR_LIMIT=30] -->
+ <string name="delete_zone_label_workspace">Remove</string>
+ <!-- Label for trash icon in All Apps. The icon/widget will become completely unavailable on the
+ device. [CHAR_LIMIT=30]-->
+ <string name="delete_zone_label_all_apps">Delete</string>
<!-- Menus items: -->
<skip />
diff --git a/src/com/android/launcher2/AllApps3D.java b/src/com/android/launcher2/AllApps3D.java
index 9f40b55..2ecf761 100644
--- a/src/com/android/launcher2/AllApps3D.java
+++ b/src/com/android/launcher2/AllApps3D.java
@@ -937,7 +937,7 @@
ScriptC_allapps mScript;
private Mesh mMesh;
- private ProgramVertex.MatrixAllocation mPVA;
+ private ProgramVertexFixedFunction.Constants mPVA;
private ScriptField_VpConsts mUniformAlloc;
@@ -1039,7 +1039,7 @@
void resize(int w, int h) {
Matrix4f proj = getProjectionMatrix(w, h);
- mPVA.loadProjection(proj);
+ mPVA.setProjection(proj);
if (mUniformAlloc != null) {
ScriptField_VpConsts.Item i = new ScriptField_VpConsts.Item();
@@ -1063,20 +1063,20 @@
}
private void initProgramVertex() {
- mPVA = new ProgramVertex.MatrixAllocation(sRS);
+ mPVA = new ProgramVertexFixedFunction.Constants(sRS);
resize(mWidth, mHeight);
- ProgramVertex.Builder pvb = new ProgramVertex.Builder(sRS, null, null);
+ ProgramVertexFixedFunction.Builder pvb = new ProgramVertexFixedFunction.Builder(sRS);
pvb.setTextureMatrixEnable(true);
ProgramVertex pv = pvb.create();
- pv.bindAllocation(mPVA);
+ ((ProgramVertexFixedFunction)pv).bindConstants(mPVA);
sRS.bindProgramVertex(pv);
mUniformAlloc = new ScriptField_VpConsts(sRS, 1);
mScript.bind_vpConstants(mUniformAlloc);
initMesh();
- ProgramVertex.ShaderBuilder sb = new ProgramVertex.ShaderBuilder(sRS);
+ ProgramVertex.Builder sb = new ProgramVertex.Builder(sRS);
String t = "varying vec4 varColor;\n" +
"varying vec2 varTex0;\n" +
"void main() {\n" +
@@ -1145,19 +1145,19 @@
private void initProgramFragment() {
Sampler.Builder sb = new Sampler.Builder(sRS);
- sb.setMin(Sampler.Value.LINEAR_MIP_LINEAR);
- sb.setMag(Sampler.Value.NEAREST);
+ sb.setMinification(Sampler.Value.LINEAR_MIP_LINEAR);
+ sb.setMagnification(Sampler.Value.NEAREST);
sb.setWrapS(Sampler.Value.CLAMP);
sb.setWrapT(Sampler.Value.CLAMP);
Sampler linear = sb.create();
- sb.setMin(Sampler.Value.NEAREST);
- sb.setMag(Sampler.Value.NEAREST);
+ sb.setMinification(Sampler.Value.NEAREST);
+ sb.setMagnification(Sampler.Value.NEAREST);
Sampler nearest = sb.create();
- ProgramFragment.Builder bf = new ProgramFragment.Builder(sRS);
- bf.setTexture(ProgramFragment.Builder.EnvMode.MODULATE,
- ProgramFragment.Builder.Format.RGBA, 0);
+ ProgramFragmentFixedFunction.Builder bf = new ProgramFragmentFixedFunction.Builder(sRS);
+ bf.setTexture(ProgramFragmentFixedFunction.Builder.EnvMode.MODULATE,
+ ProgramFragmentFixedFunction.Builder.Format.RGBA, 0);
bf.setVaryingColor(true);
ProgramFragment pfTexMip = bf.create();
pfTexMip.bindSampler(linear, 0);
@@ -1166,8 +1166,8 @@
ProgramFragment pfTexNearest = bf.create();
pfTexNearest.bindSampler(nearest, 0);
- bf.setTexture(ProgramFragment.Builder.EnvMode.MODULATE,
- ProgramFragment.Builder.Format.ALPHA, 0);
+ bf.setTexture(ProgramFragmentFixedFunction.Builder.EnvMode.MODULATE,
+ ProgramFragmentFixedFunction.Builder.Format.ALPHA, 0);
bf.setVaryingColor(true);
ProgramFragment pfTexMipAlpha = bf.create();
pfTexMipAlpha.bindSampler(linear, 0);
@@ -1178,10 +1178,10 @@
}
private void initProgramStore() {
- ProgramStore.Builder bs = new ProgramStore.Builder(sRS, null, null);
+ ProgramStore.Builder bs = new ProgramStore.Builder(sRS);
bs.setDepthFunc(ProgramStore.DepthFunc.ALWAYS);
- bs.setColorMask(true,true,true,false);
- bs.setDitherEnable(true);
+ bs.setColorMaskEnabled(true,true,true,false);
+ bs.setDitherEnabled(true);
bs.setBlendFunc(ProgramStore.BlendSrcFunc.SRC_ALPHA,
ProgramStore.BlendDstFunc.ONE_MINUS_SRC_ALPHA);
mScript.set_gPS(bs.create());
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java
index 5b98a15..a424bc6 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -204,10 +204,6 @@
private void setupDragMode() {
mLauncher.getWorkspace().shrink(Workspace.ShrinkState.BOTTOM_VISIBLE);
-
- DeleteZone deleteZone = (DeleteZone) mLauncher.findViewById(R.id.delete_zone);
- deleteZone.setDragAndDropEnabled(false);
-
DeleteZone allAppsDeleteZone = (DeleteZone)
mLauncher.findViewById(R.id.all_apps_delete_zone);
allAppsDeleteZone.setDragAndDropEnabled(true);
@@ -223,9 +219,6 @@
// deleteZone and the appInfoButton in all apps, and re-enable the instance which
// live in the workspace
public void run() {
- DeleteZone deleteZone = (DeleteZone) mLauncher.findViewById(R.id.delete_zone);
- deleteZone.setDragAndDropEnabled(true);
-
DeleteZone allAppsDeleteZone =
(DeleteZone) mLauncher.findViewById(R.id.all_apps_delete_zone);
allAppsDeleteZone.setDragAndDropEnabled(false);
@@ -270,6 +263,10 @@
// Toggle the selection on the dragged app
Checkable checkable = (Checkable) v;
+
+ // Note: we toggle the checkable state to actually cause an alpha fade for the duration
+ // of the drag of the item. (The fade-in will occur when all checked states are
+ // disabled when dragging ends)
checkable.toggle();
}
diff --git a/src/com/android/launcher2/ApplicationInfoDropTarget.java b/src/com/android/launcher2/ApplicationInfoDropTarget.java
index 9d421c6..f944022 100644
--- a/src/com/android/launcher2/ApplicationInfoDropTarget.java
+++ b/src/com/android/launcher2/ApplicationInfoDropTarget.java
@@ -51,11 +51,15 @@
int colour = getContext().getResources().getColor(R.color.app_info_filter);
mHoverPaint.setColorFilter(new PorterDuffColorFilter(colour, PorterDuff.Mode.SRC_ATOP));
- // For the application info drop target, we just ignore the left padding since we don't want
- // to overlap with the delete zone padding
- int tb = getResources().getDimensionPixelSize(R.dimen.delete_zone_vertical_drag_padding);
- int lr = getResources().getDimensionPixelSize(R.dimen.delete_zone_horizontal_drag_padding);
- setDragPadding(tb, lr, tb, 0);
+ if (LauncherApplication.isScreenXLarge()) {
+ // For the application info drop target, we just ignore the left padding since we don't want
+ // to overlap with the delete zone padding
+ int tb = getResources().getDimensionPixelSize(
+ R.dimen.delete_zone_vertical_drag_padding);
+ int lr = getResources().getDimensionPixelSize(
+ R.dimen.delete_zone_horizontal_drag_padding);
+ setDragPadding(tb, lr, tb, 0);
+ }
}
public boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset,
diff --git a/src/com/android/launcher2/BubbleTextView.java b/src/com/android/launcher2/BubbleTextView.java
index 6e2a58b..2d04924 100644
--- a/src/com/android/launcher2/BubbleTextView.java
+++ b/src/com/android/launcher2/BubbleTextView.java
@@ -88,13 +88,10 @@
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaint.setColor(bubbleColor);
mBubbleColorAlpha = Color.alpha(bubbleColor) / 255.0f;
- mFocusedOutlineColor =
- getResources().getColor(R.color.workspace_item_focused_outline_color);
- mFocusedGlowColor = getResources().getColor(R.color.workspace_item_focused_glow_color);
- mPressedOutlineColor =
- getResources().getColor(R.color.workspace_item_pressed_outline_color);
- mPressedGlowColor =
- getResources().getColor(R.color.workspace_item_pressed_glow_color);
+ mFocusedOutlineColor = res.getColor(R.color.workspace_item_focused_outline_color);
+ mFocusedGlowColor = res.getColor(R.color.workspace_item_focused_glow_color);
+ mPressedOutlineColor = res.getColor(R.color.workspace_item_pressed_outline_color);
+ mPressedGlowColor = res.getColor(R.color.workspace_item_pressed_glow_color);
}
protected int getCacheTopPadding() {
diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java
index 60f1c90..ec9d52e 100644
--- a/src/com/android/launcher2/CustomizePagedView.java
+++ b/src/com/android/launcher2/CustomizePagedView.java
@@ -54,6 +54,7 @@
import android.view.View;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
+import android.widget.Checkable;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -327,6 +328,7 @@
@Override
public void onDropCompleted(View target, boolean success) {
+ resetCheckedGrandchildren();
mLauncher.getWorkspace().onDragStopped();
}
@@ -498,6 +500,7 @@
}
super.beginDragging(v);
+ boolean result = false;
switch (mCustomizationType) {
case WidgetCustomization: {
// Get the widget preview as the drag representation
@@ -515,7 +518,8 @@
mDragController.startDrag(
i, b, this, createWidgetInfo, DragController.DRAG_ACTION_COPY, null);
b.recycle();
- return true;
+ result = true;
+ break;
}
case ShortcutCustomization: {
// get icon (top compound drawable, index is 1)
@@ -528,7 +532,8 @@
mDragController.startDrag(v, b, this, createItemInfo, DragController.DRAG_ACTION_COPY,
null);
b.recycle();
- return true;
+ result = true;
+ break;
}
case ApplicationCustomization: {
// Pick up the application for dropping
@@ -542,10 +547,28 @@
mLauncher.getWorkspace().onDragStartedWithItemSpans(1, 1, b);
mDragController.startDrag(v, b, this, app, DragController.DRAG_ACTION_COPY, null);
b.recycle();
- return true;
+ result = true;
+ break;
}
}
- return false;
+
+ // We toggle the checked state _after_ we create the view for the drag in case toggling the
+ // checked state changes the view's look
+ if (v instanceof Checkable) {
+ // In preparation for drag, we always reset the checked grand children regardless of
+ // what choice mode we are in
+ resetCheckedGrandchildren();
+
+ // Toggle the selection on the dragged app
+ Checkable checkable = (Checkable) v;
+
+ // Note: we toggle the checkable state to actually cause an alpha fade for the duration
+ // of the drag of the item. (The fade-in will occur when all checked states are
+ // disabled when dragging ends)
+ checkable.toggle();
+ }
+
+ return result;
}
/**
diff --git a/src/com/android/launcher2/DeleteZone.java b/src/com/android/launcher2/DeleteZone.java
index 16061d3..98d2b83 100644
--- a/src/com/android/launcher2/DeleteZone.java
+++ b/src/com/android/launcher2/DeleteZone.java
@@ -16,7 +16,10 @@
package com.android.launcher2;
+import com.android.launcher.R;
+
import android.content.Context;
+import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
@@ -31,14 +34,13 @@
import android.view.animation.AnimationSet;
import android.view.animation.TranslateAnimation;
-import com.android.launcher.R;
-
public class DeleteZone extends IconDropTarget {
private static final int ORIENTATION_HORIZONTAL = 1;
private static final int TRANSITION_DURATION = 250;
private static final int ANIMATION_DURATION = 200;
private static final int XLARGE_TRANSITION_DURATION = 150;
private static final int XLARGE_ANIMATION_DURATION = 200;
+ private static final int LEFT_DRAWABLE = 0;
private AnimationSet mInAnimation;
private AnimationSet mOutAnimation;
@@ -51,6 +53,8 @@
private final RectF mRegionF = new RectF();
private final Rect mRegion = new Rect();
private TransitionDrawable mTransition;
+ private int mTextColor;
+ private int mDragTextColor;
public DeleteZone(Context context, AttributeSet attrs) {
this(context, attrs, 0);
@@ -66,15 +70,26 @@
mOrientation = a.getInt(R.styleable.DeleteZone_direction, ORIENTATION_HORIZONTAL);
a.recycle();
- int tb = getResources().getDimensionPixelSize(R.dimen.delete_zone_vertical_drag_padding);
- int lr = getResources().getDimensionPixelSize(R.dimen.delete_zone_horizontal_drag_padding);
- setDragPadding(tb, lr, tb, lr);
+ if (LauncherApplication.isScreenXLarge()) {
+ int tb = getResources().getDimensionPixelSize(
+ R.dimen.delete_zone_vertical_drag_padding);
+ int lr = getResources().getDimensionPixelSize(
+ R.dimen.delete_zone_horizontal_drag_padding);
+ setDragPadding(tb, lr, tb, lr);
+ }
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- mTransition = (TransitionDrawable) getDrawable();
+ mTransition = (TransitionDrawable) getCompoundDrawables()[LEFT_DRAWABLE];
+ if (LauncherApplication.isScreenXLarge()) {
+ mTransition.setCrossFadeEnabled(false);
+ }
+
+ Resources r = getResources();
+ mTextColor = r.getColor(R.color.workspace_all_apps_and_delete_zone_text_color);
+ mDragTextColor = r.getColor(R.color.workspace_delete_zone_drag_text_color);
}
public boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset,
@@ -115,7 +130,6 @@
final LauncherAppWidgetInfo launcherAppWidgetInfo = (LauncherAppWidgetInfo) item;
final LauncherAppWidgetHost appWidgetHost = mLauncher.getAppWidgetHost();
if (appWidgetHost != null) {
- final int appWidgetId = launcherAppWidgetInfo.appWidgetId;
// Deleting an app widget ID is a void call but writes to disk before returning
// to the caller...
new Thread("deleteAppWidgetId") {
@@ -133,6 +147,7 @@
DragView dragView, Object dragInfo) {
if (mDragAndDropEnabled) {
mTransition.reverseTransition(getTransitionAnimationDuration());
+ setTextColor(mDragTextColor);
super.onDragEnter(source, x, y, xOffset, yOffset, dragView, dragInfo);
}
}
@@ -141,6 +156,7 @@
DragView dragView, Object dragInfo) {
if (mDragAndDropEnabled) {
mTransition.reverseTransition(getTransitionAnimationDuration());
+ setTextColor(mTextColor);
super.onDragExit(source, x, y, xOffset, yOffset, dragView, dragInfo);
}
}
diff --git a/src/com/android/launcher2/IconDropTarget.java b/src/com/android/launcher2/IconDropTarget.java
index bfc46cf..fb5d0f0 100644
--- a/src/com/android/launcher2/IconDropTarget.java
+++ b/src/com/android/launcher2/IconDropTarget.java
@@ -16,22 +16,19 @@
package com.android.launcher2;
-import com.android.launcher.R;
-
import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
-import android.widget.ImageView;
+import android.widget.TextView;
+
/**
* Implements a DropTarget which allows applications to be dropped on it,
* in order to launch the application info for that app.
*/
-public class IconDropTarget extends ImageView implements DropTarget, DragController.DragListener {
+public class IconDropTarget extends TextView implements DropTarget, DragController.DragListener {
protected Launcher mLauncher;
/**
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 3c1c336..82f5aea 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2595,19 +2595,23 @@
hideOrShowToolbarButton(true, divider, showSeq);
hideOrShowToolbarButton(true, configureButton, showSeq);
mDeleteZone.setOverlappingViews(new View[] { allAppsButton, divider, configureButton });
+ mDeleteZone.setDragAndDropEnabled(true);
+ mDeleteZone.setText(getResources().getString(R.string.delete_zone_label_workspace));
break;
case ALL_APPS:
hideOrShowToolbarButton(false, configureButton, hideSeq);
hideOrShowToolbarButton(false, searchButton, hideSeq);
hideOrShowToolbarButton(false, divider, hideSeq);
hideOrShowToolbarButton(false, allAppsButton, hideSeq);
+ mDeleteZone.setDragAndDropEnabled(false);
+ mDeleteZone.setText(getResources().getString(R.string.delete_zone_label_all_apps));
break;
case CUSTOMIZE:
hideOrShowToolbarButton(false, allAppsButton, hideSeq);
hideOrShowToolbarButton(false, searchButton, hideSeq);
hideOrShowToolbarButton(false, divider, hideSeq);
hideOrShowToolbarButton(false, configureButton, hideSeq);
- //mDeleteZone.setOverlappingView(configureButton);
+ mDeleteZone.setDragAndDropEnabled(false);
break;
}
}
diff --git a/src/com/android/launcher2/PagedViewIcon.java b/src/com/android/launcher2/PagedViewIcon.java
index d91daf9..e4049eb 100644
--- a/src/com/android/launcher2/PagedViewIcon.java
+++ b/src/com/android/launcher2/PagedViewIcon.java
@@ -20,6 +20,7 @@
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
+import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@@ -57,9 +58,9 @@
private boolean mIsChecked;
private ObjectAnimator mCheckedAlphaAnimator;
- private final static float sCheckedAlpha = 0.4f;
- private final static int sCheckedFadeInDuration = 150;
- private final static int sCheckedFadeOutDuration = 200;
+ private float mCheckedAlpha = 1.0f;
+ private int mCheckedFadeInDuration;
+ private int mCheckedFadeOutDuration;
// Highlight colors
private int mHoloBlurColor;
@@ -116,6 +117,15 @@
sHolographicOutlineHelper = new HolographicOutlineHelper();
}
+ // Set up fade in/out constants
+ final Resources r = context.getResources();
+ final int alpha = r.getInteger(R.integer.icon_allAppsCustomizeFadeAlpha);
+ if (alpha > 0) {
+ mCheckedAlpha = r.getInteger(R.integer.icon_allAppsCustomizeFadeAlpha) / 256.0f;
+ mCheckedFadeInDuration = r.getInteger(R.integer.icon_allAppsCustomizeFadeInTime);
+ mCheckedFadeOutDuration = r.getInteger(R.integer.icon_allAppsCustomizeFadeOutTime);
+ }
+
setFocusable(true);
setBackgroundDrawable(null);
}
@@ -230,11 +240,11 @@
float alpha;
int duration;
if (mIsChecked) {
- alpha = sCheckedAlpha;
- duration = sCheckedFadeInDuration;
+ alpha = mCheckedAlpha;
+ duration = mCheckedFadeInDuration;
} else {
alpha = 1.0f;
- duration = sCheckedFadeOutDuration;
+ duration = mCheckedFadeOutDuration;
}
// Initialize the animator
diff --git a/src/com/android/launcher2/PagedViewWidget.java b/src/com/android/launcher2/PagedViewWidget.java
index 5f5844f..8c729b1 100644
--- a/src/com/android/launcher2/PagedViewWidget.java
+++ b/src/com/android/launcher2/PagedViewWidget.java
@@ -16,34 +16,34 @@
package com.android.launcher2;
+import android.animation.ObjectAnimator;
import android.appwidget.AppWidgetProviderInfo;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
+import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
-import android.graphics.PorterDuffXfermode;
import android.graphics.PorterDuff.Mode;
-import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Message;
import android.util.AttributeSet;
import android.view.MotionEvent;
+import android.widget.Checkable;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.launcher.R;
-import com.android.launcher2.PagedView.PagedViewIconCache;
/**
* The linear layout used strictly for the widget/wallpaper tab of the customization tray
*/
-public class PagedViewWidget extends LinearLayout {
+public class PagedViewWidget extends LinearLayout implements Checkable {
static final String TAG = "PagedViewWidgetLayout";
private final Paint mPaint = new Paint();
@@ -59,6 +59,12 @@
private int mHoloBlurColor;
private int mHoloOutlineColor;
+ private boolean mIsChecked;
+ private ObjectAnimator mCheckedAlphaAnimator;
+ private float mCheckedAlpha = 1.0f;
+ private int mCheckedFadeInDuration;
+ private int mCheckedFadeOutDuration;
+
private static final HandlerThread sWorkerThread = new HandlerThread("pagedviewwidget-helper");
static {
sWorkerThread.start();
@@ -118,6 +124,15 @@
sHolographicOutlineHelper = new HolographicOutlineHelper();
}
+ // Set up fade in/out constants
+ final Resources r = context.getResources();
+ final int alpha = r.getInteger(R.integer.icon_allAppsCustomizeFadeAlpha);
+ if (alpha > 0) {
+ mCheckedAlpha = r.getInteger(R.integer.icon_allAppsCustomizeFadeAlpha) / 256.0f;
+ mCheckedFadeInDuration = r.getInteger(R.integer.icon_allAppsCustomizeFadeInTime);
+ mCheckedFadeOutDuration = r.getInteger(R.integer.icon_allAppsCustomizeFadeOutTime);
+ }
+
setFocusable(true);
setWillNotDraw(false);
setClipToPadding(false);
@@ -219,4 +234,41 @@
super.onDetachedFromWindow();
sWorker.removeMessages(MESSAGE_CREATE_HOLOGRAPHIC_OUTLINE, this);
}
+
+ @Override
+ public void setChecked(boolean checked) {
+ if (mIsChecked != checked) {
+ mIsChecked = checked;
+
+ float alpha;
+ int duration;
+ if (mIsChecked) {
+ alpha = mCheckedAlpha;
+ duration = mCheckedFadeInDuration;
+ } else {
+ alpha = 1.0f;
+ duration = mCheckedFadeOutDuration;
+ }
+
+ // Initialize the animator
+ if (mCheckedAlphaAnimator != null) {
+ mCheckedAlphaAnimator.cancel();
+ }
+ mCheckedAlphaAnimator = ObjectAnimator.ofFloat(this, "alpha", getAlpha(), alpha);
+ mCheckedAlphaAnimator.setDuration(duration);
+ mCheckedAlphaAnimator.start();
+
+ invalidate();
+ }
+ }
+
+ @Override
+ public boolean isChecked() {
+ return mIsChecked;
+ }
+
+ @Override
+ public void toggle() {
+ setChecked(!mIsChecked);
+ }
}