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


Java Target类代码示例

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


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

示例1: displayCommunityCover

import com.squareup.picasso.Target; //导入依赖的package包/类
@Override
public void displayCommunityCover(boolean enabled, String resource) {
    if (enabled) {
        PicassoInstance.with()
                .load(resource)
                .into(new Target() {
                    @Override
                    public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
                        Drawable drawable = new BitmapDrawable(getResources(), bitmap);
                        mHeaderHolder.vgCover.setBackground(drawable);
                    }

                    @Override
                    public void onBitmapFailed(Exception e, Drawable errorDrawable) {
                        //do nothing
                    }

                    @Override
                    public void onPrepareLoad(Drawable placeHolderDrawable) {
                        //do nothing
                    }
                });
    }
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:25,代码来源:GroupWallFragment.java

示例2: setAvatar

import com.squareup.picasso.Target; //导入依赖的package包/类
private void setAvatar() {
    String s = mTeacher.getTeacher_avatar();
    if (FunctionHelper.isEmpty(s)) {
        img_avatar.setImageResource(R.drawable.person_placeholder);
    } else {
        Picasso.with(mContext)
                .load("file://" + s)
                .error(R.drawable.person_placeholder)
                .into(new Target() {
                    @Override
                    public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
                        img_avatar.setImageBitmap(bitmap);
                    }

                    @Override
                    public void onBitmapFailed(Drawable errorDrawable) {
                        img_avatar.setImageDrawable(errorDrawable);
                        FunctionHelper.makeLToast(mContext, mResources.getString(R.string.error_load_image));
                    }

                    @Override
                    public void onPrepareLoad(Drawable placeHolderDrawable) {
                    }
                });
    }
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:27,代码来源:DetailTeacherActivity.java

示例3: saveToGallery

import com.squareup.picasso.Target; //导入依赖的package包/类
private void saveToGallery() {
    Picasso.with(getActivity()).load(mImage).into(new Target() {
        @Override
        public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
            final String uri = MediaStore.Images.Media.insertImage(Inject.contentResolver(), bitmap, "", "");

            final ContentValues values = new ContentValues();
            values.put(MediaStore.Images.Media.DATE_TAKEN, System.currentTimeMillis());
            Inject.contentResolver().update(Uri.parse(uri), values, null, null);

            getActivity().sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse(uri)));
            Snackbar.make(getActivity().findViewById(R.id.coordinator),
                    R.string.image_saved, Snackbar.LENGTH_SHORT).show();
        }

        @Override
        public void onBitmapFailed(Drawable errorDrawable) {

        }

        @Override
        public void onPrepareLoad(Drawable placeHolderDrawable) {

        }
    });
}
 
开发者ID:mecid,项目名称:robird-reborn,代码行数:27,代码来源:ImageFragment.java

示例4: getNightThemeTarget

import com.squareup.picasso.Target; //导入依赖的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) {

		}
	};
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:19,代码来源:ChannelActivity.java

示例5: loadStreamerInfoAlbumArt

import com.squareup.picasso.Target; //导入依赖的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);
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:26,代码来源:PlayerService.java

示例6: loadLoadingUrl

import com.squareup.picasso.Target; //导入依赖的package包/类
private void loadLoadingUrl(@NonNull final String url, @NonNull final String loadingUrl, final boolean loadingBlur) {
    final List<Transformation> transformations = new ArrayList<>();

    if (loadingBlur) {
        transformations.add(new BlurTransformation(getContext()));
    }

    Picasso.with(getContext()).load(loadingUrl).transform(transformations).into(new Target() {
        @Override
        public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
            loadUrl(url, bitmap);
        }

        @Override
        public void onBitmapFailed(Drawable errorDrawable) {

        }

        @Override
        public void onPrepareLoad(Drawable placeHolderDrawable) {

        }
    });
}
 
开发者ID:dmallcott,项目名称:DismissibleImageView,代码行数:25,代码来源:FullScreenImageFragment.java

示例7: loadFromUrlToBitmap

import com.squareup.picasso.Target; //导入依赖的package包/类
public static void loadFromUrlToBitmap(ViewContext context, String url,
                                       LoadBitmapCallback callback)
{
    if (url.isEmpty()) {
        callback.onLoaded(null);
        return;
    }

    Target target = new Target() {
        @Override
        public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
            callback.onLoaded(bitmap);
        }

        @Override
        public void onBitmapFailed(Drawable errorDrawable) {
            callback.onLoaded(null);
        }

        @Override
        public void onPrepareLoad(Drawable placeHolderDrawable) {
        }
    };

    Picasso.with(context.getInstance()).load(url).into(target);
}
 
开发者ID:humaniq,项目名称:humaniq-android,代码行数:27,代码来源:ImageTool.java

示例8: showImage

import com.squareup.picasso.Target; //导入依赖的package包/类
public void showImage(final Picasso picasso, final Uri uri, CalculatedDimensions dimensions) {

        if(uri == null || uri.equals(this.uri)) {
            L.d(LOG_TAG, "Image already loaded. " + uri);
            return;
        }

        // cancel running picasso operations
        if(this.picasso != null) {
            this.picasso.cancelRequest((Target) this);
            this.picasso.cancelRequest((ImageView) this);
        }

        this.uri = uri;
        this.picasso = picasso;
        this.rawImageWidth = dimensions.rawImageWidth;
        this.rawImageHeight = dimensions.rawImageHeight;
        this.viewHeight = dimensions.viewHeight;
        this.viewWidth = dimensions.viewWidth;

        startImageLoading(picasso, uri, viewWidth, rawImageWidth, rawImageHeight);
    }
 
开发者ID:zendesk,项目名称:belvedere,代码行数:23,代码来源:FixedWidthImageView.java

示例9: setupForTaxon

import com.squareup.picasso.Target; //导入依赖的package包/类
public void setupForTaxon(final Taxon taxon) {
    Target target = new Target() {
        @Override
        public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
            icon.setImageBitmap(Blender.blendDrawable(bitmap, ContextCompat.getColor(icon.getContext(), R.color.googleYellow)));
        }

        @Override
        public void onBitmapFailed(Drawable errorDrawable) {}

        @Override
        public void onPrepareLoad(Drawable placeHolderDrawable) {}
    };
    icon.setTag(target);
    Picasso.with(icon.getContext()).load(taxon.getIconUrl()).into(target);

    label.setText(taxon.getName());

    view.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            drawerActionListener.onTaxonSelected(taxon);
        }
    });
}
 
开发者ID:vinsol-spree-contrib,项目名称:spree-android,代码行数:26,代码来源:DrawerPageItemRowLinearHolder.java

示例10: setupForTaxon

import com.squareup.picasso.Target; //导入依赖的package包/类
private void setupForTaxon(Taxon taxon) {
    Target target = new Target() {
        @Override
        public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
            icon.setImageBitmap(Blender.blendDrawable(bitmap, ContextCompat.getColor(getContext(), R.color.googleYellow)));
        }

        @Override
        public void onBitmapFailed(Drawable errorDrawable) {}

        @Override
        public void onPrepareLoad(Drawable placeHolderDrawable) {}
    };
    icon.setTag(target);

    Picasso.with(icon.getContext())
            .load(taxon.getIconUrl())
            .into(target);

    label.setText(taxon.getName());
}
 
开发者ID:vinsol-spree-contrib,项目名称:spree-android,代码行数:22,代码来源:BlockItem.java

示例11: createDetailsOverviewRow

import com.squareup.picasso.Target; //导入依赖的package包/类
private DetailsOverviewRow createDetailsOverviewRow() {
	final DetailsOverviewRow detailsRow = new DetailsOverviewRow(mItem);

	Picasso.with(getActivity()).load(mHeroImage).into(new Target() {
		@Override
		public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
			detailsRow.setImageBitmap(getActivity(), bitmap);
			mAdapter.notifyArrayItemRangeChanged(0, mAdapter.size());

		}

		@TargetApi(Build.VERSION_CODES.LOLLIPOP)
		@Override
		public void onBitmapFailed(Drawable errorDrawable) {
			if(VersionUtils.isLollipop())
				getActivity().startPostponedEnterTransition();
		}

		@Override
		public void onPrepareLoad(Drawable placeHolderDrawable) {

		}
	});
	return detailsRow;
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:26,代码来源:PTVBaseDetailsFragment.java

示例12: getTargetForPois

import com.squareup.picasso.Target; //导入依赖的package包/类
private Target getTargetForPois(final Place place, final int idPlaceToGo) {
    return new Target() {
        @Override
        public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
            bitmap = bitmapHelper.getTintedBitmap(bitmap, ContextCompat.getColor(getContext(), R.color.orange));
            bitmap = bitmapHelper.getScaledBitmap(bitmap, (int) getResources().getDimension(R.dimen._30dp));
            markersMap.put(addMarkerPoi(place, BitmapDescriptorFactory.fromBitmap(bitmap), idPlaceToGo), place);
        }

        @Override
        public void onBitmapFailed(Drawable errorDrawable) {
            markersMap.put(addMarkerPoi(place, getIconPoi(), idPlaceToGo), place);
        }

        @Override
        public void onPrepareLoad(Drawable placeHolderDrawable) {

        }
    };
}
 
开发者ID:miguelbcr,项目名称:RxGpsService,代码行数:21,代码来源:PlaceMapFragment.java

示例13: loadImage

import com.squareup.picasso.Target; //导入依赖的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
            getVRLibrary().onTextureResize(bitmap.getWidth(),bitmap.getHeight());

            // texture
            callback.texture(bitmap);
            cancelBusy();
        }

        @Override
        public void onBitmapFailed(Drawable errorDrawable) {

        }

        @Override
        public void onPrepareLoad(Drawable placeHolderDrawable) {

        }
    };
    Picasso.with(getApplicationContext()).load(uri).resize(3072,2048).centerInside().memoryPolicy(NO_CACHE, NO_STORE).into(mTarget);
}
 
开发者ID:RealWei,项目名称:md360,代码行数:25,代码来源:BitmapPlayerActivity.java

示例14: onProvideBitmap

import com.squareup.picasso.Target; //导入依赖的package包/类
@Override
public void onProvideBitmap(final MD360BitmapTexture.Callback callback) {
    if (model == null) {
        return;
    }

    Picasso.with(itemView.getContext()).load(model.uri).into(new Target() {
        @Override
        public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
            vrlib.onTextureResize(bitmap.getWidth(), bitmap.getHeight());
            callback.texture(bitmap);
        }

        @Override
        public void onBitmapFailed(Drawable errorDrawable) {

        }

        @Override
        public void onPrepareLoad(Drawable placeHolderDrawable) {

        }
    });
}
 
开发者ID:ashqal,项目名称:MD360Player4Android,代码行数:25,代码来源:RecyclerViewActivity.java

示例15: onProvideBitmap

import com.squareup.picasso.Target; //导入依赖的package包/类
@Override
public void onProvideBitmap(final Uri uri, final MD360BitmapTexture.Callback callback) {

    final Target target = new Target() {

        @Override
        public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
            // texture
            callback.texture(bitmap);
            targetMap.remove(uri);
        }

        @Override
        public void onBitmapFailed(Drawable errorDrawable) {
            targetMap.remove(uri);
        }

        @Override
        public void onPrepareLoad(Drawable placeHolderDrawable) {

        }
    };
    targetMap.put(uri, target);
    Picasso.with(getApplicationContext()).load(uri).resize(callback.getMaxTextureSize(),callback.getMaxTextureSize()).onlyScaleDown().centerInside().memoryPolicy(NO_CACHE, NO_STORE).into(target);
}
 
开发者ID:ashqal,项目名称:MD360Player4Android,代码行数:26,代码来源:MD360PlayerActivity.java


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