Improve image viewer (#1843)
This commit does 3 things: 1. Replaces PhotoView (which is abandonware) with modern TouchImageView 2. Fixes an issue with panning images. Gesture was not intercepted properly and pager was taking control instead of image being moved. 3. Adds feedback to dismissing of images with vertical gesture.
This commit is contained in:
parent
8245e00a29
commit
58a1046348
4 changed files with 72 additions and 38 deletions
|
|
@ -33,9 +33,9 @@ import at.connyduck.sparkbutton.helpers.Utils
|
|||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.request.target.CustomTarget
|
||||
import com.bumptech.glide.request.transition.Transition
|
||||
import com.github.chrisbanes.photoview.PhotoView
|
||||
import com.keylesspalace.tusky.R
|
||||
import com.keylesspalace.tusky.util.withLifecycleContext
|
||||
import com.ortiz.touchview.TouchImageView
|
||||
|
||||
// https://github.com/tootsuite/mastodon/blob/1656663/app/models/media_attachment.rb#L94
|
||||
private const val MEDIA_DESCRIPTION_CHARACTER_LIMIT = 420
|
||||
|
|
@ -50,9 +50,8 @@ fun <T> T.makeCaptionDialog(existingDescription: String?,
|
|||
dialogLayout.setPadding(padding, padding, padding, padding)
|
||||
|
||||
dialogLayout.orientation = LinearLayout.VERTICAL
|
||||
val imageView = PhotoView(this).apply {
|
||||
// If it seems a lot, try opening an image of A4 format or similar
|
||||
maximumScale = 6.0f
|
||||
val imageView = TouchImageView(this).apply {
|
||||
maxZoom = 6f
|
||||
}
|
||||
|
||||
val displayMetrics = DisplayMetrics()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue