package org.foxarmy.barcodescannerforemployees.activities

import android.app.Activity
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.util.Log
import android.widget.ImageView
import android.widget.LinearLayout
import org.foxarmy.barcodescannerforemployees.R
import org.foxarmy.barcodescannerforemployees.databinding.ActivityFullscreenBinding
import org.foxarmy.barcodescannerforemployees.getImageUri
import java.io.File


class FullscreenActivity : Activity() {

    private lateinit var binding: ActivityFullscreenBinding
    private lateinit var fullscreenImageView: ImageView
    private lateinit var fullscreenContentControls: LinearLayout
    private val hideHandler = Handler(Looper.myLooper()!!)

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContentView(R.layout.activity_fullscreen)

        fullscreenImageView = findViewById(R.id.fullscreenImageView)

        val extras = intent.extras
        val imageHash = extras!!.get("imagehash") as String?


        val picturesDir = File(filesDir, "pictures")
        picturesDir.mkdirs()
        val fullscreenImageFile = File(picturesDir, "$imageHash.png")
        fullscreenImageView.setImageURI(getImageUri(this, fullscreenImageFile))
        fullscreenImageView.setOnClickListener {
            this.finish()
        }
    }

}