本文整理汇总了Java中com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView类的典型用法代码示例。如果您正苦于以下问题:Java SubsamplingScaleImageView类的具体用法?Java SubsamplingScaleImageView怎么用?Java SubsamplingScaleImageView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SubsamplingScaleImageView类属于com.davemorrissey.labs.subscaleview包,在下文中一共展示了SubsamplingScaleImageView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setWallpaper
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入依赖的package包/类
private void setWallpaper() {
try {
WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
InputStream inputStream = getContentResolver().openInputStream(imageUri);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Rect croppedRect = getCroppedRect();
wallpaperManager.setStream(inputStream, croppedRect, true);
} else {
wallpaperManager.setStream(inputStream);
}
SubsamplingScaleImageView imageView = findViewById(R.id.imageView);
imageView.recycle();
this.finish();
} catch (IOException | IllegalArgumentException e) {
e.printStackTrace();
Toast.makeText(this, R.string.error, Toast.LENGTH_SHORT).show();
}
}
示例2: onViewCreated
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mImageView = view.findViewById(R.id.siv_raw_imageview);
mImageView.setDismissListener(this);
mImageView.setDoubleTapZoomScale(2.0f);
mImageView.setMaxScale(3.0f);
mImageView.setOnImageEventListener(new SubsamplingScaleImageView.DefaultOnImageEventListener() {
@Override
public void onImageLoaded() {
super.onImageLoaded();
mProgressBar.setVisibility(View.GONE);
}
@Override
public void onImageLoadError(Exception e) {
super.onImageLoadError(e);
mProgressBar.setVisibility(View.GONE);
}
});
mProgressBar = view.findViewById(R.id.progressbar);
loadThumb();
loadImageView();
}
示例3: initData
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入依赖的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);
}
});
}
示例4: scaleDown
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入依赖的package包/类
private void scaleDown(final ItemActivity.Callback callback) {
final SubsamplingScaleImageView imageView = itemView.findViewById(R.id.subsampling);
if (imageView != null) {
try {
imageView.animateScale(0.0f)
.withDuration(300)
.withOnAnimationEventListener(
new SubsamplingScaleImageView.DefaultOnAnimationEventListener() {
@Override
public void onComplete() {
super.onComplete();
swapView(true);
callback.done();
//imageView.recycle();
}
})
.start();
} catch (NullPointerException e) {
swapView(true);
callback.done();
//imageView.recycle();
}
}
}
示例5: onSaveInstanceState
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入依赖的package包/类
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if (albumItem instanceof Photo) {
View itemView = viewPager.findViewWithTag(albumItem.getPath());
if (itemView != null) {
View view = itemView.findViewById(R.id.subsampling);
if (view instanceof SubsamplingScaleImageView) {
SubsamplingScaleImageView imageView = (SubsamplingScaleImageView) view;
ImageViewState state = imageView.getState();
if (state != null) {
outState.putSerializable(IMAGE_VIEW_SAVED_STATE, state);
}
}
}
}
//outState.putParcelable(ALBUM, album);
outState.putParcelable(ALBUM_ITEM, albumItem);
outState.putBoolean(WAS_SYSTEM_UI_HIDDEN, !systemUiVisible);
outState.putBoolean(INFO_DIALOG_SHOWN, infoDialog != null);
}
示例6: instantiateItem
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入依赖的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;
}
示例7: setInitScaleType
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入依赖的package包/类
public void setInitScaleType(int initScaleType) {
mInitScaleType = initScaleType;
switch (initScaleType) {
case INIT_SCALE_TYPE_CENTER_CROP:
mImageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_CROP);
break;
case INIT_SCALE_TYPE_CUSTOM:
mImageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CUSTOM);
break;
case INIT_SCALE_TYPE_START:
mImageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_START);
break;
case INIT_SCALE_TYPE_CENTER_INSIDE:
default:
mImageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_INSIDE);
break;
}
if (mDisplayOptimizeListener != null) {
mDisplayOptimizeListener.setInitScaleType(initScaleType);
}
}
示例8: ShowBigImg
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入依赖的package包/类
private View ShowBigImg(final ViewGroup container, final int position) {
RelativeLayout layout = (RelativeLayout) LayoutInflater.from(context).inflate(R.layout.big_img_layout, container, false);
final SubsamplingScaleImageView imageView = (SubsamplingScaleImageView) layout.findViewById(R.id.image_item);
final String imageUri = images.get(position).getUri();
FrescoHelper.loadBigImage(context, imageView, imageUri, R.mipmap.ic_launcher);
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(context, "点击可以退出", Toast.LENGTH_SHORT).show();
}
});
container.addView(layout);
return layout;
}
示例9: onCreateView
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入依赖的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;
}
示例10: onViewCreated
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getSSSIV().setOrientation(SubsamplingScaleImageView.ORIENTATION_0);
Bitmap bitmap=getArguments().getParcelable(ARG_BITMAP);
if (bitmap == null) {
Uri uri=getArguments().getParcelable(ARG_URI);
if (uri != null) {
setImage(uri);
}
}
else {
setImage(bitmap);
}
}
示例11: instantiateItem
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入依赖的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;
}
示例12: onCreateView
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.world_map, null);
imageSurfaceView = (SubsamplingScaleImageView) view.findViewById(R.id.world_map_image);
drawerLayout = (DrawerLayout) view.findViewById(R.id.drawer_map_layout);
poICitiesListView = (ListView) view.findViewById(R.id.poi_cities);
navigationView = (NavigationView) view.findViewById(R.id.navigation);
view.findViewById(R.id.world_map_open).setOnClickListener(this);
initWorldMap(savedInstanceState);
initPoT();
return view;
}
示例13: renderImage
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入依赖的package包/类
@UiThread
void renderImage() {
final String mapFileName = AppConstants.getMapType(pageNumber, mapType.value);
String imageFile = StorageUtils.getAppSpecificFolder() + File.separator + mapFileName + ".jpg";
if (!StorageUtils.fileExists(imageFile)) {
Log.e("File not exists: " + pageNumber);
noImageBanner.setVisibility(View.VISIBLE);
map_updated_time.setVisibility(View.GONE);
return;
}
map_updated_time.setVisibility(View.VISIBLE);
if (mapViewState != null) {
touchImage.setImageFile(imageFile, mapViewState);
} else {
touchImage.setScaleAndCenter(2f, touchImage.getCenter());
touchImage.setImageFile(imageFile);
}
touchImage.setMaxScale(7f);
touchImage.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_CROP);
Log.d("Map refreshed");
updateLastModifiedTime(mapFileName);
}
示例14: onCreateView
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入依赖的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;
}
示例15: ZoomingImageView
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入依赖的package包/类
public ZoomingImageView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
inflate(context, R.layout.zooming_image_view, this);
this.imageView = (ImageView) findViewById(R.id.image_view);
this.subsamplingImageView = (SubsamplingScaleImageView) findViewById(R.id.subsampling_image_view);
this.imageViewAttacher = new PhotoViewAttacher(imageView);
this.subsamplingImageView.setBitmapDecoderClass(AttachmentBitmapDecoder.class);
this.subsamplingImageView.setRegionDecoderClass(AttachmentRegionDecoder.class);
this.subsamplingImageView.setOrientation(SubsamplingScaleImageView.ORIENTATION_USE_EXIF);
}