use of cn.sharesdk.onekeyshare.PicViewer in project nmid-headline by miao1007.
the class EditPage method getThumbView.
// shared image container
private RelativeLayout getThumbView() {
rlThumb = new RelativeLayout(getContext());
rlThumb.setId(1);
int dp_82 = dipToPx(getContext(), 82);
int dp_98 = dipToPx(getContext(), 98);
LayoutParams lpThumb = new LayoutParams(dp_82, dp_98);
rlThumb.setLayoutParams(lpThumb);
ivImage = new ImageView(getContext());
int resId = getBitmapRes(activity, "btn_back_nor");
if (resId > 0) {
ivImage.setBackgroundResource(resId);
}
ivImage.setScaleType(ScaleType.CENTER_INSIDE);
ivImage.setImageBitmap(image);
int dp_4 = dipToPx(getContext(), 4);
ivImage.setPadding(dp_4, dp_4, dp_4, dp_4);
int dp_74 = dipToPx(getContext(), 74);
RelativeLayout.LayoutParams lpImage = new RelativeLayout.LayoutParams(dp_74, dp_74);
int dp_16 = dipToPx(getContext(), 16);
int dp_8 = dipToPx(getContext(), 8);
lpImage.setMargins(0, dp_16, dp_8, 0);
ivImage.setLayoutParams(lpImage);
ivImage.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
if (image != null && !image.isRecycled()) {
PicViewer pv = new PicViewer();
pv.setImageBitmap(image);
pv.show(activity, null);
}
}
});
rlThumb.addView(ivImage);
int dp_24 = dipToPx(getContext(), 24);
progressBar = new ProgressBar(getContext());
progressBar.setPadding(dp_24, dp_24, dp_24, dp_24);
RelativeLayout.LayoutParams pb = new RelativeLayout.LayoutParams(dp_74, dp_74);
pb.setMargins(0, dp_16, dp_8, 0);
progressBar.setLayoutParams(pb);
rlThumb.addView(progressBar);
Button btn = new Button(getContext());
btn.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// remove the photo to share
rlThumb.setVisibility(View.GONE);
ivPin.setVisibility(View.GONE);
removeImage(imgInfo);
}
});
resId = getBitmapRes(activity, "img_cancel");
if (resId > 0) {
btn.setBackgroundResource(resId);
}
int dp_20 = dipToPx(getContext(), 20);
RelativeLayout.LayoutParams lpBtn = new RelativeLayout.LayoutParams(dp_20, dp_20);
lpBtn.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
lpBtn.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
btn.setLayoutParams(lpBtn);
rlThumb.addView(btn);
if (!haveImage()) {
rlThumb.setVisibility(View.GONE);
}
return rlThumb;
}
use of cn.sharesdk.onekeyshare.PicViewer in project nmid-headline by miao1007.
the class EditPage method makeImageItemView.
private View makeImageItemView(final ImageInfo imageInfo) {
final View view = LayoutInflater.from(activity).inflate(getLayoutRes(activity, "skyblue_editpage_inc_image_layout"), null);
ImageView imageView = (ImageView) view.findViewById(getIdRes(activity, "imageView"));
imageView.setImageBitmap(imageInfo.bitmap);
imageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
PicViewer pv = new PicViewer();
pv.setImageBitmap(imageInfo.bitmap);
pv.show(activity, null);
}
});
View removeBtn = view.findViewById(getIdRes(activity, "imageRemoveBtn"));
removeBtn.setTag(imageInfo);
removeBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
view.setVisibility(View.GONE);
removeImage((ImageInfo) v.getTag());
}
});
return view;
}
Aggregations