From 2a5b91a92b4c25dd53e04d322251867921a8a21c Mon Sep 17 00:00:00 2001 From: kindOfCurly Date: Fri, 5 May 2023 15:27:20 +0200 Subject: [PATCH] #4: remember IP addresses - every valid input for IP address is saved - saved IP addresses are shown in an AutoCompleteTextView --- .../java/com/android/dippid/DebugFragment.kt | 52 ++++++++++++++----- app/src/main/res/layout/fragment_debug.xml | 13 ++++- 2 files changed, 50 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/android/dippid/DebugFragment.kt b/app/src/main/java/com/android/dippid/DebugFragment.kt index 57f5be5..5e82f85 100644 --- a/app/src/main/java/com/android/dippid/DebugFragment.kt +++ b/app/src/main/java/com/android/dippid/DebugFragment.kt @@ -10,22 +10,21 @@ import android.hardware.SensorManager import android.os.Bundle import android.view.MotionEvent import android.view.View -import android.widget.Button -import android.widget.EditText -import android.widget.TextView -import android.widget.Toast +import android.widget.* import androidx.appcompat.widget.SwitchCompat import androidx.core.widget.doOnTextChanged import androidx.fragment.app.Fragment import java.net.InetAddress import java.util.* + class DebugFragment : Fragment(R.layout.fragment_debug), SensorEventListener { private var listener: DataListener? = null var ipAddress: String = "" private var port: Int = 0 + private var ipAddressSet: MutableSet = mutableSetOf() private var stateButton1 = 0 private var stateButton2 = 0 @@ -76,7 +75,7 @@ class DebugFragment : Fragment(R.layout.fragment_debug), SensorEventListener { ) // init UI - val ipInput = view.findViewById(R.id.input_ip) + val ipInput = view.findViewById(R.id.input_ip) val portInput = view.findViewById(R.id.input_port) val button1 = view.findViewById