Java 类android.view.View.OnHoverListener 实例源码

项目:AbacusUtil    文件:Observer.java   
public Disposable onHover(final OnHoverListener onNext, final Consumer<? super Exception> onError, final Runnable onComplete) {
    N.requireNonNull(onNext, "onNext");
    N.requireNonNull(onError, "onError");
    N.requireNonNull(onComplete, "onComplete");

    dispatcher.append(new DispatcherBase<Object>(onError, onComplete) {
        @Override
        public void onNext(Object param) {
            final Tuple2<View, MotionEvent> tmp = (Tuple2<View, MotionEvent>) param;

            if (Fu.isUiThread()) {
                onNext.onHover(tmp._1, tmp._2);
            } else {
                UIExecutor.execute(new Runnable() {
                    @Override
                    public void run() {
                        onNext.onHover(tmp._1, tmp._2);
                    }
                });
            }
        }
    });

    _view.setOnHoverListener(new OnHoverListener() {
        @Override
        public boolean onHover(View view, MotionEvent dragEvent) {
            dispatcher.onNext(Tuple.of(view, dragEvent));
            return true;
        }
    });

    disposeActions.add(new Runnable() {
        @Override
        public void run() {
            _view.setOnHoverListener(null);
        }
    });

    return this;
}
项目:iTester    文件:OTGActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_otg);
    findViewById(R.id.button_pass).setOnClickListener(this);
    findViewById(R.id.button_fail).setOnClickListener(this);
    tv_otg = (TextView)findViewById(R.id.textView_otg);
    tv_otg.setOnHoverListener(new OnHoverListener() {

        @Override
        public boolean onHover(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            int what = event.getAction();
            switch(what){
             case MotionEvent.ACTION_HOVER_ENTER:  //������view

                    break;
                case MotionEvent.ACTION_HOVER_MOVE:  //�����view��
                 if(!isPassed)
                 {
                 isPassed =true;
                 tv_otg.setText("Pass");
                 tv_otg.setTextColor(Color.GREEN);
                 findViewById(R.id.button_pass).setEnabled(true);
                 if(FunctionApplication.isAutoMode)jumpUtils.jumpTo(getResources().getString(R.string.title_activity_otg), OTGActivity.this, XmlUtils.activityClasses.get(0), true);
                 if(FunctionApplication.isAutoMode)
                 OTGActivity.this.finish();
                 }

                    break;
                case MotionEvent.ACTION_HOVER_EXIT:  //����뿪view

                    break;
            }
            return false;
        }
    });
}
项目:AndroidViewHelper    文件:ViewWrapper.java   
/**
* @see View#setOnHoverListener(OnHoverListener)
*/
 public W setOnHoverListener(OnHoverListener l) {
     mView.setOnHoverListener(l);
     return (W)this;
 }
项目:AbacusUtil    文件:Observer.java   
public Disposable onHover(final OnHoverListener onNext) {
    return onHover(onNext, Fu.ON_ERROR_MISSING);
}
项目:AbacusUtil    文件:Observer.java   
public Disposable onHover(final OnHoverListener onNext, final Consumer<? super Exception> onError) {
    return onHover(onNext, onError, Fu.EMPTY_ACTION);
}