Commit 8ed3753b482c8a5882ecec396a6c372329313b04
1 parent
ea89488e54
Exists in
master
17092020 1900
Showing
13 changed files
with
295 additions
and
124 deletions
Show diff stats
app/src/main/java/com/focasoftware/deboinventariov20/DB/DAO/ArticulosDAO.kt
| ... | ... | @@ -110,6 +110,6 @@ interface ServeInvDao { |
| 110 | 110 | @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=1 WHERE SER_NUM = :numero") |
| 111 | 111 | suspend fun UpdateServerPre(numero: Int) |
| 112 | 112 | |
| 113 | - @Query("SELECT SER_DIR FROM $TABLA_SERV_INV WHERE SER_PRE= 1") | |
| 114 | - suspend fun fetchServerPreOne(): String | |
| 113 | + @Query("SELECT * FROM $TABLA_SERV_INV WHERE SER_PRE= 1") | |
| 114 | + suspend fun fetchServerPreOne(): ServeInv | |
| 115 | 115 | } |
| 116 | 116 | \ No newline at end of file |
app/src/main/java/com/focasoftware/deboinventariov20/Model/Tablas.kt
| ... | ... | @@ -112,6 +112,7 @@ data class InvBody(@ColumnInfo(name = "INV_NUM") var invNum: Int, |
| 112 | 112 | data class ServeInv( |
| 113 | 113 | @ColumnInfo(name = "SER_DESC") var descripcion: String?, |
| 114 | 114 | @ColumnInfo(name = "SER_DIR") var direccion: String?, |
| 115 | + @ColumnInfo(name = "SER_PUERTO") var puerto: String?, | |
| 115 | 116 | @ColumnInfo(name = "SER_PRE") var predeterminado: Int?): |
| 116 | 117 | Serializable { @PrimaryKey(autoGenerate = true) |
| 117 | 118 | @ColumnInfo(name = "SER_NUM") |
app/src/main/java/com/focasoftware/deboinventariov20/UI/Utils/Utils.kt
| ... | ... | @@ -9,6 +9,8 @@ import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 9 | 9 | import kotlinx.coroutines.Dispatchers |
| 10 | 10 | import kotlinx.coroutines.GlobalScope |
| 11 | 11 | import kotlinx.coroutines.async |
| 12 | +import java.io.IOException | |
| 13 | +import java.net.UnknownHostException | |
| 12 | 14 | |
| 13 | 15 | fun modificarCantidadEnCabecera(inventarioActual: Int, b: Boolean,context: Context) { |
| 14 | 16 | GlobalScope.async(Dispatchers.IO) { |
| ... | ... | @@ -77,4 +79,22 @@ public class NoEncontradoSimple : DialogFragment() { |
| 77 | 79 | return builder.create() |
| 78 | 80 | } ?: throw IllegalStateException("Activity cannot be null") |
| 79 | 81 | } |
| 80 | -} | |
| 81 | 82 | \ No newline at end of file |
| 83 | +} | |
| 84 | +fun isConnectedToThisServer(host: String): Boolean { | |
| 85 | + | |
| 86 | + val runtime = Runtime.getRuntime() | |
| 87 | + try { | |
| 88 | + val ipProcess = runtime.exec("/system/bin/ping -c 1 $host") | |
| 89 | + val exitValue = ipProcess.waitFor() | |
| 90 | + ipProcess.destroy() | |
| 91 | + return exitValue == 0 | |
| 92 | + } catch (e: UnknownHostException) { | |
| 93 | + e.printStackTrace() | |
| 94 | + } catch (e: IOException) { | |
| 95 | + e.printStackTrace() | |
| 96 | + } catch (e: InterruptedException) { | |
| 97 | + e.printStackTrace() | |
| 98 | + } | |
| 99 | + | |
| 100 | + return false | |
| 101 | +} |
app/src/main/java/com/focasoftware/deboinventariov20/UI/actualizacionMaestros/ActuaMaestrosFragment.kt
| ... | ... | @@ -9,6 +9,7 @@ import androidx.fragment.app.Fragment |
| 9 | 9 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 10 | 10 | import com.focasoftware.deboinventariov20.Model.Articles |
| 11 | 11 | import com.focasoftware.deboinventariov20.Model.ProductosService |
| 12 | +import com.focasoftware.deboinventariov20.Model.ServeInv | |
| 12 | 13 | import com.focasoftware.deboinventariov20.R |
| 13 | 14 | import com.focasoftware.deboinventariov20.UI.Utils.noServerConf |
| 14 | 15 | import kotlinx.android.synthetic.main.fragment_actua_maestros.* |
| ... | ... | @@ -25,17 +26,17 @@ class ActuaMaestrosFragment : Fragment() { |
| 25 | 26 | super.onCreate(savedInstanceState) |
| 26 | 27 | GlobalScope.launch(Main) { |
| 27 | 28 | val serverPre = fetchServerPreOne() |
| 28 | - if (serverPre.isNullOrEmpty()) { | |
| 29 | + if (serverPre!!.direccion.isNullOrEmpty()) { | |
| 29 | 30 | val modalDialog = noServerConf() |
| 30 | 31 | modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") |
| 31 | 32 | } else { |
| 32 | - BASE_URL = serverPre.toString() | |
| 33 | + BASE_URL = serverPre.direccion.toString()+":"+serverPre.puerto.toString()+"/" | |
| 33 | 34 | } |
| 34 | 35 | } |
| 35 | 36 | // mostrarArticulos() |
| 36 | 37 | } |
| 37 | 38 | |
| 38 | - private suspend fun fetchServerPreOne(): String? { | |
| 39 | + private suspend fun fetchServerPreOne(): ServeInv? { | |
| 39 | 40 | return GlobalScope.async(IO) { |
| 40 | 41 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchServerPreOne() |
| 41 | 42 | }.await() |
app/src/main/java/com/focasoftware/deboinventariov20/UI/configuracion/ConfiguracionFragment.kt
| ... | ... | @@ -16,6 +16,7 @@ import androidx.navigation.fragment.findNavController |
| 16 | 16 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 17 | 17 | import com.focasoftware.deboinventariov20.Model.ServeInv |
| 18 | 18 | import com.focasoftware.deboinventariov20.R |
| 19 | +import com.focasoftware.deboinventariov20.UI.Utils.isConnectedToThisServer | |
| 19 | 20 | import kotlinx.android.synthetic.main.fragment_configuracion.* |
| 20 | 21 | import kotlinx.coroutines.* |
| 21 | 22 | import kotlinx.coroutines.Dispatchers.Main |
| ... | ... | @@ -40,15 +41,25 @@ class ConfiguracionFragment : Fragment() { |
| 40 | 41 | for (server in getDescServers()) { |
| 41 | 42 | listServer.add((if (server.servNum < 9) "0" + server.servNum.toString() else server.servNum.toString()) + " - " + server.descripcion.toString()) |
| 42 | 43 | } |
| 43 | - val adapterSpServer = ArrayAdapter(requireContext(), R.layout.support_simple_spinner_dropdown_item, listServer) | |
| 44 | + val adapterSpServer = ArrayAdapter( | |
| 45 | + requireContext(), | |
| 46 | + R.layout.support_simple_spinner_dropdown_item, | |
| 47 | + listServer | |
| 48 | + ) | |
| 44 | 49 | spServidor.adapter = adapterSpServer |
| 45 | 50 | if (sharedPreferences.contains("ServerPredeterminado")) { |
| 46 | - spServidor.setSelection(sharedPreferences.getString("ServerPredeterminado", "").toString().toInt()) | |
| 51 | + spServidor.setSelection( | |
| 52 | + sharedPreferences.getString("ServerPredeterminado", "").toString().toInt() | |
| 53 | + ) | |
| 47 | 54 | } else (spServidor.setSelection(0)) |
| 48 | 55 | } |
| 49 | 56 | } |
| 50 | 57 | |
| 51 | - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | |
| 58 | + override fun onCreateView( | |
| 59 | + inflater: LayoutInflater, | |
| 60 | + container: ViewGroup?, | |
| 61 | + savedInstanceState: Bundle? | |
| 62 | + ): View? { | |
| 52 | 63 | |
| 53 | 64 | val v = inflater.inflate(R.layout.fragment_configuracion, container, false) |
| 54 | 65 | val etRuta = v.findViewById<EditText>(R.id.etRuta) |
| ... | ... | @@ -170,18 +181,34 @@ class ConfiguracionFragment : Fragment() { |
| 170 | 181 | |
| 171 | 182 | btnGuardar.setOnClickListener { |
| 172 | 183 | guardarPreferencias() |
| 173 | - Toast.makeText(v.context, "Los Datos se guardaron correctamente", Toast.LENGTH_LONG).show() | |
| 184 | + Toast.makeText(v.context, "Los Datos se guardaron correctamente", Toast.LENGTH_LONG) | |
| 185 | + .show() | |
| 174 | 186 | navController.navigate(R.id.action_configuracionFragment_to_mainFragment2) |
| 175 | 187 | } |
| 176 | 188 | btnAgregarServidor.setOnClickListener { findNavController().navigate(R.id.servidoresFragment) } |
| 177 | 189 | |
| 178 | - btnValidarServidor.setOnClickListener { Toast.makeText(requireContext(), "Dirección correcta", Toast.LENGTH_LONG).show() } | |
| 190 | + btnValidarServidor.setOnClickListener { | |
| 191 | + GlobalScope.launch(Main) { | |
| 192 | + val serverPre = fetchServerPreOne() | |
| 193 | + if (isConnectedToThisServer(serverPre!!.direccion.toString().substring(7,serverPre.direccion.toString().length))) { | |
| 194 | + Toast.makeText(requireContext(), "¡Dirección Valida!", Toast.LENGTH_LONG).show() | |
| 195 | + } else { | |
| 196 | + Toast.makeText(requireContext(), "¡Verifique la Dirección!", Toast.LENGTH_LONG) | |
| 197 | + .show() | |
| 198 | + } | |
| 199 | + } | |
| 200 | + } | |
| 179 | 201 | |
| 180 | 202 | spServidor.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { |
| 181 | 203 | override fun onNothingSelected(parent: AdapterView<*>?) {} |
| 182 | - override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { | |
| 204 | + override fun onItemSelected( | |
| 205 | + parent: AdapterView<*>?, | |
| 206 | + view: View?, | |
| 207 | + position: Int, | |
| 208 | + id: Long | |
| 209 | + ) { | |
| 183 | 210 | itemSelect = parent!!.getItemAtPosition(position).toString().substring(0, 2).toInt() |
| 184 | - indexSelect=position | |
| 211 | + indexSelect = position | |
| 185 | 212 | } |
| 186 | 213 | } |
| 187 | 214 | return v |
| ... | ... | @@ -199,18 +226,51 @@ class ConfiguracionFragment : Fragment() { |
| 199 | 226 | |
| 200 | 227 | if (etRuta.text.isNotEmpty()) editor?.putString("etRuta", etRuta.text.toString()) |
| 201 | 228 | |
| 202 | - if (rbProInclu.isChecked) editor?.putString("rbProInclu", "1") else editor?.putString("rbProInclu", "0") | |
| 203 | - if (rbProNoInclu.isChecked) editor?.putString("rbProNoInclu", "1") else editor?.putString("rbProNoInclu", "0") | |
| 204 | - | |
| 205 | - if (cbHabiLectura.isChecked) editor?.putString("cbHabiLectura", "1") else editor?.putString("cbHabiLectura", "0") | |
| 206 | - if (cbMostrarStock.isChecked) editor?.putString("cbMostrarStock", "1") else editor?.putString("cbMostrarStock", "0") | |
| 207 | - if (rbVentas.isChecked) editor?.putString("rbVentas", "1") else editor?.putString("rbVentas", "0") | |
| 208 | - if (rbDeposito.isChecked) editor?.putString("rbDeposito", "1") else editor?.putString("rbDeposito", "0") | |
| 209 | - if (rbCodigoDebo.isChecked) editor?.putString("rbCodigoDebo", "1") else editor?.putString("rbCodigoDebo", "0") | |
| 210 | - if (rbCodigoOrigen.isChecked) editor?.putString("rbCodigoOrigen", "1") else editor?.putString("rbCodigoOrigen", "0") | |
| 211 | - if (rbCodigoBarras.isChecked) editor?.putString("rbCodigoBarras", "1") else editor?.putString("rbCodigoBarras", "0") | |
| 212 | - if (cbMostrarExistencia.isChecked) editor?.putString("cbMostrarExistencia", "1") else editor?.putString("cbMostrarExistencia", "0") | |
| 213 | - if (cbMostrarPrecio.isChecked) editor?.putString("cbMostrarPrecio", "1") else editor?.putString("cbMostrarPrecio", "0") | |
| 229 | + if (rbProInclu.isChecked) editor?.putString( | |
| 230 | + "rbProInclu", | |
| 231 | + "1" | |
| 232 | + ) else editor?.putString("rbProInclu", "0") | |
| 233 | + if (rbProNoInclu.isChecked) editor?.putString( | |
| 234 | + "rbProNoInclu", | |
| 235 | + "1" | |
| 236 | + ) else editor?.putString("rbProNoInclu", "0") | |
| 237 | + | |
| 238 | + if (cbHabiLectura.isChecked) editor?.putString("cbHabiLectura", "1") else editor?.putString( | |
| 239 | + "cbHabiLectura", | |
| 240 | + "0" | |
| 241 | + ) | |
| 242 | + if (cbMostrarStock.isChecked) editor?.putString( | |
| 243 | + "cbMostrarStock", | |
| 244 | + "1" | |
| 245 | + ) else editor?.putString("cbMostrarStock", "0") | |
| 246 | + if (rbVentas.isChecked) editor?.putString( | |
| 247 | + "rbVentas", | |
| 248 | + "1" | |
| 249 | + ) else editor?.putString("rbVentas", "0") | |
| 250 | + if (rbDeposito.isChecked) editor?.putString( | |
| 251 | + "rbDeposito", | |
| 252 | + "1" | |
| 253 | + ) else editor?.putString("rbDeposito", "0") | |
| 254 | + if (rbCodigoDebo.isChecked) editor?.putString( | |
| 255 | + "rbCodigoDebo", | |
| 256 | + "1" | |
| 257 | + ) else editor?.putString("rbCodigoDebo", "0") | |
| 258 | + if (rbCodigoOrigen.isChecked) editor?.putString( | |
| 259 | + "rbCodigoOrigen", | |
| 260 | + "1" | |
| 261 | + ) else editor?.putString("rbCodigoOrigen", "0") | |
| 262 | + if (rbCodigoBarras.isChecked) editor?.putString( | |
| 263 | + "rbCodigoBarras", | |
| 264 | + "1" | |
| 265 | + ) else editor?.putString("rbCodigoBarras", "0") | |
| 266 | + if (cbMostrarExistencia.isChecked) editor?.putString( | |
| 267 | + "cbMostrarExistencia", | |
| 268 | + "1" | |
| 269 | + ) else editor?.putString("cbMostrarExistencia", "0") | |
| 270 | + if (cbMostrarPrecio.isChecked) editor?.putString( | |
| 271 | + "cbMostrarPrecio", | |
| 272 | + "1" | |
| 273 | + ) else editor?.putString("cbMostrarPrecio", "0") | |
| 214 | 274 | editor?.putString("ServerPredeterminado", indexSelect.toString()) |
| 215 | 275 | updateServerPreInZero() |
| 216 | 276 | updateServerPre(itemSelect) |
| ... | ... | @@ -245,4 +305,9 @@ class ConfiguracionFragment : Fragment() { |
| 245 | 305 | } |
| 246 | 306 | } |
| 247 | 307 | } |
| 308 | + private suspend fun fetchServerPreOne(): ServeInv? { | |
| 309 | + return GlobalScope.async(Dispatchers.IO) { | |
| 310 | + return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchServerPreOne() | |
| 311 | + }.await() | |
| 312 | + } | |
| 248 | 313 | } |
| 249 | 314 | \ No newline at end of file |
app/src/main/java/com/focasoftware/deboinventariov20/UI/inventario/ProductosListAdapter.kt
| ... | ... | @@ -8,6 +8,8 @@ import androidx.recyclerview.widget.RecyclerView |
| 8 | 8 | import com.focasoftware.deboinventariov20.R |
| 9 | 9 | import com.focasoftware.deboinventariov20.UI.Utils.BaseViewHolder |
| 10 | 10 | import kotlinx.android.synthetic.main.item.view.* |
| 11 | +import java.io.IOException | |
| 12 | +import java.net.UnknownHostException | |
| 11 | 13 | |
| 12 | 14 | |
| 13 | 15 | class ProductosListAdapter(private val context: Context,private val productos: ArrayList<ItemsRecycler>, private val itemImageClickListener: OnImageDotsClickListener) : |
| ... | ... | @@ -54,6 +56,5 @@ class ProductosListAdapter(private val context: Context,private val productos: A |
| 54 | 56 | productos.removeAt(viewHolder.adapterPosition) |
| 55 | 57 | notifyItemRemoved(viewHolder.adapterPosition) |
| 56 | 58 | } |
| 59 | +} | |
| 57 | 60 | |
| 58 | - | |
| 59 | -} | |
| 60 | 61 | \ No newline at end of file |
app/src/main/java/com/focasoftware/deboinventariov20/UI/servidores/AdapterServidores.kt
| ... | ... | @@ -17,6 +17,7 @@ class AdapterServidores(private val servidor: ArrayList<ItemsServidores>, privat |
| 17 | 17 | fun bind(itemsServidores: ItemsServidores) { |
| 18 | 18 | vista.tvDescServidor.text = itemsServidores.descripcion |
| 19 | 19 | vista.tvDireccionServidor.text = itemsServidores.direccion |
| 20 | + vista.tvPuertoServidor.text = itemsServidores.puerto | |
| 20 | 21 | |
| 21 | 22 | } |
| 22 | 23 | } |
app/src/main/java/com/focasoftware/deboinventariov20/UI/servidores/ItemsServidores.kt
| 1 | 1 | package com.focasoftware.deboinventariov20.UI.servidores |
| 2 | 2 | |
| 3 | -data class ItemsServidores(val descripcion: String?, var direccion: String?, var predeterminado: String?) | |
| 4 | 3 | \ No newline at end of file |
| 4 | +data class ItemsServidores(val descripcion: String?, var direccion: String?, var puerto: String?, var predeterminado: String?) | |
| 5 | 5 | \ No newline at end of file |
app/src/main/java/com/focasoftware/deboinventariov20/UI/servidores/ServidoresFragment.kt
| ... | ... | @@ -51,7 +51,8 @@ class ServidoresFragment : Fragment() { |
| 51 | 51 | if (!etDireccionServidor.text.isNullOrBlank() || !etNombreServidor.text.isNullOrBlank()) { |
| 52 | 52 | // GlobalScope.launch(Dispatchers.Main) { |
| 53 | 53 | // ServerNew =AppDb.getAppDb(requireContext())?.ServeInvDao()?.findLastServer()?.plus(1) ?: 1 |
| 54 | - val servidor = ServeInv(etNombreServidor.text.toString(), "http://${etDireccionServidor.text}/", 0) | |
| 54 | + val servidor = ServeInv(etNombreServidor.text.toString(), "http://${etDireccionServidor.text}", | |
| 55 | + etPuerto.text.toString(),0) | |
| 55 | 56 | ingresarDatos(servidor) |
| 56 | 57 | cargarRecicler(servidor) |
| 57 | 58 | Toast.makeText(requireContext(), "Servidor ${etNombreServidor.text} Guardado", Toast.LENGTH_LONG).show() |
| ... | ... | @@ -86,7 +87,7 @@ class ServidoresFragment : Fragment() { |
| 86 | 87 | GlobalScope.launch(Dispatchers.Main) { |
| 87 | 88 | servidores = buscarEnBD() |
| 88 | 89 | for ((i, item) in servidores.withIndex()) { |
| 89 | - val ser = ServeInv(servidores[i].descripcion, servidores[i].direccion, servidores[i].predeterminado) | |
| 90 | + val ser = ServeInv(servidores[i].descripcion, servidores[i].direccion,servidores[i].puerto, servidores[i].predeterminado) | |
| 90 | 91 | cargarRecicler(ser) |
| 91 | 92 | } |
| 92 | 93 | } |
| ... | ... | @@ -95,7 +96,7 @@ class ServidoresFragment : Fragment() { |
| 95 | 96 | fun cargarRecicler(ser: ServeInv) { |
| 96 | 97 | //TODO CARGO EN LE RV |
| 97 | 98 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! |
| 98 | - val item = ItemsServidores(ser.descripcion, ser.direccion, ser.predeterminado.toString()) | |
| 99 | + val item = ItemsServidores(ser.descripcion, ser.direccion, ser.puerto.toString(),ser.predeterminado.toString()) | |
| 99 | 100 | |
| 100 | 101 | listServ.add(item) |
| 101 | 102 |
app/src/main/res/layout-land/fragment_servidores.xml
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | -<androidx.constraintlayout.widget.ConstraintLayout | |
| 3 | - xmlns:android="http://schemas.android.com/apk/res/android" | |
| 2 | +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 4 | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 5 | 4 | xmlns:tools="http://schemas.android.com/tools" |
| 6 | 5 | android:layout_width="match_parent" |
| ... | ... | @@ -10,7 +9,7 @@ |
| 10 | 9 | <androidx.appcompat.widget.AppCompatTextView |
| 11 | 10 | android:id="@+id/tvTitutloServer" |
| 12 | 11 | android:layout_width="match_parent" |
| 13 | - android:layout_height="40dp" | |
| 12 | + android:layout_height="90dp" | |
| 14 | 13 | android:layout_marginStart="8dp" |
| 15 | 14 | android:layout_marginTop="15dp" |
| 16 | 15 | android:layout_marginEnd="8dp" |
| ... | ... | @@ -27,81 +26,112 @@ |
| 27 | 26 | app:layout_constraintStart_toStartOf="parent" |
| 28 | 27 | app:layout_constraintTop_toTopOf="parent" /> |
| 29 | 28 | |
| 29 | + | |
| 30 | 30 | <TextView |
| 31 | - android:id="@+id/tvDirServer" | |
| 31 | + android:id="@+id/tvNomServer" | |
| 32 | 32 | android:layout_width="match_parent" |
| 33 | 33 | android:layout_height="wrap_content" |
| 34 | - | |
| 34 | + android:layout_margin="10dp" | |
| 35 | 35 | android:gravity="start" |
| 36 | 36 | android:lines="1" |
| 37 | - android:text="@string/tvDirServer" | |
| 37 | + android:text="@string/tvNomServer" | |
| 38 | 38 | android:textColor="@android:color/black" |
| 39 | 39 | android:textSize="@dimen/SubTitulos" |
| 40 | 40 | android:textStyle="bold|italic" |
| 41 | 41 | app:fontFamily="sans-serif-condensed" |
| 42 | - app:layout_constraintBottom_toTopOf="@+id/etDireccionServidor" | |
| 43 | 42 | app:layout_constraintEnd_toEndOf="parent" |
| 44 | 43 | app:layout_constraintStart_toStartOf="parent" |
| 45 | 44 | app:layout_constraintTop_toBottomOf="@id/tvTitutloServer" /> |
| 46 | 45 | |
| 47 | 46 | <EditText |
| 48 | - android:id="@+id/etDireccionServidor" | |
| 49 | - android:layout_width="0dp" | |
| 47 | + android:id="@+id/etNombreServidor" | |
| 48 | + android:layout_width="match_parent" | |
| 50 | 49 | android:layout_height="wrap_content" |
| 51 | - android:clickable="true" | |
| 50 | + android:layout_margin="10dp" | |
| 51 | + android:autofillHints="" | |
| 52 | + android:clickable="true" | |
| 52 | 53 | android:ems="10" |
| 53 | 54 | android:focusable="true" |
| 54 | - android:hint="192.168.10.1:9090" | |
| 55 | + android:hint="Servidor Local" | |
| 55 | 56 | android:inputType="text" |
| 56 | 57 | android:lines="1" |
| 57 | - android:textSize="10sp" | |
| 58 | + android:textSize="15sp" | |
| 58 | 59 | app:layout_constraintEnd_toEndOf="parent" |
| 59 | 60 | app:layout_constraintStart_toStartOf="parent" |
| 60 | - app:layout_constraintTop_toBottomOf="@id/tvDirServer" /> | |
| 61 | + app:layout_constraintTop_toBottomOf="@+id/tvNomServer" /> | |
| 61 | 62 | |
| 62 | 63 | <TextView |
| 63 | - android:id="@+id/tvNomServer" | |
| 64 | - android:layout_width="match_parent" | |
| 64 | + android:id="@+id/tvDirServer" | |
| 65 | + android:layout_width="wrap_content" | |
| 65 | 66 | android:layout_height="wrap_content" |
| 67 | + android:layout_margin="10dp" | |
| 66 | 68 | android:gravity="start" |
| 67 | 69 | android:lines="1" |
| 68 | - android:text="@string/tvNomServer" | |
| 70 | + android:text="@string/tvDirServer" | |
| 69 | 71 | android:textColor="@android:color/black" |
| 70 | 72 | android:textSize="@dimen/SubTitulos" |
| 71 | 73 | android:textStyle="bold|italic" |
| 72 | 74 | app:fontFamily="sans-serif-condensed" |
| 73 | - app:layout_constraintEnd_toEndOf="parent" | |
| 74 | 75 | app:layout_constraintStart_toStartOf="parent" |
| 75 | - app:layout_constraintTop_toBottomOf="@id/etDireccionServidor" /> | |
| 76 | + app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" /> | |
| 76 | 77 | |
| 77 | 78 | <EditText |
| 78 | - android:id="@+id/etNombreServidor" | |
| 79 | - android:layout_width="match_parent" | |
| 79 | + android:id="@+id/etDireccionServidor" | |
| 80 | + android:layout_width="130dp" | |
| 80 | 81 | android:layout_height="wrap_content" |
| 81 | - android:autofillHints="" | |
| 82 | + | |
| 82 | 83 | android:clickable="true" |
| 83 | 84 | android:ems="10" |
| 84 | 85 | android:focusable="true" |
| 86 | + android:hint="192.168.100.100" | |
| 85 | 87 | android:inputType="text" |
| 86 | 88 | android:lines="1" |
| 87 | - android:hint="Servidor Local" | |
| 88 | - android:textSize="10sp" | |
| 89 | - app:layout_constraintEnd_toEndOf="parent" | |
| 90 | - app:layout_constraintStart_toStartOf="parent" | |
| 91 | - app:layout_constraintTop_toBottomOf="@+id/tvNomServer" /> | |
| 89 | + android:textSize="15sp" | |
| 90 | + app:layout_constraintBaseline_toBaselineOf="@+id/tvDirServer" | |
| 91 | + app:layout_constraintStart_toEndOf="@+id/tvDirServer" /> | |
| 92 | + | |
| 93 | + <TextView | |
| 94 | + android:id="@+id/tvPuerto" | |
| 95 | + android:layout_width="wrap_content" | |
| 96 | + android:layout_height="wrap_content" | |
| 97 | + android:layout_marginStart="10dp" | |
| 98 | + android:layout_marginTop="10dp" | |
| 99 | + android:gravity="start" | |
| 100 | + android:lines="1" | |
| 101 | + android:text="Puerto:" | |
| 102 | + android:textColor="@android:color/black" | |
| 103 | + android:textSize="@dimen/SubTitulos" | |
| 104 | + android:textStyle="bold|italic" | |
| 105 | + app:fontFamily="sans-serif-condensed" | |
| 106 | + app:layout_constraintStart_toEndOf="@+id/etDireccionServidor" | |
| 107 | + app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" /> | |
| 108 | + | |
| 109 | + <EditText | |
| 110 | + android:id="@+id/etPuerto" | |
| 111 | + android:layout_width="80dp" | |
| 112 | + android:layout_height="wrap_content" | |
| 113 | + android:clickable="true" | |
| 114 | + android:ems="10" | |
| 115 | + android:focusable="true" | |
| 116 | + android:hint="9999" | |
| 117 | + android:inputType="text" | |
| 118 | + android:lines="1" | |
| 119 | + android:textSize="15sp" | |
| 120 | + app:layout_constraintBaseline_toBaselineOf="@+id/tvPuerto" | |
| 121 | + app:layout_constraintStart_toEndOf="@+id/tvPuerto" | |
| 122 | + android:autofillHints="" /> | |
| 92 | 123 | |
| 93 | 124 | |
| 94 | 125 | <androidx.recyclerview.widget.RecyclerView |
| 95 | 126 | android:id="@+id/rvServidores" |
| 96 | - android:layout_width="0dp" | |
| 127 | + android:layout_width="match_parent" | |
| 97 | 128 | android:layout_height="0dp" |
| 98 | 129 | android:layout_marginTop="10dp" |
| 99 | 130 | android:background="@android:color/darker_gray" |
| 100 | 131 | app:layout_constraintBottom_toTopOf="@+id/btnGuardarServidores" |
| 101 | 132 | app:layout_constraintEnd_toEndOf="parent" |
| 102 | - app:layout_constraintHorizontal_bias="0.0" | |
| 103 | 133 | app:layout_constraintStart_toStartOf="parent" |
| 104 | - app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" | |
| 134 | + app:layout_constraintTop_toBottomOf="@+id/etPuerto" | |
| 105 | 135 | app:layout_goneMarginEnd="10dp" |
| 106 | 136 | tools:listitem="@layout/item_servidores" /> |
| 107 | 137 | |
| ... | ... | @@ -109,14 +139,15 @@ |
| 109 | 139 | android:id="@+id/btnGuardarServidores" |
| 110 | 140 | android:layout_width="0dp" |
| 111 | 141 | android:layout_height="wrap_content" |
| 112 | - | |
| 142 | + android:layout_marginTop="10dp" | |
| 143 | + android:layout_marginEnd="10dp" | |
| 144 | + android:background="@drawable/boton_borde_redondeado" | |
| 145 | + android:padding="10dp" | |
| 113 | 146 | android:text="@string/btnGuardarServidores" |
| 114 | 147 | android:textColor="@android:color/white" |
| 115 | - android:padding="5dp" | |
| 116 | - android:background="@drawable/boton_borde_redondeado" | |
| 117 | - app:layout_constraintTop_toBottomOf="@+id/rvServidores" | |
| 148 | + app:layout_constraintBottom_toBottomOf="parent" | |
| 118 | 149 | app:layout_constraintEnd_toEndOf="parent" |
| 119 | 150 | app:layout_constraintStart_toStartOf="parent" |
| 120 | - app:layout_constraintBottom_toBottomOf="parent"/> | |
| 151 | + app:layout_constraintTop_toBottomOf="@+id/rvServidores" /> | |
| 121 | 152 | |
| 122 | 153 | </androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/layout/fragment_servidores.xml
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | -<androidx.constraintlayout.widget.ConstraintLayout | |
| 3 | - xmlns:android="http://schemas.android.com/apk/res/android" | |
| 2 | +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 4 | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 5 | 4 | xmlns:tools="http://schemas.android.com/tools" |
| 6 | 5 | android:layout_width="match_parent" |
| ... | ... | @@ -27,99 +26,128 @@ |
| 27 | 26 | app:layout_constraintStart_toStartOf="parent" |
| 28 | 27 | app:layout_constraintTop_toTopOf="parent" /> |
| 29 | 28 | |
| 29 | + | |
| 30 | 30 | <TextView |
| 31 | - android:id="@+id/tvDirServer" | |
| 31 | + android:id="@+id/tvNomServer" | |
| 32 | 32 | android:layout_width="match_parent" |
| 33 | 33 | android:layout_height="wrap_content" |
| 34 | 34 | android:layout_margin="10dp" |
| 35 | 35 | android:gravity="start" |
| 36 | 36 | android:lines="1" |
| 37 | - android:text="@string/tvDirServer" | |
| 37 | + android:text="@string/tvNomServer" | |
| 38 | 38 | android:textColor="@android:color/black" |
| 39 | - android:textSize="@dimen/TitulosMedios" | |
| 39 | + android:textSize="@dimen/SubTitulos" | |
| 40 | 40 | android:textStyle="bold|italic" |
| 41 | 41 | app:fontFamily="sans-serif-condensed" |
| 42 | - app:layout_constraintBottom_toTopOf="@+id/etDireccionServidor" | |
| 43 | 42 | app:layout_constraintEnd_toEndOf="parent" |
| 44 | 43 | app:layout_constraintStart_toStartOf="parent" |
| 45 | 44 | app:layout_constraintTop_toBottomOf="@id/tvTitutloServer" /> |
| 46 | 45 | |
| 47 | 46 | <EditText |
| 48 | - android:id="@+id/etDireccionServidor" | |
| 49 | - android:layout_width="0dp" | |
| 47 | + android:id="@+id/etNombreServidor" | |
| 48 | + android:layout_width="match_parent" | |
| 50 | 49 | android:layout_height="wrap_content" |
| 51 | 50 | android:layout_margin="10dp" |
| 51 | + android:autofillHints="" | |
| 52 | 52 | android:clickable="true" |
| 53 | 53 | android:ems="10" |
| 54 | 54 | android:focusable="true" |
| 55 | - android:hint="192.168.10.1:9090" | |
| 55 | + android:hint="Servidor Local" | |
| 56 | 56 | android:inputType="text" |
| 57 | 57 | android:lines="1" |
| 58 | 58 | android:textSize="15sp" |
| 59 | 59 | app:layout_constraintEnd_toEndOf="parent" |
| 60 | 60 | app:layout_constraintStart_toStartOf="parent" |
| 61 | - app:layout_constraintTop_toBottomOf="@id/tvDirServer" /> | |
| 61 | + app:layout_constraintTop_toBottomOf="@+id/tvNomServer" /> | |
| 62 | 62 | |
| 63 | 63 | <TextView |
| 64 | - android:id="@+id/tvNomServer" | |
| 65 | - android:layout_width="match_parent" | |
| 64 | + android:id="@+id/tvDirServer" | |
| 65 | + android:layout_width="wrap_content" | |
| 66 | 66 | android:layout_height="wrap_content" |
| 67 | 67 | android:layout_margin="10dp" |
| 68 | 68 | android:gravity="start" |
| 69 | 69 | android:lines="1" |
| 70 | - android:text="@string/tvNomServer" | |
| 70 | + android:text="@string/tvDirServer" | |
| 71 | 71 | android:textColor="@android:color/black" |
| 72 | - android:textSize="@dimen/TitulosMedios" | |
| 72 | + android:textSize="@dimen/SubTitulos" | |
| 73 | 73 | android:textStyle="bold|italic" |
| 74 | 74 | app:fontFamily="sans-serif-condensed" |
| 75 | - app:layout_constraintEnd_toEndOf="parent" | |
| 76 | 75 | app:layout_constraintStart_toStartOf="parent" |
| 77 | - app:layout_constraintTop_toBottomOf="@id/etDireccionServidor" /> | |
| 76 | + app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" /> | |
| 78 | 77 | |
| 79 | - <EditText | |
| 80 | - android:id="@+id/etNombreServidor" | |
| 81 | - android:layout_width="match_parent" | |
| 82 | - android:layout_height="wrap_content" | |
| 83 | - android:layout_margin="10dp" | |
| 84 | - android:autofillHints="" | |
| 85 | - android:clickable="true" | |
| 86 | - android:ems="10" | |
| 87 | - android:focusable="true" | |
| 88 | - android:inputType="text" | |
| 89 | - android:lines="1" | |
| 90 | - android:hint="Servidor Local" | |
| 91 | - android:textSize="15sp" | |
| 92 | - app:layout_constraintEnd_toEndOf="parent" | |
| 93 | - app:layout_constraintStart_toStartOf="parent" | |
| 94 | - app:layout_constraintTop_toBottomOf="@+id/tvNomServer" /> | |
| 78 | + <EditText | |
| 79 | + android:id="@+id/etDireccionServidor" | |
| 80 | + android:layout_width="130dp" | |
| 81 | + android:layout_height="wrap_content" | |
| 95 | 82 | |
| 83 | + android:clickable="true" | |
| 84 | + android:ems="10" | |
| 85 | + android:focusable="true" | |
| 86 | + android:hint="192.168.100.100" | |
| 87 | + android:inputType="text" | |
| 88 | + android:lines="1" | |
| 89 | + android:textSize="15sp" | |
| 90 | + app:layout_constraintBaseline_toBaselineOf="@+id/tvDirServer" | |
| 91 | + app:layout_constraintStart_toEndOf="@+id/tvDirServer" /> | |
| 96 | 92 | |
| 97 | - <androidx.recyclerview.widget.RecyclerView | |
| 93 | + <TextView | |
| 94 | + android:id="@+id/tvPuerto" | |
| 95 | + android:layout_width="wrap_content" | |
| 96 | + android:layout_height="wrap_content" | |
| 97 | + android:layout_marginStart="10dp" | |
| 98 | + android:layout_marginTop="10dp" | |
| 99 | + android:gravity="start" | |
| 100 | + android:lines="1" | |
| 101 | + android:text="Puerto:" | |
| 102 | + android:textColor="@android:color/black" | |
| 103 | + android:textSize="@dimen/SubTitulos" | |
| 104 | + android:textStyle="bold|italic" | |
| 105 | + app:fontFamily="sans-serif-condensed" | |
| 106 | + app:layout_constraintStart_toEndOf="@+id/etDireccionServidor" | |
| 107 | + app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" /> | |
| 108 | + | |
| 109 | + <EditText | |
| 110 | + android:id="@+id/etPuerto" | |
| 111 | + android:layout_width="80dp" | |
| 112 | + android:layout_height="wrap_content" | |
| 113 | + android:clickable="true" | |
| 114 | + android:ems="10" | |
| 115 | + android:focusable="true" | |
| 116 | + android:hint="9999" | |
| 117 | + android:inputType="text" | |
| 118 | + android:lines="1" | |
| 119 | + android:textSize="15sp" | |
| 120 | + app:layout_constraintBaseline_toBaselineOf="@+id/tvPuerto" | |
| 121 | + app:layout_constraintStart_toEndOf="@+id/tvPuerto" | |
| 122 | + android:autofillHints="" /> | |
| 123 | + | |
| 124 | + | |
| 125 | + <androidx.recyclerview.widget.RecyclerView | |
| 98 | 126 | android:id="@+id/rvServidores" |
| 99 | 127 | android:layout_width="match_parent" |
| 100 | 128 | android:layout_height="0dp" |
| 101 | 129 | android:layout_marginTop="10dp" |
| 102 | - app:layout_goneMarginEnd="10dp" | |
| 103 | 130 | android:background="@android:color/darker_gray" |
| 104 | 131 | app:layout_constraintBottom_toTopOf="@+id/btnGuardarServidores" |
| 105 | 132 | app:layout_constraintEnd_toEndOf="parent" |
| 106 | 133 | app:layout_constraintStart_toStartOf="parent" |
| 107 | - app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" | |
| 134 | + app:layout_constraintTop_toBottomOf="@+id/etPuerto" | |
| 135 | + app:layout_goneMarginEnd="10dp" | |
| 108 | 136 | tools:listitem="@layout/item_servidores" /> |
| 109 | 137 | |
| 110 | - <Button | |
| 111 | - android:id="@+id/btnGuardarServidores" | |
| 112 | - android:layout_width="0dp" | |
| 113 | - android:layout_height="wrap_content" | |
| 114 | - android:layout_marginTop="10dp" | |
| 115 | - android:layout_marginEnd="10dp" | |
| 116 | - android:text="@string/btnGuardarServidores" | |
| 117 | - android:textColor="@android:color/white" | |
| 118 | - android:padding="10dp" | |
| 119 | - android:background="@drawable/boton_borde_redondeado" | |
| 120 | - app:layout_constraintTop_toBottomOf="@+id/rvServidores" | |
| 121 | - app:layout_constraintEnd_toEndOf="parent" | |
| 122 | - app:layout_constraintStart_toStartOf="parent" | |
| 123 | - app:layout_constraintBottom_toBottomOf="parent"/> | |
| 138 | + <Button | |
| 139 | + android:id="@+id/btnGuardarServidores" | |
| 140 | + android:layout_width="0dp" | |
| 141 | + android:layout_height="wrap_content" | |
| 142 | + android:layout_marginTop="10dp" | |
| 143 | + android:layout_marginEnd="10dp" | |
| 144 | + android:background="@drawable/boton_borde_redondeado" | |
| 145 | + android:padding="10dp" | |
| 146 | + android:text="@string/btnGuardarServidores" | |
| 147 | + android:textColor="@android:color/white" | |
| 148 | + app:layout_constraintBottom_toBottomOf="parent" | |
| 149 | + app:layout_constraintEnd_toEndOf="parent" | |
| 150 | + app:layout_constraintStart_toStartOf="parent" | |
| 151 | + app:layout_constraintTop_toBottomOf="@+id/rvServidores" /> | |
| 124 | 152 | |
| 125 | 153 | </androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/layout/item_servidores.xml
| ... | ... | @@ -28,7 +28,6 @@ |
| 28 | 28 | app:layout_constraintStart_toStartOf="parent" |
| 29 | 29 | app:layout_constraintTop_toTopOf="parent" /> |
| 30 | 30 | |
| 31 | - | |
| 32 | 31 | <TextView |
| 33 | 32 | android:id="@+id/tvDescServidor" |
| 34 | 33 | android:layout_width="0dp" |
| ... | ... | @@ -52,25 +51,48 @@ |
| 52 | 51 | android:text="Dirección:" |
| 53 | 52 | android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" |
| 54 | 53 | android:textSize="14sp" |
| 55 | - app:layout_constraintHorizontal_chainStyle="packed" | |
| 56 | 54 | app:layout_constraintStart_toStartOf="parent" |
| 57 | - app:layout_constraintEnd_toStartOf="@id/tvDireccionServidor" | |
| 58 | 55 | app:layout_constraintTop_toBottomOf="@id/tvDescServidor" /> |
| 59 | 56 | |
| 60 | 57 | <TextView |
| 61 | 58 | android:id="@+id/tvDireccionServidor" |
| 62 | - android:layout_width="0dp" | |
| 63 | - android:layout_height="match_parent" | |
| 64 | - android:layout_marginStart="8dp" | |
| 65 | - android:text="http://192.168.0.205:3008" | |
| 59 | + android:layout_width="wrap_content" | |
| 60 | + android:layout_height="wrap_content" | |
| 61 | + android:layout_marginStart="5dp" | |
| 62 | + android:text="http://192.168.0.205" | |
| 66 | 63 | android:textAppearance="@style/TextAppearance.AppCompat.Large" |
| 67 | 64 | android:textColorHint="@android:color/black" |
| 68 | 65 | android:textSize="14sp" |
| 69 | 66 | android:textStyle="bold" |
| 70 | 67 | app:layout_constraintBaseline_toBaselineOf="@+id/textView85" |
| 71 | - app:layout_constraintEnd_toEndOf="parent" | |
| 72 | 68 | app:layout_constraintStart_toEndOf="@+id/textView85" /> |
| 73 | 69 | |
| 70 | + <TextView | |
| 71 | + android:id="@+id/textView86" | |
| 72 | + android:layout_width="wrap_content" | |
| 73 | + android:layout_height="wrap_content" | |
| 74 | + android:layout_marginTop="8dp" | |
| 75 | + android:layout_marginStart="10dp" | |
| 76 | + android:text="Puerto:" | |
| 77 | + android:textAppearance="@style/TextAppearance.AppCompat.Widget.PopupMenu.Large" | |
| 78 | + android:textSize="14sp" | |
| 79 | + app:layout_constraintHorizontal_chainStyle="packed" | |
| 80 | + app:layout_constraintStart_toEndOf="@+id/tvDireccionServidor" | |
| 81 | + app:layout_constraintTop_toBottomOf="@id/tvDescServidor" /> | |
| 82 | + | |
| 83 | + <TextView | |
| 84 | + android:id="@+id/tvPuertoServidor" | |
| 85 | + android:layout_width="wrap_content" | |
| 86 | + android:layout_height="wrap_content" | |
| 87 | + android:layout_marginTop="8dp" | |
| 88 | + android:layout_marginStart="5dp" | |
| 89 | + android:text="" | |
| 90 | + android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
| 91 | + android:textColorHint="@android:color/black" | |
| 92 | + android:textSize="14sp" | |
| 93 | + android:textStyle="bold" | |
| 94 | + app:layout_constraintStart_toEndOf="@+id/textView86" | |
| 95 | + app:layout_constraintTop_toBottomOf="@+id/tvDescServidor" /> | |
| 74 | 96 | </androidx.constraintlayout.widget.ConstraintLayout> |
| 75 | 97 | |
| 76 | 98 | </androidx.cardview.widget.CardView> |
| 77 | 99 | \ No newline at end of file |
app/src/main/res/values/strings.xml
| ... | ... | @@ -111,8 +111,8 @@ |
| 111 | 111 | |
| 112 | 112 | <!-- FRAGMENT SERVIDOR--> |
| 113 | 113 | <string name="tvTitutloServer">Alta de Servidores</string> |
| 114 | - <string name="tvNomServer">Ingrese un nombre para identificar al servidor</string> | |
| 115 | - <string name="tvDirServer">Ingrese la dirección del servidor</string> | |
| 114 | + <string name="tvNomServer">Descripción para identificar al servidor</string> | |
| 115 | + <string name="tvDirServer">Dirección del servidor</string> | |
| 116 | 116 | <string name="btnGuardarServidores">Guardar Servidor</string> |
| 117 | 117 | |
| 118 | 118 | <string name="tvSeleccion">Toque sobre la operación que desea realizar</string> |