本文整理汇总了Java中com.taobao.weex.utils.WXLogUtils类的典型用法代码示例。如果您正苦于以下问题:Java WXLogUtils类的具体用法?Java WXLogUtils怎么用?Java WXLogUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WXLogUtils类属于com.taobao.weex.utils包,在下文中一共展示了WXLogUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onOpen
import com.taobao.weex.utils.WXLogUtils; //导入依赖的package包/类
@Override
public void onOpen(WebSocket webSocket, Request arg1, Response arg2)
throws IOException {
mWebSocket = webSocket;
setEnvironment(WXEnvironment.getConfig());
WXSDKManager.getInstance().postOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(WXEnvironment.sApplication, "Has switched to DEBUG mode, you can see the DEBUG information on the browser!", Toast.LENGTH_SHORT).show();
}
},0);
for (JSDebuggerCallback callback : mCallbacks.values()) {
callback.onSuccess(arg2);
}
WXLogUtils.e("into--[onOpen]");
}
示例2: destroyView
import com.taobao.weex.utils.WXLogUtils; //导入依赖的package包/类
private void destroyView(View rootView) {
try {
if (rootView instanceof ViewGroup) {
ViewGroup cViewGroup = ((ViewGroup) rootView);
for (int index = 0; index < cViewGroup.getChildCount(); index++) {
destroyView(cViewGroup.getChildAt(index));
}
cViewGroup.removeViews(0, ((ViewGroup) rootView).getChildCount());
// Ensure that the viewgroup's status to be normal
WXReflectionUtils.setValue(rootView, "mChildrenCount", 0);
}
if(rootView instanceof Destroyable){
((Destroyable)rootView).destroy();
}
} catch (Exception e) {
WXLogUtils.e("WXSDKInstance destroyView Exception: ", e);
}
}
示例3: loadConstructor
import com.taobao.weex.utils.WXLogUtils; //导入依赖的package包/类
private void loadConstructor(){
Class<? extends WXComponent> c = mCompClz;
Constructor<? extends WXComponent> constructor;
try {
constructor = c.getConstructor(WXSDKInstance.class, WXDomObject.class, WXVContainer.class);
} catch (NoSuchMethodException e) {
WXLogUtils.d("ClazzComponentCreator","Use deprecated component constructor");
try {
//compatible deprecated constructor with 4 args
constructor = c.getConstructor(WXSDKInstance.class, WXDomObject.class, WXVContainer.class, boolean.class);
} catch (NoSuchMethodException e1) {
try {
//compatible deprecated constructor with 5 args
constructor = c.getConstructor(WXSDKInstance.class, WXDomObject.class, WXVContainer.class,String.class, boolean.class);
} catch (NoSuchMethodException e2) {
throw new WXRuntimeException("Can't find constructor of component.");
}
}
}
mConstructor = constructor;
}
示例4: performRemoveItem
import com.taobao.weex.utils.WXLogUtils; //导入依赖的package包/类
private boolean performRemoveItem(String key) {
SQLiteDatabase database = mDatabaseSupplier.getDatabase();
if (database == null) {
return false;
}
int count = 0;
try {
count = database.delete(WXSQLiteOpenHelper.TABLE_STORAGE,
WXSQLiteOpenHelper.COLUMN_KEY + "=?",
new String[]{key});
} catch (Exception e) {
WXLogUtils.e(WXSQLiteOpenHelper.TAG_STORAGE, "DefaultWXStorage occurred an exception when execute removeItem:" + e.getMessage());
return false;
}
return count == 1;
}
示例5: createAnimationBean
import com.taobao.weex.utils.WXLogUtils; //导入依赖的package包/类
private WXAnimationBean createAnimationBean(String ref, String animation){
try {
WXAnimationBean animationBean =
JSONObject.parseObject(animation, WXAnimationBean.class);
if (animationBean != null && animationBean.styles != null) {
WXDomObject domObject=mRegistry.get(ref);
int width=(int)domObject.getLayoutWidth();
int height=(int)domObject.getLayoutHeight();
animationBean.styles.init(animationBean.styles.transformOrigin,
animationBean.styles.transform,width,height,WXSDKManager.getInstance().getSDKInstance(mInstanceId).getViewPortWidth());
}
return animationBean;
} catch (RuntimeException e) {
WXLogUtils.e("", e);
return null;
}
}
示例6: registerDomObject
import com.taobao.weex.utils.WXLogUtils; //导入依赖的package包/类
public static boolean registerDomObject(String type, Class<? extends WXDomObject> clazz) throws WXException {
if (clazz == null || TextUtils.isEmpty(type)) {
return false;
}
if (sDom.containsKey(type)) {
if (WXEnvironment.isApkDebugable()) {
throw new WXException("WXDomRegistry had duplicate Dom:" + type);
} else {
WXLogUtils.e("WXDomRegistry had duplicate Dom: " + type);
return false;
}
}
sDom.put(type, clazz);
return true;
}
示例7: onBindViewHolder
import com.taobao.weex.utils.WXLogUtils; //导入依赖的package包/类
/**
* Bind the component of the position to the holder. Then flush the view.
*
* @param holder viewHolder, which holds reference to the view
* @param position position of component in WXListComponent
*/
@Override
public void onBindViewHolder(ListBaseViewHolder holder, int position) {
if (holder == null) return;
holder.setComponentUsing(true);
WXComponent component = getChild(position);
if (component == null
|| (component instanceof WXRefresh)
|| (component instanceof WXLoading)
|| (component.getDomObject() != null && component.getDomObject().isFixed())
) {
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.d(TAG, "Bind WXRefresh & WXLoading " + holder);
}
return;
}
if (holder.getComponent() != null && holder.getComponent() instanceof WXCell) {
holder.getComponent().bindData(component);
// holder.getComponent().refreshData(component);
}
}
示例8: measure
import com.taobao.weex.utils.WXLogUtils; //导入依赖的package包/类
@Override
public void measure(CSSNode node, float width, MeasureOutput measureOutput) {
try {
Context context=((WXDomObject) node).getDomContext().getUIContext();
WXSwitchView wxSwitchView = new WXSwitchView(context);
int widthSpec, heightSpec;
heightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
if (Float.isNaN(width)) {
widthSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
} else {
widthSpec = MeasureSpec.makeMeasureSpec((int) width, MeasureSpec.AT_MOST);
}
wxSwitchView.measure(widthSpec, heightSpec);
measureOutput.width = wxSwitchView.getMeasuredWidth();
measureOutput.height = wxSwitchView.getMeasuredHeight();
} catch (RuntimeException e) {
WXLogUtils.e(TAG, WXLogUtils.getStackTrace(e));
}
}
示例9: instantiateItem
import com.taobao.weex.utils.WXLogUtils; //导入依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {
View pageView = null;
try {
pageView = shadow.get(position);
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.d("onPageSelected >>>> instantiateItem >>>>> position:" + position + ",position % getRealCount()" + position % getRealCount());
}
if (pageView.getParent() == null) {
container.addView(pageView);
} else {
((ViewGroup) pageView.getParent()).removeView(pageView);
container.addView(pageView);
}
} catch (Exception e) {
WXLogUtils.e("[CirclePageAdapter] instantiateItem: ", e);
}
return pageView;
}
示例10: reportJSException
import com.taobao.weex.utils.WXLogUtils; //导入依赖的package包/类
/**
* Report JavaScript Exception
*/
public void reportJSException(String instanceId, String function,
String exception) {
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e("reportJSException >>>> instanceId:" + instanceId
+ ", exception function:" + function + ", exception:"
+ exception);
}
WXSDKInstance instance;
if (instanceId != null && (instance = WXSDKManager.getInstance().getSDKInstance(instanceId)) != null) {
// TODO add errCode
instance.onJSException(null, function, exception);
String err="function:"+function+"#exception:"+exception;
commitJSBridgeAlarmMonitor(instanceId,WXErrorCode.WX_ERR_JS_EXECUTE,err);
}
}
示例11: commitJSBridgeAlarmMonitor
import com.taobao.weex.utils.WXLogUtils; //导入依赖的package包/类
public void commitJSBridgeAlarmMonitor(String instanceId, WXErrorCode errCode, String errMsg) {
WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(instanceId);
if (instance == null || errCode == null) {
return;
}
// TODO: We should move WXPerformance and IWXUserTrackAdapter
// into a adapter level.
// comment out the line below to prevent commiting twice.
//instance.commitUTStab(WXConst.JS_BRIDGE, errCode, errMsg);
IWXUserTrackAdapter adapter = WXSDKManager.getInstance().getIWXUserTrackAdapter();
if (adapter == null) {
return;
}
WXPerformance performance = new WXPerformance();
performance.args=instance.getBundleUrl();
performance.errCode=errCode.getErrorCode();
if (errCode != WXErrorCode.WX_SUCCESS) {
performance.appendErrMsg(TextUtils.isEmpty(errMsg)?errCode.getErrorMsg():errMsg);
WXLogUtils.e("wx_monitor",performance.toString());
}
adapter.commit(WXEnvironment.getApplication(), null, IWXUserTrackAdapter.JS_BRIDGE, performance, instance.getUserTrackParams());
}
示例12: sendRequest
import com.taobao.weex.utils.WXLogUtils; //导入依赖的package包/类
private void sendRequest(Options options,ResponseCallback callback,JSCallback progressCallback){
WXRequest wxRequest = new WXRequest();
wxRequest.method = options.getMethod();
wxRequest.url = mWXSDKInstance.rewriteUri(Uri.parse(options.getUrl()), URIAdapter.REQUEST).toString();
wxRequest.body = options.getBody();
wxRequest.timeoutMs = options.getTimeout();
if(options.getHeaders()!=null)
if (wxRequest.paramMap == null) {
wxRequest.paramMap = options.getHeaders();
}else{
wxRequest.paramMap.putAll(options.getHeaders());
}
IWXHttpAdapter adapter = ( mAdapter==null && mWXSDKInstance != null) ? mWXSDKInstance.getWXHttpAdapter() : mAdapter;
if (adapter != null) {
adapter.sendRequest(wxRequest, new StreamHttpListener(callback,progressCallback));
}else{
WXLogUtils.e("WXStreamModule","No HttpAdapter found,request failed.");
}
}
示例13: performGetAllKeys
import com.taobao.weex.utils.WXLogUtils; //导入依赖的package包/类
private List<String> performGetAllKeys() {
SQLiteDatabase database = mDatabaseSupplier.getDatabase();
if (database == null) {
return null;
}
List<String> result = new ArrayList<>();
Cursor c = database.query(WXSQLiteOpenHelper.TABLE_STORAGE, new String[]{WXSQLiteOpenHelper.COLUMN_KEY}, null, null, null, null, null);
try {
while (c.moveToNext()) {
result.add(c.getString(c.getColumnIndex(WXSQLiteOpenHelper.COLUMN_KEY)));
}
return result;
} catch (Exception e) {
WXLogUtils.e(WXSQLiteOpenHelper.TAG_STORAGE, "DefaultWXStorage occurred an exception when execute getAllKeys:" + e.getMessage());
return result;
} finally {
c.close();
}
}
示例14: callAddEvent
import com.taobao.weex.utils.WXLogUtils; //导入依赖的package包/类
/**
* JavaScript uses this methods to call Android code
* @param instanceId
* @param ref
* @param event
* @param callback
* @return int
*/
public int callAddEvent(String instanceId, String ref, String event, String callback) {
long start = System.currentTimeMillis();
WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(instanceId);
if(instance != null) {
instance.firstScreenCreateInstanceTime(start);
}
int errorCode = IWXBridge.INSTANCE_RENDERING;
try {
errorCode = WXBridgeManager.getInstance().callAddEvent(instanceId, ref, event, callback);
} catch (Throwable e) {
//catch everything during call native.
if(WXEnvironment.isApkDebugable()){
WXLogUtils.e(TAG,"callAddEvent throw exception:" + e.getMessage());
}
}
if(instance != null) {
instance.callNativeTime(System.currentTimeMillis() - start);
}
return errorCode;
}
示例15: createBodyOnDomThread
import com.taobao.weex.utils.WXLogUtils; //导入依赖的package包/类
WXComponent createBodyOnDomThread(WXDomObject dom) {
if (mWXSDKInstance == null) {
return null;
}
WXDomObject domObject = new WXDomObject();
WXDomObject.prepareGod(domObject);
mGodComponent = (WXVContainer) WXComponentFactory.newInstance(mWXSDKInstance, domObject, null);
mGodComponent.createView(null, -1);
if (mGodComponent == null) {
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e("rootView failed!");
}
//TODO error callback
return null;
}
FrameLayout frameLayout = (FrameLayout) mGodComponent.getHostView();
ViewGroup.LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
frameLayout.setLayoutParams(layoutParams);
frameLayout.setBackgroundColor(Color.TRANSPARENT);
WXComponent component = generateComponentTree(dom, mGodComponent);
mGodComponent.addChild(component);
mRegistry.put(component.getRef(), component);
return component;
}