本文整理汇总了Java中com.github.chrisbanes.photoview.PhotoView类的典型用法代码示例。如果您正苦于以下问题:Java PhotoView类的具体用法?Java PhotoView怎么用?Java PhotoView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PhotoView类属于com.github.chrisbanes.photoview包,在下文中一共展示了PhotoView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: instantiateItem
import com.github.chrisbanes.photoview.PhotoView; //导入依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {
if (photos == null) {
return null;
}
if (mViews == null) {
mViews = new PhotoView[photos.size()];
for (int i = 0; i < 4; i++) {
mViews[i] = new PhotoView(container.getContext());
mViews[i].setBackgroundColor(Color.BLACK);
}
}
if (mViews[position] == null) {
mViews[position] = mViews[position % 4];
}
container.addView(mViews[position], ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
Log.e("TAG", "addView: " + position);
GlideApp.with(GalleryActivity.this)
.load(photos.get(position))
.format(DecodeFormat.PREFER_ARGB_8888)
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(mViews[position]);
return mViews[position];
}
示例2: onCreate
import com.github.chrisbanes.photoview.PhotoView; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_photo);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setHomeAsUpIndicator(R.drawable.icon_back);
}
String imageUrl = getIntent().getStringExtra("image_url");
PhotoView photoView = (PhotoView) findViewById(R.id.photoview);
Glide.with(this).load(imageUrl).into(photoView);
}
示例3: AbsImageDisplayHolder
import com.github.chrisbanes.photoview.PhotoView; //导入依赖的package包/类
public AbsImageDisplayHolder(int adapterPosition, @NonNull View itemView) {
super(adapterPosition, itemView);
mContext = itemView.getContext().getApplicationContext();
mPhotoView = (PhotoView) itemView.findViewById(idOfImageView());
mPhotoView.setMaximumScale(5f);
mProgressBar = (ProgressBar) itemView.findViewById(idOfProgressBar());
mPicassoLoadCallback = new WeakPicassoLoadCallback(this);
}
示例4: instantiateItem
import com.github.chrisbanes.photoview.PhotoView; //导入依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {
if (meizis == null) {
return null;
}
if (mViews == null) {
mViews = new PhotoView[meizis.size()];
for (int i = 0; i < 4; i++) {
mViews[i] = new PhotoView(container.getContext());
mViews[i].setTransitionName(meizis.get(position).get_id());
mViews[i].setBackgroundColor(Color.BLACK);
}
}
if (mViews[position] == null) {
mViews[position] = mViews[position % 4];
}
container.addView(mViews[position], ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
Log.e("TAG", "addView: " + position);
RequestOptions options = new RequestOptions()
.format(DecodeFormat.PREFER_ARGB_8888)
.diskCacheStrategy(DiskCacheStrategy.DATA);
Glide.with(GalleryActivity.this)
.load(meizis.get(position).getUrl())
.apply(options)
.listener(new CallbackListener(mViews[position], position))
.into(mViews[position]);
return mViews[position];
}
示例5: getView
import com.github.chrisbanes.photoview.PhotoView; //导入依赖的package包/类
public PhotoView getView(int position) {
if (mViews == null) {
return null;
} else {
return mViews[position];
}
}
示例6: instantiateItem
import com.github.chrisbanes.photoview.PhotoView; //导入依赖的package包/类
@Override
public View instantiateItem(ViewGroup container, int position) {
PhotoView photoView = new PhotoView(container.getContext());
Glide.with(getApplicationContext())
.load(mImageUrlList.get(position))
.into(photoView);
// Now just add PhotoView to ViewPager and return it
container.addView(photoView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
return photoView;
}
示例7: instantiateItem
import com.github.chrisbanes.photoview.PhotoView; //导入依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {
View view = LayoutInflater.from(mCtx).inflate(R.layout.widget_item_pager_per_img, null);
PhotoView pvImg = (PhotoView) view.findViewById(R.id.pv_img);
ProgressBar pbLoading = (ProgressBar) view.findViewById(R.id.pb_loading);
//设置点击事件
pvImg.setOnPhotoTapListener(this);
//加载图片
mCfg.getLoader().load(pvImg, mCfg.getModelList().get(position), pbLoading);
container.addView(view);
return view;
}
示例8: instantiateItem
import com.github.chrisbanes.photoview.PhotoView; //导入依赖的package包/类
@Override
public View instantiateItem(ViewGroup container, int position) {
PhotoView photoView = new PhotoView(container.getContext());
Glide.with(container.getContext()).load(mDataList.get(position).getUrl()).into(photoView);
container.addView(photoView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
return photoView;
}
示例9: initView
import com.github.chrisbanes.photoview.PhotoView; //导入依赖的package包/类
private void initView(FrameLayout frameLayout) {
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
layoutParams.gravity = Gravity.CENTER;
/* 图片加载进度圈 */
CircleProgress progress = getProgressView(getActivity());
mProgressModelLoader = new ProgressModelLoader(getHandler(progress));
if (url.endsWith(".gif")) {
GifMovieView gifView = new GifMovieView(frameLayout.getContext());
gifView.setLayoutParams(layoutParams);
gifView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 点击图片返回
getActivity().onBackPressed();
}
});
frameLayout.addView(gifView);
progress.inject(gifView);
loadPic(url, gifView, true);
} else {
PhotoView photoView = new PhotoView(frameLayout.getContext());
photoView.setLayoutParams(layoutParams);
photoView.setOnPhotoTapListener(new OnPhotoTapListener() {
@Override
public void onPhotoTap(ImageView view, float x, float y) {
// 点击图片返回
getActivity().onBackPressed();
}
});
frameLayout.addView(photoView);
progress.inject(photoView);
loadPic(url, photoView, false);
}
}
示例10: onCreate
import com.github.chrisbanes.photoview.PhotoView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_expand_image);
ActionBar actionBar = getSupportActionBar();
actionBar.hide();
Bundle extras = getIntent().getExtras();
int rackId = 0;
if (extras != null) {
rackId = extras.getInt(RACK_ID);
} else {
// Something's not right, finish this activity
this.finish();
}
DetailViewModel detailViewModel = new DetailViewModel(rackId, this);
PhotoView photoView = (PhotoView) findViewById(R.id.photo_view);
// Request cached thumbnail
DrawableRequestBuilder<String> thumbnailRequest = Glide
.with(this)
.load(detailViewModel.getImage().replace("images/", "images/thumbs/"))
.diskCacheStrategy(DiskCacheStrategy.ALL)
.override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
.transform(new BlurTransformation(this));
Glide.with(this)
.load(detailViewModel.getImage())
.thumbnail(thumbnailRequest)
.crossFade()
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.priority(Priority.HIGH)
.into(photoView);
}
示例11: onCreateViewHolder
import com.github.chrisbanes.photoview.PhotoView; //导入依赖的package包/类
@Override
public ImageViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
PhotoView photoView = new PhotoView(context);
photoView.setEnabled(isZoomingAllowed);
ImageViewHolder holder = new ImageViewHolder(photoView);
holders.add(holder);
return holder;
}
示例12: instantiateItem
import com.github.chrisbanes.photoview.PhotoView; //导入依赖的package包/类
@Override
public View instantiateItem(ViewGroup container, int position) {
final String imageUrl = mData.get(position).getUrl();
View view = layoutInflater.inflate(R.layout.item_girl_detail, container, false);
PhotoView imageView = (PhotoView) view.findViewById(R.id.girl_image);
Glide.with(mContext)
.load(imageUrl)
.thumbnail(0.2f)
.into(imageView);
container.addView(view);
return view;
}
示例13: onCreate
import com.github.chrisbanes.photoview.PhotoView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pending_img);
PhotoView mImageView = (PhotoView) findViewById(R.id.img);
mImageView.setImageResource(R.drawable.name);
mImageView.setOnDragListener(new View.OnDragListener() {
@Override
public boolean onDrag(View v, DragEvent event) {
return false;
}
});
mImageView.setOnViewDragListener(new OnViewDragListener() {
@Override
public void onDrag(float dx, float dy) {
// Log.e(TAG, "onDrag: dx= " + dx);
Log.e(TAG, "onDrag: dy= " + dy);
}
});
// if (getIntent() != null) {
// ImageBean mBean = (ImageBean) getIntent().getSerializableExtra("bean");
// String url = mBean.getFilepath();
// Glide.with(this).load(url).into(mImageView);
// Log.e("onCreate", "longitude=" + mBean.getLongitude());
// Log.e("onCreate", "latitude=" + mBean.getLatitude());
// }
}
示例14: onSetLayout
import com.github.chrisbanes.photoview.PhotoView; //导入依赖的package包/类
protected void onSetLayout(final String image_url, final String cctv) {
mImage = (PhotoView) findViewById(R.id.ssz_uk_co_senab_photoview);
mCurrMatrixTv = (TextView) findViewById(R.id.ssz_debug_textview);
// mCurrMatrixTv.setText(cctv);
mCaptv = (TextView) findViewById(R.id.ssz_caption_textview);
setCaptionTextviewAdvance(mCaptv, cctv);
final ProgressBar circle = (ProgressBar) findViewById(R.id.ns_loading_progress);
Log.d(LOG_TAG, "load image with url : " + image_url + " title:" + cctv);
picasso.load(image_url).into(mImage, new Callback() {
@Override
public void onSuccess() {
mAttacher = new PhotoViewAttacher(mImage);
mAttacher.setOnMatrixChangeListener(new MatrixChangeListener());
mAttacher.setOnPhotoTapListener(new PhotoTapListener());
circle.setVisibility(View.GONE);
mImage.post(new Runnable() {
@Override
public void run() {
mAttacher.setScale(2f, mImage.getWidth() / 2, mImage.getHeight() / 2, true);
}
});
//slidrInf.unlock();
mAttacher.setScale(1.5f);
}
@Override
public void onError() {
circle.setVisibility(View.GONE);
}
});
}
示例15: instantiateItem
import com.github.chrisbanes.photoview.PhotoView; //导入依赖的package包/类
@Override
public View instantiateItem(ViewGroup container, int position) {
PhotoView photoView = new PhotoView(container.getContext());
String url = mGalleryUrls[position];
Glide.with(mContext).load(url).listener(listener).into(photoView);
// Now just add PhotoView to ViewPager and return it
container.addView(photoView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
return photoView;
}