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


Java PhotoViewAttacher類代碼示例

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


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

示例1: onCreateView

import uk.co.senab.photoview.PhotoViewAttacher; //導入依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View contentView = inflater.inflate(R.layout.fragment_image_preview, container, false);
    final ImageView imageView = (ImageView) contentView.findViewById(R.id.preview_image);
    final PhotoViewAttacher mAttacher = new PhotoViewAttacher(imageView);
    Glide.with(container.getContext())
            .load(new File(getArguments().getString(PATH)))
            .asBitmap()
            .into(new SimpleTarget<Bitmap>(480, 800) {
                @Override
                public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                    imageView.setImageBitmap(resource);
                    mAttacher.update();
                }
            });
    mAttacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
        @Override
        public void onViewTap(View view, float x, float y) {
            ImagePreviewActivity activity = (ImagePreviewActivity) getActivity();
            activity.switchBarVisibility();
        }
    });
    return contentView;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:26,代碼來源:ImagePreviewFragment.java

示例2: initEventAndData

import uk.co.senab.photoview.PhotoViewAttacher; //導入依賴的package包/類
@Override
protected void initEventAndData() {
    setToolBar(toolBar,"");
    mRealmHelper = App.getAppComponent().realmHelper();
    Intent intent = getIntent();
    url = intent.getExtras().getString(Constants.IT_GANK_GRIL_URL);
    id = intent.getExtras().getString(Constants.IT_GANK_GRIL_ID);
    if (url != null) {
        Glide.with(mContext).load(url).asBitmap().into(new SimpleTarget<Bitmap>() {
            @Override
            public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                bitmap = resource;
                ivGirlDetail.setImageBitmap(resource);
                mAttacher = new PhotoViewAttacher(ivGirlDetail);
            }
        });
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:GirlDetailActivity.java

示例3: initEventAndData

import uk.co.senab.photoview.PhotoViewAttacher; //導入依賴的package包/類
@Override
protected void initEventAndData() {
    setToolBar(toolBar,"");
    mRealmHelper = App.getAppComponent().realmHelper();
    Intent intent = getIntent();
    url = intent.getExtras().getString("url");
    id = intent.getExtras().getString("id");
    if (url != null) {
        Glide.with(mContext).load(url).asBitmap().into(new SimpleTarget<Bitmap>() {
            @Override
            public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                bitmap = resource;
                ivGirlDetail.setImageBitmap(resource);
                mAttacher = new PhotoViewAttacher(ivGirlDetail);
            }
        });
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:GirlDetailActivity.java

示例4: onSuccess

import uk.co.senab.photoview.PhotoViewAttacher; //導入依賴的package包/類
@Override
public void onSuccess() {
    if (mWr.get() == null || mWr.get().mImageView == null) {
        return;
    }
    mWr.get().dismissProgressDialog();
    Drawable drawable = mWr.get().mImageView.getDrawable();
    PhotoViewAttacher attacher = mWr.get().mAttacher;
    if (attacher != null) {
        if (drawable.getIntrinsicHeight() > (drawable.getIntrinsicWidth() << 2)) {
            // handle the super height image.
            int scale = drawable.getIntrinsicHeight() / drawable.getIntrinsicWidth();
            scale = Math.min(MAX_SCALE, scale);
            attacher.setMaximumScale(scale);
            attacher.setScale(scale, true);
        }
        attacher.update();
    }
    BoxingViewActivity activity = mWr.get().getThisActivity();
    if (activity != null && activity.mGallery != null) {
        activity.mGallery.setVisibility(View.VISIBLE);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:24,代碼來源:BoxingRawImageFragment.java

示例5: instantiateItem

import uk.co.senab.photoview.PhotoViewAttacher; //導入依賴的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

示例6: instantiateItem

import uk.co.senab.photoview.PhotoViewAttacher; //導入依賴的package包/類
@RequiresApi(api = Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public View instantiateItem(ViewGroup container, int position) {
    PhotoView photoView = new PhotoView(container.getContext());
    photoView.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
        @Override
        public void onViewTap(View view, float x, float y) {
            playZoomOutAnim();
        }
    });
    PicInfo picInfo = picUrls.get(position);
    sceneHelp.showExpandedView(photoView, picInfo);
    container.addView(photoView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

    return photoView;
}
 
開發者ID:Sherchen,項目名稱:LikeWechatPhotoViewer,代碼行數:17,代碼來源:MainActivity.java

示例7: onTap

import uk.co.senab.photoview.PhotoViewAttacher; //導入依賴的package包/類
private void onTap() {
    mPhotoViewAttacher = new PhotoViewAttacher(imageView);

    mPhotoViewAttacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
        @Override
        public void onPhotoTap(View view, float x, float y) {
            if (isShowing) {
                isShowing = false;
                toolbar.animate().translationY(-toolbar.getBottom()).setInterpolator(new AccelerateInterpolator()).start();
                imagesHorizontalList.animate().translationY(imagesHorizontalList.getBottom()).setInterpolator(new AccelerateInterpolator()).start();
            } else {
                isShowing = true;
                toolbar.animate().translationY(0).setInterpolator(new DecelerateInterpolator()).start();
                imagesHorizontalList.animate().translationY(0).setInterpolator(new DecelerateInterpolator()).start();
            }
        }

        @Override
        public void onOutsidePhotoTap() {

        }
    });
}
 
開發者ID:alhazmy13,項目名稱:MediaGallery,代碼行數:24,代碼來源:ViewPagerAdapter.java

示例8: instantiateItem

import uk.co.senab.photoview.PhotoViewAttacher; //導入依賴的package包/類
public View instantiateItem(ViewGroup container, int position) {
    MQImageView imageView = new MQImageView(container.getContext());
    container.addView(imageView, -1, -1);
    final PhotoViewAttacher photoViewAttacher = new PhotoViewAttacher(imageView);
    photoViewAttacher.setOnViewTapListener(MQPhotoPreviewActivity.this);
    imageView.setDrawableChangedCallback(new MQImageView$OnDrawableChangedCallback() {
        public void onDrawableChanged() {
            photoViewAttacher.update();
        }
    });
    MQConfig.getImageLoader(MQPhotoPreviewActivity.this).displayImage(imageView, (String)
            MQPhotoPreviewActivity.this.mPreviewImages.get(position), R.drawable
            .mq_ic_holder_dark, R.drawable.mq_ic_holder_dark, MQUtils.getScreenWidth
            (MQPhotoPreviewActivity.this), MQUtils.getScreenHeight(MQPhotoPreviewActivity
            .this), null);
    return imageView;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:18,代碼來源:MQPhotoPreviewActivity.java

示例9: instantiateItem

import uk.co.senab.photoview.PhotoViewAttacher; //導入依賴的package包/類
public View instantiateItem(ViewGroup container, int position) {
    MQImageView imageView = new MQImageView(container.getContext());
    container.addView(imageView, -1, -1);
    final PhotoViewAttacher photoViewAttacher = new PhotoViewAttacher(imageView);
    photoViewAttacher.setOnViewTapListener(MQPhotoPickerPreviewActivity.this);
    imageView.setDrawableChangedCallback(new MQImageView$OnDrawableChangedCallback() {
        public void onDrawableChanged() {
            photoViewAttacher.update();
        }
    });
    MQConfig.getImageLoader(MQPhotoPickerPreviewActivity.this).displayImage(imageView,
            (String) MQPhotoPickerPreviewActivity.this.mPreviewImages.get(position), R
                    .drawable.mq_ic_holder_dark, R.drawable.mq_ic_holder_dark, MQUtils
                    .getScreenWidth(MQPhotoPickerPreviewActivity.this), MQUtils
                    .getScreenHeight(MQPhotoPickerPreviewActivity.this), null);
    return imageView;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:18,代碼來源:MQPhotoPickerPreviewActivity.java

示例10: init

import uk.co.senab.photoview.PhotoViewAttacher; //導入依賴的package包/類
private void init() {
    if (this.mImageLoader != null) {
        this.attacher = new PhotoViewAttacher(this.ivPhoto);
        this.attacher.setOnPhotoTapListener(new PhotoViewAttacher$OnPhotoTapListener() {
            public void onPhotoTap(View view, float v, float v2) {
                MultiImagePreviewFragment.this.getActivity().finish();
            }
        });
        this.mImageLoader.loadImage(Uri.decode(Uri.fromFile(new File(this.image.path)).toString()), this.ivPhoto, 17170445, new LoadCallBack() {
            public void onSuccess() {
                if (MultiImagePreviewFragment.this.attacher != null) {
                    MultiImagePreviewFragment.this.attacher.update();
                }
            }
        });
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:18,代碼來源:MultiImagePreviewFragment.java

示例11: instantiateItem

import uk.co.senab.photoview.PhotoViewAttacher; //導入依賴的package包/類
@Override
public View instantiateItem(ViewGroup container, final int position) {
    PhotoView photoView = new PhotoView(container.getContext());
    //load full size image with Picasso lib into the photoView
    Picasso.with(container.getContext())
            .load(sDrawables.get(position).getPhoto().getOriginalSize().getUrl())
            .placeholder(R.drawable.ic_sync)
            .error(R.drawable.ic_warning)
            .into(photoView);
    container.addView(photoView, ViewPager.LayoutParams.MATCH_PARENT, ViewPager.LayoutParams.MATCH_PARENT);

    photoView.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
        @Override
        public void onViewTap(final View view, float x, float y) {
            //on photo click, display or hide data section
            View photoDataView = findViewById(R.id.photo_data);
            if (photoDataView.getVisibility() == View.VISIBLE) {
                photoDataView.setVisibility(View.GONE);
            } else {
                photoDataView.setVisibility(View.VISIBLE);
            }
        }
    });

    return photoView;
}
 
開發者ID:nioc,項目名稱:tumblr-photo-browse,代碼行數:27,代碼來源:BlogActivity.java

示例12: onCreateView

import uk.co.senab.photoview.PhotoViewAttacher; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    View rootView = inflater.inflate(R.layout.image_fragment, container, false);
    backgroundImage = (ImageView)rootView.findViewById(R.id.backgroundImage);
    backgroundImage.setImageBitmap((Bitmap) getArguments().getParcelable("image"));
    if(getArguments().getBoolean("isZoom")) photoViewAttacher = new PhotoViewAttacher(backgroundImage);
    viewPager = getViewPager();

    if(savedInstanceState != null) {
        boolean isLocked = savedInstanceState.getBoolean(IS_LOCKED, false);
        viewPager.setLocked(isLocked);
    }

    return rootView;
}
 
開發者ID:LegendKe,項目名稱:MyTravelingDiary,代碼行數:17,代碼來源:ImageFragment.java

示例13: onCreate

import uk.co.senab.photoview.PhotoViewAttacher; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dialog_photo_show_layout);
    photoView = (PhotoView) findViewById(R.id.photoview);
    Glide.with(context).load(imgpath).into(photoView);
    mAttacher = new PhotoViewAttacher(photoView);
    mAttacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {

        @Override
        public void onPhotoTap(View view, float x, float y) {

        }

        @Override
        public void onOutsidePhotoTap() {

        }
    });
}
 
開發者ID:wanliyang1990,項目名稱:AndroidPickPhotoDialog,代碼行數:21,代碼來源:ImgShowDialog.java

示例14: onCreateView

import uk.co.senab.photoview.PhotoViewAttacher; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	final View v = inflater.inflate(R.layout.gushi_image_detail_fragment, container, false);
	mImageView = (ImageView) v.findViewById(R.id.image);
	mAttacher = new PhotoViewAttacher(mImageView);
	
	mAttacher.setOnPhotoTapListener(new OnPhotoTapListener() {
		
		@Override
		public void onPhotoTap(View arg0, float arg1, float arg2) {
			getActivity().finish();
		}
	});
	
	progressBar = (ProgressBar) v.findViewById(R.id.loading);
	return v;
}
 
開發者ID:macyuan,項目名稱:TAG,代碼行數:18,代碼來源:ImageDetailFragment.java

示例15: onCreateView

import uk.co.senab.photoview.PhotoViewAttacher; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	 View v = inflater.inflate(R.layout.fragment_image_detail, container, false);
	mImageView = (ImageView) v.findViewById(R.id.image_browse_image);
	textTip = (TextView) v.findViewById(R.id.image_browse_tip);
	progressBar = (ProgressBar) v.findViewById(R.id.image_browse_loading);
	
	mAttacher = new PhotoViewAttacher(mImageView);
	mAttacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
		
		@Override
		public void onPhotoTap(View arg0, float arg1, float arg2) {
			getActivity().finish();
		}

		@Override
		public void onOutsidePhotoTap() {
			
		}
	});
	return v;
}
 
開發者ID:qiaop,項目名稱:android-post,代碼行數:23,代碼來源:ImageDetailFragment.java


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