本文整理汇总了Java中com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.setVisibility方法的典型用法代码示例。如果您正苦于以下问题:Java SubsamplingScaleImageView.setVisibility方法的具体用法?Java SubsamplingScaleImageView.setVisibility怎么用?Java SubsamplingScaleImageView.setVisibility使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
的用法示例。
在下文中一共展示了SubsamplingScaleImageView.setVisibility方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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));
}
});
}
}
}
示例2: 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()));
}
}