API CHANGE: startDrag() now takes "int flags" instead of "boolean localOnly"

startDrag() that crosses application boundaries will remain @hide until we get
more of the surrounding behaviors nailed down.

Drag-and-drop demo updated to only show app-local drag operations pro tem.

Change-Id: I9cdcd132c1aae45bc472e70293b7187b4cba9bca
This commit is contained in:
Christopher Tate
2011-01-10 20:45:20 -08:00
parent d8126c7d89
commit 134fada434
4 changed files with 2 additions and 22 deletions

View File

@@ -62,18 +62,6 @@
dot:anr="drop" dot:anr="drop"
/> />
<com.example.android.apis.view.DraggableDot
android:id="@+id/drag_dot_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
dot:radius="64dp"
android:padding="15dp"
android:layout_below="@id/drag_dot_1"
android:layout_toRightOf="@id/drag_dot_3"
dot:legend="Local"
dot:localOnly="true"
/>
<TextView android:id="@+id/drag_result_text" <TextView android:id="@+id/drag_result_text"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@@ -38,7 +38,6 @@
<declare-styleable name="DraggableDot"> <declare-styleable name="DraggableDot">
<attr name="radius" format="dimension" /> <attr name="radius" format="dimension" />
<attr name="legend" format="string" /> <attr name="legend" format="string" />
<attr name="localOnly" format="boolean" />
<attr name="anr"> <attr name="anr">
<enum name="none" value="0" /> <enum name="none" value="0" />
<enum name="thumbnail" value="1" /> <enum name="thumbnail" value="1" />

View File

@@ -39,8 +39,6 @@ public class DragAndDropDemo extends Activity {
dot.setReportView(text); dot.setReportView(text);
dot = (DraggableDot) findViewById(R.id.drag_dot_3); dot = (DraggableDot) findViewById(R.id.drag_dot_3);
dot.setReportView(text); dot.setReportView(text);
dot = (DraggableDot) findViewById(R.id.drag_dot_4);
dot.setReportView(text);
mResultText = (TextView) findViewById(R.id.drag_result_text); mResultText = (TextView) findViewById(R.id.drag_result_text);
mResultText.setOnDragListener(new View.OnDragListener() { mResultText.setOnDragListener(new View.OnDragListener() {

View File

@@ -48,7 +48,6 @@ public class DraggableDot extends View {
int mRadius; int mRadius;
int mAnrType; int mAnrType;
boolean mLocalOnly;
CharSequence mLegend; CharSequence mLegend;
static final int ANR_NONE = 0; static final int ANR_NONE = 0;
@@ -123,21 +122,17 @@ public class DraggableDot extends View {
case R.styleable.DraggableDot_anr: { case R.styleable.DraggableDot_anr: {
mAnrType = a.getInt(attr, 0); mAnrType = a.getInt(attr, 0);
} break; } break;
case R.styleable.DraggableDot_localOnly: {
mLocalOnly = a.getBoolean(attr, false);
} break;
} }
} }
Log.i(TAG, "DraggableDot @ " + this + " : radius=" + mRadius + " legend='" + mLegend Log.i(TAG, "DraggableDot @ " + this + " : radius=" + mRadius + " legend='" + mLegend
+ "' anr=" + mAnrType + " local=" + mLocalOnly); + "' anr=" + mAnrType);
setOnLongClickListener(new View.OnLongClickListener() { setOnLongClickListener(new View.OnLongClickListener() {
public boolean onLongClick(View v) { public boolean onLongClick(View v) {
ClipData data = ClipData.newPlainText("dot", null, "Dot : " + v.toString()); ClipData data = ClipData.newPlainText("dot", null, "Dot : " + v.toString());
v.startDrag(data, new ANRShadowBuilder(v, mAnrType == ANR_SHADOW), v.startDrag(data, new ANRShadowBuilder(v, mAnrType == ANR_SHADOW),
mLocalOnly, (Object)v); (Object)v, 0);
return true; return true;
} }
}); });