| | |
| | | package cn.com.basic.face.widget.checkin;
|
| | |
|
| | | import android.content.Context;
|
| | | import android.graphics.Bitmap;
|
| | | import android.graphics.Canvas;
|
| | | import android.graphics.Paint;
|
| | | import android.graphics.PorterDuff;
|
| | | import android.graphics.PorterDuffXfermode;
|
| | | import android.graphics.Rect;
|
| | | import android.net.Uri;
|
| | | import android.util.AttributeSet;
|
| | | import android.view.LayoutInflater;
|
| | | import android.view.Surface;
|
| | | import android.view.SurfaceView;
|
| | | import android.view.View;
|
| | | import android.widget.ImageView;
|
| | | import android.widget.LinearLayout;
|
| | | import android.widget.TextView;
|
| | |
|
| | | import com.bsk.zhangbo.demoforbsk.R;
|
| | | import com.facebook.imagepipeline.request.ImageRequest;
|
| | | import com.facebook.imagepipeline.request.ImageRequestBuilder;
|
| | | import com.lidroid.xutils.ViewUtils;
|
| | | import com.lidroid.xutils.view.annotation.ViewInject;
|
| | |
|
| | |
| | | import cn.com.basic.face.util.AppApi;
|
| | |
|
| | | public class CheckInRightVisitorCell extends LinearLayout{
|
| | |
|
| | |
|
| | | @ViewInject(R.id.fragment_check_in_right_visitor_cell_name)
|
| | | private TextView fragment_check_in_right_visitor_cell_name;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public Bitmap getCroppedBitmap(Bitmap bitmap) {
|
| | | Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
|
| | | bitmap.getHeight(), Bitmap.Config.ARGB_8888);
|
| | | Canvas canvas = new Canvas(output);
|
| | |
|
| | | final int color = 0xff424242;
|
| | | final Paint paint = new Paint();
|
| | | final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
|
| | |
|
| | | paint.setAntiAlias(true);
|
| | | canvas.drawARGB(0, 0, 0, 0);
|
| | | paint.setColor(color);
|
| | | canvas.drawCircle(bitmap.getWidth() / 2, bitmap.getHeight() / 2,
|
| | | bitmap.getWidth() / 2, paint);
|
| | | paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
|
| | | canvas.drawBitmap(bitmap, rect, rect, paint);
|
| | | return output;
|
| | | }
|
| | |
|
| | | public void setPhoto(Bitmap photo) {
|
| | | fragment_check_in_right_visitor_cell_photo.setImageBitmap(getCroppedBitmap(photo));
|
| | | fragment_check_in_right_visitor_cell_photo_placeholder.setVisibility(INVISIBLE);
|
| | | }
|
| | |
|
| | | public CheckInQueryItem getVisitor() {
|
| | | return item;
|
| | | }
|