|
|
@@ -1,14 +1,5 @@
|
|
|
package kr.co.zumo.app.lifeplus.view.fragment.bucketlist;
|
|
|
|
|
|
-import android.graphics.Bitmap;
|
|
|
-import android.graphics.BitmapFactory;
|
|
|
-import android.graphics.BitmapShader;
|
|
|
-import android.graphics.Canvas;
|
|
|
-import android.graphics.Color;
|
|
|
-import android.graphics.Paint;
|
|
|
-import android.graphics.Shader;
|
|
|
-import android.graphics.drawable.BitmapDrawable;
|
|
|
-import android.graphics.drawable.Drawable;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
import android.view.View;
|
|
|
import android.widget.ImageView;
|
|
|
@@ -16,7 +7,6 @@ import android.widget.TextView;
|
|
|
|
|
|
import kr.co.zumo.app.R;
|
|
|
import kr.co.zumo.app.lifeplus.bean.TextImageBean;
|
|
|
-import kr.co.zumo.app.lifeplus.util.ResourceUtil;
|
|
|
|
|
|
/**
|
|
|
* AddMyBucketListViewHolder
|
|
|
@@ -52,32 +42,30 @@ public class AddMyBucketListViewHolder extends RecyclerView.ViewHolder {
|
|
|
}
|
|
|
|
|
|
private void onClickImage(TextImageBean bean) {
|
|
|
- Bitmap bitmap = BitmapFactory.decodeResource(itemView.getResources(), bean.getImageResource());
|
|
|
- Drawable circleFrame = new BitmapDrawable(itemView.getResources(), getCircleBitmap(bitmap, ResourceUtil.dpToPx(2)));
|
|
|
- //textViewMyBucketExample.setText(bean.getTextResource());
|
|
|
- imageViewSelectImage.setBackground(circleFrame);
|
|
|
+ bean.setClicked(!bean.isClicked());
|
|
|
+ imageViewSelectImage.setBackground(bean.isClicked() == true ? itemView.getResources().getDrawable(R.drawable.image_circle_border) : itemView.getResources().getDrawable(R.drawable.radio_uncheck));
|
|
|
}
|
|
|
|
|
|
- public static Bitmap getCircleBitmap(Bitmap bitmap , int borderWidth) {
|
|
|
- if (bitmap == null || bitmap.isRecycled()) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- final int width = bitmap.getWidth() + borderWidth;
|
|
|
- final int height = bitmap.getHeight() + borderWidth;
|
|
|
- Bitmap canvasBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
|
|
- BitmapShader shader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP.CLAMP);
|
|
|
- Paint paint = new Paint();
|
|
|
- paint.setAntiAlias(true);
|
|
|
- paint.setShader(shader);
|
|
|
-
|
|
|
- Canvas canvas = new Canvas(canvasBitmap);
|
|
|
- float radius = width > height ? ((float) height) / 2f : ((float) width) / 2f;
|
|
|
- canvas.drawCircle(width / 2, height / 2, radius, paint);
|
|
|
- paint.setShader(null);
|
|
|
- paint.setStyle(Paint.Style.STROKE);
|
|
|
- paint.setColor(Color.WHITE);
|
|
|
- paint.setStrokeWidth(borderWidth);
|
|
|
- canvas.drawCircle(width / 2, height / 2, radius - borderWidth / 2, paint);
|
|
|
- return canvasBitmap;
|
|
|
- }
|
|
|
+// public static Bitmap getCircleBitmap(Bitmap bitmap , int borderWidth) {
|
|
|
+// if (bitmap == null || bitmap.isRecycled()) {
|
|
|
+// return null;
|
|
|
+// }
|
|
|
+// final int width = bitmap.getWidth() + borderWidth;
|
|
|
+// final int height = bitmap.getHeight() + borderWidth;
|
|
|
+// Bitmap canvasBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
|
|
+// BitmapShader shader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP.CLAMP);
|
|
|
+// Paint paint = new Paint();
|
|
|
+// paint.setAntiAlias(true);
|
|
|
+// paint.setShader(shader);
|
|
|
+//
|
|
|
+// Canvas canvas = new Canvas(canvasBitmap);
|
|
|
+// float radius = width > height ? ((float) height) / 2f : ((float) width) / 2f;
|
|
|
+// canvas.drawCircle(width / 2, height / 2, radius, paint);
|
|
|
+// paint.setShader(null);
|
|
|
+// paint.setStyle(Paint.Style.STROKE);
|
|
|
+// paint.setColor(Color.WHITE);
|
|
|
+// paint.setStrokeWidth(borderWidth);
|
|
|
+// canvas.drawCircle(width / 2, height / 2, radius - borderWidth / 2, paint);
|
|
|
+// return canvasBitmap;
|
|
|
+// }
|
|
|
}
|