Java 类android.support.annotation.Nullable 实例源码

项目:q-mail    文件:TextPartFinder.java   
@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;
}
项目:DateTimePicker    文件:CalendarView.java   
@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");
    }*/
}
项目:android_additive_animations    文件:RepeatingChainedAnimationsDemoFragment.java   
@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;
}
项目:API-Example-App    文件:FragmentDemoInteraction.java   
/**
 * 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("");
                }
            }
        });
    }
}
项目:ViewPagerZoomTransformer    文件:WatchDetailInfoActivity.java   
@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);
}
项目:MiniDownloader    文件:Task.java   
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;
}
项目:android_nextgis_mobile    文件:NGIDLoginFragment.java   
@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;
}
项目:ucar-weex-core    文件:WXImageView.java   
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();
      }
    }
  }
}
项目:Android-2017    文件:DetailActivity.java   
@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);
    }

}
项目:Plamber-Android    文件:LocalFileFragment.java   
@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;
}
项目:memetastic    文件:LanguagePreferenceCompat.java   
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);
}
项目:mi-firma-android    文件:NFCWatchdogRefresher.java   
@Nullable
private Tag getTag() {
    final IsoDep isoDep = mIsoDep.get();
    if (isoDep != null) {
        return isoDep.getTag();
    }
    return null;
}
项目:BlackList    文件:DatabaseAccessHelper.java   
/**
 * Creates 'LIKE part' of 'WHERE' clause
 */

@Nullable
static String getLikeClause(String column, String filter) {
    return (filter == null ? null :
            column + " LIKE '%" + filter + "%' ");
}
项目:PureNews    文件:BaseFragment.java   
@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;
}
项目:OSchina_resources_android    文件:SettingsFragment.java   
@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;
}
项目:Phoenix-for-VK    文件:DocPreviewFragment.java   
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;
}
项目:Renrentou    文件:XFragment.java   
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (useEventBus()) {
        BusProvider.getBus().register(this);
    }
    bindEvent();
    initData(savedInstanceState);
}
项目:FastTextView    文件:ItalicReplacementSpan.java   
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;
  }
}
项目:Trivia-Knowledge    文件:ScienceEasyTab.java   
@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;
}
项目:FragmentCapsulation    文件:BasicToolbarFragment.java   
@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;
}
项目:GitHub    文件:SecondBackstackMviLifecycleFragment.java   
@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;
}
项目:GitHub    文件:AuthFragment.java   
@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();
    }
  });
}
项目:GitHub    文件:UndoHelper.java   
/**
 * 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);
}
项目:dagger-test-example    文件:SearchFragment.java   
@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();
}
项目:AndroidSkinAnimator    文件:MainActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mDataBinding.setListener(this);
    initToolbar(mDataBinding.toolBar);
    initNavigationView(mDataBinding.navigationView);
    configAnimator();
    configFragments();
    initConfigAnimatorDialog();
}
项目:android-titanium-imagecropper    文件:CropImage.java   
/** 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;
}
项目:lighthouse    文件:PodcastsUtils.java   
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;
}
项目:GitHub    文件:AboutFragment.java   
@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;
}
项目:Orin    文件:LibraryFragment.java   
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    setStatusbarColorAuto(view);
    getMainActivity().setNavigationbarColorAuto();
    getMainActivity().setTaskDescriptionColorAuto();

    setUpToolbar();
    setUpViewPager();
}
项目:Rx-Android-Samples    文件:MapOperatorFragment.java   
@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);
}
项目:okdownload    文件:QueueListener.java   
@Override
public void taskEnd(DownloadTask task, EndCause cause, @Nullable Exception realCause,
                    @NonNull Listener1Assist.Listener1Model model) {
    final String status = cause.toString();
    TagUtil.saveStatus(task, status);

    final QueueViewHolder holder = holderMap.get(task.getId());
    if (holder == null) return;

    holder.statusTv.setText(status);
    if (cause == EndCause.COMPLETED) {
        holder.progressBar.setProgress(holder.progressBar.getMax());
    }
}
项目:mapbox-plugins-android    文件:OfflineRegionDetailActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_offline_region_detail);
  ButterKnife.bind(this);
  mapView.onCreate(savedInstanceState);
  offlinePlugin = OfflinePlugin.getInstance();

  Bundle bundle = getIntent().getExtras();
  if (bundle != null) {
    loadOfflineDownload(bundle);
  }
}
项目:conductor-attacher    文件:AnimatorChangeHandler2.java   
@Override
public void onAbortPush(@NonNull ControllerChangeHandler newHandler, @Nullable Controller newTop) {
  super.onAbortPush(newHandler, newTop);

  canceled = true;
  if (animator != null) {
    animator.cancel();
  }
}
项目:rapid-io-android    文件:CollectionProvider.java   
@Nullable
CollectionConnection findCollectionBySubscriptionId(String subscriptionId) {
    for(String channelName : mCollectionConnections.keySet()) {
        if(mCollectionConnections.get(channelName).hasSubscription(subscriptionId))
            return mCollectionConnections.get(channelName);
    }
    return null;
}
项目:HeaderRecyclerViewAdapter-Android    文件:HeaderRecyclerViewAdapter.java   
@Nullable
public final View getHeaderViewForType(int viewType) {
    for (View headerView : headerViews) {
        if (getViewTypeForHeaderOrFooter(headerView) == viewType) {
            return headerView;
        }
    }
    return null;
}
项目:android_ui    文件:LinearLayoutWidget.java   
/**
 */
@Nullable
@Override
public PorterDuff.Mode getBackgroundTintMode() {
    this.ensureDecorator();
    return mDecorator.getBackgroundTintMode();
}
项目:passman-android    文件:CredentialDisplay.java   
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);

    label.setText(credential.getLabel());
    user.setText(credential.getUsername());
    password.setModePassword();
    password.setText(credential.getPassword());
    email.setModeEmail();
    email.setText(credential.getEmail());
    url.setText(credential.getUrl());
    description.setText(credential.getDescription());
    otp.setEnabled(false);
}
项目:GitHub    文件:SizeConfigStrategy.java   
@Override
@Nullable
public Bitmap removeLast() {
  Bitmap removed = groupedMap.removeLast();
  if (removed != null) {
    int removedSize = Util.getBitmapByteSize(removed);
    decrementBitmapOfSize(removedSize, removed);
  }
  return removed;
}
项目:GitHub    文件:Router.java   
public Router putShort(@Nullable String key, short value) {
    getBundleData().putShort(key, value);
    return this;
}
项目:Protein    文件:CurvedFrameLayout.java   
public CurvedFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
    super(context, attrs);
}