Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (mMainImageView.getWidth() > 0) { // View is laid out
- Log.d(TAG, "VIEW WIDTH: " + mMainImageView.getWidth());
- Picasso
- .with(mContext)
- .load(file)
- .into(mMainImageView);
- }
- else
- mMainImageView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
- @Override
- public void onGlobalLayout() {
- Log.d(TAG, "VIEW WIDTH: " + mMainImageView.getWidth());
- Picasso
- .with(mContext)
- .load(file)
- .into(mMainImageView);
- // mMainImageView.setImageBitmap(
- // InfUtils.getSampledBitmapByWidth(
- // mMainImageView.getWidth(),
- // file
- // )
- // );
- // Picasso
- // .with(mContext)
- // .load(file)
- // .fit()
- // .centerInside()
- // .placeholder(R.drawable.doc_placeholder)
- // .into(mMainImageView);
- // FIXME: 31.12.2016 blink
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
- mMainImageView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
- }
- else {
- mMainImageView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement