Skip to content

Commit

Permalink
fix placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
wailbabou committed Oct 11, 2018
1 parent f8da5ce commit e7842e8
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.Priority;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.github.chrisbanes.photoview.PhotoView;


Expand Down Expand Up @@ -52,10 +55,19 @@ public void initView(View view){
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
RequestOptions options = new RequestOptions()
.centerCrop()
.placeholder(placeholder)
.error(placeholder)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.priority(Priority.HIGH)
.dontAnimate()
.dontTransform();

if(imgUrl!=null){
Glide.with(this).load(imgUrl).into(picture);
Glide.with(this).load(imgUrl).apply(options).into(picture);
}else if(imgUri!=null){
Glide.with(this).load(imgUri).into(picture);
Glide.with(this).load(imgUri).apply(options).into(picture);
}

}
Expand Down

0 comments on commit e7842e8

Please sign in to comment.