List of usage examples for android.provider Browser BOOKMARKS_URI
Uri BOOKMARKS_URI
To view the source code for android.provider Browser BOOKMARKS_URI.
Click Source Link
From source file:qr.cloud.qrpedia.BookmarksListFragment.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { String[] projection = new String[] { Browser.BookmarkColumns._ID, Browser.BookmarkColumns.TITLE, Browser.BookmarkColumns.URL }; CursorLoader cursorLoader = new CursorLoader(getActivity(), android.provider.Browser.BOOKMARKS_URI, projection, android.provider.Browser.BookmarkColumns.BOOKMARK, null, null); return cursorLoader; }
From source file:com.android.browser.kai.DownloadTouchIcon.java
@Override public void onPostExecute(Bitmap icon) { // Do this first in case the download failed. if (mActivity != null) { // Remove the touch icon loader from the BrowserActivity. mActivity.mTouchIconLoader = null; }/*from w w w . j a v a 2s . c o m*/ if (icon == null || mCursor == null || isCancelled()) { return; } final ByteArrayOutputStream os = new ByteArrayOutputStream(); icon.compress(Bitmap.CompressFormat.PNG, 100, os); ContentValues values = new ContentValues(); values.put(Browser.BookmarkColumns.TOUCH_ICON, os.toByteArray()); if (mCursor.moveToFirst()) { do { mContentResolver.update(ContentUris.withAppendedId(Browser.BOOKMARKS_URI, mCursor.getInt(0)), values, null, null); } while (mCursor.moveToNext()); } mCursor.close(); }
From source file:com.marvin.webvox.DownloadTouchIcon.java
@Override public void onPostExecute(Bitmap icon) { // Do this first in case the download failed. if (mActivity != null) { // Remove the touch icon loader from the BrowserActivity. mActivity.mTouchIconLoader = null; }// ww w. j a v a 2s .c o m if (icon == null || mCursor == null || isCancelled()) { return; } final ByteArrayOutputStream os = new ByteArrayOutputStream(); icon.compress(Bitmap.CompressFormat.PNG, 100, os); ContentValues values = new ContentValues(); // values.put(Browser.BookmarkColumns.TOUCH_ICON, // os.toByteArray()); if (mCursor.moveToFirst()) { do { mContentResolver.update(ContentUris.withAppendedId(Browser.BOOKMARKS_URI, mCursor.getInt(0)), values, null, null); } while (mCursor.moveToNext()); } mCursor.close(); }
From source file:com.android.browser.DownloadTouchIcon.java
private void storeIcon(Bitmap icon) { // Do this first in case the download failed. if (mTab != null) { // Remove the touch icon loader from the BrowserActivity. mTab.mTouchIconLoader = null;/*from w w w . j a va 2 s . c o m*/ } if (icon == null || mCursor == null || isCancelled()) { return; } final ByteArrayOutputStream os = new ByteArrayOutputStream(); icon.compress(Bitmap.CompressFormat.PNG, 100, os); ContentValues values = new ContentValues(); values.put(Browser.BookmarkColumns.TOUCH_ICON, os.toByteArray()); if (mCursor.moveToFirst()) { do { mContentResolver.update(ContentUris.withAppendedId(Browser.BOOKMARKS_URI, mCursor.getInt(0)), values, null, null); } while (mCursor.moveToNext()); } }
From source file:mai.whack.StickyNotesActivity.java
private void onDataWrite(Intent intent) { byte[] tagId = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID); Cursor mCur = this.managedQuery(Browser.BOOKMARKS_URI, Browser.HISTORY_PROJECTION, null, null, "DATE"); // mCur.moveToFirst(); if (mCur.moveToLast() && mCur.getCount() > 0) { String url = mCur.getString(Browser.HISTORY_PROJECTION_URL_INDEX); mHttpPostThread = new HttpPostThread(toHex(tagId), "tabs", url); mHttpPostThread.start();// ww w . j a va 2s .c o m } }
From source file:be.vbsteven.bmtodesk.SendAllCurrentBookmarksActivity.java
protected ArrayList<Bookmark> getAllBookmarks() { ArrayList<Bookmark> result = new ArrayList<SendAllCurrentBookmarksActivity.Bookmark>(); String[] projection = new String[] { BookmarkColumns.TITLE, BookmarkColumns.URL }; Cursor c = managedQuery(Browser.BOOKMARKS_URI, projection, "bookmark = ?", new String[] { "1" }, null); if (c.moveToFirst()) { int title = c.getColumnIndex(BookmarkColumns.TITLE); int url = c.getColumnIndex(BookmarkColumns.URL); while (!c.isAfterLast()) { Bookmark b = new Bookmark(); b.title = c.getString(title); b.url = c.getString(url);/*from w w w .jav a 2 s .c o m*/ result.add(b); c.moveToNext(); } } return result; }
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Utility method to load the list of browser bookmarks. *///from ww w . j av a 2s. c o m private static ArrayList<BookmarkInfo> loadBookmarks(Launcher context) { ArrayList<BookmarkInfo> bookmarks = new ArrayList<BookmarkInfo>(); Cursor cursor = context.managedQuery(Browser.BOOKMARKS_URI, Browser.HISTORY_PROJECTION, null, null, null); if (cursor != null) { cursor.moveToFirst(); if (cursor.moveToFirst() && cursor.getCount() > 0) { while (cursor.isAfterLast() == false) { String bookmarkIndex = cursor.getString(Browser.HISTORY_PROJECTION_BOOKMARK_INDEX); if (bookmarkIndex != null && bookmarkIndex.equals("1")) { BookmarkInfo bookmark = new BookmarkInfo(); String title = cursor.getString(Browser.HISTORY_PROJECTION_TITLE_INDEX); bookmark.setTitle(title); String url = cursor.getString(Browser.HISTORY_PROJECTION_URL_INDEX); bookmark.setUrl(url); // for some reason the favicons aren't good looking // images // byte[] data = // cursor.getBlob(Browser.HISTORY_PROJECTION_FAVICON_INDEX); // if (data != null) { // try { // Bitmap bitmap = BitmapFactory.decodeByteArray(data, // 0, data.length); // bookmark.setDrawable(new FastBitmapDrawable(bitmap)); // } catch (Exception e) { // Log.e(LOG_TAG, "bookmark icon", e); // } // } bookmarks.add(bookmark); } cursor.moveToNext(); } } } return bookmarks; }
From source file:com.andrewshu.android.reddit.common.Common.java
public static boolean isClicked(Context context, String url) { Cursor cursor;/*from w w w . java 2 s .c o m*/ try { cursor = context.getContentResolver().query(Browser.BOOKMARKS_URI, Browser.HISTORY_PROJECTION, Browser.HISTORY_PROJECTION[Browser.HISTORY_PROJECTION_URL_INDEX] + "=?", new String[] { url }, null); } catch (Exception ex) { if (Constants.LOGGING) Log.w(TAG, "Error querying Android Browser for history; manually revoked permission?", ex); return false; } if (cursor != null) { boolean isClicked = cursor.moveToFirst(); // returns true if cursor is not empty cursor.close(); return isClicked; } else { return false; } }
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Utility method to load the list of browser history. *///from w w w . j ava 2 s . c o m private static ArrayList<BookmarkInfo> loadBrowserHistory(Launcher context) { ArrayList<BookmarkInfo> bookmarks = new ArrayList<BookmarkInfo>(); Cursor cursor = context.managedQuery(Browser.BOOKMARKS_URI, Browser.HISTORY_PROJECTION, null, null, Browser.BookmarkColumns.DATE + " DESC"); if (cursor != null) { int count = 0; cursor.moveToFirst(); if (cursor.moveToFirst() && cursor.getCount() > 0) { while (cursor.isAfterLast() == false) { String title = cursor.getString(Browser.HISTORY_PROJECTION_TITLE_INDEX); String url = cursor.getString(Browser.HISTORY_PROJECTION_URL_INDEX); String bookmarkIndex = cursor.getString(Browser.HISTORY_PROJECTION_BOOKMARK_INDEX); Log.d(LOG_TAG, "bookmarkIndex=" + bookmarkIndex); if (url != null && title != null && !bookmarkIndex.equals("1")) { // check for duplicates boolean found = false; for (BookmarkInfo bookmarkInfo : bookmarks) { if (bookmarkInfo.getUrl() != null && bookmarkInfo.getUrl().equals(url)) { found = true; break; } } if (!found) { BookmarkInfo bookmark = new BookmarkInfo(); bookmark.setTitle(title); bookmark.setUrl(url); bookmarks.add(bookmark); } } cursor.moveToNext(); if (++count >= BROWSER_HISTORY_LIMIT) { break; } } } } return bookmarks; }
From source file:com.dish.browser.activity.BrowserActivity.java
public boolean getSystemBrowser() { Cursor c = null;/*from w w w. j a v a 2 s . c o m*/ String[] columns = new String[] { "url", "title" }; boolean browserFlag; try { Uri bookmarks = Browser.BOOKMARKS_URI; c = getContentResolver().query(bookmarks, columns, null, null, null); } catch (SQLiteException | IllegalStateException | NullPointerException e) { e.printStackTrace(); } if (c != null) { Log.d("Browser", "System Browser Available"); browserFlag = true; } else { Log.e("Browser", "System Browser Unavailable"); browserFlag = false; } if (c != null) { c.close(); } mPreferences.setSystemBrowserPresent(browserFlag); return browserFlag; }