summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Tate <ctate@google.com>2010-10-14 14:44:06 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-10-14 14:44:06 -0700
commitba7aad209f2b130a953467abd8cb41357fc20410 (patch)
treef5f9c21c1f75d42774feca45dbfda8def4bc5b43
parent7ffe05227eecfb4115b73f5fbc1577db4c84b4df (diff)
parenta32dcf7f724137842b9b8d72add4e690fac74984 (diff)
downloadframeworks_base-ba7aad209f2b130a953467abd8cb41357fc20410.zip
frameworks_base-ba7aad209f2b130a953467abd8cb41357fc20410.tar.gz
frameworks_base-ba7aad209f2b130a953467abd8cb41357fc20410.tar.bz2
Merge "Actually draw the drag thumbnail"
-rw-r--r--api/current.xml39
-rw-r--r--core/java/android/view/View.java55
-rw-r--r--services/java/com/android/server/WindowManagerService.java15
3 files changed, 15 insertions, 94 deletions
diff --git a/api/current.xml b/api/current.xml
index 5f08249..6677a90 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -204443,19 +204443,6 @@
<parameter name="canvas" type="android.graphics.Canvas">
</parameter>
</method>
-<method name="onDrawDragThumbnail"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="protected"
->
-<parameter name="canvas" type="android.graphics.Canvas">
-</parameter>
-</method>
<method name="onDrawScrollBars"
return="void"
abstract="false"
@@ -204649,17 +204636,6 @@
<parameter name="heightMeasureSpec" type="int">
</parameter>
</method>
-<method name="onMeasureDragThumbnail"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="protected"
->
-</method>
<method name="onRestoreInstanceState"
return="void"
abstract="false"
@@ -205325,21 +205301,6 @@
<parameter name="contentDescription" type="java.lang.CharSequence">
</parameter>
</method>
-<method name="setDragThumbnailDimension"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="true"
- deprecated="not deprecated"
- visibility="protected"
->
-<parameter name="width" type="int">
-</parameter>
-<parameter name="height" type="int">
-</parameter>
-</method>
<method name="setDrawingCacheBackgroundColor"
return="void"
abstract="false"
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 7ee360d..8e4591a 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -2037,8 +2037,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
*
*/
boolean mCanAcceptDrop;
- private int mThumbnailWidth;
- private int mThumbnailHeight;
/**
* Simple constructor to use when creating a view from code.
@@ -9921,10 +9919,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
throw new IllegalStateException("Drag thumb dimensions must not be negative");
}
+ if (ViewDebug.DEBUG_DRAG) {
+ Log.d(VIEW_LOG_TAG, "drag thumb: width=" + thumbSize.x + " height=" + thumbSize.y
+ + " thumbX=" + thumbTouchPoint.x + " thumbY=" + thumbTouchPoint.y);
+ }
Surface surface = new Surface();
try {
IBinder token = mAttachInfo.mSession.prepareDrag(mAttachInfo.mWindow,
- myWindowOnly, mThumbnailWidth, mThumbnailHeight, surface);
+ myWindowOnly, thumbSize.x, thumbSize.y, surface);
if (ViewDebug.DEBUG_DRAG) Log.d(VIEW_LOG_TAG, "prepareDrag returned token=" + token
+ " surface=" + surface);
if (token != null) {
@@ -9951,53 +9953,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
return okay;
}
- private void measureThumbnail() {
- mPrivateFlags &= ~MEASURED_DIMENSION_SET;
-
- onMeasureDragThumbnail();
-
- // flag not set, setDragThumbnailDimension() was not invoked, we raise
- // an exception to warn the developer
- if ((mPrivateFlags & MEASURED_DIMENSION_SET) != MEASURED_DIMENSION_SET) {
- throw new IllegalStateException("onMeasureDragThumbnail() did not set the"
- + " measured dimension by calling setDragThumbnailDimension()");
- }
-
- if (ViewDebug.DEBUG_DRAG) {
- Log.d(VIEW_LOG_TAG, "Drag thumb measured: w=" + mThumbnailWidth
- + " h=" + mThumbnailHeight);
- }
- }
-
- /**
- * The View must call this method from onMeasureDragThumbnail() in order to
- * specify the dimensions of the drag thumbnail image.
- *
- * @param width The desired thumbnail width.
- * @param height The desired thumbnail height.
- */
- protected final void setDragThumbnailDimension(int width, int height) {
- mPrivateFlags |= MEASURED_DIMENSION_SET;
- mThumbnailWidth = width;
- mThumbnailHeight = height;
- }
-
- /**
- * The default implementation specifies a drag thumbnail that matches the
- * View's current size and appearance.
- */
- protected void onMeasureDragThumbnail() {
- setDragThumbnailDimension(getWidth(), getHeight());
- }
-
- /**
- * The default implementation just draws the current View appearance as the thumbnail
- * @param canvas
- */
- protected void onDrawDragThumbnail(Canvas canvas) {
- draw(canvas);
- }
-
/**
* Drag-and-drop event dispatch. The event.getAction() verb is one of the DragEvent
* constants DRAG_STARTED_EVENT, DRAG_EVENT, DROP_EVENT, and DRAG_ENDED_EVENT.
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index 6c23e37..def36de 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -555,6 +555,12 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
+ int getDragLayerLw() {
+ return mPolicy.windowTypeToLayerLw(WindowManager.LayoutParams.TYPE_DRAG)
+ * TYPE_LAYER_MULTIPLIER
+ + TYPE_LAYER_OFFSET;
+ }
+
/* call out to each visible window/session informing it about the drag
*/
void broadcastDragStartedLw(final float touchX, final float touchY) {
@@ -5533,7 +5539,7 @@ public class WindowManagerService extends IWindowManager.Stub
return null;
}
- private void addDragInputWindow(InputWindowList windowList) {
+ private void addDragInputWindowLw(InputWindowList windowList) {
final InputWindow inputWindow = windowList.add();
inputWindow.inputChannel = mDragState.mServerChannel;
inputWindow.name = "drag";
@@ -5545,9 +5551,7 @@ public class WindowManagerService extends IWindowManager.Stub
inputWindow.hasFocus = true;
inputWindow.hasWallpaper = false;
inputWindow.paused = false;
- inputWindow.layer = mPolicy.windowTypeToLayerLw(inputWindow.layoutParamsType)
- * TYPE_LAYER_MULTIPLIER
- + TYPE_LAYER_OFFSET;
+ inputWindow.layer = mDragState.getDragLayerLw();
inputWindow.ownerPid = Process.myPid();
inputWindow.ownerUid = Process.myUid();
@@ -5583,7 +5587,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (DEBUG_DRAG) {
Log.d(TAG, "Inserting drag window");
}
- addDragInputWindow(mTempInputWindows);
+ addDragInputWindowLw(mTempInputWindows);
}
final int N = windows.size();
@@ -6231,6 +6235,7 @@ public class WindowManagerService extends IWindowManager.Stub
surface.setPosition((int)(touchX - thumbCenterX),
(int)(touchY - thumbCenterY));
surface.setAlpha(.5f);
+ surface.setLayer(mDragState.getDragLayerLw());
surface.show();
} finally {
surface.closeTransaction();