use of com.lzy.imagepickerdemo.imageloader.GlideImageLoader in project ImagePicker by jeasonlzy.
the class WxDemoActivity method initImagePicker.
private void initImagePicker() {
ImagePicker imagePicker = ImagePicker.getInstance();
//设置图片加载器
imagePicker.setImageLoader(new GlideImageLoader());
//显示拍照按钮
imagePicker.setShowCamera(true);
//允许裁剪(单选才有效)
imagePicker.setCrop(false);
//是否按矩形区域保存
imagePicker.setSaveRectangle(true);
//选中数量限制
imagePicker.setSelectLimit(maxImgCount);
//裁剪框的形状
imagePicker.setStyle(CropImageView.Style.RECTANGLE);
//裁剪框的宽度。单位像素(圆形自动取宽高最小值)
imagePicker.setFocusWidth(800);
//裁剪框的高度。单位像素(圆形自动取宽高最小值)
imagePicker.setFocusHeight(800);
//保存文件的宽度。单位像素
imagePicker.setOutPutX(1000);
//保存文件的高度。单位像素
imagePicker.setOutPutY(1000);
}
use of com.lzy.imagepickerdemo.imageloader.GlideImageLoader in project ImagePicker by jeasonlzy.
the class ImagePickerActivity method onClick.
@Override
public void onClick(View v) {
switch(v.getId()) {
case R.id.btn_open_gallery:
if (rb_uil.isChecked())
imagePicker.setImageLoader(new UILImageLoader());
else if (rb_glide.isChecked())
imagePicker.setImageLoader(new GlideImageLoader());
else if (rb_picasso.isChecked())
imagePicker.setImageLoader(new PicassoImageLoader());
else if (rb_fresco.isChecked())
imagePicker.setImageLoader(new GlideImageLoader());
else if (rb_xutils3.isChecked())
imagePicker.setImageLoader(new XUtils3ImageLoader());
else if (rb_xutils.isChecked())
imagePicker.setImageLoader(new GlideImageLoader());
if (rb_single_select.isChecked())
imagePicker.setMultiMode(false);
else if (rb_muti_select.isChecked())
imagePicker.setMultiMode(true);
if (rb_crop_square.isChecked()) {
imagePicker.setStyle(CropImageView.Style.RECTANGLE);
Integer width = Integer.valueOf(et_crop_width.getText().toString());
Integer height = Integer.valueOf(et_crop_height.getText().toString());
width = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, width, getResources().getDisplayMetrics());
height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, height, getResources().getDisplayMetrics());
imagePicker.setFocusWidth(width);
imagePicker.setFocusHeight(height);
} else if (rb_crop_circle.isChecked()) {
imagePicker.setStyle(CropImageView.Style.CIRCLE);
Integer radius = Integer.valueOf(et_crop_radius.getText().toString());
radius = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, radius, getResources().getDisplayMetrics());
imagePicker.setFocusWidth(radius * 2);
imagePicker.setFocusHeight(radius * 2);
}
imagePicker.setOutPutX(Integer.valueOf(et_outputx.getText().toString()));
imagePicker.setOutPutY(Integer.valueOf(et_outputy.getText().toString()));
Intent intent = new Intent(this, ImageGridActivity.class);
startActivityForResult(intent, 100);
break;
case R.id.btn_wxDemo:
startActivity(new Intent(this, WxDemoActivity.class));
break;
}
}
use of com.lzy.imagepickerdemo.imageloader.GlideImageLoader in project ImagePicker by jeasonlzy.
the class ImagePickerActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_image_picker);
imagePicker = ImagePicker.getInstance();
imagePicker.setImageLoader(new GlideImageLoader());
rb_uil = (RadioButton) findViewById(R.id.rb_uil);
rb_glide = (RadioButton) findViewById(R.id.rb_glide);
rb_picasso = (RadioButton) findViewById(R.id.rb_picasso);
rb_fresco = (RadioButton) findViewById(R.id.rb_fresco);
rb_xutils3 = (RadioButton) findViewById(R.id.rb_xutils3);
rb_xutils = (RadioButton) findViewById(R.id.rb_xutils);
rb_single_select = (RadioButton) findViewById(R.id.rb_single_select);
rb_muti_select = (RadioButton) findViewById(R.id.rb_muti_select);
rb_crop_square = (RadioButton) findViewById(R.id.rb_crop_square);
rb_crop_circle = (RadioButton) findViewById(R.id.rb_crop_circle);
rb_glide.setChecked(true);
rb_muti_select.setChecked(true);
rb_crop_square.setChecked(true);
et_crop_width = (EditText) findViewById(R.id.et_crop_width);
et_crop_width.setText("280");
et_crop_height = (EditText) findViewById(R.id.et_crop_height);
et_crop_height.setText("280");
et_crop_radius = (EditText) findViewById(R.id.et_crop_radius);
et_crop_radius.setText("140");
et_outputx = (EditText) findViewById(R.id.et_outputx);
et_outputx.setText("800");
et_outputy = (EditText) findViewById(R.id.et_outputy);
et_outputy.setText("800");
tv_select_limit = (TextView) findViewById(R.id.tv_select_limit);
SeekBar sb_select_limit = (SeekBar) findViewById(R.id.sb_select_limit);
sb_select_limit.setMax(15);
sb_select_limit.setOnSeekBarChangeListener(this);
sb_select_limit.setProgress(9);
CheckBox cb_show_camera = (CheckBox) findViewById(R.id.cb_show_camera);
cb_show_camera.setOnCheckedChangeListener(this);
cb_show_camera.setChecked(true);
CheckBox cb_crop = (CheckBox) findViewById(R.id.cb_crop);
cb_crop.setOnCheckedChangeListener(this);
cb_crop.setChecked(true);
CheckBox cb_isSaveRectangle = (CheckBox) findViewById(R.id.cb_isSaveRectangle);
cb_isSaveRectangle.setOnCheckedChangeListener(this);
cb_isSaveRectangle.setChecked(true);
Button btn_open_gallery = (Button) findViewById(R.id.btn_open_gallery);
btn_open_gallery.setOnClickListener(this);
Button btn_wxDemo = (Button) findViewById(R.id.btn_wxDemo);
btn_wxDemo.setOnClickListener(this);
gridView = (GridView) findViewById(R.id.gridview);
}
Aggregations