当前位置: 首页>>代码示例>>Java>>正文


Java RequestCreator.fit方法代码示例

本文整理汇总了Java中com.squareup.picasso.RequestCreator.fit方法的典型用法代码示例。如果您正苦于以下问题:Java RequestCreator.fit方法的具体用法?Java RequestCreator.fit怎么用?Java RequestCreator.fit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.squareup.picasso.RequestCreator的用法示例。


在下文中一共展示了RequestCreator.fit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: show

import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
@Override
public void show() {
  RequestCreator creator = Picasso.with(imageView != null ? imageView.getContext() : context)
      .load(url);

  if (transformation != null) {
    creator.transform(transformation);
  }

  if (placeholder != null) {
    creator.placeholder(placeholder);
  }

  if (with > 0 && height > 0) {
    creator.resize(with, height);
  }

  if (centerCrop) {
    creator.centerCrop();
  }

  if (fit) {
    creator.fit();
  }

  if (target != null) {
    creator.into(target);
  } else {
    creator.into(imageView);
  }
}
 
开发者ID:tonilopezmr,项目名称:Game-of-Thrones,代码行数:32,代码来源:PicassoImageLoader.java

示例2: bindEventAndShow

import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
private void bindEventAndShow(
        @NonNull final ImageView targetImageView,
        @NonNull final String mURI
) {

    //  mLoadListener.onStart(me);
    final Picasso p = Picasso.with(mContext);
    final RequestCreator mreq = p.load(mURI);
    if (getEmpty() != 0) {
        mreq.placeholder(getEmpty());
    }
    if (getError() != 0) {
        mreq.error(getError());
    }
    if (mImageLocalStorageEnable) {
        mreq.memoryPolicy(MemoryPolicy.NO_STORE, MemoryPolicy.NO_CACHE);
    }
    switch (mScaleType) {
        case Fit:
            mreq.fit();
            break;
        case CenterCrop:
            mreq.fit().centerCrop();
            break;
        case CenterInside:
            mreq.fit().centerInside();
            break;
    }

    mreq.into(targetImageView, new Callback() {
        @Override
        public void onSuccess() {
            //  if (v.findViewById(R.id.ns_loading_progress) != null) {
            //    hideoutView(v.findViewById(R.id.ns_loading_progress));
            //  }

            if (mLongClickSaveImage && fmg != null) {
                targetImageView.setOnLongClickListener(new View.OnLongClickListener() {
                    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
                    @Override
                    public boolean onLongClick(View v) {
                        prepare_request_save_image = mreq;
                        final saveImageDialog saveImageDial = new saveImageDialog();
                        saveImageDial.show(fmg.get(), "DESC_SAVE_IM");
                        return false;
                    }
                });
            }
        }

        @Override
        public void onError() {
            //if (mLoadListener != null) {
            //     mLoadListener.onEnd(false, me);
            // }
        }
    });

}
 
开发者ID:jjhesk,项目名称:LoyalNativeSlider,代码行数:60,代码来源:CompactSliderView.java

示例3: bindCompatPicasso

import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
protected void bindCompatPicasso(String mURI, final MiniSliderFrame Fr) {

        final Picasso p = Picasso.with(mContext);
        final RequestCreator mreq = p.load(mURI);
        if (getEmpty() != 0) {
            mreq.placeholder(getEmpty());
        }
        if (getError() != 0) {
            mreq.error(getError());
        }
        if (mImageLocalStorageEnable) {
            mreq.memoryPolicy(MemoryPolicy.NO_STORE, MemoryPolicy.NO_CACHE);
        }
        switch (mScaleType) {
            case Fit:
                mreq.fit();
                break;
            case CenterCrop:
                mreq.fit().centerCrop();
                break;
            case CenterInside:
                mreq.fit().centerInside();
                break;
        }


        mreq.into(Fr.getImageTarget(), new Callback() {
            @Override
            public void onSuccess() {
                hideoutView(Fr.getLoadingBar());
                if (mLongClickSaveImage && fmg != null) {
                    Fr.getTouch().setOnLongClickListener(new View.OnLongClickListener() {
                        @TargetApi(Build.VERSION_CODES.HONEYCOMB)
                        @Override
                        public boolean onLongClick(View v) {
                            prepare_request_save_image = mreq;
                            final saveImageDialog saveImageDial = new saveImageDialog();
                            saveImageDial.show(fmg.get(), "DESC_SAVE_IM");
                            return false;
                        }
                    });
                }
            }

            @Override
            public void onError() {
                //if (mLoadListener != null) {
                //     mLoadListener.onEnd(false, me);
                // }
            }
        });
    }
 
开发者ID:jjhesk,项目名称:LoyalNativeSlider,代码行数:53,代码来源:CompactFrameSliderView.java

示例4: loadByPicasso

import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
protected void loadByPicasso(final View v, ImageView targetImageView) {
    final BaseSliderView me = this;
    Picasso p = Picasso.with(mContext);
    RequestCreator rq;
    if (mUrl != null) {
        rq = p.load(mUrl);
    } else if (mFile != null) {
        rq = p.load(mFile);
    } else if (mRes != 0) {
        rq = p.load(mRes);
    } else {
        return;
    }

    if (rq == null) {
        return;
    }
    if (getImageResForEmpty() != 0) {
        rq.placeholder(getImageResForEmpty());
    }
    if (getImageResForError() != 0) {
        rq.error(getImageResForError());
    }

    switch (mScaleType) {
        case Fit:
            rq.fit();
            break;
        case CenterCrop:
            rq.fit().centerCrop();
            break;
        case CenterInside:
            rq.fit().centerInside();
            break;
    }

    rq.into(targetImageView, new Callback() {
        @Override
        public void onSuccess() {
            if (v.findViewById(R.id.loading_bar) != null) {
                v.findViewById(R.id.loading_bar).setVisibility(View.INVISIBLE);
            }
            if (mBitmapLoadListener != null) {
                mBitmapLoadListener.onLoadComplete(me);
            }
        }

        @Override
        public void onError() {
            if (mBitmapLoadListener != null) {
                mBitmapLoadListener.onLoadFail(me);
            }
        }
    });
}
 
开发者ID:Thewhitelight,项目名称:SiYuNote,代码行数:56,代码来源:BaseSliderView.java

示例5: loadThumbnailForAssetWithSize

import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
/**
 * Loads a thumbnail of an Asset to a given ImageView.
 * If explicit dimensions are specified ({@code width} and {@code height}) those will be
 * passed as URL parameters to allow server-side scaling of the image.
 */
public static void loadThumbnailForAssetWithSize(Context context, CDAAsset asset,
    ImageView imageView, @Nullable Integer width, @Nullable Integer height,
    boolean centerCropRemoteImages) {

  Integer thumbnailResId = Utils.getThumbnailResIdForAsset(asset);
  RequestCreator rc;
  Picasso picasso = Picasso.with(context);
  boolean hasExplicitDimensions = width != null && height != null;

  if (thumbnailResId == null) {
    String url = "http:" + asset.url();

    if (hasExplicitDimensions) {
      if (url.contains("?")) {
        url += "&";
      } else {
        url += "?";
      }
      url += "w=" + width + "&h=" + height;
    }

    rc = picasso.load(url);

    if (hasExplicitDimensions) {
      rc.resize(width, height);
    } else {
      rc.fit();
    }

    if (centerCropRemoteImages) {
      rc.centerCrop();
    } else {
      rc.centerInside();
    }
  } else {
    rc = picasso.load(thumbnailResId).fit().centerCrop();
  }

  rc.into(imageView);
}
 
开发者ID:contentful,项目名称:discovery-app-android,代码行数:46,代码来源:Utils.java


注:本文中的com.squareup.picasso.RequestCreator.fit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。