com.github.chrisbanes.photoview.PhotoView Java Examples

The following examples show how to use com.github.chrisbanes.photoview.PhotoView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OtherNewPhotoSetAdapter.java    From NewFastFrame with Apache License 2.0 6 votes vote down vote up
@Override
public Object instantiateItem(ViewGroup container, final int position) {
    View view = LayoutInflater.from(container.getContext())
            .inflate(R.layout.item_activity_other_new_photo_set, null);
    PhotoView photoView = view.findViewById(R.id.pv_item_activity_other_new_photo_set_display);
    photoView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (onItemClickListener != null) {
                onItemClickListener.onItemClick(v, position);
            }
        }
    });
    BaseApplication
            .getAppComponent().getImageLoader().loadImage(container.getContext()
            , new GlideImageLoaderConfig.Builder().imageView(photoView)
                    .url(imageList.get(position)).centerInside().build());
    container.addView(view);
    return view;
}
 
Example #2
Source File: PictureAdapter.java    From v9porn with MIT License 6 votes vote down vote up
@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
    FrameLayout view = (FrameLayout) object;
    for (int i = 0; i < view.getChildCount(); i++) {
        View childView = view.getChildAt(i);
        if (childView instanceof PhotoView) {
            childView.setOnClickListener(null);
            childView.setOnLongClickListener(null);
            GlideApp.with(container).clear(childView);
            view.removeViewAt(i);
            Logger.t(TAG).d("clean photoView");
        }
    }
    container.removeView(view);
    Logger.t(TAG).d("destroyItem");
}
 
Example #3
Source File: ImagePagerAdapter.java    From ImageSelector with Apache License 2.0 6 votes vote down vote up
private void setBitmap(PhotoView imageView, Bitmap bitmap) {
    imageView.setImageBitmap(bitmap);
    if (bitmap != null) {
        int bw = bitmap.getWidth();
        int bh = bitmap.getHeight();
        int vw = imageView.getWidth();
        int vh = imageView.getHeight();
        if (bw != 0 && bh != 0 && vw != 0 && vh != 0) {
            if (1.0f * bh / bw > 1.0f * vh / vw) {
                imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
                float offset = (1.0f * bh * vw / bw - vh) / 2;
                adjustOffset(imageView, offset);
            } else {
                imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
            }
        }
    }
}
 
Example #4
Source File: PhotoActivity.java    From NetEasyNews with GNU General Public License v3.0 6 votes vote down vote up
@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);
}
 
Example #5
Source File: ComicFragment.java    From Easy_xkcd with Apache License 2.0 6 votes vote down vote up
@Override
public Object instantiateItem(final ViewGroup container, final int position) {
    View itemView = setupPager(container, position);
    final PhotoView pvComic = itemView.findViewById(R.id.ivComic);
    final TextView tvAlt = itemView.findViewById(R.id.tvAlt);
    final TextView tvTitle = itemView.findViewById(R.id.tvTitle);

    RealmComic comic = getRealmComic(position); //TODO check if comic is null

    try {
        tvAlt.setText(Html.fromHtml(comic.getAltText()));
        tvTitle.setText((prefHelper.subtitleEnabled() ? "" : comic.getComicNumber() + ": ") + Html.fromHtml(RealmComic.getInteractiveTitle(comic, getActivity())));
        pvComic.setTransitionName("im" + comic.getComicNumber());
        tvTitle.setTransitionName(String.valueOf(comic.getComicNumber()));

        loadComicImage(comic, pvComic);
    } catch (NullPointerException e) {
        Timber.e(e, "NullPointerException at %s", position);
    }


    container.addView(itemView);
    return itemView;
}
 
Example #6
Source File: ComicFragment.java    From Easy_xkcd with Apache License 2.0 6 votes vote down vote up
public boolean zoomReset() {
    int index;
    if (this instanceof FavoritesFragment)
        index = favoriteIndex;
    else
        index = lastComicNumber - 1;

    if (prefHelper.altBackButton() && !(pager.findViewWithTag(index).findViewById(R.id.tvAlt).getVisibility() == View.VISIBLE))
        return setAltText(false);

    try {
        PhotoView pv = (PhotoView) pager.findViewWithTag(index).findViewById(R.id.ivComic);
        float scale = pv.getScale();
        if (scale != 1f) {
            pv.setScale(1f, true);
            return true;
        } else {
            return false;
        }
    } catch (NullPointerException e) {
        Log.e("error", "pv nullPointer");
        return false;
    }
}
 
Example #7
Source File: PictureAdapter.java    From v9porn with MIT License 6 votes vote down vote up
@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
    FrameLayout view = (FrameLayout) object;
    for (int i = 0; i < view.getChildCount(); i++) {
        View childView = view.getChildAt(i);
        if (childView instanceof PhotoView) {
            childView.setOnClickListener(null);
            childView.setOnLongClickListener(null);
            GlideApp.with(container).clear(childView);
            view.removeViewAt(i);
            Logger.t(TAG).d("clean photoView");
        }
    }
    container.removeView(view);
    Logger.t(TAG).d("destroyItem");
}
 
Example #8
Source File: ComicFragment.java    From Easy_xkcd with Apache License 2.0 5 votes vote down vote up
protected void postImageLoadedSetupPhotoView(PhotoView pvComic, Bitmap bitmap, RealmComic comic) {
    if (themePrefs.invertColors(false) && themePrefs.bitmapContainsColor(bitmap, comic.getComicNumber()))
        pvComic.clearColorFilter();

    if (!transitionPending) {
        pvComic.setAlpha(0f);
        pvComic.animate()
                .alpha(1f)
                .setDuration(200);
    }
}
 
Example #9
Source File: FavoritesFragment.java    From Easy_xkcd with Apache License 2.0 5 votes vote down vote up
@Override
void loadComicImage(RealmComic comic, PhotoView pvComic) {
    if (!loadGif(comic.getComicNumber(), pvComic)) {
        Bitmap bitmap = RealmComic.getOfflineBitmap(comic.getComicNumber(), context, prefHelper);
        postImageLoadedSetupPhotoView(pvComic, bitmap, comic);
        if (bitmap != null) {
            pvComic.setImageBitmap(bitmap);
        } else {
            new RedownloadFavorite().execute(comic.getComicNumber()); // If the image is gone for some reason download it and refresh the fragment
        }
        postImageLoaded(comic.getComicNumber());
    }
}
 
Example #10
Source File: ImagePagerAdapter.java    From Cashew with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #11
Source File: OfflineFragment.java    From Easy_xkcd with Apache License 2.0 5 votes vote down vote up
@Override
void loadComicImage(RealmComic comic, PhotoView pvComic) {
    if (!loadGif(comic.getComicNumber(), pvComic)) {
        Bitmap bitmap = RealmComic.getOfflineBitmap(comic.getComicNumber(), context, prefHelper);
        postImageLoadedSetupPhotoView(pvComic, bitmap, comic);
        if (bitmap != null) {
            pvComic.setImageBitmap(bitmap);
        } else {
            pvComic.setTag(MISSING_IMAGE);
        }
        postImageLoaded(comic.getComicNumber());
    }
}
 
Example #12
Source File: ViewBigImageActivity.java    From CloudReader with Apache License 2.0 5 votes vote down vote up
@NonNull
@Override
public Object instantiateItem(@NonNull ViewGroup container, int position) {
    View view = getLayoutInflater().inflate(R.layout.viewpager_very_image, container, false);
    PhotoView zoomImageView = view.findViewById(R.id.zoom_image_view);
    ProgressBar spinner = view.findViewById(R.id.loading);
    spinner.setVisibility(View.GONE);
    if (imageId != 0) {
        zoomImageView.setImageResource(imageId);
    }
    zoomImageView.setOnPhotoTapListener(ViewBigImageActivity.this);
    container.addView(view, 0);
    return view;
}
 
Example #13
Source File: PendingImgActivity.java    From AndroidAnimationExercise with Apache License 2.0 5 votes vote down vote up
@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());
//        }
    }
 
Example #14
Source File: ImageViewerActivity.java    From intra42 with Apache License 2.0 5 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_image_viewer);

        String login;
        String displayName;

        if (getIntent().hasExtra(INTENT_LOGIN))
            login = getIntent().getStringExtra(INTENT_LOGIN).toLowerCase();
        else
            return;
        displayName = getIntent().getStringExtra(INTENT_DISPLAY_NAME);

        PhotoView photoView = findViewById(R.id.photoView);
        TextView textView = findViewById(R.id.textView);

        if (displayName != null && !displayName.isEmpty()) {
            textView.setVisibility(View.VISIBLE);
            textView.setText(displayName);
        } else {
            textView.setVisibility(View.GONE);
        }
        UsersLTE user = new UsersLTE();
        user.login = login;
        RequestCreator requestCreator = UserImage.getRequestCreator(this, user, "large");
        if (requestCreator != null)
            requestCreator.into(photoView);

//        photoView.setOnSingleFlingListener(new OnSingleFlingListener() {
//            @Override
//            public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
//                finish();
//                return true;
//            }
//        });
    }
 
Example #15
Source File: GirlAdapter.java    From AndroidModulePattern with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #16
Source File: PictureFragment.java    From Simpler with Apache License 2.0 5 votes vote down vote up
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);
    }
}
 
Example #17
Source File: ZoomablePicassoSwippable.java    From LoyalNativeSlider with MIT License 5 votes vote down vote up
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);
        }
    });


}
 
Example #18
Source File: GalleryAdapter.java    From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 5 votes vote down vote up
@Override
public View instantiateItem(ViewGroup container, int position) {
    PhotoView photoView = new PhotoView(container.getContext());
    String url = mGalleryUrls[position];
    GlideApp.with(mContext).load(url).listener(mRequestListener).into(photoView);

    // Now just add PhotoView to ViewPager and return it
    container.addView(photoView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    return photoView;
}
 
Example #19
Source File: ImagePagerAdapter.java    From ImageSelector with Apache License 2.0 5 votes vote down vote up
@Override
public Object instantiateItem(ViewGroup container, final int position) {
    final PhotoView currentView = viewList.remove(0);
    final Image image = mImgList.get(position);
    container.addView(currentView);
    if (image.isGif()) {
        currentView.setScaleType(ImageView.ScaleType.FIT_CENTER);
        Glide.with(mContext).load(isAndroidQ ? image.getUri() : image.getPath())
                .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE)).override(720,1080)
                .into(currentView);
    } else {
        Glide.with(mContext).asBitmap()
                .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE))
                .load(isAndroidQ ? image.getUri() : image.getPath()).into(new SimpleTarget<Bitmap>(720,1080) {
            @Override
            public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
                int bw = resource.getWidth();
                int bh = resource.getHeight();
                if (bw > 4096 || bh > 4096) {
                    Bitmap bitmap = ImageUtil.zoomBitmap(resource, 4096, 4096);
                    setBitmap(currentView, bitmap);
                } else {
                    setBitmap(currentView, resource);
                }
            }
        });
    }
    currentView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mListener != null) {
                mListener.onItemClick(position, image);
            }
        }
    });
    return currentView;
}
 
Example #20
Source File: ImagePagerAdapter.java    From ImageSelector with Apache License 2.0 5 votes vote down vote up
private void adjustOffset(PhotoView view, float offset) {
    PhotoViewAttacher attacher = view.getAttacher();
    try {
        Field field = PhotoViewAttacher.class.getDeclaredField("mBaseMatrix");
        field.setAccessible(true);
        Matrix matrix = (Matrix) field.get(attacher);
        matrix.postTranslate(0, offset);
        Method method = PhotoViewAttacher.class.getDeclaredMethod("resetMatrix");
        method.setAccessible(true);
        method.invoke(attacher);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example #21
Source File: ImageViewPagerAdapter.java    From scallop with MIT License 5 votes vote down vote up
@NonNull
@Override
public Object instantiateItem(@NonNull ViewGroup container, int position) {
    PhotoView photoView = new PhotoView(container.getContext());
    Glide.with(container.getContext()).load(imageUrlList.get(position)).into(photoView);
    container.addView(photoView, ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    return photoView;
}
 
Example #22
Source File: ImagePagerAdapter.java    From ImageSelector with Apache License 2.0 5 votes vote down vote up
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    if (object instanceof PhotoView) {
        PhotoView view = (PhotoView) object;
        view.setImageDrawable(null);
        viewList.add(view);
        container.removeView(view);
    }
}
 
Example #23
Source File: ImagePagerAdapter.java    From ImageSelector with Apache License 2.0 5 votes vote down vote up
private void createImageViews() {
    for (int i = 0; i < 4; i++) {
        PhotoView imageView = new PhotoView(mContext);
        imageView.setAdjustViewBounds(true);
        viewList.add(imageView);
    }
}
 
Example #24
Source File: ViewPagerActivity.java    From Meteorite with Apache License 2.0 5 votes vote down vote up
@Override
public View instantiateItem(ViewGroup container, int position) {
    PhotoView photoView = new PhotoView(container.getContext());
    //photoView.setImageURI(Uri.parse(gankBeans.get(position).getUrl()));
    Glide.with(container.getContext()).load(gankBeans.get(position).getUrl()).into(photoView);
    // Now just add PhotoView to ViewPager and return it
    container.addView(photoView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    return photoView;
}
 
Example #25
Source File: PhotoPreViewAdapter.java    From NewFastFrame with Apache License 2.0 5 votes vote down vote up
@Override
public Object instantiateItem(ViewGroup container, final int position) {
    View view = LayoutInflater.from(mContext).inflate(R.layout.item_activity_photo_preview, null);
    PhotoView photoView = view.findViewById(R.id.pv_item_activity_photo_preview_display);
    photoView.setOnPhotoTapListener((view1, x, y) -> {
        if (mOnPhotoViewClickListener != null) {
            mOnPhotoViewClickListener.onPhotoViewClick(view1, position);
        }
    });
    SystemUtil.ImageItem imageItem = data.get(position);
    String url = imageItem.getPath();
    if (url != null) {
        if (url.endsWith(".gif")) {
            BaseApplication
                    .getAppComponent()
                    .getImageLoader().loadImage(mContext
                    , GlideImageLoaderConfig.newBuild().cacheStrategy(GlideImageLoaderConfig.CACHE_SOURCE)
                            .asGif().override(screenWidth, screenHeight).imageView(photoView).url(url).build());
        } else {
            BaseApplication
                    .getAppComponent()
                    .getImageLoader().loadImage(mContext
                    , GlideImageLoaderConfig.newBuild().cacheStrategy(GlideImageLoaderConfig.CACHE_RESULT).centerInside().url(url).imageView(photoView).build());
        }
    }
    container.addView(view);
    return view;
}
 
Example #26
Source File: ImagePreViewFragment.java    From NewFastFrame with Apache License 2.0 5 votes vote down vote up
@Override
protected void initView() {
    display = (PhotoView) findViewById(R.id.pv_fragment_image_preview_display);
    display.setOnPhotoTapListener((view1, x, y) -> {
        getActivity().onBackPressed();
    });
    display.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
        @Override
        public boolean onPreDraw() {
            display.getViewTreeObserver().removeOnPreDrawListener(this);
            getActivity().supportStartPostponedEnterTransition();
            return true;
        }
    });
}
 
Example #27
Source File: ChatImageViewActivity.java    From NaviBee with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_chat_image_view);

    String imageFsPath = getIntent().getStringExtra("IMG_FS_PATH");
    PhotoView photoView = findViewById(R.id.chat_photo_view);
    FirebaseStorageHelper.loadImage(photoView, imageFsPath, true);

    FirebaseStorageHelper.loadImage(photoView, imageFsPath, false, this);
}
 
Example #28
Source File: ZoomFragment.java    From NClientV2 with Apache License 2.0 5 votes vote down vote up
private void createTarget() {
    target=new CustomTarget<Drawable>() {
        void applyDrawable(ImageView toShow,ImageView toHide,Drawable drawable){
            toShow.setVisibility(View.VISIBLE);
            toHide.setVisibility(View.GONE);
            toShow.setImageDrawable(drawable);
            if(toShow instanceof PhotoView)
                scalePhoto(drawable);
        }

        @Override
        public void onLoadStarted(@Nullable Drawable placeholder) {
            super.onLoadStarted(placeholder);
            applyDrawable(photoView,retryButton,placeholder);
        }

        @Override
        public void onLoadFailed(@Nullable Drawable errorDrawable) {
            super.onLoadFailed(errorDrawable);
            applyDrawable(retryButton,photoView,errorDrawable);
        }

        @Override
        public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
            applyDrawable(photoView,retryButton,resource);
        }

        @Override
        public void onLoadCleared(@Nullable Drawable placeholder) {
            applyDrawable(photoView,retryButton,placeholder);
        }
    };
}
 
Example #29
Source File: ImagePagerAdapter.java    From AndroidProject with Apache License 2.0 5 votes vote down vote up
@NonNull
@Override
public Object instantiateItem(@NonNull ViewGroup container, int position) {
    PhotoView view = new PhotoView(mActivity);
    view.setOnClickListener(this);

    GlideApp.with(container.getContext())
            .load(mData.get(position))
            .into(view);

    container.addView(view);
    return view;
}
 
Example #30
Source File: ImagePreview.java    From Hify with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ViewPump.init(ViewPump.builder()
            .addInterceptor(new CalligraphyInterceptor(
                    new CalligraphyConfig.Builder()
                            .setDefaultFontPath("fonts/bold.ttf")
                            .setFontAttrId(R.attr.fontPath)
                            .build()))
            .build());
    setContentView(R.layout.activity_image_preview);

    intent_URI=getIntent().getStringExtra("uri");
    intent_URL=getIntent().getStringExtra("url");

    PhotoView photoView = findViewById(R.id.photo_view);

    if(!TextUtils.isEmpty(intent_URI)) {
        photoView.setImageURI(Uri.parse(intent_URI));
    }else {
        if(getSharedPreferences("theme",MODE_PRIVATE).getBoolean("dark",false)) {

            Glide.with(this)
                    .setDefaultRequestOptions(new RequestOptions().placeholder(getResources().getDrawable(R.drawable.placeholder)))
                    .load(intent_URL)
                    .into(photoView);

        }else{

            Glide.with(this)
                    .setDefaultRequestOptions(new RequestOptions().placeholder(getResources().getDrawable(R.drawable.placeholder2)))
                    .load(intent_URL)
                    .into(photoView);

        }


    }

}