Ejemplo n.º 1
0
 @Override
 public void setData(Object obj) {
   if (obj == null) return;
   mData = obj;
   mYJNView.setData(obj);
   String url;
   if (obj instanceof JSON) {
     url = ((JSON) obj).getString(mDataKey);
   } else {
     url = obj.toString();
   }
   NetworkPhotoTask task = NetworkPhotoTask.build();
   task.url = url;
   task.height = mHeight;
   task.width = mWidth;
   task.isSetRounded = mRounded;
   task.roundedCornersSize = (int) mCorners;
   task.startDrawId = mDefaultBitmap;
   setImageParams(task);
 }
Ejemplo n.º 2
0
  public YNImageView(Context context, AttributeSet attrs) {
    super(context, attrs);
    TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.YNView);
    mWidth = (int) array.getDimension(R.styleable.YNView_image_width, -1);
    mHeight = (int) array.getDimension(R.styleable.YNView_image_height, -1);
    int widthSize = array.getInt(R.styleable.YNView_image_width_size, 0);
    if (widthSize != 0) {
      mWidth = SystemUtil.getPhoneScreenWH(context)[0] / widthSize;
    }
    mYJNView = new YJNView(this, context, attrs);
    mDataKey = mYJNView.getDataKey();

    TypedArray array1 = context.obtainStyledAttributes(attrs, R.styleable.YNImageView);
    mRounded = array1.getBoolean(R.styleable.YNImageView_rounded, false);
    mCorners = array1.getDimension(R.styleable.YNImageView_corners, -1);
    mDefaultBitmap = array1.getResourceId(R.styleable.YNImageView_default_bitmap, -1);
    array1.recycle();
    if (mDefaultBitmap != -1) {
      setImageResource(mDefaultBitmap);
    }
  }
Ejemplo n.º 3
0
 @Override
 public int getOnClick() {
   return mYJNView.getOnClick();
 }
Ejemplo n.º 4
0
 @Override
 public void setOnBackListener(OnBackListener l) {
   mYJNView.setOnBackListener(l, mPosition);
 }