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


Java RxTextView类代码示例

本文整理汇总了Java中com.jakewharton.rxbinding2.widget.RxTextView的典型用法代码示例。如果您正苦于以下问题:Java RxTextView类的具体用法?Java RxTextView怎么用?Java RxTextView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RxTextView类属于com.jakewharton.rxbinding2.widget包,在下文中一共展示了RxTextView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onStart

import com.jakewharton.rxbinding2.widget.RxTextView; //导入依赖的package包/类
@Override protected void onStart() {
  super.onStart();

  disposeOnStop(RxTextView.textChanges(etEmail)
      .debounce(200, TimeUnit.MILLISECONDS)
      .map(email -> new CheckEmailAction(email.toString()))
      .subscribe(action -> store.dispatch(action)));

  disposeOnStop(RxView.clicks(btSignIn)
      .map(ignored -> new SubmitAction(
          etEmail.getText().toString(),
          etPassword.getText().toString()))
      .subscribe(action -> store.dispatch(action)));

  disposeOnStop(viewModel.idle().subscribe(ignored -> renderIdle()));
  disposeOnStop(viewModel.loading().subscribe(ignored -> renderLoading()));
  disposeOnStop(viewModel.success().subscribe(ignored -> renderSuccess()));
  disposeOnStop(viewModel.error().subscribe(this::renderError));
}
 
开发者ID:dbof10,项目名称:redux-observable,代码行数:20,代码来源:LoginActivity.java

示例2: onCreateView

import com.jakewharton.rxbinding2.widget.RxTextView; //导入依赖的package包/类
@Override
public View onCreateView(
    LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
  View layout = inflater.inflate(R.layout.fragment_form_validation_comb_latest, container, false);
  unbinder = ButterKnife.bind(this, layout);

  _emailChangeObservable =
      RxTextView.textChanges(_email).skip(1).toFlowable(BackpressureStrategy.LATEST);
  _passwordChangeObservable =
      RxTextView.textChanges(_password).skip(1).toFlowable(BackpressureStrategy.LATEST);
  _numberChangeObservable =
      RxTextView.textChanges(_number).skip(1).toFlowable(BackpressureStrategy.LATEST);

  _combineLatestEvents();

  return layout;
}
 
开发者ID:kaushikgopal,项目名称:RxJava-Android-Samples,代码行数:18,代码来源:FormValidationCombineLatestFragment.java

示例3: onCreateView

import com.jakewharton.rxbinding2.widget.RxTextView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_edit, container, false);
    unbinder = ButterKnife.bind(this, view);
    ((MarkdownApplication) getActivity().getApplication()).getComponent().inject(this);
    Observable<String> obs = RxTextView.textChanges(markdownEditor)
            .debounce(50, TimeUnit.MILLISECONDS).map(CharSequence::toString);
    obs.subscribeOn(Schedulers.io());
    obs.observeOn(AndroidSchedulers.mainThread());
    obs.subscribe(markdown -> {
        presenter.onMarkdownEdited(markdown);
    });
    return view;
}
 
开发者ID:wbrawner,项目名称:SimpleMarkdown,代码行数:17,代码来源:EditFragment.java

示例4: onViewCreated

import com.jakewharton.rxbinding2.widget.RxTextView; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    RxTextView.textChanges(binding.edtSearch)
            .debounce(100, TimeUnit.MILLISECONDS)
            .observeOn(AndroidSchedulers.mainThread())
            .filter(charSequence -> charSequence.length() > 0)
            .map(charSequence -> "*" + charSequence + "*") // realm search
            .subscribe(s -> viewModel.searchLocal(s));

    RxTextView.textChanges(binding.edtSearch)
            .debounce(500, TimeUnit.MILLISECONDS)
            .observeOn(AndroidSchedulers.mainThread())
            .filter(charSequence -> charSequence.length() > 0)
            .map(CharSequence::toString)
            .subscribe(s -> viewModel.searchRemote(s));

    setNoDataText("No result");
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:21,代码来源:RepoSearchFragment.java

示例5: getRealView

import com.jakewharton.rxbinding2.widget.RxTextView; //导入依赖的package包/类
@Override
protected View getRealView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    if (convertView == null || convertView.getTag() == null) {
        context = parent.getContext();
        convertView = getLayoutInflater(context).inflate(R.layout.recycle_list, null);
        holder = new ViewHolder(convertView);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }

    if (dataList != null && dataList.size() > 0) {

        if (dataList.get(position) instanceof TngouBean) {
           TngouBean entity = (TngouBean) dataList.get(position);
            Observable.just(entity.getTitle())
                .subscribe(RxTextView.text(holder.mName));
            FrescoHelper.displayImageResize(holder.ivAvatar,"http://tnfs.tngou.net/img"+entity.getImg(),300,150,2);

        }
    }
        return convertView;

}
 
开发者ID:lizubing1992,项目名称:Li-MVPArms,代码行数:26,代码来源:ImageListAdapter.java

示例6: onFinishInflate

import com.jakewharton.rxbinding2.widget.RxTextView; //导入依赖的package包/类
@Override
protected void onFinishInflate() {
    super.onFinishInflate();

    EditText editText = (EditText) findViewById(R.id.repositories_search);
    searchStringObservable = RxTextView.textChanges(editText).map(CharSequence::toString);

    statusText = (TextView) findViewById(R.id.repositories_status_text);

    repositoriesAdapter = new RepositoriesAdapter(Collections.emptyList());

    repositoriesListView = (RecyclerView) findViewById(R.id.repositories_list_view);
    repositoriesListView.setHasFixedSize(true);
    repositoriesListView.setLayoutManager(new LinearLayoutManager(getContext()));
    repositoriesListView.setAdapter(repositoriesAdapter);
}
 
开发者ID:reark,项目名称:reark,代码行数:17,代码来源:RepositoriesView.java

示例7: onResume

import com.jakewharton.rxbinding2.widget.RxTextView; //导入依赖的package包/类
@Override
protected void onResume() {
    super.onResume();

    // Listen to key presses and only start search after user paused to avoid excessive redrawing on the screen.
    disposable = RxTextView.textChangeEvents(searchInputView)
            .debounce(200, TimeUnit.MILLISECONDS) // default Scheduler is Schedulers.computation()
            .observeOn(AndroidSchedulers.mainThread()) // Needed to access Realm data
            .toFlowable(BackpressureStrategy.BUFFER)
            .switchMap(textChangeEvent -> {
                // Use Async API to move Realm queries off the main thread.
                // Realm currently doesn't support the standard Schedulers.
                return realm.where(Person.class)
                        .beginsWith("name", textChangeEvent.text().toString())
                        .findAllSortedAsync("name")
                        .asFlowable();
            })
            // Only continue once data is actually loaded
            // RealmObservables will emit the unloaded (empty) list as its first item
            .filter(people -> people.isLoaded())
            .subscribe(people -> {
                searchResultsView.removeAllViews();
                for (Person person : people) {
                    TextView view = new TextView(ThrottleSearchActivity.this);
                    view.setText(person.getName());
                    searchResultsView.addView(view);
                }
            }, throwable -> throwable.printStackTrace());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:30,代码来源:ThrottleSearchActivity.java

示例8: init

import com.jakewharton.rxbinding2.widget.RxTextView; //导入依赖的package包/类
@Override protected void init() {
  setSupportActionBar(toolbar);
  showBackButton(true);
  setTitle(getString(R.string.screen_manage_cities));

  recyclerCities.setLayoutManager(new LinearLayoutManager(this));
  adapter = new CityAdapter(this);
  recyclerCities.setAdapter(adapter);

  autocompleteTxtCity.setAdapter(autoCompleteAdapter);
  autocompleteTxtCity.setOnItemClickListener(this);

  Observable<String> observable = RxTextView.textChangeEvents(autocompleteTxtCity)
      .skip(2)
      .debounce(500, TimeUnit.MILLISECONDS)
      .map(new Function<TextViewTextChangeEvent, String>() {
        @Override public String apply(TextViewTextChangeEvent textViewTextChangeEvent)
            throws Exception {
          return textViewTextChangeEvent.text().toString();
        }
      })
      .filter(new Predicate<String>() {
        @Override public boolean test(String s) throws Exception {
          return s.length() > 2;
        }
      });

  presenter.loadAutocompleteCities(observable);
  presenter.loadCities();
}
 
开发者ID:nikacotAndroid,项目名称:Weather-Guru-MVP,代码行数:31,代码来源:ManageCityActivity.java

示例9: validateEmail

import com.jakewharton.rxbinding2.widget.RxTextView; //导入依赖的package包/类
/**
 * A small example in which we check if user's input email is valid or not
 * and show message in real-time.
 */
private void validateEmail() {
  RxTextView.textChanges(emailEdit)
      .map(textChange -> isEmail(textChange.toString()))
      .map(isValid -> isValid ? "OK" : "INVALID EMAIL")
      .observeOn(AndroidSchedulers.mainThread())
      .subscribe(msg -> logText.setText(msg));
}
 
开发者ID:quangctkm9207,项目名称:rxjava-family,代码行数:12,代码来源:RxBindingActivity.java

示例10: setupSearchContact

import com.jakewharton.rxbinding2.widget.RxTextView; //导入依赖的package包/类
private void setupSearchContact() {
    mDisposable = RxTextView.textChangeEvents(etSearchBox)
            .debounce(300, TimeUnit.MILLISECONDS) // default Scheduler is Computation
            .filter(changes -> (changes.text().toString() != null))
            .observeOn(AndroidSchedulers.mainThread())
            .subscribeWith(getSearchObserver());
}
 
开发者ID:AnhLeAit,项目名称:ContactLoader,代码行数:8,代码来源:ContactActivity.java

示例11: listener

import com.jakewharton.rxbinding2.widget.RxTextView; //导入依赖的package包/类
private void listener(){

        RxTextView.textChanges(activity_pokelist_et_search)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .debounce(1, TimeUnit.SECONDS)
                .subscribe(s -> {
                   if(s.length() != 0){
                       clearData();
                       startLoading();
                       loading = true;
                       page = 0;
                       context.getCardSearch(s.toString(),Constants.ITEM_LIMIT, page);
                   }
                });


        adapter.setOnLoadMoreListener(() -> {
            if(!loading && data.size() >= Constants.ITEM_LIMIT) {
                adapter.setProgress();
                page++;
                if(activity_pokelist_et_search.getText().toString().length() != 0){
                    context.getCardSearch(activity_pokelist_et_search.getText().toString(),Constants.ITEM_LIMIT, page);
                    return;
                }
                context.getCards(Constants.ITEM_LIMIT, page);
            }
        });

        activity_pokelist_rv_list.setOnTouchListener((v, event) -> {
            InputMethodManager inm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
            inm.hideSoftInputFromWindow(v.getWindowToken(),0);
            return false;
        });
    }
 
开发者ID:alicanozkara,项目名称:PokemonCards,代码行数:36,代码来源:PokeListView.java

示例12: onCreate

import com.jakewharton.rxbinding2.widget.RxTextView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    unbinder = ButterKnife.bind(this);

    firstNameChangeObservable = RxTextView.textChanges(etFirstName).skip(1).toFlowable(BackpressureStrategy.LATEST);
    lastNameChangeObservable = RxTextView.textChanges(etLastName).skip(1).toFlowable(BackpressureStrategy.LATEST);
    emailChangeObservable = RxTextView.textChanges(etEmail).skip(1).toFlowable(BackpressureStrategy.LATEST);

    combineLatestEvents();
}
 
开发者ID:shuza,项目名称:RxAndroid-Examples,代码行数:13,代码来源:MainActivity.java

示例13: initView

import com.jakewharton.rxbinding2.widget.RxTextView; //导入依赖的package包/类
public void initView() {
    Observable<CharSequence> observable = RxTextView.textChanges(stakeTxt);
    observable
            .filter(cs -> !Utils.isEmpty(cs))
            .map(cs -> Double.parseDouble(cs.toString()))
            .subscribe(stake -> this.slotRoom.setBankerBalance(Convert.toWei(stake, Convert.Unit.ETHER)));
    balanceTextView.setText("Current balance : " + Convert.fromWei(AccountProvider.account.getBalance(), Convert.Unit.ETHER) + " ETH");
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:9,代码来源:MakeSlotStepTwoFragment.java

示例14: initView

import com.jakewharton.rxbinding2.widget.RxTextView; //导入依赖的package包/类
public void initView() {
    Observable<CharSequence> minRangeObservable = RxTextView.textChanges(minRangeEditText);
    Observable<CharSequence> maxRangeObservable = RxTextView.textChanges(maxRangeEditText);
    minRangeObservable
            .filter(cs -> !Utils.isEmpty(cs))
            .map(cs -> Double.parseDouble(cs.toString()))
            .subscribe(bet -> this.slotRoom.setMinBet(bet) );
    maxRangeObservable
            .filter(cs -> !Utils.isEmpty(cs))
            .map(cs -> Double.parseDouble(cs.toString()))
            .subscribe(bet -> this.slotRoom.setMaxBet(bet) );
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:13,代码来源:MakeSlotStepFourFragment.java

示例15: bindPresentationModel

import com.jakewharton.rxbinding2.widget.RxTextView; //导入依赖的package包/类
@Override
protected void bindPresentationModel(MainPresentationModel presentationModel) {
    // State

    // Input text
    bindState(presentationModel.inputText(), string -> {
                input.setText(string);
                input.setSelection(input.length());
            }
    );

    // Output text
    bindState(presentationModel.outputText(), output::setText);

    // Children presence
    bindState(presentationModel.childrenPresence(), isPresented -> {
                changeChildrenPresence(isPresented);
                childrenButton.setText(isPresented ? R.string.children_button_hide
                        : R.string.children_button_show);
            }
    );

    // Actions

    // Tell presentation model that input text changed
    bindAction(
            RxTextView.textChanges(input)
                    .map(CharSequence::toString),
            presentationModel.inputTextChanges
    );

    // Tell presentation model that children button was clicked
    bindAction(
            RxView.clicks(childrenButton),
            presentationModel.childrenButtonClicks
    );
}
 
开发者ID:Jeevuz,项目名称:Outlast,代码行数:38,代码来源:MainFragment.java


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