update
parent
65fbe50a40
commit
7f94955bd0
@ -1,11 +1,44 @@
|
|||||||
package com.rookiedev.hexapod
|
package com.rookiedev.hexapod
|
||||||
|
|
||||||
|
import android.net.InetAddresses.isNumericAddress
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.widget.Button
|
||||||
|
import android.widget.Toast
|
||||||
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
|
import android.text.Editable
|
||||||
|
|
||||||
|
import android.text.TextWatcher
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppCompatActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_main)
|
setContentView(R.layout.activity_main)
|
||||||
|
|
||||||
|
val ipInput = findViewById<TextInputEditText>(R.id.ip_input)
|
||||||
|
val portInput = findViewById<TextInputEditText>(R.id.port_input)
|
||||||
|
val buttonConnect = findViewById<Button>(R.id.button_connect)
|
||||||
|
|
||||||
|
buttonConnect.setOnClickListener {
|
||||||
|
// your code to perform when the user clicks on the button
|
||||||
|
|
||||||
|
Toast.makeText(this@MainActivity, "You clicked me.", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ipInput.addTextChangedListener(object : TextWatcher {
|
||||||
|
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {}
|
||||||
|
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
|
||||||
|
override fun afterTextChanged(s: Editable) {
|
||||||
|
if (isNumericAddress(s.toString())){
|
||||||
|
Toast.makeText(this@MainActivity, "Correct", Toast.LENGTH_SHORT).show()
|
||||||
|
} else {
|
||||||
|
Toast.makeText(this@MainActivity, "Wrong", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
#Wed Feb 09 11:03:31 EST 2022
|
#Wed Feb 09 11:03:31 EST 2022
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
Loading…
Reference in New Issue