本文整理汇总了Java中uk.co.senab.photoview.PhotoViewAttacher.setOnViewTapListener方法的典型用法代码示例。如果您正苦于以下问题:Java PhotoViewAttacher.setOnViewTapListener方法的具体用法?Java PhotoViewAttacher.setOnViewTapListener怎么用?Java PhotoViewAttacher.setOnViewTapListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uk.co.senab.photoview.PhotoViewAttacher
的用法示例。
在下文中一共展示了PhotoViewAttacher.setOnViewTapListener方法的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: 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;
}
示例3: 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;
}
示例4: setupPhotoAttacher
import uk.co.senab.photoview.PhotoViewAttacher; //导入方法依赖的package包/类
private void setupPhotoAttacher() {
mPhotoViewAttacher = new PhotoViewAttacher(mImageView);
mPhotoViewAttacher.setOnViewTapListener((view, v, v1) -> hideOrShowToolbar());
// @formatter:off
mPhotoViewAttacher.setOnLongClickListener(v -> {
new AlertDialog.Builder(PictureActivity.this)
.setMessage(getString(R.string.ask_saving_picture))
.setNegativeButton(android.R.string.cancel,
(dialog, which) -> dialog.dismiss())
.setPositiveButton(android.R.string.ok,
(dialog, which) -> {
saveImageToGallery();
dialog.dismiss();
})
.show();
// @formatter:on
return true;
});
}
示例5: onCreate
import uk.co.senab.photoview.PhotoViewAttacher; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_image_review);
ButterKnife.inject(this);
attacher = new PhotoViewAttacher(image);
attacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
@Override
public void onViewTap(View view, float v, float v2) {
finish();
}
});
final String path = getIntent().getExtras().getString("path");
displayImage("file://" + path, image);
}
示例6: onCreate
import uk.co.senab.photoview.PhotoViewAttacher; //导入方法依赖的package包/类
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//如果没有虚拟按键则设置为全屏
if (!UIUtil.isHasNavigationBar(this)) {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LOW_PROFILE |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_FULLSCREEN);
}
if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.addFlags(LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(R.color.black);
}
mAttacher = new PhotoViewAttacher(mPhoto);
mAttacher.setOnViewTapListener(new OnViewTapListener() {
@Override public void onViewTap(View view, float x, float y) {
hideBottomOption();
}
});
}
示例7: 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)))
.load(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;
}
示例8: setupPhotoAttacher
import uk.co.senab.photoview.PhotoViewAttacher; //导入方法依赖的package包/类
private void setupPhotoAttacher() {
mPhotoViewAttacher = new PhotoViewAttacher(mImageView);
mPhotoViewAttacher.setOnViewTapListener((view, v, v1) -> onBackPressed());
mPhotoViewAttacher.setOnLongClickListener(v -> {
new AlertDialog.Builder(PictureActivity.this)
.setMessage(getString(R.string.ask_saving_picture))
.setNegativeButton(android.R.string.cancel,
(dialog, which) -> dialog.dismiss())
.setPositiveButton(android.R.string.ok,
(dialog, which) -> {
saveImageToGallery();
// TODO:保存图片逻辑
dialog.dismiss();
})
.show();
return true;
});
}
示例9: onCreateView
import uk.co.senab.photoview.PhotoViewAttacher; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View rootView = inflater.inflate(R.layout.photo_browser_image, container, false);
imageView = (ImageView)rootView.findViewById(R.id.imageView);
textView = (TextView)rootView.findViewById(R.id.textView);
attacher = new PhotoViewAttacher(imageView);
attacher.setOnViewTapListener(new OnViewTapListener() {
@Override
public void onViewTap(View view, float x, float y) {
((Loader)getActivity()).toggleActionBar();
}
});
if (caption == null || caption.isEmpty())
textView.setVisibility(View.INVISIBLE);
else
textView.setText(caption);
return rootView;
}
示例10: onResourceReady
import uk.co.senab.photoview.PhotoViewAttacher; //导入方法依赖的package包/类
@Override
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
mCircleProgressView.setVisibility(View.GONE);
mCircleProgressView.stopSpinning();
mImageView.setImageDrawable(resource);
mPhotoViewAttacher = new PhotoViewAttacher(mImageView);
mPhotoViewAttacher.setOnViewTapListener((view, v, v1) -> getActivity().finish());
return false;
}
示例11: setAttacher
import uk.co.senab.photoview.PhotoViewAttacher; //导入方法依赖的package包/类
public void setAttacher(ImageView imageView) {
attacher = new PhotoViewAttacher(imageView);
attacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
@Override
public void onViewTap(View view, float x, float y) {
imageOnClick(view);
}
});
}
示例12: onLoadingFailed
import uk.co.senab.photoview.PhotoViewAttacher; //导入方法依赖的package包/类
@Override
public void onLoadingFailed(String imageUri, View view,
FailReason failReason) {
mImageView.setScaleType(ImageView.ScaleType.CENTER);
mProgress.setVisibility(View.GONE);
PhotoViewAttacher photo = new PhotoViewAttacher(mImageView);
photo.setMaxScale(8);
photo.setOnPhotoTapListener(this);
photo.setOnViewTapListener(this);
}
示例13: onLoadingComplete
import uk.co.senab.photoview.PhotoViewAttacher; //导入方法依赖的package包/类
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
mImageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
mProgress.setVisibility(View.GONE);
PhotoViewAttacher photo = new PhotoViewAttacher(mImageView);
photo.setMaxScale(10);
photo.setOnPhotoTapListener(this);
photo.setOnViewTapListener(this);
}
示例14: onCreate
import uk.co.senab.photoview.PhotoViewAttacher; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PictureActivityBinding binding =
DataBindingUtil.setContentView(this, R.layout.picture_activity);
String mGirlUrl = getIntent().getExtras().getString("url");
ViewCompat.setTransitionName(binding.ivPhoto, "girl");
Picasso.with(this).load(mGirlUrl)
.into(binding.ivPhoto);
background = new ColorDrawable(Color.BLACK);
binding.pullBackLayout.getRootView().setBackground(background);
PhotoViewAttacher mViewAttacher = new PhotoViewAttacher(binding.ivPhoto);
binding.pullBackLayout.setPullCallBack(this);
mViewAttacher.setOnViewTapListener((view, x, y) -> {
if (systemUiIsShow) {
hideSystemUI();
systemUiIsShow = false;
} else {
showSystemUI();
systemUiIsShow = true;
}
});
}
示例15: onCreate
import uk.co.senab.photoview.PhotoViewAttacher; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_viewer);
unbinder = ButterKnife.bind(this);
toolbar.inflateMenu(R.menu.menu_viewer);
toolbar.setOnMenuItemClickListener(this);
toolbar.setNavigationIcon(R.drawable.ic_close);
toolbar.setNavigationOnClickListener(v -> finish());
attacher = new PhotoViewAttacher(image);
attacher.setOnPhotoTapListener(this);
attacher.setOnViewTapListener((view, x, y) -> onPhotoTap(null, 0f, 0f));
Glide.with(this).load(new File(getIntent().getData().getPath())).into(mTarget);
if (toolbar != null) {
new Handler()
.postDelayed(
() -> {
if (toolbar != null) {
onPhotoTap(null, 0f, 0f);
}
},
2000);
}
}