use of com.github.piasy.biv.view.ImageSaveCallback in project BigImageViewer by Piasy.
the class LongImageActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_big_image);
mBigImageView = (BigImageView) findViewById(R.id.mBigImage);
mBigImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
mBigImageView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
new MaterialDialog.Builder(LongImageActivity.this).items(R.array.big_image_ops).itemsCallback(new MaterialDialog.ListCallback() {
@Override
public void onSelection(MaterialDialog dialog, View itemView, int position, CharSequence text) {
if (TextUtils.equals(text, getString(R.string.save_image))) {
saveImage();
} else if (TextUtils.equals(text, getString(R.string.scan_qr_code))) {
decodeQrCode();
}
}
}).show();
return true;
}
});
mBigImageView.setImageSaveCallback(new ImageSaveCallback() {
@Override
public void onSuccess(String uri) {
Toast.makeText(LongImageActivity.this, "Success", Toast.LENGTH_SHORT).show();
}
@Override
public void onFail(Throwable t) {
t.printStackTrace();
Toast.makeText(LongImageActivity.this, "Fail", Toast.LENGTH_SHORT).show();
}
});
mBigImageView.setProgressIndicator(new ProgressPieIndicator());
findViewById(R.id.mBtnLoad).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mBigImageView.showImage(Uri.parse("http://ww1.sinaimg.cn/mw690/005Fj2RDgw1f9mvl4pivvj30c82ougw3.jpg"));
}
});
}
Aggregations