java类android.support.annotation.UiThread的实例源码

AndroidNotificationManagerImpl.java 文件源码 项目:Nird2 阅读 32 收藏 0 点赞 0 评论 0
@UiThread
private int getDefaults() {
    int defaults = DEFAULT_LIGHTS;
    boolean sound = settings.getBoolean(PREF_NOTIFY_SOUND, true);
    String ringtoneUri = settings.get(PREF_NOTIFY_RINGTONE_URI);
    if (sound && StringUtils.isNullOrEmpty(ringtoneUri))
        defaults |= DEFAULT_SOUND;
    if (settings.getBoolean(PREF_NOTIFY_VIBRATION, true))
        defaults |= DEFAULT_VIBRATE;
    return defaults;
}
BookmarkWidgetService.java 文件源码 项目:chromium-for-android-56-debug-video 阅读 30 收藏 0 点赞 0 评论 0
@UiThread
private void loadBookmarks(BookmarkId folderId) {
    mFolder = new BookmarkFolder();

    // Load the requested folder if it exists. Otherwise, fall back to the default folder.
    if (folderId != null) {
        mFolder.folder = Bookmark.fromBookmarkItem(mBookmarkModel.getBookmarkById(
                folderId));
    }
    if (mFolder.folder == null) {
        folderId = mBookmarkModel.getDefaultFolder();
        mFolder.folder = Bookmark.fromBookmarkItem(mBookmarkModel.getBookmarkById(
                folderId));
    }

    mFolder.parent = Bookmark.fromBookmarkItem(mBookmarkModel.getBookmarkById(
            mFolder.folder.parentId));

    List<BookmarkItem> items = mBookmarkModel.getBookmarksForFolder(folderId);

    // Move folders to the beginning of the list.
    Collections.sort(items, new Comparator<BookmarkItem>() {
        @Override
        public int compare(BookmarkItem lhs, BookmarkItem rhs) {
            return lhs.isFolder() == rhs.isFolder() ? 0 : lhs.isFolder() ? -1 : 1;
        }
    });

    for (BookmarkItem item : items) {
        Bookmark bookmark = Bookmark.fromBookmarkItem(item);
        loadFavicon(bookmark);
        mFolder.children.add(bookmark);
    }

    taskFinished();
}
EegeoNativeMapView.java 文件源码 项目:android-api 阅读 36 收藏 0 点赞 0 评论 0
@UiThread
public void onPointerMove(final int primaryActionIndex, final int primaryActionIdentifier, final int pointerCount, final float[] x, final float y[], final int[] pointerIdentity, final int[] pointerIndex) {
    runOnNativeThread(new Runnable() {
        @WorkerThread
        @Override
        public void run() {
            nativeProcessPointerMove(m_jniApiRunnerPtr, primaryActionIndex, primaryActionIdentifier, pointerCount, x, y, pointerIdentity, pointerIndex);
        }
    });

}
MaterialDialog.java 文件源码 项目:GitHub 阅读 33 收藏 0 点赞 0 评论 0
/**
 * Convenience method for setting the currently selected indices of a multi choice list. This
 * only works if you are not using a custom adapter; if you're using a custom adapter, an
 * IllegalStateException is thrown. Note that this does not call the respective multi choice
 * callback.
 *
 * @param indices The indices of the list items to check.
 */
@UiThread
public void setSelectedIndices(@NonNull Integer[] indices) {
    selectedIndicesList = new ArrayList<>(Arrays.asList(indices));
    if (builder.adapter != null && builder.adapter instanceof DefaultRvAdapter) {
        builder.adapter.notifyDataSetChanged();
    } else {
        throw new IllegalStateException("You can only use setSelectedIndices() with the default adapter implementation.");
    }
}
RecentPageModel.java 文件源码 项目:Quran 阅读 20 收藏 0 点赞 0 评论 0
@UiThread
public void updateLatestPage(int page) {
  if (initialDataSubscription != null) {
    // it is possible (though unlikely) for a page update to come in while we're still waiting
    // for the initial query of recent pages from the database. if so, unsubscribe from the initial
    // query since its data will be stale relative to this data.
    initialDataSubscription.dispose();
  }
  lastPageSubject.onNext(page);
}
ConnectivityReceiver.java 文件源码 项目:mapbox-events-android 阅读 37 收藏 0 点赞 0 评论 0
@UiThread
public void removeConnectivityUpdates() {
  activationCounter--;
  if (activationCounter == 0) {
    context.unregisterReceiver(this);
  }
}
Utils.java 文件源码 项目:butterknife-parent 阅读 30 收藏 0 点赞 0 评论 0
@UiThread // Implicit synchronization for use of shared resource VALUE.
public static float getFloat(Context context, @DimenRes int id) {
  TypedValue value = VALUE;
  context.getResources().getValue(id, value, true);
  if (value.type == TypedValue.TYPE_FLOAT) {
    return value.getFloat();
  }
  throw new Resources.NotFoundException("Resource ID #0x" + Integer.toHexString(id)
      + " type #0x" + Integer.toHexString(value.type) + " is not valid");
}
EegeoNativeMapView.java 文件源码 项目:android-api 阅读 30 收藏 0 点赞 0 评论 0
@UiThread
public void postTo(Runnable runnable) {
    if (!m_threadExiting) {
        m_nativeThreadHandler.post(runnable);
    } else {
        Log.d("eegeo-android-sdk", "thread exiting, ignoring runnable");
    }
}
EegeoNativeMapView.java 文件源码 项目:android-api 阅读 32 收藏 0 点赞 0 评论 0
@UiThread
public void quit() {
    //m_nativeThreadHandler.dump(new LogPrinter(Log.DEBUG, "eegeo-android-sdk"), "");
    m_threadExiting = true;
    m_nativeThreadHandler.removeCallbacksAndMessages(null);
    m_nativeThreadHandler.post(new Runnable() {
        @WorkerThread
        @Override
        public void run() {
            Looper.myLooper().quit();
        }
    });
}
MapView.java 文件源码 项目:android-api 阅读 30 收藏 0 点赞 0 评论 0
/**
 * Constructor for a MapView object.
 *
 * @param context      The Android context for the view.
 * @param attributeSet Attributes which may be used to initialize the view.  Attributes may be defined
 *                     in the view's layout xml by setting eegeo_MapView styleable resources.
 */
@UiThread
public MapView(@NonNull Context context, AttributeSet attributeSet) {
    super(context, attributeSet);
    if (isInEditMode()) {
        LayoutInflater.from(context).inflate(R.layout.eegeo_mapview_preview, this);
    } else {
        EegeoMapOptions eegeoMapOptions = EegeoMapOptions.createFromAttributeSet(context, attributeSet);
        initialise(context, eegeoMapOptions);
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号