Java Code Examples for com.taobao.weex.utils.WXLogUtils#w()

The following examples show how to use com.taobao.weex.utils.WXLogUtils#w() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WXSDKInstance.java    From ucar-weex-core with Apache License 2.0 6 votes vote down vote up
/********************************
 *  begin hook Activity life cycle callback
 ********************************************************/

@Override
public void onActivityCreate() {

  // module listen Activity onActivityCreate
  WXModuleManager.onActivityCreate(getInstanceId());

  if(mRootComp != null) {
    mRootComp.onActivityCreate();
  }else{
    WXLogUtils.w("Warning :Component tree has not build completely,onActivityCreate can not be call!");
  }

  mGlobalEventReceiver=new WXGlobalEventReceiver(this);
  getContext().registerReceiver(mGlobalEventReceiver,new IntentFilter(WXGlobalEventReceiver.EVENT_ACTION));
}
 
Example 2
Source File: WXSDKInstance.java    From ucar-weex-core with Apache License 2.0 6 votes vote down vote up
@Override
public void onActivityResume() {

  // notify onActivityResume callback to module
  WXModuleManager.onActivityResume(getInstanceId());

  if(mRootComp != null) {
    mRootComp.onActivityResume();
  }else{
    WXLogUtils.w("Warning :Component tree has not build completely, onActivityResume can not be call!");
  }

  if (mCurrentGround) {
    WXLogUtils.i("Application  to be in the foreground");
    Intent intent = new Intent(WXGlobalEventReceiver.EVENT_ACTION);
    intent.putExtra(WXGlobalEventReceiver.EVENT_NAME, Constants.Event.RESUME_EVENT);
    intent.putExtra(WXGlobalEventReceiver.EVENT_WX_INSTANCEID, getInstanceId());
    mContext.sendBroadcast(intent);
    mCurrentGround = false;
  }

  onViewAppear();

  setViewPortWidth(mInstanceViewPortWidth);
}
 
Example 3
Source File: WXSDKInstance.java    From weex-uikit with MIT License 6 votes vote down vote up
/********************************
 *  begin hook Activity life cycle callback
 ********************************************************/

@Override
public void onActivityCreate() {

  // module listen Activity onActivityCreate
  WXModuleManager.onActivityCreate(getInstanceId());

  if(mRootComp != null) {
    mRootComp.onActivityCreate();
  }else{
    WXLogUtils.w("Warning :Component tree has not build completely,onActivityCreate can not be call!");
  }

  mGlobalEventReceiver=new WXGlobalEventReceiver(this);
  getContext().registerReceiver(mGlobalEventReceiver,new IntentFilter(WXGlobalEventReceiver.EVENT_ACTION));
}
 
Example 4
Source File: WXImageView.java    From ucar-weex-core with Apache License 2.0 6 votes vote down vote up
@Override
public int getNaturalWidth() {
  Drawable drawable = getDrawable();
  if (drawable != null) {
    if (drawable instanceof ImageDrawable) {
      return ((ImageDrawable) drawable).getBitmapWidth();
    } else if (drawable instanceof BitmapDrawable) {
      Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
      if (bitmap != null) {
        return bitmap.getWidth();
      } else {
        WXLogUtils.w("WXImageView", "Bitmap on " + drawable.toString() + " is null");
      }
    } else {
      WXLogUtils.w("WXImageView", "Not supported drawable type: " + drawable.getClass().getSimpleName());
    }
  }
  return -1;
}
 
Example 5
Source File: WXSDKInstance.java    From weex-uikit with MIT License 5 votes vote down vote up
@Override
public void onActivityPause() {
  onViewDisappear();
  if(!isCommit){
    Set<String> componentTypes= WXComponentFactory.getComponentTypesByInstanceId(getInstanceId());
    if(componentTypes!=null && componentTypes.contains(WXBasicComponentType.SCROLLER)){
      mWXPerformance.useScroller=1;
    }
    mWXPerformance.maxDeepViewLayer=getMaxDeepLayer();
    if (mUserTrackAdapter != null) {
      mUserTrackAdapter.commit(mContext, null, IWXUserTrackAdapter.LOAD, mWXPerformance, getUserTrackParams());
    }
    isCommit=true;
  }
  // module listen Activity onActivityPause
  WXModuleManager.onActivityPause(getInstanceId());
  if(mRootComp != null) {
    mRootComp.onActivityPause();
  }else{
    WXLogUtils.w("Warning :Component tree has not build completely,onActivityPause can not be call!");
  }

  Intent intent=new Intent(WXGlobalEventReceiver.EVENT_ACTION);
  intent.putExtra(WXGlobalEventReceiver.EVENT_NAME,Constants.Event.PAUSE_EVENT);
  intent.putExtra(WXGlobalEventReceiver.EVENT_WX_INSTANCEID,getInstanceId());
  mContext.sendBroadcast(intent);
}
 
Example 6
Source File: WXModuleManager.java    From weex-uikit with MIT License 5 votes vote down vote up
public static void onActivityStop(String instanceId){
  HashMap<String, WXModule> modules = sInstanceModuleMap.get(instanceId);
  if(modules!=null) {
    for (String key : modules.keySet()) {
      WXModule module = modules.get(key);
      if (module != null) {
        module.onActivityStop();
      } else {
        WXLogUtils.w("onActivityStop can not find the " + key + " module");
      }
    }
  }
}
 
Example 7
Source File: WXSDKInstance.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
@Override
public void onActivityDestroy() {
  WXModuleManager.onActivityDestroy(getInstanceId());

  if(mRootComp != null) {
    mRootComp.onActivityDestroy();
  }else{
    WXLogUtils.w("Warning :Component tree has not build completely, onActivityDestroy can not be call!");
  }

  destroy();
}
 
Example 8
Source File: WXSDKInstance.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
@Override
public void onActivityPause() {
  onViewDisappear();
  if(!isCommit){
    Set<String> componentTypes= WXComponentFactory.getComponentTypesByInstanceId(getInstanceId());
    if(componentTypes!=null && componentTypes.contains(WXBasicComponentType.SCROLLER)){
      mWXPerformance.useScroller=1;
    }
    mWXPerformance.maxDeepViewLayer=getMaxDeepLayer();
    if (mUserTrackAdapter != null) {
      mUserTrackAdapter.commit(mContext, null, IWXUserTrackAdapter.LOAD, mWXPerformance, getUserTrackParams());
    }
    isCommit=true;
  }
  // module listen Activity onActivityPause
  WXModuleManager.onActivityPause(getInstanceId());
  if(mRootComp != null) {
    mRootComp.onActivityPause();
  }else{
    WXLogUtils.w("Warning :Component tree has not build completely,onActivityPause can not be call!");
  }

  WXLogUtils.i("Application onActivityPause()");
  if (!mCurrentGround) {
    WXLogUtils.i("Application to be in the backround");
    Intent intent = new Intent(WXGlobalEventReceiver.EVENT_ACTION);
    intent.putExtra(WXGlobalEventReceiver.EVENT_NAME, Constants.Event.PAUSE_EVENT);
    intent.putExtra(WXGlobalEventReceiver.EVENT_WX_INSTANCEID, getInstanceId());
    mContext.sendBroadcast(intent);
    this.mCurrentGround = true;
  }
}
 
Example 9
Source File: WXModalUIModule.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
@Override
public void destroy() {
  if (activeDialog != null && activeDialog.isShowing()) {
    WXLogUtils.w("Dismiss the active dialog");
    activeDialog.dismiss();
  }
}
 
Example 10
Source File: WXRecyclerDomObject.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
public void updateRecyclerAttr(){
    preCalculateCellWidth();
    if(mColumnWidth ==0 && mColumnWidth == Float.NaN){
        WXLogUtils.w("preCalculateCellWidth mColumnGap :" + mColumnGap + " mColumnWidth:" + mColumnWidth + " mColumnCount:" + mColumnCount);
        return;
    }
    int count = getChildCount();
    for(int i=0;i<count; i++){
        WXDomObject domObject = getChild(i);
        if(WXBasicComponentType.CELL.equals(domObject.getType())) {
            getChild(i).getStyles().put(Constants.Name.WIDTH, mColumnWidth);
        }
    }
}
 
Example 11
Source File: WXModuleManager.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
public static void onRequestPermissionsResult(String instanceId ,int requestCode, String[] permissions, int[] grantResults) {
  Map<String, WXModule> modules = sInstanceModuleMap.get(instanceId);
  if(modules!=null) {
    for (String key : modules.keySet()) {
      WXModule module = modules.get(key);
      if (module != null) {
        module.onRequestPermissionsResult(requestCode, permissions, grantResults);
      } else {
        WXLogUtils.w("onActivityResult can not find the " + key + " module");
      }
    }
  }
}
 
Example 12
Source File: WXSDKInstance.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {

    WXModuleManager.onRequestPermissionsResult(getInstanceId(),requestCode,permissions,grantResults);

    if(mRootComp != null) {
       mRootComp.onRequestPermissionsResult(requestCode,permissions,grantResults);
    }else{
      WXLogUtils.w("Warning :Component tree has not build completely, onRequestPermissionsResult can not be call!");
    }
  }
 
Example 13
Source File: WXModuleManager.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
public static void onActivityResult(String instanceId,int requestCode, int resultCode, Intent data){

    Map<String, WXModule> modules = sInstanceModuleMap.get(instanceId);
    if(modules!=null) {
      for (String key : modules.keySet()) {
        WXModule module = modules.get(key);
        if (module != null) {
          module.onActivityResult(requestCode, resultCode, data);
        } else {
          WXLogUtils.w("onActivityResult can not find the " + key + " module");
        }
      }
    }
  }
 
Example 14
Source File: WXModuleManager.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
public static boolean onActivityBack(String instanceId){
  Map<String, WXModule> modules = sInstanceModuleMap.get(instanceId);
  if(modules!=null) {
    for (String key : modules.keySet()) {
      WXModule module = modules.get(key);
      if (module != null) {
        return module.onActivityBack();
      } else {
        WXLogUtils.w("onActivityCreate can not find the " + key + " module");
      }
    }
  }
  return false;
}
 
Example 15
Source File: WXModuleManager.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
public static void onActivityDestroy(String instanceId){
  Map<String, WXModule> modules = sInstanceModuleMap.get(instanceId);
  if(modules!=null) {
    for (String key : modules.keySet()) {
      WXModule module = modules.get(key);
      if (module != null) {
        module.onActivityDestroy();
      } else {
        WXLogUtils.w("onActivityDestroy can not find the " + key + " module");
      }
    }
  }
}
 
Example 16
Source File: WXModuleManager.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
public static void onActivityResume(String instanceId){
  Map<String, WXModule> modules = sInstanceModuleMap.get(instanceId);
  if(modules!=null) {
    for (String key : modules.keySet()) {
      WXModule module = modules.get(key);
      if (module != null) {
        module.onActivityResume();
      } else {
        WXLogUtils.w("onActivityResume can not find the " + key + " module");
      }
    }
  }
}
 
Example 17
Source File: WXModuleManager.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
public static void onActivityPause(String instanceId){
  Map<String, WXModule> modules = sInstanceModuleMap.get(instanceId);
  if(modules!=null) {
    for (String key : modules.keySet()) {
      WXModule module = modules.get(key);
      if (module != null) {
        module.onActivityPause();
      } else {
        WXLogUtils.w("onActivityPause can not find the " + key + " module");
      }
    }
  }
}
 
Example 18
Source File: WXSDKInstance.java    From weex-uikit with MIT License 5 votes vote down vote up
public void onActivityResult(int requestCode, int resultCode, Intent data){
  WXModuleManager.onActivityResult(getInstanceId(),requestCode,resultCode,data);

  if(mRootComp != null) {
    mRootComp.onActivityResult(requestCode,requestCode,data);
  }else{
    WXLogUtils.w("Warning :Component tree has not build completely, onActivityResult can not be call!");
  }
}
 
Example 19
Source File: WXModuleManager.java    From weex-uikit with MIT License 5 votes vote down vote up
public static void onActivityDestroy(String instanceId){
  HashMap<String, WXModule> modules = sInstanceModuleMap.get(instanceId);
  if(modules!=null) {
    for (String key : modules.keySet()) {
      WXModule module = modules.get(key);
      if (module != null) {
        module.onActivityDestroy();
      } else {
        WXLogUtils.w("onActivityDestroy can not find the " + key + " module");
      }
    }
  }
}
 
Example 20
Source File: WXBridge.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
/**
 * JSF render Node by callAddElement
 */
public int callAddElement(String instanceId, String ref,String dom,String index, 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().callAddElement(instanceId, ref,dom,index, callback);
  }catch (Throwable e){
    //catch everything during call native.
    if(WXEnvironment.isApkDebugable()){
      e.printStackTrace();
      WXLogUtils.e(TAG,"callNative throw error:"+e.getMessage());
    }
  }

  if(instance != null) {
    instance.callNativeTime(System.currentTimeMillis() - start);
  }
  if(WXEnvironment.isApkDebugable()){
    if(errorCode == IWXBridge.DESTROY_INSTANCE){
      WXLogUtils.w("destroyInstance :"+instanceId+" JSF must stop callNative");
    }
  }
  return errorCode;
}