本文整理匯總了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;
}