Skip to content

Commit

Permalink
Improve visual transition when going from postview to final capture
Browse files Browse the repository at this point in the history
- show the postview
- show the final capture on top
  • Loading branch information
jsaund committed May 23, 2024
1 parent e97a8dd commit e37680f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import android.Manifest
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Bundle
import android.util.Log
import androidx.activity.OnBackPressedCallback
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
Expand Down Expand Up @@ -97,7 +98,6 @@ class MainActivity : AppCompatActivity() {
}.updateCameraScreen {
it.hideCameraControls()
.hideProcessProgressViewState()
.hidePostview()
}
)
captureUri = null
Expand Down Expand Up @@ -201,6 +201,7 @@ class MainActivity : AppCompatActivity() {
.updateCameraScreen {
it.enableCameraShutter(true)
.enableSwitchLens(true)
.hidePostview()
}
)
}
Expand Down Expand Up @@ -302,6 +303,7 @@ class MainActivity : AppCompatActivity() {
}
.updateCameraScreen {
it.showCameraControls()
.hidePostview()
.enableCameraShutter(false)
.enableSwitchLens(false)
}
Expand Down Expand Up @@ -342,6 +344,7 @@ class MainActivity : AppCompatActivity() {
captureScreenViewState.value
.updateCameraScreen { state ->
state.showCameraControls()
state.hidePostview()
}
.updatePostCaptureScreen {
PostCaptureScreenViewState.PostCaptureScreenHiddenViewState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,10 @@ class CameraExtensionsScreen(private val root: View) {
private fun showPostview(bitmap: Bitmap) {
if (photoPostview.isVisible) return
photoPostview.isVisible = true
photoPostview.load(bitmap)
photoPostview.load(bitmap) {
crossfade(true)
crossfade(200)
}
}

private fun hidePostview() {
Expand Down Expand Up @@ -261,7 +264,10 @@ class CameraExtensionsScreen(private val root: View) {
private fun showPhoto(uri: Uri?) {
if (uri == null) return
photoPreview.isVisible = true
photoPreview.load(uri)
photoPreview.load(uri) {
crossfade(true)
crossfade(200)
}
closePhotoPreview.isVisible = true
}

Expand Down

0 comments on commit e37680f

Please sign in to comment.