Here are the examples of the java api @android.support.annotation.Nullable taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
6633 Examples
19
Source : LruCache.java
with Apache License 2.0
from Zweihui
with Apache License 2.0
from Zweihui
/**
* 移除缓存中这个 {@code key} 所对应的条目,并返回所移除条目的 {@code value}
* 如果返回为 {@code null} 则有可能时因为这个 {@code key} 对应的 {@code value} 为 {@code null} 或条目不存在
*
* @param key 使用这个 {@code key} 移除对应的条目
*/
@Override
@Nullable
public synchronized V remove(K key) {
final V value = cache.remove(key);
if (value != null) {
currentSize -= gereplacedemSize(value);
}
return value;
}
19
Source : BaseService.java
with Apache License 2.0
from Zweihui
with Apache License 2.0
from Zweihui
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}
19
Source : SortedAutoAdapter.java
with Apache License 2.0
from Zuluft
with Apache License 2.0
from Zuluft
@Nullable
@Override
public OrderableRenderer gereplacedem(final int position) {
return mSortedAdapterDataStructure.get(position);
}
19
Source : TabPagerAdapter.java
with MIT License
from zion223
with MIT License
from zion223
@Nullable
@Override
public CharSequence getPagereplacedle(int position) {
return replacedles[position];
}
19
Source : LauncherDelegate.java
with MIT License
from zion223
with MIT License
from zion223
public clreplaced LauncherDelegate extends LatteDelegate implements ITimeListener {
@Nullable
@BindView(R2.id.tv_launcher_timer1)
AppCompatTextView mTvTimer = null;
private ILauncherListener mILauncherListener = null;
private Timer mTimer = null;
private int mCount = 5;
@Optional
@OnClick(R2.id.tv_launcher_timer1)
void onClickTimerView() {
if (mTimer != null) {
mTimer.cancel();
mTimer = null;
checkIsShowScroll();
}
}
@Override
public Object setLayout() {
return R.layout.delegate_launcher;
}
@Override
public void onBindView(@Nullable Bundle savedInstanceState, @NonNull View view) {
initTimer();
}
@Override
public void onTime() {
getProxyActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (mTvTimer != null) {
mTvTimer.setText(MessageFormat.format("{0} 跳过", mCount));
mCount--;
if (mCount < 0) {
mTimer.cancel();
mTimer = null;
checkIsShowScroll();
}
}
}
});
}
private void initTimer() {
mTimer = new Timer();
final BaseTimeTask timeTask = new BaseTimeTask(this);
mTimer.schedule(timeTask, 0, 1000);
}
/**
* 是否需要显示滚动界面
*/
private void checkIsShowScroll() {
// 是否第一次启动App
if (!LattePreference.getAppFlag(ScrollLauncherTag.HAS_FIRST_LAUNCHER_APP.name())) {
getSupportDelegate().start(new LauncherScrollDelegate(), SINGLETASK);
} else {
// 检查用户是否登录
AccountManager.checkAccount(new IUserChecker() {
// 用户登陆了
@Override
public void onSignIn() {
if (mILauncherListener != null) {
mILauncherListener.onLauncherFinish(OnLauncherFinishTag.SIGNED);
}
}
// 用户没有登录
@Override
public void onNotSignIn() {
if (mILauncherListener != null) {
mILauncherListener.onLauncherFinish(OnLauncherFinishTag.NOT_SIGNED);
}
}
});
}
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (activity instanceof ILauncherListener) {
mILauncherListener = (ILauncherListener) activity;
}
}
}
19
Source : JMWebViewClient.java
with Apache License 2.0
from ZhuoKeTeam
with Apache License 2.0
from ZhuoKeTeam
@Nullable
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
try {
if (!TextUtils.isEmpty(url) && url.contains(JM_LOCAL_COLLECTOR_JS_PATH)) {
InputStream inputStream = ConvertUtils.string2InputStream(ResourceUtils.readreplacedets2String("collector.js"), "utf-8");
return new WebResourceResponse("application/javascript", "UTF-8", inputStream);
}
} catch (Exception e) {
e.printStackTrace();
}
return super.shouldInterceptRequest(view, url);
}
19
Source : Absent.java
with Apache License 2.0
from Zhuinden
with Apache License 2.0
from Zhuinden
@Override
@Nullable
public T orNull() {
return null;
}
19
Source : Task.java
with Apache License 2.0
from Zhuinden
with Apache License 2.0
from Zhuinden
@Nullable
public String getreplacedleForList() {
if (!Strings.isNullOrEmpty(replacedle())) {
return replacedle();
} else {
return description();
}
}
19
Source : SectionsPagerAdapter.java
with GNU General Public License v3.0
from zhoorta
with GNU General Public License v3.0
from zhoorta
@Nullable
@Override
public CharSequence getPagereplacedle(int position) {
return mContext.getResources().getString(TAB_replacedLES[position]);
}
19
Source : ArtboardPagerAdapter.java
with GNU General Public License v3.0
from zhihu
with GNU General Public License v3.0
from zhihu
@Nullable
public ArtboardLayout getCurrentLayout() {
return mCurrentLayout;
}
19
Source : VerticalStepperView.java
with MIT License
from zhangjing02
with MIT License
from zhangjing02
/**
* Get error text of item
*
* @param index Index
* @return Error text or null (means no error)
*/
@Nullable
public CharSequence getErrorText(int index) {
if (mErrorTexts != null) {
return mErrorTexts[index];
}
return null;
}
19
Source : VerticalStepperAdapterDemoFragment.java
with MIT License
from zhangjing02
with MIT License
from zhangjing02
@Override
@Nullable
public CharSequence getSummary(int index) {
switch(index) {
case 0:
return Html.fromHtml("Summarized if needed" + (mVerticalStepperView.getCurrentStep() > index ? "; <b>isDone!</b>" : ""));
case 2:
return Html.fromHtml("Last step" + (mVerticalStepperView.getCurrentStep() > index ? "; <b>isDone!</b>" : ""));
default:
return null;
}
}
19
Source : BaseFragment.java
with Apache License 2.0
from zhanghacker
with Apache License 2.0
from zhanghacker
@Nullable
@Override
public View getView() {
return mRootView;
}
19
Source : BaseDaggerActivity.java
with Apache License 2.0
from zhanghacker
with Apache License 2.0
from zhanghacker
/**
* ProjectName: helperHabit
* Author: xxzhang
* CreateAt: 2018/9/3 15:58
* Description: 集成dagger继承基类
* Copyright © itzxx Inc. All Rights Reserved
*/
public abstract clreplaced BaseDaggerActivity<T1 extends BasePresenter> extends AppCompatActivity implements IBaseView {
protected View mRootView;
Unbinder unbinder;
@Nullable
@Inject
protected T1 mPresenter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// dagger框架注入
initInjector();
mRootView = createView(null, null, savedInstanceState);
setContentView(mRootView);
AppManager.getAppManager().addActivity(this);
bindView(mRootView, savedInstanceState);
// 初始化数据
initData();
}
@Override
public View createView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = getLayoutInflater().inflate(getContentLayout(), container);
unbinder = ButterKnife.bind(this, view);
return view;
}
@Override
public View getView() {
return mRootView;
}
@Override
protected void onDestroy() {
super.onDestroy();
unbinder.unbind();
AppManager.getAppManager().removeActivity(this);
if (mPresenter != null) {
mPresenter.detachView();
}
}
/**
* dagger注解框架
*/
protected void initInjector() {
}
/**
* 继承可直接使用对话框
* @param string
*/
protected void T(String string) {
T.showShort(this, string);
}
}
19
Source : BaseActivity.java
with Apache License 2.0
from zhanghacker
with Apache License 2.0
from zhanghacker
/**
* ProjectName: helperHabit
* Author: xxzhang
* CreateAt: 2018/9/3 15:58
* Description: 集成dagger继承基类
* Copyright © itzxx Inc. All Rights Reserved
*/
public abstract clreplaced BaseActivity<T1 extends BasePresenter> extends AppCompatActivity implements IBaseView {
protected View mRootView;
Unbinder unbinder;
@Nullable
protected T1 mPresenter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mRootView = createView(null, null, savedInstanceState);
setContentView(mRootView);
AppManager.getAppManager().addActivity(this);
// 创建presenter
mPresenter = createPresenter();
bindView(mRootView, savedInstanceState);
// 初始化数据
initData();
// 初始化监听
initListener();
}
@Override
public View createView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = getLayoutInflater().inflate(getContentLayout(), container);
unbinder = ButterKnife.bind(this, view);
return view;
}
@Override
public View getView() {
return mRootView;
}
/**
* 用于有初始化MVP的p层
*/
protected T1 createPresenter() {
return null;
}
/**
* 初始化监听
*/
protected void initListener() {
}
@Override
protected void onDestroy() {
super.onDestroy();
unbinder.unbind();
AppManager.getAppManager().removeActivity(this);
if (mPresenter != null) {
mPresenter.detachView();
}
}
/**
* 继承可直接使用对话框
* @param string
*/
protected void T(String string) {
T.showShort(this, string);
}
}
19
Source : ProjectileWeapon.java
with MIT License
from ZafraniTechLLC
with MIT License
from ZafraniTechLLC
@Nullable
public int[] getMagazinesIds() {
return magazinesIds;
}
19
Source : ProjectileWeapon.java
with MIT License
from ZafraniTechLLC
with MIT License
from ZafraniTechLLC
@Nullable
public int[] getGripIds() {
return gripIds;
}
19
Source : ProjectileWeapon.java
with MIT License
from ZafraniTechLLC
with MIT License
from ZafraniTechLLC
@Nullable
public int[] getSightIds() {
return sightIds;
}
19
Source : ProjectileWeapon.java
with MIT License
from ZafraniTechLLC
with MIT License
from ZafraniTechLLC
@Nullable
public int[] getStockIds() {
return stockIds;
}
19
Source : ProjectileWeapon.java
with MIT License
from ZafraniTechLLC
with MIT License
from ZafraniTechLLC
@Nullable
public int[] getLoopIds() {
return loopIds;
}
19
Source : ProjectileWeapon.java
with MIT License
from ZafraniTechLLC
with MIT License
from ZafraniTechLLC
@Nullable
public int[] getMuzzleIds() {
return muzzleIds;
}
19
Source : AttachmentCategory.java
with MIT License
from ZafraniTechLLC
with MIT License
from ZafraniTechLLC
@Nullable
public Attachment getAttachmentWithId(final int id) {
for (final Attachment attachment : attachmentList) {
if (attachment.getId() == id) {
return attachment;
}
}
return null;
}
19
Source : AmmoCategory.java
with MIT License
from ZafraniTechLLC
with MIT License
from ZafraniTechLLC
@Nullable
public Ammo getAmmoWithId(final int id) {
for (final Ammo ammo : ammoList) {
if (ammo.getId() == id) {
return ammo;
}
}
return null;
}
19
Source : NewsDetailFragment.java
with MIT License
from ZafraniTechLLC
with MIT License
from ZafraniTechLLC
public clreplaced NewsDetailFragment extends BaseFragment {
public static final String TAG = NewsDetailFragment.clreplaced.getSimpleName();
public static final String ARG_NEWS_SRC = NewsDetailFragment.clreplaced.getSimpleName() + ".ARG_NEWS_SRC";
@Nullable
@BindView(R.id.fragment_newsdetails_webview)
WebView newsWebView;
public static NewsDetailFragment newInstance(@NonNull final String newsSrc) {
final NewsDetailFragment fragment = new NewsDetailFragment();
final Bundle bundle = new Bundle();
bundle.putString(ARG_NEWS_SRC, newsSrc);
fragment.setArguments(bundle);
return fragment;
}
@Override
protected int getLayoutRes() {
return R.layout.fragment_newsdetails;
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final Bundle args = getArguments();
if (args == null) {
throw new IllegalStateException("Missing arguments");
}
if (!args.containsKey(ARG_NEWS_SRC)) {
throw new IllegalStateException("Missing key");
}
final String newsSrc = args.getString(ARG_NEWS_SRC);
if (newsSrc == null) {
Toast.makeText(getActivity(), "Failed to load.", Toast.LENGTH_SHORT).show();
getActivity().finish();
return;
}
setWebView(newsSrc);
}
private void setWebView(@NonNull final String newsSrc) {
if (newsWebView != null) {
WebSettings settings = this.newsWebView.getSettings();
settings.setUseWideViewPort(true);
settings.setBuiltInZoomControls(true);
settings.setLoadWithOverviewMode(true);
this.newsWebView.loadUrl(newsSrc);
}
}
}
19
Source : BaseActivity.java
with MIT License
from ZafraniTechLLC
with MIT License
from ZafraniTechLLC
@Nullable
private Fragment getTopFragment() {
return getFragmentManager().findFragmentById(getContentView());
}
19
Source : IntRangeValidator.java
with Apache License 2.0
from ZacSweers
with Apache License 2.0
from ZacSweers
@Nullable
public static Annotation findAnnotation(Set<? extends Annotation> annotations, Clreplaced<? extends Annotation> annotationClreplaced) {
// Save an iterator in the common case.
if (annotations.isEmpty())
return null;
for (Annotation annotation : annotations) {
if (annotation.annotationType() == annotationClreplaced)
return annotation;
}
return null;
}
19
Source : MvpLoaderFragment.java
with GNU General Public License v3.0
from z-chu
with GNU General Public License v3.0
from z-chu
@Nullable
public P getPresenter() {
return mPresenter;
}
19
Source : ByWebChromeClient.java
with Apache License 2.0
from youlookwhat
with Apache License 2.0
from youlookwhat
@Nullable
@Override
public Bitmap getDefaultVideoPoster() {
if (super.getDefaultVideoPoster() == null) {
return BitmapFactory.decodeResource(mByWebView.getWebView().getResources(), R.drawable.by_icon_video);
} else {
return super.getDefaultVideoPoster();
}
}
19
Source : BaseNode.java
with Apache License 2.0
from YoshiOne
with Apache License 2.0
from YoshiOne
@Nullable
private BaseNode getChildByModelName(String name) {
for (BaseNode node : mChildren) {
if (node.getModel().getName().toLowerCase().equals(name.toLowerCase())) {
return node;
}
}
return null;
}
19
Source : BackupTestJobCreator.java
with Apache License 2.0
from YoshiOne
with Apache License 2.0
from YoshiOne
@Override
@Nullable
public Job create(@NonNull String tag) {
switch(tag) {
case BackupTestJob.TAG:
return new BackupTestJob();
default:
return null;
}
}
19
Source : BackupJobCreator.java
with Apache License 2.0
from YoshiOne
with Apache License 2.0
from YoshiOne
@Override
@Nullable
public Job create(@NonNull String tag) {
switch(tag) {
case BackupJob.TAG:
return new BackupJob();
default:
return null;
}
}
19
Source : DenvelopingConverter.java
with Apache License 2.0
from yongjhih
with Apache License 2.0
from yongjhih
@Nullable
private String getPayloadName(Annotation[] annotations) {
if (annotations == null)
return null;
for (Annotation annotation : annotations) {
if (annotation instanceof EnvelopePayload) {
return ((EnvelopePayload) annotation).value();
}
}
return null;
}
19
Source : MySnap.java
with Apache License 2.0
from yiyuanliu
with Apache License 2.0
from yiyuanliu
@Nullable
@Override
public View findSnapView(RecyclerView.LayoutManager layoutManager) {
FlipLayoutManager flipLayoutManager = (FlipLayoutManager) layoutManager;
return flipLayoutManager.findSnapView();
}
19
Source : MySnap.java
with Apache License 2.0
from yiyuanliu
with Apache License 2.0
from yiyuanliu
@Nullable
@Override
public int[] calculateDistanceToFinalSnap(@NonNull RecyclerView.LayoutManager layoutManager, @NonNull View targetView) {
if (layoutManager instanceof FlipLayoutManager) {
return new int[] { 0, ((FlipLayoutManager) layoutManager).calculateDistance(targetView) };
} else {
throw new RuntimeException();
}
}
19
Source : CompositionAvatarView.java
with MIT License
from YiiGuxing
with MIT License
from YiiGuxing
@Nullable
private DrawableInfo findAvatarDrawableById(int id) {
if (id != NO_ID) {
for (DrawableInfo drawable : mDrawables) {
if (drawable.mId == id) {
return drawable;
}
}
}
return null;
}
19
Source : Platform.java
with Apache License 2.0
from yifei8
with Apache License 2.0
from yifei8
@Nullable
Executor defaultCallbackExecutor() {
return null;
}
19
Source : NoFragment.java
with Apache License 2.0
from yanzhenjie
with Apache License 2.0
from yanzhenjie
/**
* Get Toolbar.
*
* @return {@link Toolbar}.
*/
@Nullable
protected final Toolbar getToolbar() {
return mToolbar;
}
19
Source : AppConfig.java
with Apache License 2.0
from yanzhenjie
with Apache License 2.0
from yanzhenjie
@Nullable
public <P extends Parcelable> P getObject(String key, Clreplaced<P> pClreplaced) {
String jsonObject = getString(key, "");
if (!TextUtils.isEmpty(jsonObject)) {
try {
return JSON.parseObject(jsonObject, pClreplaced);
} catch (Exception e) {
return null;
}
}
return null;
}
19
Source : PhotoViewAttacher.java
with Apache License 2.0
from yanzhenjie
with Apache License 2.0
from yanzhenjie
@Nullable
OnViewTapListener getOnViewTapListener() {
return mViewTapListener;
}
19
Source : PhotoViewAttacher.java
with Apache License 2.0
from yanzhenjie
with Apache License 2.0
from yanzhenjie
@Nullable
OnPhotoTapListener getOnPhotoTapListener() {
return mPhotoTapListener;
}
19
Source : RequestTask.java
with Apache License 2.0
from yangxch
with Apache License 2.0
from yangxch
/**
* 执行网络请求
*
* @param url 请求的url地址.
* @param REQUEST_MODE 标记请求方式get和post
* (REQUEST_MODE_GET和REQUEST_MODE_POST)
* @param args 为请求添加的参数
* @return 返回请求的文本信息
*/
@Nullable
public void executeRequest(String url, int REQUEST_MODE, String... args) {
switch(REQUEST_MODE) {
case REQUEST_MODE_GET:
requestGET(url, args);
break;
case REQUEST_MODE_POST:
requestPOST(url, args);
break;
}
}
19
Source : MyProvider.java
with Apache License 2.0
from yangkun19921001
with Apache License 2.0
from yangkun19921001
@Nullable
@Override
public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) {
return null;
}
19
Source : MyProvider.java
with Apache License 2.0
from yangkun19921001
with Apache License 2.0
from yangkun19921001
@Nullable
@Override
public String getType(@NonNull Uri uri) {
return null;
}
19
Source : MyProvider.java
with Apache License 2.0
from yangkun19921001
with Apache License 2.0
from yangkun19921001
@Nullable
@Override
public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) {
return null;
}
19
Source : X5WebViewClient.java
with Apache License 2.0
from yangchong211
with Apache License 2.0
from yangchong211
/**
* 将最后停留的页面url弹出
* 获取最后停留的页面url
* @return null 表示已经没有上一页了
*/
@Nullable
public final String popBackUrl() {
if (mUrlStack.size() >= 2) {
// pop current page url
mUrlStack.pop();
return mUrlStack.pop();
}
return null;
}
19
Source : X5WebViewClient.java
with Apache License 2.0
from yangchong211
with Apache License 2.0
from yangchong211
/**
* 获取最后停留页面的链接.
*
* @return url
*/
@Nullable
public String getUrl() {
// peek方法,查看此堆栈顶部的对象,而不将其从堆栈中删除。
return mUrlStack.size() > 0 ? mUrlStack.peek() : null;
}
19
Source : ScrollPageHelper.java
with Apache License 2.0
from yangchong211
with Apache License 2.0
from yangchong211
/**
* @param layoutManager layoutManager
* @param targetView 目标view
* @return
*/
@Nullable
@Override
public int[] calculateDistanceToFinalSnap(@NonNull RecyclerView.LayoutManager layoutManager, @NonNull View targetView) {
// 创建数组
int[] out = new int[2];
// 判断是否是横向方法
if (layoutManager.canScrollHorizontally()) {
if (gravity == Gravity.START) {
out[0] = distanceToStart(targetView, getHorizontalHelper(layoutManager), false);
} else {
// END
out[0] = distanceToEnd(targetView, getHorizontalHelper(layoutManager), false);
}
} else {
out[0] = 0;
}
// 判断是否是竖直方法
if (layoutManager.canScrollVertically()) {
if (gravity == Gravity.TOP) {
out[1] = distanceToStart(targetView, getVerticalHelper(layoutManager), false);
} else {
// BOTTOM
out[1] = distanceToEnd(targetView, getVerticalHelper(layoutManager), false);
}
} else {
out[1] = 0;
}
return out;
}
19
Source : ScrollPageHelper.java
with Apache License 2.0
from yangchong211
with Apache License 2.0
from yangchong211
/**
* 找到当前时刻的SnapView
* @param layoutManager layoutManager
* @return
*/
@Nullable
@Override
public View findSnapView(RecyclerView.LayoutManager layoutManager) {
View snapView = null;
if (layoutManager instanceof LinearLayoutManager) {
switch(gravity) {
case Gravity.START:
snapView = findStartView(layoutManager, getHorizontalHelper(layoutManager));
break;
case Gravity.END:
snapView = findEndView(layoutManager, getHorizontalHelper(layoutManager));
break;
case Gravity.TOP:
snapView = findStartView(layoutManager, getVerticalHelper(layoutManager));
break;
case Gravity.BOTTOM:
snapView = findEndView(layoutManager, getVerticalHelper(layoutManager));
break;
default:
break;
}
}
return snapView;
}
19
Source : ScrollSnapHelper.java
with Apache License 2.0
from yangchong211
with Apache License 2.0
from yangchong211
@Nullable
protected LinearSmoothScroller createSnapScroller(final RecyclerView.LayoutManager layoutManager) {
if (!(layoutManager instanceof RecyclerView.SmoothScroller.ScrollVectorProvider)) {
return null;
}
return new LinearSmoothScroller(mRecyclerView.getContext()) {
@Override
protected void onTargetFound(View targetView, RecyclerView.State state, Action action) {
int[] snapDistances = calculateDistanceToFinalSnap(mRecyclerView.getLayoutManager(), targetView);
final int dx;
final int dy;
if (snapDistances != null) {
dx = snapDistances[0];
dy = snapDistances[1];
final int time = calculateTimeForDeceleration(Math.max(Math.abs(dx), Math.abs(dy)));
if (time > 0) {
action.update(dx, dy, time, mDecelerateInterpolator);
}
}
}
@Override
protected float calculateSpeedPerPixel(DisplayMetrics displayMetrics) {
return MILLISECONDS_PER_INCH / displayMetrics.densityDpi;
}
};
}
19
Source : ScrollPageHelper.java
with Apache License 2.0
from yangchong211
with Apache License 2.0
from yangchong211
@Nullable
@Override
public int[] calculateDistanceToFinalSnap(@NonNull RecyclerView.LayoutManager layoutManager, @NonNull View targetView) {
int[] out = new int[2];
if (layoutManager.canScrollHorizontally()) {
if (gravity == Gravity.START) {
out[0] = distanceToStart(targetView, getHorizontalHelper(layoutManager), false);
} else {
// END
out[0] = distanceToEnd(targetView, getHorizontalHelper(layoutManager), false);
}
} else {
out[0] = 0;
}
if (layoutManager.canScrollVertically()) {
if (gravity == Gravity.TOP) {
out[1] = distanceToStart(targetView, getVerticalHelper(layoutManager), false);
} else {
// BOTTOM
out[1] = distanceToEnd(targetView, getVerticalHelper(layoutManager), false);
}
} else {
out[1] = 0;
}
return out;
}
See More Examples