當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。