Search in sources :

Example 1 with PicViewer

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;
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) PicViewer(cn.sharesdk.onekeyshare.PicViewer) Button(android.widget.Button) RelativeLayout(android.widget.RelativeLayout) OnClickListener(android.view.View.OnClickListener) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) HorizontalScrollView(android.widget.HorizontalScrollView) View(android.view.View) TextView(android.widget.TextView) BitmapHelper.captureView(com.mob.tools.utils.BitmapHelper.captureView) ProgressBar(android.widget.ProgressBar)

Example 2 with PicViewer

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;
}
Also used : PicViewer(cn.sharesdk.onekeyshare.PicViewer) OnClickListener(android.view.View.OnClickListener) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) HorizontalScrollView(android.widget.HorizontalScrollView) TextView(android.widget.TextView) View(android.view.View)

Aggregations

View (android.view.View)2 OnClickListener (android.view.View.OnClickListener)2 HorizontalScrollView (android.widget.HorizontalScrollView)2 ImageView (android.widget.ImageView)2 TextView (android.widget.TextView)2 PicViewer (cn.sharesdk.onekeyshare.PicViewer)2 Button (android.widget.Button)1 LayoutParams (android.widget.LinearLayout.LayoutParams)1 ProgressBar (android.widget.ProgressBar)1 RelativeLayout (android.widget.RelativeLayout)1 BitmapHelper.captureView (com.mob.tools.utils.BitmapHelper.captureView)1