本文整理汇总了Java中com.squareup.picasso.Picasso.LoadedFrom方法的典型用法代码示例。如果您正苦于以下问题:Java Picasso.LoadedFrom方法的具体用法?Java Picasso.LoadedFrom怎么用?Java Picasso.LoadedFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.squareup.picasso.Picasso
的用法示例。
在下文中一共展示了Picasso.LoadedFrom方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadStreamerInfoAlbumArt
import com.squareup.picasso.Picasso; //导入方法依赖的package包/类
private void loadStreamerInfoAlbumArt() {
Target loadArtTarget = new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
if (mediaSession != null && mediaSession.isActive()) {
mediaSession.setMetadata(getMediaSessionData(bitmap));
}
mChannelInfo.setLogoImage(bitmap);
if (lastNotificationAction != null) {
buildNotification(lastNotificationAction);
}
}
@Override
public void onBitmapFailed(Drawable errorDrawable) {
}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
};
Picasso.with(this).load(mChannelInfo.getLogoURLString()).into(loadArtTarget);
}
示例2: getNightThemeTarget
import com.squareup.picasso.Picasso; //导入方法依赖的package包/类
private Target getNightThemeTarget() {
return new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
streamerImage.setImageBitmap(bitmap);
}
@Override
public void onBitmapFailed(Drawable errorDrawable) {
}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
};
}
示例3: loadImage
import com.squareup.picasso.Picasso; //导入方法依赖的package包/类
private void loadImage(Uri uri, final MD360BitmapTexture.Callback callback){
mTarget = new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
// notify if size changed
mVRLibrary.onTextureResize(bitmap.getWidth(), bitmap.getHeight());
// texture
callback.texture(bitmap);
imagenCargada();
}
@Override
public void onBitmapFailed(Drawable errorDrawable) {}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {}
};
//Cargo la imagen con Picasso, me aseguro de que no la guarde en cache
//que la reescale para ser más pequeña, que la centre y que la ponga
//en el target
Picasso.with(getApplicationContext())
.load(uri)
.resize(callback.getMaxTextureSize(),callback.getMaxTextureSize())
.onlyScaleDown()
.centerInside()
.memoryPolicy(NO_CACHE, NO_STORE)
.into(mTarget);
}
示例4: onBitmapLoaded
import com.squareup.picasso.Picasso; //导入方法依赖的package包/类
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
Drawable drawable = new BitmapDrawable(getContext().getResources(), bitmap);
drawable.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight());
urlDrawable.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight());
urlDrawable.setDrawable(drawable);
RichTextView.this.setText(getText());
}
示例5: onBitmapLoaded
import com.squareup.picasso.Picasso; //导入方法依赖的package包/类
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom loadedFrom) {
Drawable bitmapDrawable = new BitmapDrawable(mContext.getResources(), bitmap);
mImageCardView.setMainImageScaleType(ImageView.ScaleType.CENTER_CROP);
// Do not fade-in when loading from cache memory (because it is most likely instantaneous in that case)
boolean fade = (loadedFrom!= Picasso.LoadedFrom.MEMORY);
mImageCardView.setMainImage(bitmapDrawable, fade);
}
示例6: onBitmapLoaded
import com.squareup.picasso.Picasso; //导入方法依赖的package包/类
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
fetchColors(bitmap);
art.setImageBitmap(bitmap);
}
示例7: onBitmapLoaded
import com.squareup.picasso.Picasso; //导入方法依赖的package包/类
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
ch.setIcon(bitmap);
invalidate();
}
示例8: onCreateView
import com.squareup.picasso.Picasso; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_details, container, false);
ButterKnife.bind(this, view);
if (getActivity() instanceof BaseActivity) {
baseActivity = (BaseActivity) getActivity();
data = baseActivity.getData();
} else {
watchLaterActivity = (WatchLaterActivity) getActivity();
data = watchLaterActivity.getData();
}
detailsPresenter = new DetailsPresenter(this);
setupRecyclerView();
Object dataObject = data.getParcelable("ITEM");
if (dataObject instanceof Movie) {
isMovie = true;
this.movie = (Movie) dataObject;
} else {
this.tvSeries = (TvSeries) dataObject;
}
backdropTarget = new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
ivBackdropPoster.setImageBitmap(bitmap);
if (Build.VERSION.SDK_INT >= 21) {
createPaletteAsync(bitmap);
}
}
@Override
public void onBitmapFailed(Drawable errorDrawable) {
}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
};
initTransitionViews();
if (getContext() != null) {
if (Util.isConnected(getContext())) {
if (isMovie) {
detailsPresenter.fetchMovieDetails(movie.getMovieId());
} else {
detailsPresenter.fetchTvSeriesDetails(tvSeries.getTvId());
}
} else {
Toast.makeText(getContext(), "No Internet Connection", Toast.LENGTH_SHORT).show();
}
}
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (getActivity() != null) {
getActivity().onBackPressed();
}
}
});
return view;
}
示例9: onBitmapLoaded
import com.squareup.picasso.Picasso; //导入方法依赖的package包/类
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
bitmapList.put(index, bitmap);
setBitmapShaders(index, bitmap);
postInvalidate();
}
示例10: onBitmapLoaded
import com.squareup.picasso.Picasso; //导入方法依赖的package包/类
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
mBitmapCover = bitmap;
createShader();
postInvalidate();
}
示例11: onBitmapLoaded
import com.squareup.picasso.Picasso; //导入方法依赖的package包/类
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
setDrawable(new BitmapDrawable(context.getResources(), bitmap));
}
示例12: onBitmapLoaded
import com.squareup.picasso.Picasso; //导入方法依赖的package包/类
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom loadedFrom) {
mImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
mImageView.setImageBitmap(bitmap);
}
示例13: onBitmapLoaded
import com.squareup.picasso.Picasso; //导入方法依赖的package包/类
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom loadedFrom) {
if (this.mBackgroundManager.isAttached()) { // try to fix some cases of "java.lang.IllegalStateException: Must attach before setting background drawable"
this.mBackgroundManager.setBitmap(bitmap);
}
}
示例14: onBitmapLoaded
import com.squareup.picasso.Picasso; //导入方法依赖的package包/类
@Override
public final void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
final Palette palette = getPalette(bitmap);
onBitmapLoaded(bitmap, from, palette);
}
示例15: getLightThemeTarget
import com.squareup.picasso.Picasso; //导入方法依赖的package包/类
private Target getLightThemeTarget() {
return new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
streamerImage.setImageBitmap(bitmap);
Palette palette = Palette.from(bitmap).generate();
int defaultColor = Service.getColorAttribute(R.attr.colorPrimary, R.color.primary, getBaseContext());
int defaultDarkColor = Service.getColorAttribute(R.attr.colorPrimaryDark, R.color.primaryDark, getBaseContext());
int vibrant = palette.getVibrantColor(defaultColor);
int vibrantDark = palette.getDarkVibrantColor(defaultColor);
int vibrantLight = palette.getLightVibrantColor(defaultColor);
int muted = palette.getMutedColor(defaultColor);
int mutedDark = palette.getDarkMutedColor(defaultColor);
int mutedLight = palette.getLightMutedColor(defaultColor);
Palette.Swatch swatch = null;
if (vibrant != defaultColor) {
swatch = palette.getVibrantSwatch();
} else if (vibrantDark != defaultColor) {
swatch = palette.getDarkVibrantSwatch();
} else if (vibrantLight != defaultColor){
swatch = palette.getLightVibrantSwatch();
} else if (muted != defaultColor) {
swatch = palette.getMutedSwatch();
} else if (mutedDark != defaultColor) {
swatch = palette.getDarkMutedSwatch();
} else {
swatch = palette.getLightMutedSwatch();
}
if (swatch != null) {
float[] swatchValues = swatch.getHsl();
float[] newSwatch = {swatchValues[0], (float) 0.85, (float) 0.85};
float[] newSwatchComposite = {(swatchValues[0] + 180) % 360, newSwatch[1], newSwatch[2]};
float[] newSwatchDark = {newSwatch[0], newSwatch[1], (float) 0.6};
int newColorDark = Color.HSVToColor(newSwatchDark);
int newColor = Color.HSVToColor(newSwatch);
int compositeNewColor = Color.HSVToColor(newSwatchComposite);
int primaryColor = Service.getBackgroundColorFromView(toolbar, defaultColor);
int primaryColorDark = Service.getBackgroundColorFromView(mTabs, defaultDarkColor);
Service.animateBackgroundColorChange(toolbar, newColor, primaryColor, COLOR_FADE_DURATION);
Service.animateBackgroundColorChange(additionalToolbar, newColor, primaryColor, COLOR_FADE_DURATION);
Service.animateBackgroundColorChange(mTabs, newColorDark, primaryColorDark, COLOR_FADE_DURATION);
mFab.setBackgroundTintList(ColorStateList.valueOf(compositeNewColor));
mTabs.setSelectedTabIndicatorColor(compositeNewColor);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(newColorDark);
}
}
}
@Override
public void onBitmapFailed(Drawable errorDrawable) {}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {}
};
}