package com.sybotan.android.demo.activities.poc

import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.AppCompatEditText
import android.widget.Button
import android.widget.ImageView
import com.sybotan.android.demo.R
import com.sybotan.android.demo.base.SimpleTextWatcher

class RecordInfoActivity : AppCompatActivity() {
    private var info = ""
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_record_info)
        val backIv = findViewById<ImageView>(R.id.backIv)
        backIv.setOnClickListener {
            finish()
        }

        val recordEt = findViewById<AppCompatEditText>(R.id.recordEt)
        recordEt.addTextChangedListener(object : SimpleTextWatcher() {
            override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
                info = s.toString()

            }
        })

        val saveBtn = findViewById<Button>(R.id.saveBtn)
        saveBtn.setOnClickListener {
            val intent = Intent()
            intent.putExtra("info", info)
            setResult(DeviceActivity.REQ_CODE_INFO,intent)
            finish()
        }
    }
}