Search in sources :

Example 1 with ImageSaveCallback

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"));
        }
    });
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) ProgressPieIndicator(com.github.piasy.biv.indicator.progresspie.ProgressPieIndicator) BigImageView(com.github.piasy.biv.view.BigImageView) View(android.view.View) ImageSaveCallback(com.github.piasy.biv.view.ImageSaveCallback)

Aggregations

View (android.view.View)1 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)1 ProgressPieIndicator (com.github.piasy.biv.indicator.progresspie.ProgressPieIndicator)1 BigImageView (com.github.piasy.biv.view.BigImageView)1 ImageSaveCallback (com.github.piasy.biv.view.ImageSaveCallback)1