當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。