android.support.annotation.BinderThread Java Examples
The following examples show how to use
android.support.annotation.BinderThread.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BookmarkWidgetService.java From delion with Apache License 2.0 | 6 votes |
@BinderThread private BookmarkFolder loadBookmarks(final BookmarkId folderId) { final LinkedBlockingQueue<BookmarkFolder> resultQueue = new LinkedBlockingQueue<>(1); ThreadUtils.runOnUiThread(new Runnable() { @Override public void run() { new BookmarkLoader(mContext, folderId, new BookmarkLoaderCallback() { @Override public void onBookmarksLoaded(BookmarkFolder folder) { resultQueue.add(folder); } }); } }); try { return resultQueue.take(); } catch (InterruptedException e) { return null; } }
Example #2
Source File: BookmarkWidgetService.java From AndroidChromium with Apache License 2.0 | 6 votes |
@BinderThread @Override public int getCount() { //On some Sony devices, getCount() could be called before onDatasetChanged() //returns. If it happens, refresh widget until the bookmarks are all loaded. if (mCurrentFolder == null || !mPreferences.getString(PREF_CURRENT_FOLDER, "") .equals(mCurrentFolder.folder.id.toString())) { ThreadUtils.runOnUiThread(new Runnable() { @Override public void run() { refreshWidget(); } }); } if (mCurrentFolder == null) { return 0; } return mCurrentFolder.children.size() + (mCurrentFolder.parent != null ? 1 : 0); }
Example #3
Source File: BookmarkWidgetService.java From 365browser with Apache License 2.0 | 6 votes |
@BinderThread @Override public int getCount() { //On some Sony devices, getCount() could be called before onDatasetChanged() //returns. If it happens, refresh widget until the bookmarks are all loaded. if (mCurrentFolder == null || !mPreferences.getString(PREF_CURRENT_FOLDER, "") .equals(mCurrentFolder.folder.id.toString())) { ThreadUtils.runOnUiThread(new Runnable() { @Override public void run() { refreshWidget(); } }); } if (mCurrentFolder == null) { return 0; } return mCurrentFolder.children.size() + (mCurrentFolder.parent != null ? 1 : 0); }
Example #4
Source File: BookmarkWidgetService.java From AndroidChromium with Apache License 2.0 | 6 votes |
@BinderThread private BookmarkFolder loadBookmarks(final BookmarkId folderId) { final LinkedBlockingQueue<BookmarkFolder> resultQueue = new LinkedBlockingQueue<>(1); //A reference of BookmarkLoader is needed in binder thread to //prevent it from being garbage collected. final BookmarkLoader bookmarkLoader = new BookmarkLoader(); ThreadUtils.runOnUiThread(new Runnable() { @Override public void run() { bookmarkLoader.initialize(mContext, folderId, new BookmarkLoaderCallback() { @Override public void onBookmarksLoaded(BookmarkFolder folder) { resultQueue.add(folder); } }); } }); try { return resultQueue.take(); } catch (InterruptedException e) { return null; } }
Example #5
Source File: BookmarkWidgetService.java From 365browser with Apache License 2.0 | 6 votes |
@BinderThread private Bookmark getBookmarkForPosition(int position) { if (mCurrentFolder == null) return null; // The position 0 is saved for an entry of the current folder used to go up. // This is not the case when the current node has no parent (it's the root node). if (mCurrentFolder.parent != null) { if (position == 0) return mCurrentFolder.folder; position--; } // This is necessary because when Chrome is cleared from Application settings, Bookmark // widget will not be notified and it causes inconsistency between model and widget. // Then if the widget is quickly scrolled down, this has an IndexOutOfBound error. if (mCurrentFolder.children.size() <= position) return null; return mCurrentFolder.children.get(position); }
Example #6
Source File: BookmarkWidgetService.java From 365browser with Apache License 2.0 | 6 votes |
@BinderThread private BookmarkFolder loadBookmarks(final BookmarkId folderId) { final LinkedBlockingQueue<BookmarkFolder> resultQueue = new LinkedBlockingQueue<>(1); //A reference of BookmarkLoader is needed in binder thread to //prevent it from being garbage collected. final BookmarkLoader bookmarkLoader = new BookmarkLoader(); ThreadUtils.runOnUiThread(new Runnable() { @Override public void run() { bookmarkLoader.initialize(mContext, folderId, new BookmarkLoaderCallback() { @Override public void onBookmarksLoaded(BookmarkFolder folder) { resultQueue.add(folder); } }); } }); try { return resultQueue.take(); } catch (InterruptedException e) { return null; } }
Example #7
Source File: JobService.java From firebase-jobdispatcher-android with Apache License 2.0 | 5 votes |
@Override @BinderThread public void stop(Bundle invocationData, boolean needToSendResult) { JobInvocation.Builder invocation = getJobCoder().decode(invocationData); if (invocation == null) { Log.wtf(TAG, "stop: unknown invocation provided"); return; } JobService.this.handleStopJobRequest(invocation.build(), needToSendResult); }
Example #8
Source File: JobService.java From firebase-jobdispatcher-android with Apache License 2.0 | 5 votes |
@Override @BinderThread public void start(Bundle invocationData, IJobCallback callback) { JobInvocation.Builder invocation = getJobCoder().decode(invocationData); if (invocation == null) { Log.wtf(TAG, "start: unknown invocation provided"); return; } JobService.this.handleStartJobRequest(invocation.build(), callback); }
Example #9
Source File: BookmarkWidgetService.java From 365browser with Apache License 2.0 | 5 votes |
@BinderThread @Override public void onDestroy() { ThreadUtils.runOnUiThread(new Runnable() { @Override public void run() { if (mBookmarkModel != null) mBookmarkModel.destroy(); } }); deleteWidgetState(mContext, mWidgetId); }
Example #10
Source File: BookmarkWidgetService.java From 365browser with Apache License 2.0 | 5 votes |
@BinderThread private void updateBookmarkList() { BookmarkId folderId = BookmarkId .getBookmarkIdFromString(mPreferences.getString(PREF_CURRENT_FOLDER, null)); mCurrentFolder = loadBookmarks(folderId); mPreferences.edit().putString(PREF_CURRENT_FOLDER, mCurrentFolder.folder.id.toString()) .apply(); }
Example #11
Source File: BookmarkWidgetService.java From AndroidChromium with Apache License 2.0 | 5 votes |
@BinderThread private Bookmark getBookmarkForPosition(int position) { if (mCurrentFolder == null) return null; // The position 0 is saved for an entry of the current folder used to go up. // This is not the case when the current node has no parent (it's the root node). if (mCurrentFolder.parent != null) { if (position == 0) return mCurrentFolder.folder; position--; } return mCurrentFolder.children.get(position); }
Example #12
Source File: BookmarkWidgetService.java From AndroidChromium with Apache License 2.0 | 5 votes |
@BinderThread private void updateBookmarkList() { BookmarkId folderId = BookmarkId .getBookmarkIdFromString(mPreferences.getString(PREF_CURRENT_FOLDER, null)); mCurrentFolder = loadBookmarks(folderId); mPreferences.edit().putString(PREF_CURRENT_FOLDER, mCurrentFolder.folder.id.toString()) .apply(); }
Example #13
Source File: BookmarkWidgetService.java From AndroidChromium with Apache License 2.0 | 5 votes |
@BinderThread @Override public void onDestroy() { ThreadUtils.runOnUiThread(new Runnable() { @Override public void run() { if (mBookmarkModel != null) mBookmarkModel.destroy(); } }); deleteWidgetState(mContext, mWidgetId); }
Example #14
Source File: BookmarkWidgetService.java From 365browser with Apache License 2.0 | 5 votes |
@BinderThread @Override public long getItemId(int position) { Bookmark bookmark = getBookmarkForPosition(position); if (bookmark == null) return BookmarkId.INVALID_FOLDER_ID; return bookmark.id.getId(); }
Example #15
Source File: BookmarkWidgetService.java From delion with Apache License 2.0 | 5 votes |
@BinderThread private Bookmark getBookmarkForPosition(int position) { if (mCurrentFolder == null) return null; // The position 0 is saved for an entry of the current folder used to go up. // This is not the case when the current node has no parent (it's the root node). if (mCurrentFolder.parent != null) { if (position == 0) return mCurrentFolder.folder; position--; } return mCurrentFolder.children.get(position); }
Example #16
Source File: BookmarkWidgetService.java From delion with Apache License 2.0 | 5 votes |
@BinderThread private void updateBookmarkList() { BookmarkId folderId = BookmarkId .getBookmarkIdFromString(mPreferences.getString(PREF_CURRENT_FOLDER, null)); mCurrentFolder = loadBookmarks(folderId); mPreferences.edit().putString(PREF_CURRENT_FOLDER, mCurrentFolder.folder.id.toString()) .apply(); }
Example #17
Source File: BookmarkWidgetService.java From delion with Apache License 2.0 | 5 votes |
@BinderThread @Override public void onDestroy() { ThreadUtils.runOnUiThread(new Runnable() { @Override public void run() { if (mBookmarkModel != null) mBookmarkModel.destroy(); } }); deleteWidgetState(mContext, mWidgetId); }
Example #18
Source File: BookmarkWidgetService.java From 365browser with Apache License 2.0 | 4 votes |
@BinderThread @Override public int getViewTypeCount() { return 2; }
Example #19
Source File: BookmarkWidgetService.java From 365browser with Apache License 2.0 | 4 votes |
@BinderThread @Override public boolean hasStableIds() { return false; }
Example #20
Source File: BookmarkWidgetService.java From 365browser with Apache License 2.0 | 4 votes |
@BinderThread @Override public void onDataSetChanged() { updateBookmarkList(); }
Example #21
Source File: JobService.java From firebase-jobdispatcher-android with Apache License 2.0 | 4 votes |
/** * Asks job to stop. * * <p>Sending results can be skipped if the call was initiated by a reschedule request. */ @BinderThread private void handleStopJobRequest(JobParameters job, boolean needToSendResult) { backgroundExecutor.execute( UnitOfWork.handleStopJobRequest(this, job, /* needToSendResult= */ needToSendResult)); }
Example #22
Source File: JobService.java From firebase-jobdispatcher-android with Apache License 2.0 | 4 votes |
/** * Asks the {@code job} to start running. Calls {@link #onStartJob} on the main thread. Once * complete, the {@code callback} will be used to send the result back. */ @BinderThread private void handleStartJobRequest(JobParameters job, IJobCallback callback) { backgroundExecutor.execute(UnitOfWork.handleStartJobRequest(this, job, callback)); }
Example #23
Source File: BookmarkWidgetService.java From 365browser with Apache License 2.0 | 4 votes |
@BinderThread @Override public RemoteViews getLoadingView() { return new RemoteViews(mContext.getPackageName(), R.layout.bookmark_widget_item); }
Example #24
Source File: ThreadAnnotation.java From Study_Android_Demo with Apache License 2.0 | 4 votes |
@BinderThread public void workOnBinderThread(){ logThreadInfo(); }
Example #25
Source File: BookmarkWidgetService.java From AndroidChromium with Apache License 2.0 | 4 votes |
@BinderThread @Override public RemoteViews getLoadingView() { return new RemoteViews(mContext.getPackageName(), R.layout.bookmark_widget_item); }
Example #26
Source File: BookmarkWidgetService.java From AndroidChromium with Apache License 2.0 | 4 votes |
@BinderThread @Override public long getItemId(int position) { return getBookmarkForPosition(position).id.getId(); }
Example #27
Source File: BookmarkWidgetService.java From AndroidChromium with Apache License 2.0 | 4 votes |
@BinderThread @Override public boolean hasStableIds() { return false; }
Example #28
Source File: BookmarkWidgetService.java From AndroidChromium with Apache License 2.0 | 4 votes |
@BinderThread @Override public int getViewTypeCount() { return 2; }
Example #29
Source File: BookmarkWidgetService.java From AndroidChromium with Apache License 2.0 | 4 votes |
@BinderThread @Override public void onDataSetChanged() { updateBookmarkList(); }
Example #30
Source File: BookmarkWidgetService.java From delion with Apache License 2.0 | 4 votes |
@BinderThread @Override public RemoteViews getLoadingView() { return new RemoteViews(mContext.getPackageName(), R.layout.bookmark_widget_item); }