forked from GitHub-Mirror/riotX-android
Preview of encrypted images (first and fast implementation)
This commit is contained in:
parent
994ee1d23f
commit
14a2570ea4
@ -20,9 +20,11 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import androidx.core.view.isVisible
|
||||
import com.github.piasy.biv.indicator.progresspie.ProgressPieIndicator
|
||||
import com.github.piasy.biv.view.GlideImageViewFactory
|
||||
import im.vector.riotredesign.core.di.ScreenComponent
|
||||
import im.vector.riotredesign.core.glide.GlideApp
|
||||
import im.vector.riotredesign.core.platform.VectorBaseActivity
|
||||
import kotlinx.android.synthetic.main.activity_image_media_viewer.*
|
||||
import javax.inject.Inject
|
||||
@ -44,9 +46,26 @@ class ImageMediaViewerActivity : VectorBaseActivity() {
|
||||
finish()
|
||||
} else {
|
||||
configureToolbar(imageMediaViewerToolbar, mediaData)
|
||||
imageMediaViewerImageView.setImageViewFactory(GlideImageViewFactory())
|
||||
imageMediaViewerImageView.setProgressIndicator(ProgressPieIndicator())
|
||||
imageContentRenderer.render(mediaData, imageMediaViewerImageView)
|
||||
|
||||
if (mediaData.elementToDecrypt != null) {
|
||||
// Encrypted image
|
||||
imageMediaViewerImageView.isVisible = false
|
||||
encryptedImageView.isVisible = true
|
||||
|
||||
GlideApp
|
||||
.with(this)
|
||||
.load(mediaData)
|
||||
.dontAnimate()
|
||||
.into(encryptedImageView)
|
||||
} else {
|
||||
// Clear image
|
||||
imageMediaViewerImageView.isVisible = true
|
||||
encryptedImageView.isVisible = false
|
||||
|
||||
imageMediaViewerImageView.setImageViewFactory(GlideImageViewFactory())
|
||||
imageMediaViewerImageView.setProgressIndicator(ProgressPieIndicator())
|
||||
imageContentRenderer.render(mediaData, imageMediaViewerImageView)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
@ -18,4 +19,11 @@
|
||||
app:failureImageInitScaleType="center"
|
||||
app:optimizeDisplay="true" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/encryptedImageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user