use of com.bumptech.glide.request.RequestOptions in project Now by XunMengWinter.
the class GankAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
MyViewHolder myViewHolder = (MyViewHolder) holder;
Gank gank = mList.get(position);
myViewHolder.mNameTv.setText(gank.desc);
myViewHolder.mUrlTv.setText(gank.url);
if (gank.images != null && !gank.images.isEmpty()) {
myViewHolder.mImageIv.setVisibility(View.VISIBLE);
final String imageUrl = gank.images.get(0);
RequestOptions requestOptions = new RequestOptions();
int imageWidth = context.getResources().getDimensionPixelSize(R.dimen.width_gank_image);
requestOptions.override(imageWidth);
Glide.with(context).load(imageUrl).apply(requestOptions).into(myViewHolder.mImageIv);
// Logger.e("gank item load image failed:" + imageUrl);
// DraweeController controller = Fresco.newDraweeControllerBuilder()
// .setUri(imageUrl)
// .setAutoPlayAnimations(true)
// .build();
// myViewHolder.mImageIv.setController(controller);
} else {
myViewHolder.mImageIv.setVisibility(View.GONE);
}
}
use of com.bumptech.glide.request.RequestOptions in project Now by XunMengWinter.
the class GankDailyActivity method showLastGankImage.
private void showLastGankImage() {
String imageUrl = mPreferencesHelper.getLastGankBanner();
if (imageUrl == null || imageUrl.isEmpty()) {
return;
}
Glide.with(GankDailyActivity.this).load(imageUrl).apply(new RequestOptions().centerCrop()).into(mBannerSdv);
}
use of com.bumptech.glide.request.RequestOptions in project CustomViews by AndroidStudy233.
the class GlideUtils method loadHeadImg.
public static void loadHeadImg(Context context, String imageUrl, ImageView targetIv) {
RequestOptions requestOptions = new RequestOptions();
requestOptions.error(R.drawable.pic_head_deauft);
requestOptions.placeholder(R.drawable.pic_head_deauft);
requestOptions.circleCrop();
Glide.with(context).load(imageUrl).apply(requestOptions).into(targetIv);
}
use of com.bumptech.glide.request.RequestOptions in project drift-sdk-android by Driftt.
the class UserPopulationHelper method populateTextAndImageFromUser.
public static void populateTextAndImageFromUser(Context context, User user, @Nullable TextView textView, ImageView imageView) {
Uri uriToLoad = null;
Boolean ignoreUri = false;
if (user != null) {
if (textView != null) {
textView.setText(user.name);
}
if (user.bot) {
ignoreUri = true;
Drawable placeholderDrawable = AppCompatResources.getDrawable(context, R.drawable.robot);
Drawable backgroundDrawable = AppCompatResources.getDrawable(context, R.drawable.drift_sdk_bot_background);
DrawableCompat.setTint(backgroundDrawable, ColorHelper.getBackgroundColor());
Drawable[] layers = new Drawable[2];
layers[0] = backgroundDrawable;
layers[1] = placeholderDrawable;
LayerDrawable layerDrawable = new LayerDrawable(layers);
imageView.setImageDrawable(layerDrawable);
} else if (user.avatarUrl != null) {
uriToLoad = Uri.parse(user.avatarUrl);
}
} else {
// Unknown User
if (textView != null) {
textView.setText("Unknown User");
}
}
if (!ignoreUri) {
RequestOptions requestOptions = new RequestOptions().circleCrop().placeholder(R.drawable.placeholder);
Glide.with(context).load(uriToLoad).apply(requestOptions).into(imageView);
}
}
use of com.bumptech.glide.request.RequestOptions in project MyNewCC98 by 6769.
the class MainActivity method setupUserLogo.
private void setupUserLogo() {
UserInfo userInfo = UserConfig.getUserInfo();
if (userInfo != null) {
userNameLabel.setText(userInfo.getName());
// userIntroLabel.setText(userInfo.getIntroduction());
String userpic = userInfo.getPortraitUrl();
try {
RequestOptions options = new RequestOptions().centerCrop().dontAnimate();
Glide.with(this).load(userpic).apply(options).into(userLogo);
} catch (Exception e) {
loge(e, "Glide load userpic failed");
}
}
}
Aggregations