@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
}
@Override protected final void subscribeActual(Observer super T> observer) {
subscribeListener(observer);
observer.onNext(getInitialValue());
}
subscribeActual这个方法就在Observable中进行调用:
@SchedulerSupport(SchedulerSupport.NONE)
@Override
public final void subscribe(Observer super T> observer) {
ObjectHelper.requireNonNull(observer, "observer is null");
try {
observer = RxJavaPlugins.onSubscribe(this, observer);
ObjectHelper.requireNonNull(observer, "Plugin returned null Observer");
**subscribeActual(observer);**
} catch (NullPointerException e) { // NOPMD
throw e;
} catch (Throwable e) {
Exceptions.throwIfFatal(e);
// can't call onError because no way to know if a Disposable has been set or not
// can't call onSubscribe because the call might have set a Subscription already
RxJavaPlugins.onError(e);
NullPointerException npe = new NullPointerException("Actually not, but can't throw other exceptions due to RS");
npe.initCause(e);
throw npe;
}
}
这个也是返回一个封装的Observable,基本逻辑和上面是差不多的,主要区别的static final class Listener extends MainThreadDisposable implements OnClickListener,这里实现的是implements OnClickListener接口,在onClick中默认发送一个数据observer.onNext(Notification.INSTANCE);按钮点击发送的数据没什么用。在解除监听的onDispose时候设置view.setOnClickListener(null);
final class ViewClickObservable extends Observable {
private final View view;
ViewClickObservable(View view) {
this.view = view;
}
@Override protected void subscribeActual(Observer super Object> observer) {
if (!checkMainThread(observer)) {
return;
}
Listener listener = new Listener(view, observer);
observer.onSubscribe(listener);
view.setOnClickListener(listener);
}
static final class Listener extends MainThreadDisposable implements OnClickListener {
private final View view;
private final Observer super Object> observer;
Listener(View view, Observer super Object> observer) {
this.view = view;
this.observer = observer;
}
@Override public void onClick(View v) {
if (!isDisposed()) {
observer.onNext(Notification.INSTANCE);
}
}
@Override protected void onDispose() {
view.setOnClickListener(null);
}
}
}
直接上源码,看出来了吧?static final class Listener extends MainThreadDisposable implements OnItemClickListener中实现的是OnItemClickListener,然后在onItemClick中调用回调observer.onNext(position);
final class AdapterViewItemClickObservable extends Observable {
private final AdapterView> view;
AdapterViewItemClickObservable(AdapterView> view) {
this.view = view;
}
@Override protected void subscribeActual(Observer super Integer> observer) {
if (!checkMainThread(observer)) {
return;
}
Listener listener = new Listener(view, observer);
observer.onSubscribe(listener);
view.setOnItemClickListener(listener);
}
static final class Listener extends MainThreadDisposable implements OnItemClickListener {
private final AdapterView> view;
private final Observer super Integer> observer;
Listener(AdapterView> view, Observer super Integer> observer) {
this.view = view;
this.observer = observer;
}
@Override
public void onItemClick(AdapterView> adapterView, View view, int position, long id) {
if (!isDisposed()) {
observer.onNext(position);
}
}
@Override protected void onDispose() {
view.setOnItemClickListener(null);
}
}
}
--只包含执行部分的PL/SQL块
--set serveroutput off
begin
dbms_output.put_line('Hello,everyone!');
end;
select * from emp;
--包含定义部分和执行部分的PL/SQL块
declare
v_ename varchar2(5);
begin
select
转:http://stackoverflow.com/questions/6352208/how-to-solve-plugin-execution-not-covered-by-lifecycle-configuration-for-sprin
maven报错:
Plugin execution not covered by lifecycle configuration:
要使用MonkeyRunner,就要学习使用Python,哎
先抄一段官方doc里的代码
作用是启动一个程序(应该是启动程序默认的Activity),然后按MENU键,并截屏
# Imports the monkeyrunner modules used by this program
from com.android.monkeyrunner import MonkeyRun