本文整理汇总了Java中com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.setImage方法的典型用法代码示例。如果您正苦于以下问题:Java SubsamplingScaleImageView.setImage方法的具体用法?Java SubsamplingScaleImageView.setImage怎么用?Java SubsamplingScaleImageView.setImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
的用法示例。
在下文中一共展示了SubsamplingScaleImageView.setImage方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: onCreate
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test_tab);
mTabLayout_8 = (CommonTabLayout) findViewById(R.id.tl_88);
ivTest = (SubsamplingScaleImageView) findViewById(R.id.iv_test);
ivTest.setImage(ImageSource.uri("/sdcard/nopicture.jpg"));
for (int i = 0; i < mTitles.length; i++) {
mTabEntities.add(new TabEntity(mTitles[i], mIconSelectIds[i], mIconUnselectIds[i]));
}
mTabLayout_8.setTabData(mTabEntities);
//设置默认选中的item
mTabLayout_8.setCurrentTab(0);
}
示例4: onCreateView
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入方法依赖的package包/类
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(layout.imagedisplay_large_fragment, container, false);
final ImageDisplayActivity activity = (ImageDisplayActivity)getActivity();
if (activity != null) {
rootView.findViewById(id.next).setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) { activity.next(); }
});
}
SubsamplingScaleImageView imageView = rootView.findViewById(id.imageView);
imageView.setImage(ImageSource.asset("card.png"));
return rootView;
}
示例5: displayImage
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入方法依赖的package包/类
private void displayImage(final ImageViewerLayout imageLayout, String imageUrl) {
imageLayout.getProgressBar().setVisibility(View.GONE);
final SubsamplingScaleImageView scaleImageView = imageLayout.getScaleImageView();
final GlideImageView glideImageView = imageLayout.getGlideImageView();
//imageView could be null if display image on GlideImageEvent
if (scaleImageView == null || glideImageView == null)
return;
ImageInfo imageInfo = ImageContainer.getImageInfo(imageUrl);
if (!imageInfo.isReady()) {
glideImageView.setVisibility(View.VISIBLE);
scaleImageView.setVisibility(View.GONE);
glideImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.image_broken));
} else {
if (imageInfo.isGif()) {
glideImageView.setVisibility(View.VISIBLE);
scaleImageView.setVisibility(View.GONE);
if (GlideHelper.isOkToLoad(mActivity)) {
Glide.with(mActivity)
.load(imageUrl)
.asBitmap()
.priority(Priority.IMMEDIATE)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.transform(new GifTransformation(mActivity))
.error(R.drawable.image_broken)
.into(new GlideBitmapTarget(glideImageView, imageInfo.getDisplayWidth(), imageInfo.getDisplayHeight()));
}
glideImageView.setUrl(imageUrl);
glideImageView.setSingleClickListener();
} else {
scaleImageView.setMinimumDpi(36);
scaleImageView.setMinimumTileDpi(160);
scaleImageView.setOrientation(SubsamplingScaleImageView.ORIENTATION_USE_EXIF);
scaleImageView.setImage(ImageSource.uri(imageInfo.getPath()));
scaleImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mActivity.finish();
}
});
scaleImageView.setOnImageEventListener(new SubsamplingScaleImageView.DefaultOnImageEventListener() {
@Override
public void onImageLoaded() {
Glide.clear(glideImageView);
glideImageView.setVisibility(View.GONE);
scaleImageView.setVisibility(View.VISIBLE);
}
@Override
public void onImageLoadError(Exception e) {
Glide.clear(glideImageView);
glideImageView.setVisibility(View.GONE);
scaleImageView.setImage(ImageSource.resource(R.drawable.image_broken));
}
});
}
}
}
示例6: onCreate
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setBackgroundDrawableResource(R.color.atlas_image_popup_background);
setContentView(R.layout.atlas_image_popup);
mImageView = (SubsamplingScaleImageView) findViewById(R.id.image_popup);
mProgressBar = (ContentLoadingProgressBar) findViewById(R.id.image_popup_progress);
mImageView.setPanEnabled(true);
mImageView.setZoomEnabled(true);
mImageView.setDoubleTapZoomDpi(160);
mImageView.setMinimumDpi(80);
mImageView.setBitmapDecoderClass(MessagePartDecoder.class);
mImageView.setRegionDecoderClass(MessagePartRegionDecoder.class);
Intent intent = getIntent();
if (intent == null) return;
mMessagePartId = intent.getParcelableExtra("fullId");
Uri previewId = intent.getParcelableExtra("previewId");
ThreePartImageCellFactory.Info info = intent.getParcelableExtra("info");
mProgressBar.show();
if (previewId != null && info != null) {
// ThreePartImage
switch (info.orientation) {
case ThreePartImageUtils.ORIENTATION_0:
mImageView.setOrientation(SubsamplingScaleImageView.ORIENTATION_0);
mImageView.setImage(
ImageSource.uri(mMessagePartId).dimensions(info.width, info.height),
ImageSource.uri(previewId));
break;
case ThreePartImageUtils.ORIENTATION_90:
mImageView.setOrientation(SubsamplingScaleImageView.ORIENTATION_270);
mImageView.setImage(
ImageSource.uri(mMessagePartId).dimensions(info.height, info.width),
ImageSource.uri(previewId));
break;
case ThreePartImageUtils.ORIENTATION_180:
mImageView.setOrientation(SubsamplingScaleImageView.ORIENTATION_180);
mImageView.setImage(
ImageSource.uri(mMessagePartId).dimensions(info.width, info.height),
ImageSource.uri(previewId));
break;
case ThreePartImageUtils.ORIENTATION_270:
mImageView.setOrientation(SubsamplingScaleImageView.ORIENTATION_90);
mImageView.setImage(
ImageSource.uri(mMessagePartId).dimensions(info.height, info.width),
ImageSource.uri(previewId));
break;
}
} else {
// SinglePartImage
mImageView.setImage(ImageSource.uri(mMessagePartId));
}
mImageView.setOnImageEventListener(this);
}
示例7: updateImageView
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入方法依赖的package包/类
private void updateImageView(SubsamplingScaleImageView imageView, Bitmap bitmap, Animation animation) {
imageView.setImage(ImageSource.bitmap(bitmap));
imageView.startAnimation(animation);
}
示例8: onCreate
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_media);
mAttachment = getIntent().getParcelableExtra(EXTRA_ATTACHMENT);
final SubsamplingScaleImageView image = (SubsamplingScaleImageView) findViewById(R.id.image);
mPlayer = (VideoView) findViewById(R.id.video);
mPauseButton = (ImageButton) findViewById(R.id.play);
mCurrentTime = (TextView) findViewById(R.id.duration);
mProgress = (ProgressBar) findViewById(R.id.seek);
mProgress.setMax(1000);
mPauseButton.setOnClickListener(mPauseListener);
Uri uri = mAttachment.getUri();
if (mAttachment instanceof VideoAttachment) {
image.setVisibility(View.GONE);
mPlayer.setVisibility(View.VISIBLE);
mPlayer.setVideoURI(uri);
mPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(final MediaPlayer mp) {
mPlayer.start();
show();
}
});
} else {
// Due to a bug in SubsamplingScaleImageView, it does not always read Exif rotation
// appropriately. We'll read it manually and adjust ourselves.
try {
Exif exif = new Exif(mAttachment.asStream(this));
switch (exif.getRotation()) {
case 0:
image.setOrientation(SubsamplingScaleImageView.ORIENTATION_0);
break;
case 90:
image.setOrientation(SubsamplingScaleImageView.ORIENTATION_90);
break;
case 180:
image.setOrientation(SubsamplingScaleImageView.ORIENTATION_180);
break;
case 270:
image.setOrientation(SubsamplingScaleImageView.ORIENTATION_270);
break;
}
} catch (IOException e) {
Log.e(TAG, "Failed to decode attachment's exif metadata", e);
image.setOrientation(SubsamplingScaleImageView.ORIENTATION_USE_EXIF);
}
mPlayer.setVisibility(View.GONE);
mPauseButton.setVisibility(View.GONE);
mCurrentTime.setVisibility(View.GONE);
mProgress.setVisibility(View.GONE);
image.setVisibility(View.VISIBLE);
image.setImage(ImageSource.uri(mAttachment.getUri()));
}
}
示例9: onCreate
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SubsamplingScaleImageView view = findViewById(id.imageView);
view.setImage(ImageSource.asset("sanmartino.jpg"));
}