diff options
| author | 2010-10-14 15:48:59 -0700 | |
|---|---|---|
| committer | 2010-10-14 16:43:39 -0700 | |
| commit | 6b3912865c1530a6e06dd189dd95dc5be102b4de (patch) | |
| tree | 7a8a2983458829eb493243623f1922c815ca9f45 | |
| parent | 6eb4122c2d886f87edc2c56f40bedd80d137d27e (diff) | |
Drag thumbnail fixes / improvements
* Properly wipe the thumbnail canvas before handing it to the app for
its contents to be drawn
* Provide a getView() method in DragThumbnailBuilder that allows
clients or subclasses to get at the associated view. This is
especially for clients that want to draw entire (sub)layouts as
the drag thumbnail, by overriding onDrawThumbnail(Canvas c)
like this:
// Override specifically for drawing a whole ViewGroup into
// the drag thumbnail canvas
@Override
public void onDrawThumbnail(Canvas c) {
getView().dispatchDraw(c);
}
Change-Id: Ib43ddd7cf1d44faf2d7f6ba79f102bc3c7f14596
| -rw-r--r-- | api/current.xml | 11 | ||||
| -rw-r--r-- | core/java/android/view/View.java | 5 |
2 files changed, 16 insertions, 0 deletions
diff --git a/api/current.xml b/api/current.xml index 6677a90f9f20..0d76b719e6fe 100644 --- a/api/current.xml +++ b/api/current.xml @@ -206860,6 +206860,17 @@ <parameter name="view" type="android.view.View"> </parameter> </constructor> +<method name="getView" + return="android.view.View" + abstract="false" + native="false" + synchronized="false" + static="false" + final="true" + deprecated="not deprecated" + visibility="public" +> +</method> <method name="onDrawThumbnail" return="void" abstract="false" diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 8e4591aac047..2b63eff0be27 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -9854,6 +9854,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility mView = new WeakReference<View>(view); } + final public View getView() { + return mView.get(); + } + /** * Provide the draggable-thumbnail metrics for the operation: the dimensions of * the thumbnail image itself, and the point within that thumbnail that should @@ -9932,6 +9936,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility if (token != null) { Canvas canvas = surface.lockCanvas(null); try { + canvas.drawColor(0, PorterDuff.Mode.CLEAR); thumbBuilder.onDrawThumbnail(canvas); } finally { surface.unlockCanvasAndPost(canvas); |