MainActivity.kt 1.18 KB
Newer Older
Anon's avatar
Anon committed
1 2 3 4
package com.github.antweb.donkey

import android.bluetooth.*
import android.content.Context
Anon's avatar
Anon committed
5
import android.content.Intent
Anon's avatar
Anon committed
6 7 8 9 10 11 12 13
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import android.util.Log
import android.widget.Button
import android.widget.TextView
import java.lang.NullPointerException

Anon's avatar
Anon committed
14
private const val TAG = "MainActivity"
Anon's avatar
Anon committed
15

Anon's avatar
Anon committed
16
class MainActivity : AppCompatActivity() {
Anon's avatar
Anon committed
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34

    private var mScanning: Boolean = false
    private var connected = false

    private lateinit var tvConnection: TextView
    private lateinit var tvValue: TextView
    private lateinit var buttonConnect: Button

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        tvValue = findViewById(R.id.text_value)
        tvConnection = findViewById(R.id.text_connection_status)
        tvConnection.text = "STATE_DISCONNECTED"

        buttonConnect = findViewById(R.id.button_connect)
        buttonConnect.setOnClickListener {
Anon's avatar
Anon committed
35 36
//            scanLeDevice()

Anon's avatar
Anon committed
37

Anon's avatar
Anon committed
38 39 40
            val intent = Intent(this, ScanActivity::class.java)
            startActivity(intent)
        }
Anon's avatar
Anon committed
41 42
    }
}