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

ShortcutHelper.java 文件源码 项目:shortcut-helper 阅读 35 收藏 0 点赞 0 评论 0
public ShortcutHelper createShortcut(@NonNull CharSequence shortLabel, @NonNull CharSequence longLabel, @NonNull int iconResource, @NonNull Intent intent) {
    if (Build.VERSION.SDK_INT < 25) {
        return this;
    }
    String shortcutId = shortLabel.toString().replaceAll("\\s+","").toLowerCase() + "_shortcut";
    ShortcutInfo shortcut = new ShortcutInfo.Builder(mActivity, shortcutId)
            .setShortLabel(shortLabel)
            .setLongLabel(longLabel)
            .setIcon(Icon.createWithResource(mActivity, iconResource))
            .setIntent(intent)
            .build();
    mShortcutInfos.add(shortcut);
    return this;
}
ViewUtil.java 文件源码 项目:Cable-Android 阅读 35 收藏 0 点赞 0 评论 0
@SuppressWarnings("unchecked")
public static <T extends View> T inflate(@NonNull   LayoutInflater inflater,
                                         @NonNull   ViewGroup      parent,
                                         @LayoutRes int            layoutResId)
{
  return (T)(inflater.inflate(layoutResId, parent, false));
}
TopAndRecentlyPlayedTracksLoader.java 文件源码 项目:Orin 阅读 30 收藏 0 点赞 0 评论 0
@Nullable
public static Cursor makeRecentTracksCursorAndClearUpDatabase(@NonNull final Context context) {
    SortedLongCursor retCursor = makeRecentTracksCursorImpl(context);

    // clean up the databases with any ids not found
    if (retCursor != null) {
        ArrayList<Long> missingIds = retCursor.getMissingIds();
        if (missingIds != null && missingIds.size() > 0) {
            for (long id : missingIds) {
                HistoryStore.getInstance(context).removeSongId(id);
            }
        }
    }
    return retCursor;
}
ExtraUtil.java 文件源码 项目:NanoIconPack 阅读 30 收藏 0 点赞 0 评论 0
public static int fetchColor(@NonNull Context context, int attrId) {
    TypedValue typedValue = new TypedValue();
    TypedArray a = context.obtainStyledAttributes(typedValue.data,
            new int[] { attrId });
    int color = a.getColor(0, 0);
    a.recycle();
    return color;
}
MainActivity.java 文件源码 项目:Reactive-Android-Programming 阅读 31 收藏 0 点赞 0 评论 0
@NonNull
private Consumer<Throwable> showToastErrorNotification() {
    return error -> {
        Toast.makeText(this, "We couldn't reach internet - falling back to local data",
                Toast.LENGTH_SHORT)
                .show();
    };
}
AboutActivity.java 文件源码 项目:Orin 阅读 34 收藏 0 点赞 0 评论 0
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
    if (item.getItemId() == android.R.id.home) {
        onBackPressed();
        return true;
    }
    return super.onOptionsItemSelected(item);
}
ChooserItemViewHolder.java 文件源码 项目:Bridge 阅读 34 收藏 0 点赞 0 评论 0
@Override
public void onBind(@NonNull List<Object> payloads) {
    super.onBind(payloads);

    for (Object payload: payloads) {
        if (CHECK_SELECT_PAYLOAD.equals(payload)) {
            checkSelected();
        }
    }
}
NewsFeedSearchPresenter.java 文件源码 项目:Phoenix-for-VK 阅读 29 收藏 0 点赞 0 评论 0
@Override
public void firePostClick(@NonNull Post post) {
    if (post.getPostType() == VKApiPost.Type.REPLY) {
        getView().openComments(getAccountId(), Commented.from(post), post.getVkid());
    } else {
        getView().openPost(getAccountId(), post);
    }
}
BaseItemAdapter.java 文件源码 项目:MultiItem 阅读 27 收藏 0 点赞 0 评论 0
/**
 * 在指定位置添加Item
 */
public void addDataItem(int position, @NonNull Object item) {
    addDataItems(position, Collections.singletonList(item));
}
WirelessSwitchService.java 文件源码 项目:LucaHome-AndroidApplication 阅读 33 收藏 0 点赞 0 评论 0
private void sendFailedWirelessSwitchToggleBroadcast(@NonNull String response) {
    if (response.length() == 0) {
        response = "Toggle for wireless switch failed!";
    }

    _broadcastController.SendSerializableBroadcast(
            WirelessSwitchToggleFinishedBroadcast,
            WirelessSwitchToggleFinishedBundle,
            new ObjectChangeFinishedContent(false, Tools.CompressStringToByteArray(response)));
}


问题


面经


文章

微信
公众号

扫码关注公众号