本文整理汇总了Java中com.facebook.react.uimanager.RootViewUtil类的典型用法代码示例。如果您正苦于以下问题:Java RootViewUtil类的具体用法?Java RootViewUtil怎么用?Java RootViewUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RootViewUtil类属于com.facebook.react.uimanager包,在下文中一共展示了RootViewUtil类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onInterceptTouchEvent
import com.facebook.react.uimanager.RootViewUtil; //导入依赖的package包/类
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
int action = MotionEventCompat.getActionMasked(event);
switch(action) {
case (MotionEvent.ACTION_DOWN):
initialX = event.getRawX();
return false;
case (MotionEvent.ACTION_MOVE) :
float deltaX = event.getRawX() - initialX;
boolean nowSwiping = Math.abs(deltaX) > MIN_DISABLE_SCROLL;
if (!swiping && nowSwiping && listener != null) {
listener.onSwipeStart();
}
swiping = swiping || nowSwiping;
if(swiping) {
RootViewUtil.getRootView(this).onChildStartedNativeGesture(event);
}
return swiping;
case (MotionEvent.ACTION_UP) :
case (MotionEvent.ACTION_CANCEL) :
case (MotionEvent.ACTION_OUTSIDE) :
default:
return false;
}
}
示例2: notifyNativeGestureStarted
import com.facebook.react.uimanager.RootViewUtil; //导入依赖的package包/类
/**
* Helper method that should be called when a native view starts a native gesture (e.g. a native
* ScrollView takes control of a gesture stream and starts scrolling). This will handle
* dispatching the appropriate events to JS to make sure the gesture in JS is canceled.
*
* @param view the View starting the native gesture
* @param event the MotionEvent that caused the gesture to be started
*/
public static void notifyNativeGestureStarted(View view, MotionEvent event) {
RootViewUtil.getRootView(view).onChildStartedNativeGesture(event);
}