Add verif on path name
This commit is contained in:
@@ -58,9 +58,16 @@ class ValidateMarker: AppCompatActivity() {
|
||||
|
||||
val validateButton = findViewById<Button>(R.id.validate_form)
|
||||
validateButton.setOnClickListener{
|
||||
val newName = findViewById<EditText>(R.id.route_name).text.toString()
|
||||
if(newName.isBlank() or newName.isEmpty()){
|
||||
val alert = AlertDialog.Builder(this).setTitle("Nom vide !")
|
||||
.setMessage("Le nom du trajet est vide !")
|
||||
alert.show()
|
||||
return@setOnClickListener
|
||||
}
|
||||
val db = dbHelper.writableDatabase
|
||||
val newPath = ContentValues().apply {
|
||||
put(PathContract.PathEntry.PATH_NAME, findViewById<EditText>(R.id.route_name).text.toString())
|
||||
put(PathContract.PathEntry.PATH_NAME, newName)
|
||||
}
|
||||
val newPathRowId = db?.insert(PathContract.PathEntry.TABLE_NAME, null, newPath)
|
||||
if(newPathRowId?.toInt() != -1){
|
||||
|
||||
Reference in New Issue
Block a user