mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 10:25:35 +03:00
Preview of encrypted images (first and fast implementation)
This commit is contained in:
parent
994ee1d23f
commit
14a2570ea4
2 changed files with 30 additions and 3 deletions
|
@ -20,9 +20,11 @@ import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.appcompat.widget.Toolbar
|
import androidx.appcompat.widget.Toolbar
|
||||||
|
import androidx.core.view.isVisible
|
||||||
import com.github.piasy.biv.indicator.progresspie.ProgressPieIndicator
|
import com.github.piasy.biv.indicator.progresspie.ProgressPieIndicator
|
||||||
import com.github.piasy.biv.view.GlideImageViewFactory
|
import com.github.piasy.biv.view.GlideImageViewFactory
|
||||||
import im.vector.riotredesign.core.di.ScreenComponent
|
import im.vector.riotredesign.core.di.ScreenComponent
|
||||||
|
import im.vector.riotredesign.core.glide.GlideApp
|
||||||
import im.vector.riotredesign.core.platform.VectorBaseActivity
|
import im.vector.riotredesign.core.platform.VectorBaseActivity
|
||||||
import kotlinx.android.synthetic.main.activity_image_media_viewer.*
|
import kotlinx.android.synthetic.main.activity_image_media_viewer.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -44,9 +46,26 @@ class ImageMediaViewerActivity : VectorBaseActivity() {
|
||||||
finish()
|
finish()
|
||||||
} else {
|
} else {
|
||||||
configureToolbar(imageMediaViewerToolbar, mediaData)
|
configureToolbar(imageMediaViewerToolbar, mediaData)
|
||||||
imageMediaViewerImageView.setImageViewFactory(GlideImageViewFactory())
|
|
||||||
imageMediaViewerImageView.setProgressIndicator(ProgressPieIndicator())
|
if (mediaData.elementToDecrypt != null) {
|
||||||
imageContentRenderer.render(mediaData, imageMediaViewerImageView)
|
// 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"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
@ -18,4 +19,11 @@
|
||||||
app:failureImageInitScaleType="center"
|
app:failureImageInitScaleType="center"
|
||||||
app:optimizeDisplay="true" />
|
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>
|
</LinearLayout>
|
Loading…
Reference in a new issue