微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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,defStyleRes);
    /*final TypedArray a = context.obtainStyledAttributes(
            attrs,R.styleable.CalendarView,defStyleRes);
    final int mode = a.getInt(R.styleable.CalendarView_calendarviewmode,MODE_HOLO);
    a.recycle();

    switch (mode) {
        case MODE_HOLO:
            mDelegate = new CalendarViewLegacyDelegate(
                    this,context,defStyleRes);
            break;
        case MODE_MATERIAL:
            mDelegate = new CalendarViewMaterialDelegate(
                    this,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,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,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 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 Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_settings,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,float,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 Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.f_sci_easy,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 Bundle savedInstanceState) {
    View view = super.onCreateView(inflater,savedInstanceState);
    initToolbar();
    setupToolbar();
    adaptStatusBar();
    return view;
}
项目:GitHub    文件SecondBackstackMviLifecycleFragment.java   
@Nullable @Override
public View onCreateView(LayoutInflater inflater,@Nullable Bundle savedInstanceState) {
  View view = inflater.inflate(R.layout.fragment_mvi,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 Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_about,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,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);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。