use of com.facebook.imagepipeline.common.ResizeOptions in project android-client by GenesisVision.
the class ProgramLogoView method setImage.
public void setImage(String imageId, String programColorHex, int width, int height) {
if (imageId == null || imageId.isEmpty()) {
GenericDraweeHierarchy hierarchy = image.getHierarchy();
hierarchy.setBackgroundImage(new ColorDrawable(Color.parseColor(programColorHex)));
image.setHierarchy(hierarchy);
image.setImageURI("");
return;
}
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(ImageUtils.getImageUri(imageId))).setResizeOptions(new ResizeOptions(width, height)).build();
PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder().setOldController(image.getController()).setImageRequest(request).build();
image.setController(controller);
}
use of com.facebook.imagepipeline.common.ResizeOptions in project android-client by GenesisVision.
the class ProgramDetailsActivity method updateHeader.
private void updateHeader() {
GenericDraweeHierarchy hierarchy = programLogo.getHierarchy();
hierarchy.setBackgroundImage(new ColorDrawable(Color.parseColor(model.getProgramColor())));
programLogo.setHierarchy(hierarchy);
if (model.getAvatar() != null && !model.getAvatar().isEmpty()) {
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(ImageUtils.getImageUri(model.getAvatar()))).setResizeOptions(new ResizeOptions(300, 300)).build();
PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder().setOldController(programLogo.getController()).setImageRequest(request).build();
programLogo.setController(controller);
}
toolbarProgramLogo.setImage(model.getAvatar(), model.getProgramColor(), 50, 50);
toolbarProgramLogo.hideLevel();
int level = model.getLevel();
if (level > 0) {
this.levelGroup.setVisibility(View.VISIBLE);
this.level.setText(String.valueOf(level));
int[] levelColors = getResources().getIntArray(R.array.levelColors);
if (level > levelColors.length) {
level = levelColors.length;
}
levelColor.setColorFilter(levelColors[level - 1]);
levelProgress.setProgress(model.getLevelProgress().intValue());
} else {
this.levelGroup.setVisibility(View.GONE);
}
programName.setText(model.getProgramName());
toolbarProgramName.setText(model.getProgramName());
setTags();
setNotificationsButtonImage(model.isHasNotifications());
setFavoriteButtonImage(model.isFavorite());
}
use of com.facebook.imagepipeline.common.ResizeOptions in project android-client by GenesisVision.
the class FundDetailsActivity method updateHeader.
private void updateHeader() {
GenericDraweeHierarchy hierarchy = fundLogo.getHierarchy();
hierarchy.setBackgroundImage(new ColorDrawable(Color.parseColor(model.getFundColor())));
fundLogo.setHierarchy(hierarchy);
if (model.getLogo() != null && !model.getLogo().isEmpty()) {
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(ImageUtils.getImageUri(model.getLogo()))).setResizeOptions(new ResizeOptions(300, 300)).build();
PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder().setOldController(fundLogo.getController()).setImageRequest(request).build();
fundLogo.setController(controller);
}
toolbarFundLogo.setImage(model.getLogo(), model.getFundColor(), 50, 50);
toolbarFundLogo.hideLevel();
fundName.setText(model.getFundName());
toolbarFundName.setText(model.getFundName());
setNotificationsButtonImage(model.isHasNotifications());
setFavoriteButtonImage(model.isFavorite());
}
Aggregations