本文整理汇总了Java中android.support.annotation.Nullable类的典型用法代码示例。如果您正苦于以下问题:Java Nullable类的具体用法?Java Nullable怎么用?Java Nullable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Nullable类属于android.support.annotation包,在下文中一共展示了Nullable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findFirstTextPart
import android.support.annotation.Nullable; //导入依赖的package包/类
@Nullable
public Part findFirstTextPart(@NonNull Part part) {
String mimeType = part.getMimeType();
Body body = part.getBody();
if (body instanceof Multipart) {
Multipart multipart = (Multipart) body;
if (isSameMimeType(mimeType, "multipart/alternative")) {
return findTextPartInMultipartAlternative(multipart);
} else {
return findTextPartInMultipart(multipart);
}
} else if (isSameMimeType(mimeType, "text/plain") || isSameMimeType(mimeType, "text/html")) {
return part;
}
return null;
}
示例2: CalendarView
import android.support.annotation.Nullable; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public CalendarView(@NonNull Context context, @Nullable AttributeSet attrs,
@AttrRes int defStyleAttr, @StyleRes int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
attrHandler(context, attrs, defStyleAttr, defStyleRes);
/*final TypedArray a = context.obtainStyledAttributes(
attrs, R.styleable.CalendarView, defStyleAttr, defStyleRes);
final int mode = a.getInt(R.styleable.CalendarView_calendarViewMode, MODE_HOLO);
a.recycle();
switch (mode) {
case MODE_HOLO:
mDelegate = new CalendarViewLegacyDelegate(
this, context, attrs, defStyleAttr, defStyleRes);
break;
case MODE_MATERIAL:
mDelegate = new CalendarViewMaterialDelegate(
this, context, attrs, defStyleAttr, defStyleRes);
break;
default:
throw new IllegalArgumentException("invalid calendarViewMode attribute");
}*/
}
示例3: onCreateView
import android.support.annotation.Nullable; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
rootView = (ViewGroup) inflater.inflate(R.layout.fragment_tap_to_move_demo, container, false);
animatedView = rootView.findViewById(R.id.animated_view);
rootView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN) {
AdditiveAnimator.cancelAnimation(animatedView, View.ROTATION);
}
return true;
}
});
animate();
return rootView;
}
开发者ID:wirecube,项目名称:android_additive_animations,代码行数:20,代码来源:RepeatingChainedAnimationsDemoFragment.java
示例4: appendText
import android.support.annotation.Nullable; //导入依赖的package包/类
/**
* Append results on the main thread.
*/
private void appendText(@Nullable final String words) {
if (getActivity() != null) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (words != null) {
tvResults.append("\n" + words);
} else {
tvResults.setText("");
}
}
});
}
}
示例5: onCreate
import android.support.annotation.Nullable; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.watch_detail_info_layout);
mPosition = getIntent().getIntExtra("position", 0);
Toolbar toolbar = (Toolbar) findViewById(R.id.infoToolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mTitleImage = (ImageView)findViewById(R.id.infoTitleImage);
mIntroImage_1 = (ImageView)findViewById(R.id.imageIntro_1);
mIntroImage_2 = (ImageView)findViewById(R.id.imageIntro_2);
mIntroImage_3 = (ImageView)findViewById(R.id.imageIntro_3);
setImagesRes(mTitleImage, mIntroImage_1, mIntroImage_2, mIntroImage_3);
}
示例6: Task
import android.support.annotation.Nullable; //导入依赖的package包/类
private Task(
@Nullable TaskUrl taskUrl,
@Nullable String urlStr,
@NonNull String filePath,
@NonNull Listener listener,
@NonNull ErrorListener errorListener,
@NonNull Priority priority) {
checkTask(taskUrl, urlStr, filePath, listener, errorListener, priority);
this.taskUrl = taskUrl;
this.urlStr = taskUrl != null ? taskUrl.toUrl() : urlStr;
this.filePath = filePath;
this.listener = listener;
this.errorListener = errorListener;
this.priority = priority;
}
示例7: onCreateView
import android.support.annotation.Nullable; //导入依赖的package包/类
@Override
public View onCreateView(
LayoutInflater inflater,
@Nullable
ViewGroup container,
@Nullable
Bundle savedInstanceState)
{
final View view = inflater.inflate(R.layout.fragment_ngid_login, container, false);
mLogin = (EditText) view.findViewById(R.id.login);
mPassword = (EditText) view.findViewById(R.id.password);
mSignInButton = (Button) view.findViewById(R.id.signin);
mSignInButton.setOnClickListener(this);
TextView signUp = (TextView) view.findViewById(R.id.signup);
signUp.setText(signUp.getText().toString().toUpperCase());
signUp.setOnClickListener(this);
return view;
}
示例8: setImageDrawable
import android.support.annotation.Nullable; //导入依赖的package包/类
public void setImageDrawable(@Nullable Drawable drawable, boolean isGif) {
this.gif = isGif;
ViewGroup.LayoutParams layoutParams;
if ((layoutParams = getLayoutParams()) != null) {
Drawable wrapDrawable = ImageDrawable.createImageDrawable(drawable,
getScaleType(), borderRadius,
layoutParams.width - getPaddingLeft() - getPaddingRight(),
layoutParams.height - getPaddingTop() - getPaddingBottom(),
isGif);
if (wrapDrawable instanceof ImageDrawable) {
ImageDrawable imageDrawable = (ImageDrawable) wrapDrawable;
if (!Arrays.equals(imageDrawable.getCornerRadii(), borderRadius)) {
imageDrawable.setCornerRadii(borderRadius);
}
}
super.setImageDrawable(wrapDrawable);
if (mWeakReference != null) {
WXImage component = mWeakReference.get();
if (component != null) {
component.readyToRender();
}
}
}
}
示例9: onCreate
import android.support.annotation.Nullable; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.details_activity_layout);
// buscamos si tenemos algun extra en esta activity
Bundle extras = getIntent().getExtras();
if (extras != null) {
String s = extras.getString(EXTRA_TITLE);
TextView tvHeader = (TextView) findViewById(R.id.header);
tvHeader.setText(s);
s = extras.getString (EXTRA_CONTENT);
TextView tvContent = (TextView) findViewById(R.id.content);
tvContent.setText(s);
}
}
示例10: onCreateView
import android.support.annotation.Nullable; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.local_file_fragment, container, false);
ButterKnife.bind(this, v);
if (listFile.isEmpty()) {
loadFiles = new LoadFiles();
loadFiles.execute(FilePickActivity.BOOK_FORMAT);
} else {
setAdapter();
}
setSwipe();
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));
return v;
}
示例11: loadLangs
import android.support.annotation.Nullable; //导入依赖的package包/类
private void loadLangs(Context context, @Nullable AttributeSet attrs) {
setDefaultValue(SYSTEM_LANGUAGE_CODE);
// Fetch readable details
ContextUtils contextUtils = new ContextUtils(context);
List<String> languages = new ArrayList<>();
Object bcof = contextUtils.getBuildConfigValue("APPLICATION_LANGUAGES");
if (bcof instanceof String[]) {
for (String langId : (String[]) bcof) {
Locale locale = contextUtils.getLocaleByAndroidCode(langId);
languages.add(summarizeLocale(locale) + ";" + langId);
}
}
// Sort languages naturally
Collections.sort(languages);
// Show in UI
String[] entries = new String[languages.size() + 2];
String[] entryval = new String[languages.size() + 2];
for (int i = 0; i < languages.size(); i++) {
entries[i + 2] = languages.get(i).split(";")[0];
entryval[i + 2] = languages.get(i).split(";")[1];
}
entryval[0] = SYSTEM_LANGUAGE_CODE;
entries[0] = _systemLanguageName + "\n[" + summarizeLocale(context.getResources().getConfiguration().locale) + "]";
entryval[1] = _defaultLanguageCode;
entries[1] = summarizeLocale(contextUtils.getLocaleByAndroidCode(_defaultLanguageCode));
setEntries(entries);
setEntryValues(entryval);
}
示例12: getTag
import android.support.annotation.Nullable; //导入依赖的package包/类
@Nullable
private Tag getTag() {
final IsoDep isoDep = mIsoDep.get();
if (isoDep != null) {
return isoDep.getTag();
}
return null;
}
示例13: getLikeClause
import android.support.annotation.Nullable; //导入依赖的package包/类
/**
* Creates 'LIKE part' of 'WHERE' clause
*/
@Nullable
static String getLikeClause(String column, String filter) {
return (filter == null ? null :
column + " LIKE '%" + filter + "%' ");
}
示例14: onCreateView
import android.support.annotation.Nullable; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mView = inflater.inflate(getLayoutId(), null);
unbinder = ButterKnife.bind(this, mView);
return mView;
}
示例15: onCreateView
import android.support.annotation.Nullable; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_settings, container,
false);
ButterKnife.bind(this, view);
initView(view);
initData();
return view;
}