@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; }
@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"); }*/ }
@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; }
/** * 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(""); } } }); } }
@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); }
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; }
@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; }
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(); } } } }
@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); } }
@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; }
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); }
@Nullable private Tag getTag() { final IsoDep isoDep = mIsoDep.get(); if (isoDep != null) { return isoDep.getTag(); } return null; }
/** * Creates 'LIKE part' of 'WHERE' clause */ @Nullable static String getLikeClause(String column, String filter) { return (filter == null ? null : column + " LIKE '%" + filter + "%' "); }
@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; }
@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; }
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; }
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (useEventBus()) { BusProvider.getBus().register(this); } bindEvent(); initData(savedInstanceState); }
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; } }
@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; }
@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; }
@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; }
@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(); } }); }
/** * 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); }
@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(); }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mDataBinding.setListener(this); initToolbar(mDataBinding.toolBar); initNavigationView(mDataBinding.navigationView); configAnimator(); configFragments(); initConfigAnimatorDialog(); }
/** 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; }
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; }
@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; }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { setStatusbarColorAuto(view); getMainActivity().setNavigationbarColorAuto(); getMainActivity().setTaskDescriptionColorAuto(); setUpToolbar(); setUpViewPager(); }
@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); }
@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()); } }
@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); } }
@Override public void onAbortPush(@NonNull ControllerChangeHandler newHandler, @Nullable Controller newTop) { super.onAbortPush(newHandler, newTop); canceled = true; if (animator != null) { animator.cancel(); } }
@Nullable CollectionConnection findCollectionBySubscriptionId(String subscriptionId) { for(String channelName : mCollectionConnections.keySet()) { if(mCollectionConnections.get(channelName).hasSubscription(subscriptionId)) return mCollectionConnections.get(channelName); } return null; }
@Nullable public final View getHeaderViewForType(int viewType) { for (View headerView : headerViews) { if (getViewTypeForHeaderOrFooter(headerView) == viewType) { return headerView; } } return null; }
/** */ @Nullable @Override public PorterDuff.Mode getBackgroundTintMode() { this.ensureDecorator(); return mDecorator.getBackgroundTintMode(); }
@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); }
@Override @Nullable public Bitmap removeLast() { Bitmap removed = groupedMap.removeLast(); if (removed != null) { int removedSize = Util.getBitmapByteSize(removed); decrementBitmapOfSize(removedSize, removed); } return removed; }
public Router putShort(@Nullable String key, short value) { getBundleData().putShort(key, value); return this; }
public CurvedFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); }