当前位置: 首页>>代码示例>>Java>>正文


Java Nullable类代码示例

本文整理汇总了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;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:19,代码来源:TextPartFinder.java

示例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");
    }*/
}
 
开发者ID:Gericop,项目名称:DateTimePicker,代码行数:24,代码来源:CalendarView.java

示例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("");
                }
            }
        });
    }
}
 
开发者ID:brandall76,项目名称:API-Example-App,代码行数:19,代码来源:FragmentDemoInteraction.java

示例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);
}
 
开发者ID:wl386123298,项目名称:ViewPagerZoomTransformer,代码行数:18,代码来源:WatchDetailInfoActivity.java

示例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;
}
 
开发者ID:xyhuangjinfu,项目名称:MiniDownloader,代码行数:19,代码来源:Task.java

示例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;
}
 
开发者ID:nextgis,项目名称:android_nextgis_mobile,代码行数:19,代码来源:NGIDLoginFragment.java

示例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();
      }
    }
  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:25,代码来源:WXImageView.java

示例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);
    }

}
 
开发者ID:gothalo,项目名称:Android-2017,代码行数:18,代码来源:DetailActivity.java

示例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;
}
 
开发者ID:OlegKlimenko,项目名称:Plamber-Android,代码行数:17,代码来源:LocalFileFragment.java

示例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);
}
 
开发者ID:gsantner,项目名称:memetastic,代码行数:33,代码来源:LanguagePreferenceCompat.java

示例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;
}
 
开发者ID:MiFirma,项目名称:mi-firma-android,代码行数:9,代码来源:NFCWatchdogRefresher.java

示例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 + "%' ");
}
 
开发者ID:kaliturin,项目名称:BlackList,代码行数:10,代码来源:DatabaseAccessHelper.java

示例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;
}
 
开发者ID:xiarunhao123,项目名称:PureNews,代码行数:8,代码来源:BaseFragment.java

示例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;
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:11,代码来源:SettingsFragment.java


注:本文中的android.support.annotation.Nullable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。