本文整理汇总了Java中com.taobao.weex.utils.WXViewUtils.onScreenArea方法的典型用法代码示例。如果您正苦于以下问题:Java WXViewUtils.onScreenArea方法的具体用法?Java WXViewUtils.onScreenArea怎么用?Java WXViewUtils.onScreenArea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.taobao.weex.utils.WXViewUtils
的用法示例。
在下文中一共展示了WXViewUtils.onScreenArea方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPageSelected
import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
@Override
public void onPageSelected(int pos) {
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.d("onPageSelected >>>>" + pos);
}
if (mAdapter == null || mAdapter.getRealCount() == 0) {
return;
}
int realPosition = pos % mAdapter.getRealCount();
if (mChildren == null || realPosition >= mChildren.size()) {
return;
}
if (getDomObject().getEvents().size() == 0) {
return;
}
WXEvent event = getDomObject().getEvents();
String ref = getDomObject().getRef();
if (event.contains(Constants.Event.CHANGE) && WXViewUtils.onScreenArea(getHostView())) {
params.put("index", realPosition);
Map<String, Object> domChanges = new HashMap<>();
Map<String, Object> attrsChanges = new HashMap<>();
attrsChanges.put("value", realPosition);
domChanges.put("attrs", attrsChanges);
WXSDKManager.getInstance().fireEvent(mInstanceId, ref,
Constants.Event.CHANGE, params, domChanges);
}
mViewPager.requestLayout();
getHostView().invalidate();
}
示例2: onPageSelected
import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
@Override
public void onPageSelected(int pos) {
if (mAdapter.getRealPosition(pos) == lastPos) {
return;
}
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.d("onPageSelected >>>>" + mAdapter.getRealPosition(pos) + " lastPos: " + lastPos);
}
if (mAdapter == null || mAdapter.getRealCount() == 0) {
return;
}
int realPosition = mAdapter.getRealPosition(pos);
if (mChildren == null || realPosition >= mChildren.size()) {
return;
}
if (getDomObject().getEvents().size() == 0) {
return;
}
WXEvent event = getDomObject().getEvents();
String ref = getDomObject().getRef();
if (event.contains(Constants.Event.CHANGE) && WXViewUtils.onScreenArea(getHostView())) {
params.put(INDEX, realPosition);
Map<String, Object> domChanges = new HashMap<>();
Map<String, Object> attrsChanges = new HashMap<>();
attrsChanges.put(INDEX, realPosition);
domChanges.put("attrs", attrsChanges);
WXSDKManager.getInstance().fireEvent(getInstanceId(), ref,
Constants.Event.CHANGE, params, domChanges);
}
mViewPager.requestLayout();
getHostView().invalidate();
lastPos = mAdapter.getRealPosition(pos);
}