diff options
author | John Reck <jreck@google.com> | 2011-01-19 16:48:57 -0800 |
---|---|---|
committer | John Reck <jreck@google.com> | 2011-01-19 16:48:57 -0800 |
commit | 70413a7cc17c2c779b4b673584946ad590f7eb87 (patch) | |
tree | b31f288a4998ee76c0120cf985b1fde651c919a3 /src/com/android/browser/BrowserHistoryPage.java | |
parent | 54260f25d34969a7337cd9138f1d5be607b0424b (diff) | |
download | packages_apps_Browser-70413a7cc17c2c779b4b673584946ad590f7eb87.zip packages_apps_Browser-70413a7cc17c2c779b4b673584946ad590f7eb87.tar.gz packages_apps_Browser-70413a7cc17c2c779b4b673584946ad590f7eb87.tar.bz2 |
Fix history click/longpress events
Bug: 3368898
The recent history UI change forgot to hook up the old event handling
to the new list view layout.
Change-Id: I470b30b748608c9e7ec05aa3ca399ca7b39f0849
Diffstat (limited to 'src/com/android/browser/BrowserHistoryPage.java')
-rw-r--r-- | src/com/android/browser/BrowserHistoryPage.java | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/src/com/android/browser/BrowserHistoryPage.java b/src/com/android/browser/BrowserHistoryPage.java index f3c7a7f..5d8d153 100644 --- a/src/com/android/browser/BrowserHistoryPage.java +++ b/src/com/android/browser/BrowserHistoryPage.java @@ -55,11 +55,9 @@ import android.view.ViewGroup; import android.view.ViewStub; import android.webkit.WebIconDatabase.IconListener; import android.widget.AdapterView; +import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; import android.widget.BaseAdapter; -import android.widget.ExpandableListView; -import android.widget.ExpandableListView.ExpandableListContextMenuInfo; -import android.widget.ExpandableListView.OnChildClickListener; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; @@ -69,7 +67,7 @@ import android.widget.Toast; * days of viewing. */ public class BrowserHistoryPage extends Fragment - implements LoaderCallbacks<Cursor>, OnChildClickListener { + implements LoaderCallbacks<Cursor> { static final int LOADER_HISTORY = 1; static final int LOADER_MOST_VISITED = 2; @@ -250,6 +248,8 @@ public class BrowserHistoryPage extends Fragment mChildWrapper = new HistoryChildWrapper(mAdapter); mChildList = new ListView(getActivity()); mChildList.setAdapter(mChildWrapper); + mChildList.setOnItemClickListener(mChildItemClickListener); + registerForContextMenu(mChildList); ViewGroup prefs = (ViewGroup) mRoot.findViewById(com.android.internal.R.id.prefs); prefs.addView(mChildList); @@ -272,6 +272,14 @@ public class BrowserHistoryPage extends Fragment } }; + private OnItemClickListener mChildItemClickListener = new OnItemClickListener() { + @Override + public void onItemClick( + AdapterView<?> parent, View view, int position, long id) { + mCallbacks.onUrlSelected(((HistoryItem) view).getUrl(), false); + } + }; + @Override public void onDestroy() { super.onDestroy(); @@ -337,11 +345,7 @@ public class BrowserHistoryPage extends Fragment @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { - ExpandableListContextMenuInfo i = (ExpandableListContextMenuInfo) menuInfo; - // Do not allow a context menu to come up from the group views. - if (!(i.targetView instanceof HistoryItem)) { - return; - } + AdapterContextMenuInfo i = (AdapterContextMenuInfo) menuInfo; // Inflate the menu Activity parent = getActivity(); @@ -380,8 +384,8 @@ public class BrowserHistoryPage extends Fragment @Override public boolean onContextItemSelected(MenuItem item) { - ExpandableListContextMenuInfo i = - (ExpandableListContextMenuInfo) item.getMenuInfo(); + AdapterContextMenuInfo i = + (AdapterContextMenuInfo) item.getMenuInfo(); if (i == null) { return false; } @@ -424,16 +428,6 @@ public class BrowserHistoryPage extends Fragment return super.onContextItemSelected(item); } - @Override - public boolean onChildClick(ExpandableListView parent, View v, - int groupPosition, int childPosition, long id) { - if (v instanceof HistoryItem) { - mCallbacks.onUrlSelected(((HistoryItem) v).getUrl(), false); - return true; - } - return false; - } - private static abstract class HistoryWrapper extends BaseAdapter { protected HistoryAdapter mAdapter; |