feat:photoViewer onLongClick return photoResult

This commit is contained in:
zixiaoweng
2023-01-09 11:45:03 +08:00
parent 38a3542a3c
commit c457aaba8a
2 changed files with 5 additions and 5 deletions
@@ -196,7 +196,7 @@ open class QMUIPhotoViewerActivity : AppCompatActivity() {
allowPullExit()
},
onLongPress = {
drawableCache.drawable?.let {
drawableCache.photoResult?.let {
onLongClick(page, it)
}
},
@@ -207,7 +207,7 @@ open class QMUIPhotoViewerActivity : AppCompatActivity() {
val onPhotoLoad: (PhotoResult) -> Unit = remember(drawableCache, onImageRatioEnsured) {
{
drawableCache.drawable = it.drawable
drawableCache.photoResult = it
if (it.drawable.intrinsicWidth > 0 && it.drawable.intrinsicHeight > 0) {
onImageRatioEnsured(it.drawable.intrinsicWidth.toFloat() / it.drawable.intrinsicHeight)
}
@@ -345,7 +345,7 @@ open class QMUIPhotoViewerActivity : AppCompatActivity() {
return true
}
protected open fun onLongClick(page: Int, drawable: Drawable) {
protected open fun onLongClick(page: Int, photoResult: PhotoResult) {
}
@@ -406,4 +406,4 @@ class QMUIPhotoViewerViewModel(val state: SavedStateHandle) : ViewModel() {
}
}
class MutableDrawableCache(var drawable: Drawable? = null)
class MutableDrawableCache(var photoResult: PhotoResult? = null)
@@ -20,7 +20,7 @@ object Dep {
// composeMajor.composeMinor.qmuiReleaseNumber
const val composeCoreVer = "1.1.1"
const val composeVer = "1.1.1.1"
const val photoVer = "1.1.1.7"
const val photoVer = "1.1.1.9"
const val editorVer = "1.1.1"
}