本文整理汇总了Java中com.jakewharton.rxbinding.widget.TextViewTextChangeEvent类的典型用法代码示例。如果您正苦于以下问题:Java TextViewTextChangeEvent类的具体用法?Java TextViewTextChangeEvent怎么用?Java TextViewTextChangeEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextViewTextChangeEvent类属于com.jakewharton.rxbinding.widget包,在下文中一共展示了TextViewTextChangeEvent类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFilterObserver
import com.jakewharton.rxbinding.widget.TextViewTextChangeEvent; //导入依赖的package包/类
/**
* Get the observer to use to handle filter text changes.
* @return Filter text change observer
*/
private Observer<TextViewTextChangeEvent> getFilterObserver() {
return new Observer<TextViewTextChangeEvent>() {
@Override
public void onCompleted() {
// Nothing.
}
@Override
public void onError(Throwable e) {
// Shouldn't happen, but we'll log it if it does.
Timber.e("Some error occurred due to the filter observer!");
e.printStackTrace();
}
@Override
public void onNext(TextViewTextChangeEvent textViewTextChangeEvent) {
// Apply filter to items and then update adapter's copy of items.
applyFilter(textViewTextChangeEvent.text().toString());
adapter.updateRealmResults(items);
}
};
}
示例2: onCreate
import com.jakewharton.rxbinding.widget.TextViewTextChangeEvent; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
ButterKnife.bind(this);
presenter = new SplashActivityPresenter(this,new Validator());
textChangeSubscription = RxTextView.textChangeEvents(etUsername).subscribe(new Action1<TextViewTextChangeEvent>() {
@Override
public void call(TextViewTextChangeEvent textViewTextChangeEvent) {
presenter.username = textViewTextChangeEvent.text().toString();
etUsername.setError(null);
}
});
}
示例3: getSearchObserver
import com.jakewharton.rxbinding.widget.TextViewTextChangeEvent; //导入依赖的package包/类
private Observer<TextViewTextChangeEvent> getSearchObserver() {
return new Observer<TextViewTextChangeEvent>() {
@Override
public void onCompleted() {
Timber.d(" onComplete");
}
@Override
public void onError(Throwable e) {
Timber.e(e, " on error!");
log("Dang error. check your logs");
}
@Override
public void onNext(TextViewTextChangeEvent onTextChangeEvent) {
log(format("Searching for %s", onTextChangeEvent.text().toString()));
}
};
}
示例4: method18
import com.jakewharton.rxbinding.widget.TextViewTextChangeEvent; //导入依赖的package包/类
/**
* EditText,每隔500ms,去响应变化
*/
private void method18() {
mSearchEditText.setVisibility(View.VISIBLE);
RxTextView.textChangeEvents(mSearchEditText)
.debounce(500, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Subscriber<TextViewTextChangeEvent>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(TextViewTextChangeEvent textViewTextChangeEvent) {
String changedMessage = textViewTextChangeEvent.text().toString();
Logger.d(TAG, changedMessage);
if (!TextUtils.isEmpty(changedMessage)) {
ToastUtil.getInstance().showToast(MainActivity.this, changedMessage);
}
}
});
}
示例5: getSearchObserver
import com.jakewharton.rxbinding.widget.TextViewTextChangeEvent; //导入依赖的package包/类
private Observer<TextViewTextChangeEvent> getSearchObserver(){
return new Observer<TextViewTextChangeEvent>() {
@Override
public void onCompleted() {
Timber.d("--------- onComplete");
}
@Override
public void onError(Throwable e) {
Timber.e(e, "--------- Woops on error!");
log("Dang error. check your logs");
}
@Override
public void onNext(TextViewTextChangeEvent textViewTextChangeEvent) {
log(format("Searching for %s", textViewTextChangeEvent.text().toString()));
}
};
}
示例6: searchKeyWordDemo
import com.jakewharton.rxbinding.widget.TextViewTextChangeEvent; //导入依赖的package包/类
/**
* 搜索关键字提醒Demo
*/
private void searchKeyWordDemo() {
RxTextView.textChangeEvents(et_search)
.debounce(300, TimeUnit.MILLISECONDS) //debounce:每次文本更改后有300毫秒的缓冲时间,默认在computation调度器
.observeOn(AndroidSchedulers.mainThread()) //触发后回到Android主线程调度器
.subscribe(new Action1<TextViewTextChangeEvent>() {
@Override
public void call(TextViewTextChangeEvent textViewTextChangeEvent) {
String key = textViewTextChangeEvent.text().toString().trim();
if (TextUtils.isEmpty(key)) {
iv_x.setVisibility(View.GONE);
if (mAdapter != null) {
mAdapter.clear();
mAdapter.notifyDataSetChanged();
}
} else {
iv_x.setVisibility(View.VISIBLE);
getKeyWordFormNet(key)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<List<String>>() {
@Override
public void call(List<String> strings) {
initPage(strings);
}
});
}
}
});
}
示例7: onActivityCreated
import com.jakewharton.rxbinding.widget.TextViewTextChangeEvent; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setupLogger();
Observable<TextViewTextChangeEvent> textChangeEventObservable = RxTextView.textChangeEvents(inputSearchText);
// subscription = textChangeEventObservable.compose(bindToLifecycle())
// .debounce(400, TimeUnit.MILLISECONDS)
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(getSearchObserver());
}