mirror of
https://github.com/SimpleMobileTools/Simple-Camera.git
synced 2025-06-27 09:02:59 +02:00
let the user know if the photo wasnt saved because he quit too early
This commit is contained in:
@ -61,6 +61,8 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
|||||||
private var mIsFocusing = false
|
private var mIsFocusing = false
|
||||||
private var autoFocusHandler = Handler()
|
private var autoFocusHandler = Handler()
|
||||||
|
|
||||||
|
var isWaitingForTakePictureCallback = false
|
||||||
|
|
||||||
constructor(context: Context) : super(context)
|
constructor(context: Context) : super(context)
|
||||||
|
|
||||||
constructor(activity: MainActivity, surfaceView: SurfaceView, previewListener: PreviewListener) : super(activity) {
|
constructor(activity: MainActivity, surfaceView: SurfaceView, previewListener: PreviewListener) : super(activity) {
|
||||||
@ -275,6 +277,15 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
|||||||
val selectedResolution = getSelectedResolution()
|
val selectedResolution = getSelectedResolution()
|
||||||
mParameters!!.setPictureSize(selectedResolution.width, selectedResolution.height);
|
mParameters!!.setPictureSize(selectedResolution.width, selectedResolution.height);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||||
|
mCamera!!.enableShutterSound(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
mRotationAtCapture = MainActivity.mLastHandledOrientation
|
||||||
|
mCamera!!.parameters = mParameters
|
||||||
|
isWaitingForTakePictureCallback = true
|
||||||
|
mCamera!!.takePicture(null, null, takePictureCallback)
|
||||||
|
|
||||||
if (config.isSoundEnabled) {
|
if (config.isSoundEnabled) {
|
||||||
val audioManager = context.getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
val audioManager = context.getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
||||||
val volume = audioManager.getStreamVolume(AudioManager.STREAM_SYSTEM)
|
val volume = audioManager.getStreamVolume(AudioManager.STREAM_SYSTEM)
|
||||||
@ -283,20 +294,13 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
|||||||
mp?.start()
|
mp?.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
|
||||||
mCamera!!.enableShutterSound(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
mRotationAtCapture = MainActivity.mLastHandledOrientation
|
|
||||||
mCamera!!.parameters = mParameters
|
|
||||||
mCamera!!.takePicture(null, null, takePictureCallback)
|
|
||||||
}
|
}
|
||||||
mCanTakePicture = false
|
mCanTakePicture = false
|
||||||
mIsFocusing = false
|
mIsFocusing = false
|
||||||
}
|
}
|
||||||
|
|
||||||
private val takePictureCallback = Camera.PictureCallback { data, cam ->
|
private val takePictureCallback = Camera.PictureCallback { data, cam ->
|
||||||
|
isWaitingForTakePictureCallback = false
|
||||||
if (config.isShowPreviewEnabled) {
|
if (config.isShowPreviewEnabled) {
|
||||||
mIsPreviewShown = true
|
mIsPreviewShown = true
|
||||||
if (!config.wasPhotoPreviewHintShown) {
|
if (!config.wasPhotoPreviewHintShown) {
|
||||||
|
@ -501,6 +501,10 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave
|
|||||||
hideTimer()
|
hideTimer()
|
||||||
mPreview?.releaseCamera()
|
mPreview?.releaseCamera()
|
||||||
mOrientationEventListener.disable()
|
mOrientationEventListener.disable()
|
||||||
|
|
||||||
|
if (mPreview?.isWaitingForTakePictureCallback == true) {
|
||||||
|
toast(R.string.photo_not_saved)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupOrientationEventListener() {
|
private fun setupOrientationEventListener() {
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
<string name="no_audio_permissions">Wir benötigen Zugriff auf das Mirkofon um Videos aufnehmen zu können</string>
|
<string name="no_audio_permissions">Wir benötigen Zugriff auf das Mirkofon um Videos aufnehmen zu können</string>
|
||||||
<string name="no_gallery_app_available">Keine Galerie App verfügbar</string>
|
<string name="no_gallery_app_available">Keine Galerie App verfügbar</string>
|
||||||
<string name="click_to_resume_preview">Click on the image to resume preview</string>
|
<string name="click_to_resume_preview">Click on the image to resume preview</string>
|
||||||
|
<string name="photo_not_saved">The photo could not be saved</string>
|
||||||
|
|
||||||
<!-- other aspect ratio -->
|
<!-- other aspect ratio -->
|
||||||
<string name="other">other</string>
|
<string name="other">other</string>
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
<string name="no_audio_permissions">Se necesita el permiso de micrófono para grabar vídeos</string>
|
<string name="no_audio_permissions">Se necesita el permiso de micrófono para grabar vídeos</string>
|
||||||
<string name="no_gallery_app_available">No hay disponible una aplicación de galería</string>
|
<string name="no_gallery_app_available">No hay disponible una aplicación de galería</string>
|
||||||
<string name="click_to_resume_preview">Haga clic en la imagen para reanudar la vista previa</string>
|
<string name="click_to_resume_preview">Haga clic en la imagen para reanudar la vista previa</string>
|
||||||
|
<string name="photo_not_saved">The photo could not be saved</string>
|
||||||
|
|
||||||
<!-- other aspect ratio -->
|
<!-- other aspect ratio -->
|
||||||
<string name="other">otro</string>
|
<string name="other">otro</string>
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
<string name="no_audio_permissions">Nous avons besoin de l\'autorisation sur l\'audio pour enregistrer des vidéos</string>
|
<string name="no_audio_permissions">Nous avons besoin de l\'autorisation sur l\'audio pour enregistrer des vidéos</string>
|
||||||
<string name="no_gallery_app_available">Pas d\'application album disponible</string>
|
<string name="no_gallery_app_available">Pas d\'application album disponible</string>
|
||||||
<string name="click_to_resume_preview">Click on the image to resume preview</string>
|
<string name="click_to_resume_preview">Click on the image to resume preview</string>
|
||||||
|
<string name="photo_not_saved">The photo could not be saved</string>
|
||||||
|
|
||||||
<!-- other aspect ratio -->
|
<!-- other aspect ratio -->
|
||||||
<string name="other">other</string>
|
<string name="other">other</string>
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
<string name="no_audio_permissions">È necessario l\'accesso al microfono per registrare i video</string>
|
<string name="no_audio_permissions">È necessario l\'accesso al microfono per registrare i video</string>
|
||||||
<string name="no_gallery_app_available">Nessuna app galleria disponibile</string>
|
<string name="no_gallery_app_available">Nessuna app galleria disponibile</string>
|
||||||
<string name="click_to_resume_preview">Click on the image to resume preview</string>
|
<string name="click_to_resume_preview">Click on the image to resume preview</string>
|
||||||
|
<string name="photo_not_saved">The photo could not be saved</string>
|
||||||
|
|
||||||
<!-- other aspect ratio -->
|
<!-- other aspect ratio -->
|
||||||
<string name="other">other</string>
|
<string name="other">other</string>
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
<string name="no_audio_permissions">ビデオを記録するためにオーディオのアクセス許可が必要です</string>
|
<string name="no_audio_permissions">ビデオを記録するためにオーディオのアクセス許可が必要です</string>
|
||||||
<string name="no_gallery_app_available">利用可能なギャラリーアプリがありません</string>
|
<string name="no_gallery_app_available">利用可能なギャラリーアプリがありません</string>
|
||||||
<string name="click_to_resume_preview">Click on the image to resume preview</string>
|
<string name="click_to_resume_preview">Click on the image to resume preview</string>
|
||||||
|
<string name="photo_not_saved">The photo could not be saved</string>
|
||||||
|
|
||||||
<!-- other aspect ratio -->
|
<!-- other aspect ratio -->
|
||||||
<string name="other">other</string>
|
<string name="other">other</string>
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
<string name="no_audio_permissions">Mums reikia audio leidimo, kad įrašyti vaizdo bylas</string>
|
<string name="no_audio_permissions">Mums reikia audio leidimo, kad įrašyti vaizdo bylas</string>
|
||||||
<string name="no_gallery_app_available">Nėra galerijos programėlės</string>
|
<string name="no_gallery_app_available">Nėra galerijos programėlės</string>
|
||||||
<string name="click_to_resume_preview">Click on the image to resume preview</string>
|
<string name="click_to_resume_preview">Click on the image to resume preview</string>
|
||||||
|
<string name="photo_not_saved">The photo could not be saved</string>
|
||||||
|
|
||||||
<!-- other aspect ratio -->
|
<!-- other aspect ratio -->
|
||||||
<string name="other">other</string>
|
<string name="other">other</string>
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
<string name="no_audio_permissions">Toestemming voor audio nodig is voor het opnemen van video\'s</string>
|
<string name="no_audio_permissions">Toestemming voor audio nodig is voor het opnemen van video\'s</string>
|
||||||
<string name="no_gallery_app_available">Geen gallery app beschikbaar</string>
|
<string name="no_gallery_app_available">Geen gallery app beschikbaar</string>
|
||||||
<string name="click_to_resume_preview">Click on the image to resume preview</string>
|
<string name="click_to_resume_preview">Click on the image to resume preview</string>
|
||||||
|
<string name="photo_not_saved">The photo could not be saved</string>
|
||||||
|
|
||||||
<!-- other aspect ratio -->
|
<!-- other aspect ratio -->
|
||||||
<string name="other">Ander</string>
|
<string name="other">Ander</string>
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
<string name="no_audio_permissions">Necessitamos da permissão de áudio para gravar os vídeos</string>
|
<string name="no_audio_permissions">Necessitamos da permissão de áudio para gravar os vídeos</string>
|
||||||
<string name="no_gallery_app_available">Nenhum aplicativo de galeria disponível</string>
|
<string name="no_gallery_app_available">Nenhum aplicativo de galeria disponível</string>
|
||||||
<string name="click_to_resume_preview">Click on the image to resume preview</string>
|
<string name="click_to_resume_preview">Click on the image to resume preview</string>
|
||||||
|
<string name="photo_not_saved">The photo could not be saved</string>
|
||||||
|
|
||||||
<!-- other aspect ratio -->
|
<!-- other aspect ratio -->
|
||||||
<string name="other">outra</string>
|
<string name="other">outra</string>
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
<string name="no_audio_permissions">Necessitamos da permissão de áudio para gravar os vídeos</string>
|
<string name="no_audio_permissions">Necessitamos da permissão de áudio para gravar os vídeos</string>
|
||||||
<string name="no_gallery_app_available">Nenhuma aplicação de galeria disponível</string>
|
<string name="no_gallery_app_available">Nenhuma aplicação de galeria disponível</string>
|
||||||
<string name="click_to_resume_preview">Clique na imagem para continuar com a pré-visualização</string>
|
<string name="click_to_resume_preview">Clique na imagem para continuar com a pré-visualização</string>
|
||||||
|
<string name="photo_not_saved">The photo could not be saved</string>
|
||||||
|
|
||||||
<!-- other aspect ratio -->
|
<!-- other aspect ratio -->
|
||||||
<string name="other">outra</string>
|
<string name="other">outra</string>
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
<string name="no_audio_permissions">Нам нужно аудио разрешение для записи видео</string>
|
<string name="no_audio_permissions">Нам нужно аудио разрешение для записи видео</string>
|
||||||
<string name="no_gallery_app_available">Нет доступного приложения-галереи</string>
|
<string name="no_gallery_app_available">Нет доступного приложения-галереи</string>
|
||||||
<string name="click_to_resume_preview">Click on the image to resume preview</string>
|
<string name="click_to_resume_preview">Click on the image to resume preview</string>
|
||||||
|
<string name="photo_not_saved">The photo could not be saved</string>
|
||||||
|
|
||||||
<!-- other aspect ratio -->
|
<!-- other aspect ratio -->
|
||||||
<string name="other">другое</string>
|
<string name="other">другое</string>
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
<string name="no_audio_permissions">För att spela in video krävs ljudrättigheter</string>
|
<string name="no_audio_permissions">För att spela in video krävs ljudrättigheter</string>
|
||||||
<string name="no_gallery_app_available">Ingen galleri-app finns tillgänglig</string>
|
<string name="no_gallery_app_available">Ingen galleri-app finns tillgänglig</string>
|
||||||
<string name="click_to_resume_preview">Click on the image to resume preview</string>
|
<string name="click_to_resume_preview">Click on the image to resume preview</string>
|
||||||
|
<string name="photo_not_saved">The photo could not be saved</string>
|
||||||
|
|
||||||
<!-- other aspect ratio -->
|
<!-- other aspect ratio -->
|
||||||
<string name="other">other</string>
|
<string name="other">other</string>
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
<string name="no_audio_permissions">We need audio permission for recording videos</string>
|
<string name="no_audio_permissions">We need audio permission for recording videos</string>
|
||||||
<string name="no_gallery_app_available">No gallery app available</string>
|
<string name="no_gallery_app_available">No gallery app available</string>
|
||||||
<string name="click_to_resume_preview">Click on the image to resume preview</string>
|
<string name="click_to_resume_preview">Click on the image to resume preview</string>
|
||||||
|
<string name="photo_not_saved">The photo could not be saved</string>
|
||||||
|
|
||||||
<!-- other aspect ratio -->
|
<!-- other aspect ratio -->
|
||||||
<string name="other">other</string>
|
<string name="other">other</string>
|
||||||
|
Reference in New Issue
Block a user