本文整理匯總了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;
}