本文整理汇总了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));
}
示例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;
}
示例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");
}
示例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;
}
示例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);
}
示例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());
}
示例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();
}
示例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));
}
示例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());
}
示例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;
});
}
示例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();
}
示例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");
}
示例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) );
}
示例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
);
}