本文整理汇总了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;
}
示例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);
}
});
}
}
示例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);
}
});
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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() {
}
});
}
示例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;
}
示例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;
}
示例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();
}
}
});
}
}
示例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;
}
示例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;
}
示例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() {
}
});
}
示例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;
}
示例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;
}