summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/view/BookmarkExpandableGridView.java
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-05-27 14:42:43 -0700
committerJohn Reck <jreck@google.com>2011-05-27 15:16:58 -0700
commite7c97de989b75a591d598da63e0bef51831462d4 (patch)
tree4c4c16f1ccb2c1ef326d3dfd9031a1e7112255e7 /src/com/android/browser/view/BookmarkExpandableGridView.java
parentb9b2a8290874e447444c7791647cbade915bc47d (diff)
downloadpackages_apps_browser-e7c97de989b75a591d598da63e0bef51831462d4.zip
packages_apps_browser-e7c97de989b75a591d598da63e0bef51831462d4.tar.gz
packages_apps_browser-e7c97de989b75a591d598da63e0bef51831462d4.tar.bz2
Bookmark drop CAB
When dragging a bookmark, show the CAB with drop targets Change-Id: I2a05800c8ab393f8fba64c46945266566eeacc7f
Diffstat (limited to 'src/com/android/browser/view/BookmarkExpandableGridView.java')
-rw-r--r--src/com/android/browser/view/BookmarkExpandableGridView.java37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/com/android/browser/view/BookmarkExpandableGridView.java b/src/com/android/browser/view/BookmarkExpandableGridView.java
index 2cf4a65..f6b9f19 100644
--- a/src/com/android/browser/view/BookmarkExpandableGridView.java
+++ b/src/com/android/browser/view/BookmarkExpandableGridView.java
@@ -16,13 +16,6 @@
package com.android.browser.view;
-import com.android.browser.BookmarkDragHandler;
-import com.android.browser.BreadCrumbView;
-import com.android.browser.BrowserBookmarksAdapter;
-import com.android.browser.R;
-import com.android.browser.BookmarkDragHandler.BookmarkDragAdapter;
-import com.android.internal.view.menu.MenuBuilder;
-
import android.content.Context;
import android.database.Cursor;
import android.database.DataSetObserver;
@@ -40,6 +33,15 @@ import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
+import com.android.browser.BookmarkDragHandler;
+import com.android.browser.BookmarkDragHandler.BookmarkDragAdapter;
+import com.android.browser.BookmarkDragHandler.BookmarkDragState;
+import com.android.browser.BreadCrumbView;
+import com.android.browser.BrowserBookmarksAdapter;
+import com.android.browser.BrowserBookmarksPage.ExtraDragState;
+import com.android.browser.R;
+import com.android.internal.view.menu.MenuBuilder;
+
import java.util.ArrayList;
import java.util.HashMap;
@@ -206,6 +208,16 @@ public class BookmarkExpandableGridView extends ExpandableListView
return mDragAdapter;
}
+ public void showContextMenuForState(BookmarkDragState state) {
+ ExtraDragState extraState = (ExtraDragState) state.extraState;
+ mContextMenuInfo = new BookmarkContextMenuInfo(
+ extraState.childPosition,
+ extraState.groupPosition);
+ if (getParent() != null) {
+ getParent().showContextMenuForChild(BookmarkExpandableGridView.this);
+ }
+ }
+
private BookmarkDragAdapter mDragAdapter = new BookmarkDragAdapter() {
@Override
@@ -219,6 +231,7 @@ public class BookmarkExpandableGridView extends ExpandableListView
int childPosition = (Integer) v.getTag(R.id.child_position);
return getChildAdapter(groupPosition).getItem(childPosition);
}
+
};
private OnClickListener mChildClickListener = new OnClickListener() {
@@ -252,11 +265,13 @@ public class BookmarkExpandableGridView extends ExpandableListView
@Override
public boolean onLongClick(View v) {
- int groupPosition = (Integer) v.getTag(R.id.group_position);
- int childPosition = (Integer) v.getTag(R.id.child_position);
+ ExtraDragState state = new ExtraDragState();
+ state.groupPosition = (Integer) v.getTag(R.id.group_position);
+ state.childPosition = (Integer) v.getTag(R.id.child_position);
long id = (Long) v.getTag(R.id.child_id);
- Cursor c = getChildAdapter(groupPosition).getItem(childPosition);
- return mDragHandler.startDrag(v, c, id);
+ Cursor c = getChildAdapter(state.groupPosition)
+ .getItem(state.childPosition);
+ return mDragHandler.startDrag(v, c, id, state);
}
};