diff --git a/software/android/.idea/misc.xml b/software/android/.idea/misc.xml index 0dafa39..70fd387 100644 --- a/software/android/.idea/misc.xml +++ b/software/android/.idea/misc.xml @@ -5,6 +5,7 @@ + diff --git a/software/android/app/src/main/java/com/rookiedev/hexapod/MainActivity.kt b/software/android/app/src/main/java/com/rookiedev/hexapod/MainActivity.kt index 2e7efbb..8284d2f 100644 --- a/software/android/app/src/main/java/com/rookiedev/hexapod/MainActivity.kt +++ b/software/android/app/src/main/java/com/rookiedev/hexapod/MainActivity.kt @@ -1,35 +1,48 @@ package com.rookiedev.hexapod +import android.Manifest +import android.bluetooth.BluetoothDevice +import android.bluetooth.BluetoothManager +import android.content.Context import android.content.Intent +import android.content.pm.PackageManager import android.net.InetAddresses.isNumericAddress +import android.os.Build import android.os.Bundle import android.text.Editable import android.text.TextWatcher import android.text.method.LinkMovementMethod -import android.widget.Button -import android.widget.TextView +import android.view.View +import android.widget.* +import android.widget.AdapterView.OnItemClickListener +import androidx.annotation.RequiresApi import androidx.appcompat.app.AppCompatActivity +import androidx.core.app.ActivityCompat +import com.google.android.material.tabs.TabLayout import com.google.android.material.textfield.TextInputEditText import com.google.android.material.textfield.TextInputLayout -import java.lang.String -import kotlin.CharSequence -import kotlin.Int -import kotlin.apply -import kotlin.toString class MainActivity : AppCompatActivity() { + companion object { + private const val BLUETOOTH_PERMISSION_CODE = 100 + private const val INTERNET_PERMISSION_CODE = 101 + } private val SHAREDPREFSNAME = "com.rookiedev.hexapod_preferences" private val SHAREDPREFSIP = "IP" private val SHAREDPREFSPORT = "PORT" - private lateinit var ipInput:TextInputEditText - private lateinit var portInput:TextInputEditText + private var mContext: Context?=null + + private lateinit var ipInput: TextInputEditText + private lateinit var portInput: TextInputEditText override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) + mContext = applicationContext + ipInput = findViewById(R.id.ip_input) portInput = findViewById(R.id.port_input) val buttonConnect = findViewById