diff --git a/app/src/main/java/com/rlabs/dakc/MainActivity.kt b/app/src/main/java/com/rlabs/dakc/MainActivity.kt index 4b98f63..556989b 100644 --- a/app/src/main/java/com/rlabs/dakc/MainActivity.kt +++ b/app/src/main/java/com/rlabs/dakc/MainActivity.kt @@ -1,6 +1,8 @@ package com.rlabs.dakc import android.os.Bundle +import android.util.Log +import android.widget.Button import android.widget.TextView import androidx.activity.ComponentActivity import androidx.activity.enableEdgeToEdge @@ -8,6 +10,8 @@ import androidx.activity.enableEdgeToEdge class MainActivity : ComponentActivity() { lateinit var dev1: TextView lateinit var dev2: TextView + lateinit var dev3: TextView + lateinit var button1: Button override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) enableEdgeToEdge() @@ -17,19 +21,33 @@ class MainActivity : ComponentActivity() { dev2 = findViewById(R.id.dev2) dev2.text = TinymixOut(device = "2") + + dev3 = findViewById(R.id.dev3) + dev3.text = TinymixOut(device = "2", 7) + + + button1 = findViewById(R.id.button1) + button1.setOnClickListener { + dev1.text = TinymixOut(device = "1") + dev2.text = TinymixOut(device = "2") + dev3.text = TinymixOut(device = "2", 7) + } + } + + } -fun TinymixOut(device: String): String { +fun TinymixOut(device: String, lineNum: Int = 0): String { val outPair = runAsRoot(arrayOf("tinymix -D $device")) val out = outPair.first.toString() val errout = outPair.second.toString() - val firstLine = if (errout.isNotEmpty()) errout.split("\n")[0] else out.split("\n")[0] + val firstLine = if (errout.isNotEmpty()) errout.split("\n")[0] else out.split("\n")[lineNum] -// Log.d("tinymix", firstLine) + Log.d("tinymix", out) - return "tinymix -D $device out: ${firstLine}!" + return "tinymix -D $device out: \n$firstLine" } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 11492fc..9dd91c7 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,6 +1,5 @@ - + android:layout_marginStart="16dp" + android:textSize="16sp" + app:layout_constraintTop_toTopOf="parent" + android:layout_marginTop="48dp" /> + android:layout_marginTop="48dp" + android:layout_marginStart="16dp" + android:textSize="16sp" /> + + + +