diff options
author | John Reck <jreck@google.com> | 2011-08-10 15:53:07 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2011-08-11 10:29:45 -0700 |
commit | 2d963a2899afbe000d1ab498f94de87f25e33184 (patch) | |
tree | 12c78e12a35dd5de8b0673768f25e8fb688d6dfd /src/com/android/browser/BrowserBookmarksPage.java | |
parent | e3da7d615be4710da92a79e6ed70dc1982deda4c (diff) | |
download | packages_apps_Browser-2d963a2899afbe000d1ab498f94de87f25e33184.zip packages_apps_Browser-2d963a2899afbe000d1ab498f94de87f25e33184.tar.gz packages_apps_Browser-2d963a2899afbe000d1ab498f94de87f25e33184.tar.bz2 |
Support horizontal swipe in combo activity
Bug: 5145315
Change-Id: I1e9b4a6bae325244c7a3fb6159deadc3fcf170e6
Diffstat (limited to 'src/com/android/browser/BrowserBookmarksPage.java')
-rw-r--r-- | src/com/android/browser/BrowserBookmarksPage.java | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java index a03590b..46521cb 100644 --- a/src/com/android/browser/BrowserBookmarksPage.java +++ b/src/com/android/browser/BrowserBookmarksPage.java @@ -101,14 +101,6 @@ public class BrowserBookmarksPage extends Fragment implements View.OnCreateConte HashMap<Integer, BrowserBookmarksAdapter> mBookmarkAdapters = new HashMap<Integer, BrowserBookmarksAdapter>(); BookmarkDragHandler mDragHandler; - static BrowserBookmarksPage newInstance(BookmarksPageCallbacks cb, - Bundle args, ViewGroup headerContainer) { - BrowserBookmarksPage bbp = new BrowserBookmarksPage(); - bbp.mCallbacks = cb; - bbp.setArguments(args); - return bbp; - } - @Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { if (id == LOADER_ACCOUNTS) { @@ -295,9 +287,6 @@ public class BrowserBookmarksPage extends Fragment implements View.OnCreateConte String url = cursor.getString(BookmarksLoader.COLUMN_INDEX_URL); item.setUrl(url); Bitmap bitmap = getBitmap(cursor, BookmarksLoader.COLUMN_INDEX_FAVICON); - if (bitmap == null) { - bitmap = CombinedBookmarkHistoryView.getIconListenerSet().getFavicon(url); - } item.setFavicon(bitmap); } } @@ -311,8 +300,37 @@ public class BrowserBookmarksPage extends Fragment implements View.OnCreateConte Bundle args = getArguments(); mDisableNewWindow = args == null ? false : args.getBoolean(EXTRA_DISABLE_WINDOW, false); setHasOptionsMenu(true); + if (mCallbacks == null && getActivity() instanceof CombinedBookmarksCallbacks) { + mCallbacks = new CombinedBookmarksCallbackWrapper( + (CombinedBookmarksCallbacks) getActivity()); + } } + private static class CombinedBookmarksCallbackWrapper + implements BookmarksPageCallbacks { + + private CombinedBookmarksCallbacks mCombinedCallback; + + private CombinedBookmarksCallbackWrapper(CombinedBookmarksCallbacks cb) { + mCombinedCallback = cb; + } + + @Override + public boolean onOpenInNewWindow(String... urls) { + mCombinedCallback.openInNewTab(urls); + return true; + } + + @Override + public boolean onBookmarkSelected(Cursor c, boolean isFolder) { + if (isFolder) { + return false; + } + mCombinedCallback.openUrl(BrowserBookmarksPage.getUrl(c)); + return true; + } + }; + @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -520,10 +538,6 @@ public class BrowserBookmarksPage extends Fragment implements View.OnCreateConte loader.forceLoad(); } - public boolean onBackPressed() { - return false; - } - public void setCallbackListener(BookmarksPageCallbacks callbackListener) { mCallbacks = callbackListener; } |