aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java/me/texx/Texx/CameraActivity.kt
diff options
context:
space:
mode:
authorMarvin Borner2018-09-02 01:52:33 +0200
committerMarvin Borner2018-09-02 01:52:33 +0200
commitb95583df09ebe117753e61d9ccc540365ca31f13 (patch)
treeadc0b130986bef412d24c5cfd3587df794d986d8 /app/src/main/java/me/texx/Texx/CameraActivity.kt
parenta7b67a410ef0043a697b36b39f629863e9794965 (diff)
Made camera even faster
Diffstat (limited to 'app/src/main/java/me/texx/Texx/CameraActivity.kt')
-rw-r--r--app/src/main/java/me/texx/Texx/CameraActivity.kt7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/src/main/java/me/texx/Texx/CameraActivity.kt b/app/src/main/java/me/texx/Texx/CameraActivity.kt
index 24978a2..eaf0333 100644
--- a/app/src/main/java/me/texx/Texx/CameraActivity.kt
+++ b/app/src/main/java/me/texx/Texx/CameraActivity.kt
@@ -47,6 +47,7 @@ class CameraActivity : AppCompatActivity() {
}
private fun initCameraLayout() {
+ camera.sessionType = SessionType.VIDEO // TODO: Find out why VIDEO is faster (-> any disadvantages?)
setGestures()
setListeners()
}
@@ -62,7 +63,7 @@ class CameraActivity : AppCompatActivity() {
camera.addCameraListener(object : CameraListener() {
override fun onPictureTaken(jpeg: ByteArray?) {
val file: File? = createFile()
- SavePhotoTask(file).execute(jpeg)
+ SaveFileTask(file).execute(jpeg)
startActivity(intentFor<PhotoEditorActivity>("filepath" to file.toString()))
}
})
@@ -78,7 +79,7 @@ class CameraActivity : AppCompatActivity() {
videoButtonDrawable.colorFilter = PorterDuffColorFilter(RED, PorterDuff.Mode.SRC_IN)
camera_button.setBackgroundDrawable(videoButtonDrawable)
} else {
- camera.sessionType = SessionType.PICTURE
+ //camera.sessionType = SessionType.PICTURE // -> faster?
camera_button.setBackgroundDrawable(this.resources.getDrawable(R.drawable.focus_marker_outline))
}
true
@@ -88,7 +89,7 @@ class CameraActivity : AppCompatActivity() {
/**
* Saves [ByteArray] in [file]
*/
- internal inner class SavePhotoTask(private val file: File?) : AsyncTask<ByteArray, String, String>() {
+ internal inner class SaveFileTask(private val file: File?) : AsyncTask<ByteArray, String, String>() {
override fun doInBackground(vararg jpeg: ByteArray): String? {
try {
val out = FileOutputStream(file!!.path)