Search in sources :

Example 1 with ProgressPieIndicator

use of com.github.piasy.biv.indicator.progresspie.ProgressPieIndicator in project BigImageViewer by Piasy.

the class LongImageActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    BigImageViewer.initialize(FrescoImageLoader.with(getApplicationContext()));
    setContentView(R.layout.activity_big_image);
    mBigImageView = 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) {
            dialog = showDialog();
            dialog.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("https://ww1.sinaimg.cn/mw690/005Fj2RDgw1f9mvl4pivvj30c82ougw3.jpg"));
        }
    });
}
Also used : ImageSaveCallback(com.github.piasy.biv.view.ImageSaveCallback) ProgressPieIndicator(com.github.piasy.biv.indicator.progresspie.ProgressPieIndicator) BigImageView(com.github.piasy.biv.view.BigImageView) TextView(android.widget.TextView) View(android.view.View)

Example 2 with ProgressPieIndicator

use of com.github.piasy.biv.indicator.progresspie.ProgressPieIndicator 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);
}
Also used : ImageSaveCallback(com.github.piasy.biv.view.ImageSaveCallback) BigImageView(com.github.piasy.biv.view.BigImageView) ProgressPieIndicator(com.github.piasy.biv.indicator.progresspie.ProgressPieIndicator)

Example 3 with ProgressPieIndicator

use of com.github.piasy.biv.indicator.progresspie.ProgressPieIndicator 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)));
        }
    });
}
Also used : BigImageView(com.github.piasy.biv.view.BigImageView) Spinner(android.widget.Spinner) ProgressPieIndicator(com.github.piasy.biv.indicator.progresspie.ProgressPieIndicator) BigImageView(com.github.piasy.biv.view.BigImageView) View(android.view.View) AdapterView(android.widget.AdapterView) FrescoImageViewFactory(com.github.piasy.biv.view.FrescoImageViewFactory) ImageViewFactory(com.github.piasy.biv.view.ImageViewFactory) FrescoImageViewFactory(com.github.piasy.biv.view.FrescoImageViewFactory) GlideImageViewFactory(com.github.piasy.biv.view.GlideImageViewFactory) AdapterView(android.widget.AdapterView) GlideImageViewFactory(com.github.piasy.biv.view.GlideImageViewFactory)

Aggregations

ProgressPieIndicator (com.github.piasy.biv.indicator.progresspie.ProgressPieIndicator)3 BigImageView (com.github.piasy.biv.view.BigImageView)3 View (android.view.View)2 ImageSaveCallback (com.github.piasy.biv.view.ImageSaveCallback)2 AdapterView (android.widget.AdapterView)1 Spinner (android.widget.Spinner)1 TextView (android.widget.TextView)1 FrescoImageViewFactory (com.github.piasy.biv.view.FrescoImageViewFactory)1 GlideImageViewFactory (com.github.piasy.biv.view.GlideImageViewFactory)1 ImageViewFactory (com.github.piasy.biv.view.ImageViewFactory)1