use of com.github.piasy.biv.view.BigImageView in project BBS-Android by bdpqchen.
the class BigPhotoActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
super.onCreate(savedInstanceState);
url = getIntent().getStringExtra(IMG_URL);
BigImageView bigImageView = (BigImageView) findViewById(R.id.image);
bigImageView.setImageSaveCallback(new ImageSaveCallback() {
@Override
public void onSuccess(String uri) {
SnackBarUtil.normal(BigPhotoActivity.this, "已保存至Pictures");
}
@Override
public void onFail(Throwable t) {
SnackBarUtil.error(BigPhotoActivity.this, "保存失败,请检查相关权限设置", true);
}
});
mIvSave.setOnClickListener(v -> {
if (ActivityCompat.checkSelfPermission(BigPhotoActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(BigPhotoActivity.this, new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, 0);
}
bigImageView.saveImageIntoGallery();
});
bigImageView.setProgressIndicator(new ProgressPieIndicator());
bigImageView.showImage(Uri.parse(url));
// Glide.with(this).load(url).placeholder(R.drawable.vista_title).crossFade().into(imageView);
}
use of com.github.piasy.biv.view.BigImageView in project BigImageViewer by Piasy.
the class GlideImageLoader method showThumbnail.
@Override
public View showThumbnail(BigImageView parent, Uri thumbnail, int scaleType) {
ImageView thumbnailView = (ImageView) LayoutInflater.from(parent.getContext()).inflate(R.layout.ui_glide_thumbnail, parent, false);
switch(scaleType) {
case BigImageView.INIT_SCALE_TYPE_CENTER_CROP:
thumbnailView.setScaleType(ImageView.ScaleType.CENTER_CROP);
break;
case BigImageView.INIT_SCALE_TYPE_CENTER_INSIDE:
thumbnailView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
default:
break;
}
mRequestManager.load(thumbnail).into(thumbnailView);
return thumbnailView;
}
use of com.github.piasy.biv.view.BigImageView in project BigImageViewer by Piasy.
the class ImageTypesActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_image_type);
mRootLayout = findViewById(R.id.rootLayout);
Spinner spLoader = findViewById(R.id.spLoader);
spLoader.setAdapter(getArrayAdapter(IMAGE_LOADERS));
spLoader.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(final AdapterView<?> parent, final View view, final int position, final long id) {
mImageLoader = IMAGE_LOADERS.get(position).value;
}
@Override
public void onNothingSelected(final AdapterView<?> parent) {
}
});
Spinner spType = findViewById(R.id.spType);
spType.setAdapter(getArrayAdapter(IMAGE_TYPES));
spType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(final AdapterView<?> parent, final View view, final int position, final long id) {
mImageType = IMAGE_TYPES.get(position).value;
}
@Override
public void onNothingSelected(final AdapterView<?> parent) {
}
});
findViewById(R.id.load).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
if (mBiv != null) {
mRootLayout.removeView(mBiv);
}
ImageViewFactory imageViewFactory;
switch(mImageLoader) {
case IMAGE_LOADER_FRESCO:
BigImageViewer.initialize(FrescoImageLoader.with(getApplicationContext()));
imageViewFactory = new FrescoImageViewFactory();
break;
case IMAGE_LOADER_GLIDE:
BigImageViewer.initialize(GlideImageLoader.with(getApplicationContext()));
imageViewFactory = new GlideImageViewFactory();
break;
default:
return;
}
mBiv = new BigImageView(ImageTypesActivity.this);
mBiv.setImageViewFactory(imageViewFactory);
mBiv.setProgressIndicator(new ProgressPieIndicator());
mRootLayout.addView(mBiv, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
mBiv.showImage(Uri.parse(IMAGE_URLS.get(mImageType)));
}
});
}
Aggregations