@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;
}
java类android.support.annotation.Nullable的实例源码
TextPartFinder.java 文件源码
项目:q-mail
阅读 45
收藏 0
点赞 0
评论 0
CalendarView.java 文件源码
项目:DateTimePicker
阅读 53
收藏 0
点赞 0
评论 0
@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");
}*/
}
RepeatingChainedAnimationsDemoFragment.java 文件源码
项目:android_additive_animations
阅读 35
收藏 0
点赞 0
评论 0
@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;
}
FragmentDemoInteraction.java 文件源码
项目:API-Example-App
阅读 42
收藏 0
点赞 0
评论 0
/**
* 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("");
}
}
});
}
}
WatchDetailInfoActivity.java 文件源码
项目:ViewPagerZoomTransformer
阅读 43
收藏 0
点赞 0
评论 0
@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);
}
Task.java 文件源码
项目:MiniDownloader
阅读 53
收藏 0
点赞 0
评论 0
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;
}
NGIDLoginFragment.java 文件源码
项目:android_nextgis_mobile
阅读 43
收藏 0
点赞 0
评论 0
@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;
}
WXImageView.java 文件源码
项目:ucar-weex-core
阅读 35
收藏 0
点赞 0
评论 0
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();
}
}
}
}
DetailActivity.java 文件源码
项目:Android-2017
阅读 55
收藏 0
点赞 0
评论 0
@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);
}
}
LocalFileFragment.java 文件源码
项目:Plamber-Android
阅读 32
收藏 0
点赞 0
评论 0
@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;
}
LanguagePreferenceCompat.java 文件源码
项目:memetastic
阅读 35
收藏 0
点赞 0
评论 0
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);
}
NFCWatchdogRefresher.java 文件源码
项目:mi-firma-android
阅读 38
收藏 0
点赞 0
评论 0
@Nullable
private Tag getTag() {
final IsoDep isoDep = mIsoDep.get();
if (isoDep != null) {
return isoDep.getTag();
}
return null;
}
DatabaseAccessHelper.java 文件源码
项目:BlackList
阅读 37
收藏 0
点赞 0
评论 0
/**
* Creates 'LIKE part' of 'WHERE' clause
*/
@Nullable
static String getLikeClause(String column, String filter) {
return (filter == null ? null :
column + " LIKE '%" + filter + "%' ");
}
BaseFragment.java 文件源码
项目:PureNews
阅读 44
收藏 0
点赞 0
评论 0
@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;
}
SettingsFragment.java 文件源码
项目:OSchina_resources_android
阅读 48
收藏 0
点赞 0
评论 0
@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;
}
DocPreviewFragment.java 文件源码
项目:Phoenix-for-VK
阅读 36
收藏 0
点赞 0
评论 0
public static Bundle buildArgs(int accountId, int docId, int docOwnerId, @Nullable Document document) {
Bundle args = new Bundle();
args.putInt(Extra.ACCOUNT_ID, accountId);
args.putInt(Extra.DOC_ID, docId);
args.putInt(Extra.OWNER_ID, docOwnerId);
if (document != null) {
args.putParcelable(Extra.DOC, document);
}
return args;
}
XFragment.java 文件源码
项目:Renrentou
阅读 43
收藏 0
点赞 0
评论 0
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (useEventBus()) {
BusProvider.getBus().register(this);
}
bindEvent();
initData(savedInstanceState);
}
ItalicReplacementSpan.java 文件源码
项目:FastTextView
阅读 40
收藏 0
点赞 0
评论 0
private void setHeightIfNeed(CharSequence text, @IntRange(from = 0) int start, @IntRange(from = 0) int end, @Nullable Paint.FontMetricsInt fm) {
if (fm != null && text.length() == end - start) {
// Extending classes can set the height of the span by updating
// attributes of {@link android.graphics.Paint.FontMetricsInt}. If the span covers the whole
// text, and the height is not set,
// {@link #draw(Canvas, CharSequence, int, int, float, int, int, int, Paint)} will not be
// called for the span.
fm.top = mRect.top;
fm.bottom = mRect.bottom;
}
}
ScienceEasyTab.java 文件源码
项目:Trivia-Knowledge
阅读 38
收藏 0
点赞 0
评论 0
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.f_sci_easy, container, false);
gridview = (GridView) v.findViewById(R.id.gridview);
Progress= (BootstrapProgressBar) v.findViewById(R.id.Progress);
progressText = (TextView) v.findViewById(R.id.progressText);
return v;
}
BasicToolbarFragment.java 文件源码
项目:FragmentCapsulation
阅读 41
收藏 0
点赞 0
评论 0
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
initToolbar();
setupToolbar();
adaptStatusBar();
return view;
}
SecondBackstackMviLifecycleFragment.java 文件源码
项目:GitHub
阅读 47
收藏 0
点赞 0
评论 0
@Nullable @Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_mvi, container, false);
TextView tv = (TextView) view.findViewById(R.id.text);
tv.setText(getClass().getSimpleName());
return view;
}
AuthFragment.java 文件源码
项目:GitHub
阅读 32
收藏 0
点赞 0
评论 0
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
authView = view.findViewById(R.id.authView);
authView.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
onAuthViewClicked();
}
});
}
UndoHelper.java 文件源码
项目:GitHub
阅读 53
收藏 0
点赞 0
评论 0
/**
* convenience method to be used if you have previously set a {@link Snackbar} with {@link #withSnackBar(Snackbar, String)}
*
* @param positions the positions where the items were removed
* @return the snackbar or null if {@link #withSnackBar(Snackbar, String)} was not previously called
*/
public @Nullable Snackbar remove(Set<Integer> positions) {
if (mSnackBar == null) {
return null;
}
View snackbarView = mSnackBar.getView();
TextView snackbarText = (TextView) snackbarView.findViewById(android.support.design.R.id.snackbar_text);
return remove(snackbarView, snackbarText.getText().toString(), mSnackbarActionText, mSnackBar.getDuration(), positions);
}
SearchFragment.java 文件源码
项目:dagger-test-example
阅读 43
收藏 0
点赞 0
评论 0
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
binding.setVm(searchViewModel);
binding.recyclerView.setLayoutManager(
new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false)
);
compositeDisposable.add(
searchViewModel.onNewAdapterAvailable().subscribe(searchAdapter -> {
binding.recyclerView.setAdapter(searchAdapter);
})
);
searchViewModel.onAttach();
}
MainActivity.java 文件源码
项目:AndroidSkinAnimator
阅读 36
收藏 0
点赞 0
评论 0
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mDataBinding.setListener(this);
initToolbar(mDataBinding.toolBar);
initNavigationView(mDataBinding.navigationView);
configAnimator();
configFragments();
initConfigAnimatorDialog();
}
CropImage.java 文件源码
项目:android-titanium-imagecropper
阅读 42
收藏 0
点赞 0
评论 0
/** Get {@link CropImageActivity} intent to start the activity. */
public Intent getIntent(@NonNull Context context, @Nullable Class<?> cls) {
mOptions.validate();
Intent intent = new Intent();
intent.setClass(context, cls);
Bundle bundle = new Bundle();
bundle.putParcelable(CROP_IMAGE_EXTRA_SOURCE, mSource);
bundle.putParcelable(CROP_IMAGE_EXTRA_OPTIONS, mOptions);
intent.putExtra(CropImage.CROP_IMAGE_EXTRA_BUNDLE, bundle);
return intent;
}
PodcastsUtils.java 文件源码
项目:lighthouse
阅读 46
收藏 0
点赞 0
评论 0
static boolean hasSplashColors(Context context, Podcast podcast, @Nullable String splashUrl) {
PodcastsOpenHelper helper = new PodcastsOpenHelper(context, PODCASTS_DATABASE_NAME);
String[] args = args(podcast.getId());
try (SQLiteDatabase database = helper.getReadableDatabase(); Cursor cursor = database.rawQuery(PODCAST_COLORS_SELECT_SQL, args)) {
if (cursor.moveToNext()) {
return hasColors(cursor, 3, splashUrl);
}
}
return false;
}
AboutFragment.java 文件源码
项目:GitHub
阅读 51
收藏 0
点赞 0
评论 0
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_about, container, false);
ActivityComponent component = getActivityComponent();
if (component != null) {
component.inject(this);
setUnBinder(ButterKnife.bind(this, view));
mPresenter.onAttach(this);
}
return view;
}
LibraryFragment.java 文件源码
项目:Orin
阅读 50
收藏 0
点赞 0
评论 0
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
setStatusbarColorAuto(view);
getMainActivity().setNavigationbarColorAuto();
getMainActivity().setTaskDescriptionColorAuto();
setUpToolbar();
setUpViewPager();
}
MapOperatorFragment.java 文件源码
项目:Rx-Android-Samples
阅读 38
收藏 0
点赞 0
评论 0
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mRepoListView = view.findViewById(R.id.repo_list_view);
mObserverLog = view.findViewById(R.id.observer_log);
mObserverLog.setMovementMethod(new ScrollingMovementMethod());
mApi.getObservableRepositories(Utils.USER)
//For every repository, this method will add the number of this repository.
.map(new Function<List<RepositoryResponse>, List<RepositoryResponse>>() {
@Override
public List<RepositoryResponse> apply(@NonNull List<RepositoryResponse> repositoryResponses) throws Exception {
for (int i = 1; i <= repositoryResponses.size(); i++) {
repositoryResponses.get(i - 1).name = "Repository N° "
+ i
+ ": "
+ repositoryResponses.get(i - 1).name;
}
return repositoryResponses;
}
})
//Subscribe the Network call in io Thread.
.subscribeOn(Schedulers.io())
//Subscribe the Observer in MainThread so it can updates the UI with the result.
.observeOn(AndroidSchedulers.mainThread())
//Choose the subscribed Observer for items emitted by this observable.
.subscribe(mListBaseObserver);
}