aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java/me/texx/Texx/CameraActivity.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/me/texx/Texx/CameraActivity.kt')
-rw-r--r--app/src/main/java/me/texx/Texx/CameraActivity.kt54
1 files changed, 54 insertions, 0 deletions
diff --git a/app/src/main/java/me/texx/Texx/CameraActivity.kt b/app/src/main/java/me/texx/Texx/CameraActivity.kt
new file mode 100644
index 0000000..df03164
--- /dev/null
+++ b/app/src/main/java/me/texx/Texx/CameraActivity.kt
@@ -0,0 +1,54 @@
+package me.texx.Texx
+
+import android.os.Bundle
+import android.support.v7.app.AppCompatActivity
+import android.view.Window
+import android.view.WindowManager
+import com.otaliastudios.cameraview.CameraListener
+import daio.io.dresscode.dressCodeName
+import daio.io.dresscode.matchDressCode
+import kotlinx.android.synthetic.main.activity_camera.*
+import me.texx.Texx.util.ThemeUtil.getThemeName
+import org.jetbrains.anko.toast
+
+class CameraActivity : AppCompatActivity() {
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ matchDressCode()
+ super.onCreate(savedInstanceState)
+ dressCodeName = getThemeName(this)
+ requestWindowFeature(Window.FEATURE_NO_TITLE)
+ window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+ WindowManager.LayoutParams.FLAG_FULLSCREEN)
+ setContentView(R.layout.activity_camera)
+
+ initCameraLayout()
+ }
+
+ private fun initCameraLayout() {
+ camera.addCameraListener(object : CameraListener() {
+ override fun onPictureTaken(jpeg: ByteArray?) {
+ toast("Photo taken")
+ }
+ })
+
+ photo_button.setOnClickListener {
+ camera.capturePicture()
+ }
+ }
+
+ override fun onResume() {
+ super.onResume()
+ camera.start()
+ }
+
+ override fun onPause() {
+ super.onPause()
+ camera.stop()
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ camera.destroy()
+ }
+}