本文整理汇总了Java中com.davemorrissey.labs.subscaleview.ImageSource类的典型用法代码示例。如果您正苦于以下问题:Java ImageSource类的具体用法?Java ImageSource怎么用?Java ImageSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImageSource类属于com.davemorrissey.labs.subscaleview包,在下文中一共展示了ImageSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadImageView
import com.davemorrissey.labs.subscaleview.ImageSource; //导入依赖的package包/类
private void loadImageView() {
final String url = getArguments().getString(ARGUMENTS_IMAGE);
Glide.with(this).downloadOnly().load(url)
/* todo replace error icon */
.apply(new RequestOptions().error(R.mipmap.qq_refresh_success))
.into(new SimpleTarget<File>() {
@Override
public void onResourceReady(File resource, Transition<? super File> transition) {
mImageView.setImage(ImageSource.uri(Uri.fromFile(resource)));
}
@Override
public void onLoadFailed(@Nullable Drawable errorDrawable) {
super.onLoadFailed(errorDrawable);
}
});
}
示例2: initData
import com.davemorrissey.labs.subscaleview.ImageSource; //导入依赖的package包/类
@Override
protected void initData() {
super.initData();
mPath = getIntent().getStringExtra("image");
getImageLoader()
.load(mPath)
.downloadOnly(new SimpleTarget<File>() {
@Override
public void onResourceReady(File resource, GlideAnimation<? super File> glideAnimation) {
if (isDestroyed())
return;
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(resource.getPath(), options);
int w = options.outWidth;
int sw = Util.getScreenWidth(LargeImageActivity.this);
float scale = (float) sw / (float) w;
mImageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CUSTOM);
mImageView.setImage(ImageSource.uri(Uri.fromFile(resource)), new ImageViewState(scale,
new PointF(0, 0), net.oschina.app.improve.utils.BitmapUtil.readPictureDegree(mPath)));
mImageSave.setVisibility(View.VISIBLE);
mLoading.stop();
mLoading.setVisibility(View.GONE);
}
});
}
示例3: loadImage
import com.davemorrissey.labs.subscaleview.ImageSource; //导入依赖的package包/类
public void loadImage(Uri uri, State state) {
setProgressBarVisibility(VISIBLE);
imageUri = uri;
String mimeType = MediaType.getMimeType(getContext(), imageUri);
if (MediaType.checkRAWMimeType(mimeType)) {
setRegionDecoderClass(RAWImageBitmapRegionDecoder.class);
} else {
setRegionDecoderClass(CustomRegionDecoder.class);
}
if (state != null) {
cropRect = state.getCropRect();
}
setImage(ImageSource.uri(uri)/*.tilingDisabled()*/, state);
}
示例4: downloadImageToPreview
import com.davemorrissey.labs.subscaleview.ImageSource; //导入依赖的package包/类
private void downloadImageToPreview() {
RequestOptions requestOptions = new RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.ALL);
Glide.with(this)
.asBitmap()
.thumbnail(0.1f)
.load(fullUrl)
.apply(requestOptions)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
pbImagePreviewLoading.hideNow();
ivPreview.setImage(ImageSource.bitmap(resource));
}
});
}
示例5: instantiateItem
import com.davemorrissey.labs.subscaleview.ImageSource; //导入依赖的package包/类
/**
* Instantiate an item. Therefor a {@link SubsamplingScaleImageView} with special decoders is
* initialized and rendered.
*
* @param container isn't used here
* @param position the current pdf page position
*/
public Object instantiateItem(ViewGroup container, int position) {
SubsamplingScaleImageView imageView = new SubsamplingScaleImageView(context);
// the smaller this number, the smaller the chance to get an "outOfMemoryException"
// still, values lower than 100 really do affect the quality of the pdf picture
int minimumTileDpi = 120;
imageView.setMinimumTileDpi(minimumTileDpi);
//sets the PDFDecoder for the imageView
imageView.setBitmapDecoderFactory(() -> new PDFDecoder(position, file, scale));
//sets the PDFRegionDecoder for the imageView
imageView.setRegionDecoderFactory(() -> new PDFRegionDecoder(position, file, scale));
ImageSource source = ImageSource.uri(file.getAbsolutePath());
imageView.setImage(source);
container.addView(imageView);
return imageView;
}
示例6: initView
import com.davemorrissey.labs.subscaleview.ImageSource; //导入依赖的package包/类
public ShowSchoolDateImgDialog initView() {
View view = LayoutInflater.from(context).inflate(R.layout.dialog_show_img, null);
ButterKnife.bind(this, view);
//开始获取图片数据
model.setOnLoadDateImgListener(new SmallToolModel.OnLoadDateImgListener() {
@Override
public void onFailed() {
loading.setVisibility(View.GONE);
Log.i("获取失败","--->");
}
@Override
public void onSucess(Bitmap bitmap) {
//获取成功后,就可以将图片显示出来了
loading.setVisibility(View.GONE);
imgview.setVisibility(View.VISIBLE);
imgview.setImage(ImageSource.bitmap(bitmap));
}
});
model.loadDateImg(Config.TERM_DATE_IMG_URL + url + ".jpg");
setContentView(view);
return this;
}
示例7: onCreateView
import com.davemorrissey.labs.subscaleview.ImageSource; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.full_image, container, false);
Glide.with(getActivity()).load("http://t0.geograph.org.uk/stamp.php?id=" + mParam1 + "&font=Helvetica&style=&weight=&gravity=South&pointsize=").asBitmap().into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
SubsamplingScaleImageView hillImageView = (SubsamplingScaleImageView) view.findViewById(R.id.hill_image);
hillImageView.setMinimumDpi(80);
hillImageView.setImage(ImageSource.bitmap(resource));
}
});
return view;
}
示例8: displayCachedImageFromBackgroundThread
import com.davemorrissey.labs.subscaleview.ImageSource; //导入依赖的package包/类
private void displayCachedImageFromBackgroundThread(ImageRequest request){
CacheKey cacheKey = DefaultCacheKeyFactory.getInstance().getEncodedCacheKey(ImageRequest.fromUri(request.getSourceUri()));
if(cacheKey != null){
BinaryResource resource = ImagePipelineFactory.getInstance().getMainDiskStorageCache().getResource(cacheKey);
if(resource != null){
File localFile = ((FileBinaryResource) resource).getFile();
if(localFile != null){
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
imagePreview.setImage(ImageSource.uri(localFile.getPath()));
}
});
}
}
}
}
示例9: instantiateItem
import com.davemorrissey.labs.subscaleview.ImageSource; //导入依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, final int position) {
View itemView = _inflater.inflate(R.layout.item_image_viewer, container, false);
container.addView(itemView);
final SubsamplingScaleImageView imageView = (SubsamplingScaleImageView) itemView.findViewById(R.id.image);
Glide.with(_context)
.load(mImageList.get(position))
.asBitmap()
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap bitmap, GlideAnimation anim) {
imageView.setImage(ImageSource.bitmap(bitmap));
}
});
return itemView;
}
示例10: onCreate
import com.davemorrissey.labs.subscaleview.ImageSource; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mImageView = $(this, R.id.picture);
mImageView.setMaxScale(3.0f);
mImageView.setImage(ImageSource.uri(getIntent().getStringExtra(EXTRA_FILE)));
mImageView.setZoomEnabled(true);
mImageView.setScaleAndCenter(1.0f, new PointF(0, 0));
setAppBarAlpha(0.7f);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
ViewCompat.setTransitionName(mImageView, TRANSIT_PIC);
mImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
hideOrShowToolbar();
}
});
}
示例11: loadBitmap
import com.davemorrissey.labs.subscaleview.ImageSource; //导入依赖的package包/类
private void loadBitmap(String url) {
// hold strong reference into target so that it does not get GC'd
mTarget = new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
setImage(ImageSource.bitmap(bitmap.copy(bitmap.getConfig(), true)));
}
@Override
public void onBitmapFailed(Drawable errorDrawable) {
}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
};
Picasso.with(getContext())
.load(url)
.into(mTarget);
}
示例12: onCreateView
import com.davemorrissey.labs.subscaleview.ImageSource; //导入依赖的package包/类
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(layout.view_pager_page, container, false);
if (savedInstanceState != null) {
if (asset == null && savedInstanceState.containsKey(BUNDLE_ASSET)) {
asset = savedInstanceState.getString(BUNDLE_ASSET);
}
}
if (asset != null) {
SubsamplingScaleImageView imageView = rootView.findViewById(id.imageView);
imageView.setImage(ImageSource.asset(asset));
}
return rootView;
}
示例13: setImagePreview
import com.davemorrissey.labs.subscaleview.ImageSource; //导入依赖的package包/类
private void setImagePreview() {
RequestOptions requestOptions = new RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.NONE);
Glide.with(this)
.asBitmap()
.thumbnail(0.1f)
.load(BookmarkManager.getInstance().getBookmarkImageFile(postId, url))
.apply(requestOptions)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
ivPreview.setImage(ImageSource.bitmap(resource));
}
});
}
示例14: instantiateItem
import com.davemorrissey.labs.subscaleview.ImageSource; //导入依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, final int position) {
View itemView = mInflater.inflate(R.layout.pager_gallery_item, container, false);
container.addView(itemView);
CastHeadShot currentItem = actorGalleryItems.get(position);
String useUrl = currentItem.fullSizeUrl;
itemView.setTag(useUrl);
// Get the border size to show around each image
int borderSize = 0;//_thumbnails.getPaddingTop();
final SubsamplingScaleImageView imageView =
(SubsamplingScaleImageView) itemView.findViewById(R.id.image);
// Asynchronously load the image and set the thumbnail and pager view
NextGenGlide.load((ActorGalleryActivity.this), useUrl)
.asBitmap()
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap bitmap, GlideAnimation anim) {
imageView.setImage(ImageSource.bitmap(bitmap));
//thumbView.setImageBitmap(bitmap);
}
});
return itemView;
}
示例15: initPhoneTableView
import com.davemorrissey.labs.subscaleview.ImageSource; //导入依赖的package包/类
public ShowImgDialog initPhoneTableView(int resourceId){
View view = LayoutInflater.from(context).inflate(R.layout.dialog_show_img,null);
ButterKnife.bind(this,view);
loading.setVisibility(View.GONE);
imgView.setImage(ImageSource.bitmap(BitmapFactory.decodeResource(context.getResources(),resourceId)));
imgView.setVisibility(View.VISIBLE);
setContentView(view);
return this;
}