com.taobao.weex.ui.component.WXComponentProp Java Examples

The following examples show how to use com.taobao.weex.ui.component.WXComponentProp. 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: WXSvgPath.java    From Svg-for-Apache-Weex with Apache License 2.0 6 votes vote down vote up
@WXComponentProp(name = "strokelinejoin")
public void setStrokeLinejoin(int strokeLinejoin) {
  switch (strokeLinejoin) {
    case JOIN_MITER:
      mStrokeLinejoin = Paint.Join.MITER;
      break;
    case JOIN_BEVEL:
      mStrokeLinejoin = Paint.Join.BEVEL;
      break;
    case JOIN_ROUND:
      mStrokeLinejoin = Paint.Join.ROUND;
      break;
    default:
      Log.v(TAG, "strokeLinejoin " + mStrokeLinejoin + " unrecognized");
  }

}
 
Example #2
Source File: WXTabPagerComponent.java    From CrazyDaily with Apache License 2.0 6 votes vote down vote up
@WXComponentProp(name = "titledata")
public void setData(List<String> datas) {

    if (mTabPagerAdapter == null) {
        final Context context = getContext();
        if (!(context instanceof FragmentActivity)) {
            LoggerUtil.d("context不是FragmentActivity");
            return;
        }
        final FragmentActivity activity = (FragmentActivity) context;
        mTabPagerAdapter = new TabPagerAdapter(activity.getSupportFragmentManager(), datas);
        mViewPager.setAdapter(mTabPagerAdapter);
        return;
    }
    mTabPagerAdapter.reload(datas);
}
 
Example #3
Source File: WXSvgPath.java    From Svg-for-Apache-Weex with Apache License 2.0 6 votes vote down vote up
@WXComponentProp(name = "strokeLinecap")
public void setStrokeLinecap(int strokeLinecap) {
  switch (strokeLinecap) {
    case CAP_BUTT:
      mStrokeLinecap = Paint.Cap.BUTT;
      break;
    case CAP_SQUARE:
      mStrokeLinecap = Paint.Cap.SQUARE;
      break;
    case CAP_ROUND:
      mStrokeLinecap = Paint.Cap.ROUND;
      break;
    default:
      Log.v(TAG, "strokeLinecap " + mStrokeLinecap + " unrecognized");
  }

}
 
Example #4
Source File: WXSvgPath.java    From Svg-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
@WXComponentProp(name = "fillRule")
public void setFillRule(int fillRule) {
  switch (fillRule) {
    case FILL_RULE_EVENODD:
      mFillRule = Path.FillType.EVEN_ODD;
      break;
    case FILL_RULE_NONZERO:
      break;
    default:
      Log.v(TAG, "fillRule " + mFillRule + " unrecognized");
  }

  mFillRuleSet = true;
  setupPath();
}
 
Example #5
Source File: WXWebComponent.java    From CrazyDaily with Apache License 2.0 5 votes vote down vote up
@WXComponentProp(name = Constants.Name.SRC)
public void setUrl(String url) {
    if (TextUtils.isEmpty(url) || getHostView() == null) {
        return;
    }
    if (!TextUtils.isEmpty(url)) {
        loadUrl(getInstance().rewriteUri(Uri.parse(url), URIAdapter.WEB).toString());
    }
}
 
Example #6
Source File: WXListComponent.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
@WXComponentProp(name = Constants.Name.COLUMN_WIDTH)
public void setColumnWidth(int columnCount)  {
  if(mDomObject.getColumnWidth() != mColumnWidth){
    markComponentUsable();
    updateRecyclerAttr();
    WXRecyclerView wxRecyclerView = getHostView().getInnerView();
    wxRecyclerView.initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
  }
}
 
Example #7
Source File: WXListComponent.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
@WXComponentProp(name = Constants.Name.COLUMN_COUNT)
public void setColumnCount(int columnCount){
  if(mDomObject.getColumnCount() != mColumnCount){
    markComponentUsable();
    updateRecyclerAttr();
    WXRecyclerView wxRecyclerView = getHostView().getInnerView();
    wxRecyclerView.initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
  }
}
 
Example #8
Source File: WXListComponent.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
@WXComponentProp(name = Constants.Name.COLUMN_GAP)
public void setColumnGap(float columnGap) throws InterruptedException {
  if(mDomObject.getColumnGap() != mColumnGap) {
    markComponentUsable();
    updateRecyclerAttr();
    WXRecyclerView wxRecyclerView = getHostView().getInnerView();
    wxRecyclerView.initView(getContext(), mLayoutType, mColumnCount, mColumnGap, getOrientation());
  }
}
 
Example #9
Source File: BasicListComponent.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
@WXComponentProp(name = Constants.Name.SCROLLABLE)
public void setScrollable(boolean scrollable) {
  this.isScrollable = scrollable;
  WXRecyclerView inner = getHostView().getInnerView();
  if(inner != null) {
    inner.setScrollable(scrollable);
  }
}
 
Example #10
Source File: BasicListComponent.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
@WXComponentProp(name = Constants.Name.DRAGGABLE)
public void setDraggable(boolean isDraggable) {
  if (mDragHelper != null) {
    mDragHelper.setDraggable(isDraggable);
  }
  if (WXEnvironment.isApkDebugable()) {
    WXLogUtils.d("set draggable : " + isDraggable);
  }
}
 
Example #11
Source File: BasicListComponent.java    From weex-uikit with MIT License 5 votes vote down vote up
@WXComponentProp(name = Constants.Name.SCROLLABLE)
public void setScrollable(boolean scrollable) {
  View inner = getHostView().getInnerView();
  if (inner instanceof WXRecyclerView) {
    ((WXRecyclerView) inner).setScrollable(scrollable);
  }
  ;
}
 
Example #12
Source File: WXSvgContainer.java    From Svg-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
@WXComponentProp(name = "viewBox")
public void setViewBox(String viewBox) {
  String box = viewBox;
  Log.v("WXSvgContainer", "box is " + box);
  if (!TextUtils.isEmpty(box)) {
    String[] p = box.split(" ");
    if (p != null && p.length == 4) {
      mViewBoxX = Integer.valueOf(p[0]);
      mViewBoxY = Integer.valueOf(p[1]);
      mviewBoxWidth = Integer.valueOf(p[2]);
      mviewBoxHeight = Integer.valueOf(p[3]);
    }
  }
}
 
Example #13
Source File: ComponentHolder.java    From weex with Apache License 2.0 5 votes vote down vote up
private synchronized void generate(){
  WXLogUtils.d(TAG,"Generate Component:"+mClz.getSimpleName());
  HashMap<String, Invoker> methods = new HashMap<>();

  Annotation[] annotations;
  Annotation anno;
  for (Method method : mClz.getMethods()) {
    annotations = method.getDeclaredAnnotations();
    for (int i = 0,annotationsCount = annotations.length;
         i < annotationsCount; ++i) {
      anno = annotations[i];
      if (anno != null && anno instanceof WXComponentProp) {
        String name = ((WXComponentProp) anno).name();
        methods.put(name, new MethodInvoker(method));
        break;
      }
    }
  }

  mMethods = methods;
  try {
    mConstructor = mClz.getConstructor(WXSDKInstance.class, WXDomObject.class, WXVContainer.class, boolean.class);
  } catch (NoSuchMethodException e) {
    try {
      //compatible deprecated constructor
      mConstructor = mClz.getConstructor(WXSDKInstance.class, WXDomObject.class, WXVContainer.class,String.class, boolean.class);
    } catch (NoSuchMethodException e1) {
      e1.printStackTrace();
      throw new WXRuntimeException("Can't find constructor of component.");
    }
    e.printStackTrace();
  }
}
 
Example #14
Source File: WXSvgAbsComponent.java    From Svg-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
@WXComponentProp(name = "clipRule")
public void setClipRule(int clipRule) {
  mClipRule = clipRule;
  mClipRuleSet = true;
  setupClip();

}
 
Example #15
Source File: WXSvgPath.java    From Svg-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
@WXComponentProp(name = "stroke")
public void setStroke(String stroke) {
  if (!TextUtils.isEmpty(stroke)) {
    mStrokeColor = stroke;
  }
}
 
Example #16
Source File: RichText.java    From weex with Apache License 2.0 4 votes vote down vote up
@WXComponentProp(name = "tel")
public void setTelLink(String tel){
  SpannableString spannable=new SpannableString(tel);
  spannable.setSpan(new URLSpan("tel:"+tel),0,tel.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
  ((TextView)mHost).setText(spannable);
}
 
Example #17
Source File: RichText.java    From WeexOne with MIT License 4 votes vote down vote up
@WXComponentProp(name = "tel")
public void setTelLink(String tel){
  SpannableString spannable=new SpannableString(tel);
  spannable.setSpan(new URLSpan("tel:"+tel),0,tel.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
  ((TextView)mHost).setText(spannable);
}
 
Example #18
Source File: WXWebComponent.java    From CrazyDaily with Apache License 2.0 4 votes vote down vote up
@WXComponentProp(name = Constants.Name.SHOW_LOADING)
public void setShowLoading(boolean showLoading) {
    getWebView().setShowLoading(showLoading);
}
 
Example #19
Source File: BasicListComponent.java    From ucar-weex-core with Apache License 2.0 4 votes vote down vote up
@WXComponentProp(name = Constants.Name.OFFSET_ACCURACY)
public void setOffsetAccuracy(int accuracy) {
  float real = WXViewUtils.getRealPxByWidth(accuracy, getInstance().getInstanceViewPortWidth());
  this.mOffsetAccuracy = (int) real;
}
 
Example #20
Source File: WXListComponent.java    From ucar-weex-core with Apache License 2.0 4 votes vote down vote up
@WXComponentProp(name = Constants.Name.SCROLLABLE)
public void setScrollable(boolean scrollable) {
  WXRecyclerView inner = getHostView().getInnerView();
  inner.setScrollable(scrollable);
}
 
Example #21
Source File: WXWebComponent.java    From CrazyDaily with Apache License 2.0 4 votes vote down vote up
@WXComponentProp(name = Constants.Name.SOURCE)
public void setSource(String source) {
    if (!TextUtils.isEmpty(source) && getHostView() != null) {
        loadDataWithBaseURL(source);
    }
}
 
Example #22
Source File: RichText.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
@WXComponentProp(name = "tel")
public void setTelLink(String tel){
  SpannableString spannable=new SpannableString(tel);
  spannable.setSpan(new URLSpan("tel:"+tel),0,tel.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
  ((TextView) getHostView()).setText(spannable);
}
 
Example #23
Source File: WXSvgRadialGradient.java    From Svg-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
@WXComponentProp(name = "cx")
public void setCx(String cx) {
  mCx = cx;
}
 
Example #24
Source File: WXSvgRadialGradient.java    From Svg-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
@WXComponentProp(name = "id")
public void setName(String id) {
  mName = id;
}
 
Example #25
Source File: WXSvgPath.java    From Svg-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
@WXComponentProp(name = "fill")
public void setFill(String fill) {
  if (!TextUtils.isEmpty(fill) && !fill.equals("none")) {
    mFillColor = fill;
  }
}
 
Example #26
Source File: WXSvgRadialGradient.java    From Svg-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
@WXComponentProp(name = "r")
public void setR(String r) {
  mRy = r;
  mRx = r;
}
 
Example #27
Source File: WXSvgPath.java    From Svg-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
@WXComponentProp(name = "strokeOpacity")
public void setStrokeOpacity(float strokeOpacity) {
  mStrokeOpacity = strokeOpacity;

}
 
Example #28
Source File: WXSvgPath.java    From Svg-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
@WXComponentProp(name = "strokeDashoffset")
public void setStrokeDashoffset(float strokeWidth) {
  mStrokeDashoffset = strokeWidth * mScale;

}
 
Example #29
Source File: WXSvgPath.java    From Svg-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
@WXComponentProp(name = "strokeMiterlimit")
public void setStrokeMiterlimit(float strokeMiterlimit) {
  mStrokeMiterlimit = strokeMiterlimit;

}
 
Example #30
Source File: WXSvgPath.java    From Svg-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
@WXComponentProp(name = "strokeWidth")
public void setStrokeWidth(float strokeWidth) {
  mStrokeWidth = strokeWidth;
}