kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
added logic to validate map naming window
rodzic
07dd8a826f
commit
ee68c98e98
|
@ -1,6 +1,7 @@
|
|||
package com.geeksville.mesh.ui
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.content.DialogInterface
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
|
@ -647,18 +648,27 @@ class MapFragment : ScreenFragment("Map"), Logging {
|
|||
nameRegionDialog.setNegativeButton("Cancel") { dialog, _ ->
|
||||
dialog.cancel()
|
||||
}
|
||||
nameRegionDialog.setPositiveButton("Save") { _, _ ->
|
||||
nameRegionDialog.setPositiveButton(
|
||||
"Save", null
|
||||
)
|
||||
|
||||
val dialog = nameRegionDialog.create()
|
||||
dialog.show()
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE)
|
||||
.setOnClickListener {
|
||||
if (userInput.text.isEmpty()) {
|
||||
// Error out dialog
|
||||
val text =
|
||||
"You must enter a name"
|
||||
val duration = Toast.LENGTH_LONG
|
||||
val toast = Toast.makeText(requireContext(), text, duration)
|
||||
toast.show()
|
||||
} else {
|
||||
this.regionName = userInput.text.toString()
|
||||
userInput.setText("")
|
||||
dialog.dismiss()
|
||||
downloadOfflineRegion(styleURI)
|
||||
}
|
||||
}
|
||||
nameRegionDialog.create()
|
||||
nameRegionDialog.show()
|
||||
|
||||
}
|
||||
|
||||
private val offlineRegionAdapter = object : RecyclerView.Adapter<ViewHolder>() {
|
||||
|
|
Ładowanie…
Reference in New Issue