當前位置: 首頁>>代碼示例>>Java>>正文


Java PhotoView.setOnPhotoTapListener方法代碼示例

本文整理匯總了Java中uk.co.senab.photoview.PhotoView.setOnPhotoTapListener方法的典型用法代碼示例。如果您正苦於以下問題:Java PhotoView.setOnPhotoTapListener方法的具體用法?Java PhotoView.setOnPhotoTapListener怎麽用?Java PhotoView.setOnPhotoTapListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在uk.co.senab.photoview.PhotoView的用法示例。


在下文中一共展示了PhotoView.setOnPhotoTapListener方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: instantiateItem

import uk.co.senab.photoview.PhotoView; //導入方法依賴的package包/類
@Override
public Object instantiateItem(ViewGroup container, final int position) {
    PhotoView photoView = new PhotoView(container.getContext());
    ImageDetail imageDetail = mImageDetails.get(position);
    ImageLoader.loadImage(container.getContext(),imageDetail.img,photoView);
    photoView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
        @Override
        public void onPhotoTap(View view, float x, float y) {
            if(mListener!=null) {
                mListener.onClick();
            }
        }
    });
    container.addView(photoView);
    return photoView;
}
 
開發者ID:Jay-Ping,項目名稱:newIPlay,代碼行數:17,代碼來源:ImageDetailAdapter.java

示例2: instantiateItem

import uk.co.senab.photoview.PhotoView; //導入方法依賴的package包/類
@Override
public Object instantiateItem(ViewGroup container, int position) {

    PhotoView photoView = new PhotoView(NewsPhotoDetailActivity.this);
    Glide.with(NewsPhotoDetailActivity.this).load(mPictureList.get(position).getImgPath())
            .placeholder(R.mipmap.ic_loading)
            .error(R.mipmap.ic_load_fail)
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .into(photoView);
    photoView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
        @Override
        public void onPhotoTap(View view, float v, float v1) {
            hideToolBarAndTextView();
            hideOrShowStatusBar();
        }

        @Override
        public void onOutsidePhotoTap() {

        }
    });
    container.addView(photoView, ViewPager.LayoutParams.MATCH_PARENT, ViewPager.LayoutParams.MATCH_PARENT);
    return photoView;
}
 
開發者ID:LuoboDcom,項目名稱:ZZShow,代碼行數:25,代碼來源:NewsPhotoDetailActivity.java

示例3: onActivityCreated

import uk.co.senab.photoview.PhotoView; //導入方法依賴的package包/類
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (getView() != null) {
        imageView = (PhotoView) getView().findViewById(R.id.layout_preview_img_img);
    }
    final String url = getArguments().getString("imagePath");
    if (ImageCache.getInstance().get(key_prefix + url) == null) {
        bp = ImageUtils.compressImgBySize(url, 480, 800);
        ImageCache.getInstance().put(key_prefix + url, bp);
    } else {
        bp = ImageCache.getInstance().get(key_prefix + url);
    }


    imageView.setImageBitmap(bp);
    imageView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
        @Override
        public void onPhotoTap(View view, float x, float y) {
            if (listener != null)
                listener.onImgClick();
        }
    });
}
 
開發者ID:cocolove2,項目名稱:LISDemo,代碼行數:25,代碼來源:ShowImageView.java

示例4: displayImage

import uk.co.senab.photoview.PhotoView; //導入方法依賴的package包/類
/**
 * 加載普通圖片
 */
private void displayImage(PhotoView photoView, byte[] res) {
    photoView.setVisibility(View.VISIBLE);

    Bitmap bitmap = byteArrayToBitmap(res);
    if (bitmap == null) {
        photoView.setImageResource(R.mipmap.default_img_rect);
    } else {
        photoView.setImageBitmap(bitmap);
    }

    photoView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
        @Override
        public void onPhotoTap(View view, float x, float y) {
            aty.finish();
        }
    });
}
 
開發者ID:kymjs,項目名稱:KJGallery,代碼行數:21,代碼來源:SamplePagerAdapter.java

示例5: instantiateItem

import uk.co.senab.photoview.PhotoView; //導入方法依賴的package包/類
@Override
public Object instantiateItem(ViewGroup container, int position) {
    PhotoView photoView = new PhotoView(container.getContext());
    Ion.with(photoView).load(urlList.get(position));
    container.addView(photoView, ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    photoView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
        @Override
        public void onPhotoTap(View view, float v, float v2) {
            mActivity.finish();
        }
    });
    photoView.setTag(urlList.get(position));
    photoView.setOnLongClickListener(new OnPhotoLongClickListener(mActivity));
    return photoView;
}
 
開發者ID:jewelzqiu,項目名稱:sjtubbs,代碼行數:17,代碼來源:PicPagerAdapter.java

示例6: instantiateItem

import uk.co.senab.photoview.PhotoView; //導入方法依賴的package包/類
@Override
public Object instantiateItem(ViewGroup container, int position) {
    View view = getLayoutInflater().inflate(R.layout.viewpager_very_image, container, false);
    PhotoView zoom_image_view = (PhotoView) view.findViewById(R.id.zoom_image_view);
    ProgressBar spinner = (ProgressBar) view.findViewById(R.id.loading);
    spinner.setVisibility(View.GONE);
    if (imageId != 0) {
        zoom_image_view.setImageResource(imageId);
    }
    zoom_image_view.setOnPhotoTapListener(ViewBigImageActivity.this);
    container.addView(view, 0);
    return view;
}
 
開發者ID:joelan,項目名稱:ClouldReader,代碼行數:14,代碼來源:ViewBigImageActivity.java

示例7: instantiateItem

import uk.co.senab.photoview.PhotoView; //導入方法依賴的package包/類
@Override
    public Object instantiateItem(ViewGroup container, int position) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_photoview, container, false);
        final ProgressBar pb = (ProgressBar) view.findViewById(R.id.pb);
        final PhotoView imageView = (PhotoView) view.findViewById(R.id.pv);

        ImageInfo info = this.imageInfo.get(position);
        imageView.setOnPhotoTapListener(this);
        showExcessPic(info, imageView);

        //如果需要加載的loading,需要自己改寫,不能使用這個方法
        NineGridView.getImageLoader().onDisplayImage(view.getContext(), imageView, info.bigImageUrl);

//        pb.setVisibility(View.VISIBLE);
//        Glide.with(context).load(info.bigImageUrl)//
//                .placeholder(R.drawable.ic_default_image)//
//                .error(R.drawable.ic_default_image)//
//                .diskCacheStrategy(DiskCacheStrategy.ALL)//
//                .listener(new RequestListener<String, GlideDrawable>() {
//                    @Override
//                    public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
//                        pb.setVisibility(View.GONE);
//                        return false;
//                    }
//
//                    @Override
//                    public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
//                        pb.setVisibility(View.GONE);
//                        return false;
//                    }
//                }).into(imageView);

        container.addView(view);
        return view;
    }
 
開發者ID:zuoweitan,項目名稱:Hitalk,代碼行數:36,代碼來源:ImagePreviewAdapter.java

示例8: instantiateItem

import uk.co.senab.photoview.PhotoView; //導入方法依賴的package包/類
@Override
    public Object instantiateItem(ViewGroup container, int position) {

        View itemView = mLayoutInflater.inflate(R.layout.item_preview, container, false);

        PhotoView imageView = (PhotoView) itemView.findViewById(R.id.iv_pager);

        final String path = paths.get(position);
        final Uri uri;
        if (path.startsWith("http")) {
            uri = Uri.parse(path);
        } else {
            uri = Uri.fromFile(new File(path));
        }
        Picasso.with(mContext).load(uri)
//            .placeholder(R.mipmap.default_error)
                .error(R.mipmap.default_error)
                .into(imageView);

        imageView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
            @Override
            public void onPhotoTap(View view, float v, float v1) {
                if (listener != null) {
                    listener.OnPhotoTapListener(view, v, v1);
                }
            }
        });

        container.addView(itemView);

        return itemView;
    }
 
開發者ID:Sugarya,項目名稱:SugarPhotoPicker,代碼行數:33,代碼來源:PhotoPagerAdapter.java

示例9: onCreate

import uk.co.senab.photoview.PhotoView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail);
    mViewPager = (ViewPager) findViewById(R.id.vp_bigPhoto);
    Bundle bundle = getIntent().getExtras();
    views = new ArrayList<>();
    int position = bundle.getInt("position");
    Log.d("Photo","get position:"+position);
    List<ImageCard> images = (List<ImageCard>) bundle.getSerializable("images");
    for (ImageCard  i :images) {
        PhotoView imageView = new PhotoView(this);
        Glide.with(this).load(i.getImgId()).into(imageView);
        views.add(imageView);
        imageView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
        @Override
        public void onPhotoTap(View view, float v, float v1) {
            DetailActivity.this.finish();
        }

        @Override
        public void onOutsidePhotoTap() {

        }
    });
    }
    CommonPagerAdapter adapter = new CommonPagerAdapter(views);
    mViewPager.setAdapter(adapter);
    mViewPager.setCurrentItem(position);
}
 
開發者ID:AndroidBoySC,項目名稱:Mybilibili,代碼行數:31,代碼來源:DetailActivity.java

示例10: instantiateItem

import uk.co.senab.photoview.PhotoView; //導入方法依賴的package包/類
@Override
public Object instantiateItem(ViewGroup container, int position) {
    PhotoView photoView = new PhotoView(mActivity);
    ImageItem imageItem = images.get(position);
    imagePicker.getImageLoader().displayImagePreview(mActivity, imageItem.path, photoView, screenWidth, screenHeight);
    photoView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
        @Override
        public void onPhotoTap(View view, float x, float y) {
            if (listener != null) listener.OnPhotoTapListener(view, x, y);
        }
    });
    container.addView(photoView);
    return photoView;
}
 
開發者ID:jeasonlzy,項目名稱:ImagePicker,代碼行數:15,代碼來源:ImagePageAdapter.java

示例11: instantiateItem

import uk.co.senab.photoview.PhotoView; //導入方法依賴的package包/類
@Override
public View instantiateItem(ViewGroup container, int position) {
    View view = LayoutInflater.from(ImageViewActivity.this).inflate(R.layout.item_imagepage, container, false);
    final PhotoView photoView = (PhotoView) view.findViewById(R.id.photoview);
    final View wheel = view.findViewById(R.id.wheel);
    photoView.setOnPhotoTapListener((view1, v, v1) -> finish());

    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(urls.get(position))
            .setResizeOptions(new ResizeOptions(768, 768))
            .build();
    DataSource<CloseableReference<CloseableImage>>
            dataSource = imagePipeline.fetchDecodedImage(request,this);
    DataSubscriber dataSubscriber = new BaseBitmapDataSubscriber() {
        @Override
        protected void onNewResultImpl(Bitmap bitmap) {
              photoView.setImageBitmap(bitmap);
              wheel.setVisibility(View.GONE);
        }

        @Override
        protected void onFailureImpl(DataSource<CloseableReference<CloseableImage>> closeableReferenceDataSource) {

        }
    };
    dataSource.subscribe(dataSubscriber, new Executor() {
        @Override
        public void execute(Runnable command) {
            handler.post(command);
        }
    });
    container.addView(view);
    return view;
}
 
開發者ID:Jude95,項目名稱:Fishing,代碼行數:35,代碼來源:ImageViewActivity.java

示例12: onPostExecute

import uk.co.senab.photoview.PhotoView; //導入方法依賴的package包/類
@Override
protected void onPostExecute(Object[] result) {
	super.onPostExecute(result);
	ViewGroup v = (ViewGroup) result[0];
	Object img = result[1];
	
	if (img != null) {
		v.removeAllViews();
		if (img instanceof Bitmap) {
			PhotoView p = new PhotoView(ImageActivity.this);
			
			// Disable hardware acceleration if too large
			Bitmap image = (Bitmap) img;
			int maxSize = Utility.getSupportedMaxPictureSize();
			if (image.getWidth() > maxSize || image.getHeight() > maxSize) {
				p.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
				
				if (DEBUG) {
					Log.d(TAG, "Image too large, hardware acceleration disabled. max size: " + maxSize);
				}
			}
			
			p.setImageBitmap(image);
			p.setOnPhotoTapListener(ImageActivity.this);
			v.addView(p, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
		} else if (img instanceof Movie) {
			GifView g = new GifView(ImageActivity.this);
			g.setMovie((Movie) img);
			v.addView(g, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
		}
	}
}
 
開發者ID:PeterCxy,項目名稱:BlackLight,代碼行數:33,代碼來源:ImageActivity.java

示例13: onCreate

import uk.co.senab.photoview.PhotoView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_single_pic);
    mPhotoView = (PhotoView) findViewById(R.id.photo);

    Ion.with(mPhotoView).load(getIntent().getStringExtra(PIC_URL));
    mPhotoView.setOnLongClickListener(new OnPhotoLongClickListener(this));
    mPhotoView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
        @Override
        public void onPhotoTap(View view, float v, float v2) {
            finish();
        }
    });
}
 
開發者ID:jewelzqiu,項目名稱:sjtubbs,代碼行數:16,代碼來源:SinglePicActivity.java

示例14: instantiateItem

import uk.co.senab.photoview.PhotoView; //導入方法依賴的package包/類
@Override
public Object instantiateItem(ViewGroup container, int position) {
    View itemView = mLayoutInflater.inflate(R.layout.item_full_image, container, false);

    final PhotoView imageView = (PhotoView) itemView.findViewById(R.id.full_image);
    final ProgressBar progressBar = (ProgressBar) itemView.findViewById(R.id.full_progress);

    progressBar.animate().setStartDelay(PROGRESS_DELAY).alpha(1f);

    final String path = mPaths.get(position);
    if (path.startsWith("http")) { //遠程圖片
        GlideHelper.loadFullImageWithUrl(path, imageView, new GlideHelper.ImageLoadingListener() {

            @Override
            public void onLoaded() {
                progressBar.animate().cancel();
                progressBar.animate().alpha(0f);
            }

            @Override
            public void onFailed() {
                progressBar.animate().alpha(0f);
            }
        });

        // 長按調取保存手機到手機
        imageView.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
                onPopupMenu(path);
                return true;
            }
        });
    } else { // 本地圖片
        Uri uri = Uri.fromFile(new File(path));
        GlideHelper.loadWithUri(uri, imageView);
        progressBar.animate().cancel();
        progressBar.animate().alpha(0f);
    }

    /** 單擊關閉當前瀏覽頁 */
    imageView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
        @Override
        public void onPhotoTap(View view, float x, float y) {
            if (!((Activity) mContext).isFinishing()) {
                ((Activity) mContext).onBackPressed();
            }
        }
    });

    container.addView(itemView);

    return itemView;
}
 
開發者ID:LegendKe,項目名稱:MyTravelingDiary,代碼行數:55,代碼來源:ImagePagerAdapter.java


注:本文中的uk.co.senab.photoview.PhotoView.setOnPhotoTapListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。