Commit ea6d4ed726409da9942637c47a77deacd39cbef6
1 parent
7483a587d5
Exists in
master
02092020 0207
Showing
16 changed files
with
170 additions
and
85 deletions
Show diff stats
app/src/main/java/com/focasoftware/deboinventariov20/DB/DAO/ArticulosDAO.kt
| 1 | package com.focasoftware.deboinventariov20.DB.DAO | 1 | package com.focasoftware.deboinventariov20.DB.DAO |
| 2 | 2 | ||
| 3 | import androidx.room.* | 3 | import androidx.room.* |
| 4 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_ART | 4 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_ART |
| 5 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_B | 5 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_B |
| 6 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_H | 6 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_H |
| 7 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_SERV_INV | 7 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_SERV_INV |
| 8 | import com.focasoftware.deboinventariov20.Model.* | 8 | import com.focasoftware.deboinventariov20.Model.* |
| 9 | import java.util.ArrayList | 9 | import java.util.ArrayList |
| 10 | 10 | ||
| 11 | @Dao | 11 | @Dao |
| 12 | interface ArticulosDAO { | 12 | interface ArticulosDAO { |
| 13 | 13 | ||
| 14 | // TABLA ARTICULOS | 14 | // TABLA ARTICULOS |
| 15 | @Insert(onConflict = OnConflictStrategy.REPLACE) | 15 | @Insert(onConflict = OnConflictStrategy.REPLACE) |
| 16 | suspend fun insertArticulos(articulos: Articles?) | 16 | suspend fun insertArticulos(articulos: Articles?) |
| 17 | 17 | ||
| 18 | @Query("SELECT * FROM $TABLA_ART ORDER BY DES DESC") | 18 | @Query("SELECT * FROM $TABLA_ART ORDER BY DES DESC") |
| 19 | suspend fun findAllArticulos(): List<Articles> | 19 | suspend fun findAllArticulos(): List<Articles> |
| 20 | 20 | ||
| 21 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND DES LIKE '%' || :description || '%' GROUP BY DES ORDER BY DES") | 21 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND DES LIKE '%' || :description || '%' GROUP BY DES ORDER BY DES") |
| 22 | suspend fun findArticuloByDesc(description: String?, dep: Int): List<Articles> | 22 | suspend fun findArticuloByDesc(description: String?, dep: Int): List<Articles> |
| 23 | 23 | ||
| 24 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND CB LIKE :codBarra") | 24 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND CB LIKE :codBarra") |
| 25 | suspend fun findArticuloByCodBar(codBarra: String?, dep: Int): Articles? | 25 | suspend fun findArticuloByCodBar(codBarra: String?, dep: Int): Articles? |
| 26 | 26 | ||
| 27 | @Query("DELETE FROM $TABLA_ART") | 27 | @Query("DELETE FROM $TABLA_ART") |
| 28 | suspend fun deleteAllArticulos() | 28 | suspend fun deleteAllArticulos() |
| 29 | 29 | ||
| 30 | @Query("SELECT * FROM $TABLA_ART WHERE SEC=:sector AND COD=:codigo") | 30 | @Query("SELECT * FROM $TABLA_ART WHERE SEC=:sector AND COD=:codigo") |
| 31 | suspend fun fetchArticuloByCodSec(sector: String?, codigo: String?): Articles? | 31 | suspend fun fetchArticuloByCodSec(sector: String?, codigo: String?): Articles? |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | @Dao | 34 | @Dao |
| 35 | interface InvHeadDAO { | 35 | interface InvHeadDAO { |
| 36 | @Insert() | 36 | @Insert() |
| 37 | suspend fun insertInvHead(invHead: InvHead?) | 37 | suspend fun insertInvHead(invHead: InvHead?) |
| 38 | 38 | ||
| 39 | @Query("SELECT INV_NUM FROM $TABLA_INV_H ORDER BY INV_NUM DESC") | 39 | @Query("SELECT INV_NUM FROM $TABLA_INV_H ORDER BY INV_NUM DESC") |
| 40 | suspend fun findLastInv(): Int | 40 | suspend fun findLastInv(): Int |
| 41 | 41 | ||
| 42 | @Query("DELETE FROM $TABLA_INV_H") | 42 | @Query("DELETE FROM $TABLA_INV_H") |
| 43 | suspend fun deleteAllArticulos() | 43 | suspend fun deleteAllArticulos() |
| 44 | 44 | ||
| 45 | @Query("DELETE FROM $TABLA_INV_H WHERE INV_NUM=:inven") | 45 | @Query("DELETE FROM $TABLA_INV_H WHERE INV_NUM=:inven") |
| 46 | suspend fun deleteinvHead(inven: Int) | 46 | suspend fun deleteinvHead(inven: Int) |
| 47 | 47 | ||
| 48 | @Query("SELECT * FROM $TABLA_INV_H ORDER BY INV_FEI") | 48 | @Query("SELECT * FROM $TABLA_INV_H ORDER BY INV_FEI") |
| 49 | suspend fun fetchAllInvHead(): List<InvHead> | 49 | suspend fun fetchAllInvHead(): List<InvHead> |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | @Dao | 52 | @Dao |
| 53 | interface InvBodyDAO { | 53 | interface InvBodyDAO { |
| 54 | @Insert() | 54 | @Insert() |
| 55 | suspend fun insertInvBody(invBody: InvBody?) | 55 | suspend fun insertInvBody(invBody: InvBody?) |
| 56 | 56 | ||
| 57 | @Query("DELETE FROM $TABLA_INV_B") | 57 | @Query("DELETE FROM $TABLA_INV_B") |
| 58 | suspend fun deleteAllInvBody() | 58 | suspend fun deleteAllInvBody() |
| 59 | 59 | ||
| 60 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:inven") | 60 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:inven") |
| 61 | suspend fun deleteInvBody(inven: Int) | 61 | suspend fun deleteInvBody(inven: Int) |
| 62 | 62 | ||
| 63 | @Query("UPDATE $TABLA_INV_B SET CANT=:cant WHERE SEC=:sec AND COD=:cod") | 63 | @Query("UPDATE $TABLA_INV_B SET CANT=:cant WHERE SEC=:sec AND COD=:cod") |
| 64 | suspend fun UpdateInvBody(cant: Float, sec: String, cod: String) | 64 | suspend fun UpdateInvBody(cant: Float, sec: String, cod: String) |
| 65 | 65 | ||
| 66 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:inven ORDER BY INV_FEI DESC") | 66 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:inven ORDER BY INV_FEI DESC") |
| 67 | suspend fun fetchAllInvBody(inven:Int): List<InvBody> | 67 | suspend fun fetchAllInvBody(inven:Int): List<InvBody> |
| 68 | 68 | ||
| 69 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") | 69 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") |
| 70 | suspend fun fetchArtInInvBody(sector: String, codigo: String, numInventario: String): InvBody | 70 | suspend fun fetchArtInInvBody(sector: String, codigo: String, numInventario: String): InvBody |
| 71 | 71 | ||
| 72 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") | 72 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:numInventario AND SEC=:sector AND COD=:codigo") |
| 73 | suspend fun deleteItemFromInvBody(sector: String, codigo: String, numInventario: String): Int | 73 | suspend fun deleteItemFromInvBody(sector: String, codigo: String, numInventario: String): Int |
| 74 | } | 74 | } |
| 75 | @Dao | 75 | @Dao |
| 76 | interface ServeInvDao { | 76 | interface ServeInvDao { |
| 77 | @Insert(onConflict = OnConflictStrategy.REPLACE) | 77 | @Insert(onConflict = OnConflictStrategy.REPLACE) |
| 78 | fun insertServer(servidor: ServeInv) | 78 | fun insertServer(servidor: ServeInv) |
| 79 | 79 | ||
| 80 | @Query("SELECT * FROM $TABLA_SERV_INV") | 80 | @Query("SELECT * FROM $TABLA_SERV_INV ORDER BY SER_NUM") |
| 81 | suspend fun fetchAllServers(): List<ServeInv> | 81 | suspend fun fetchAllServers(): List<ServeInv> |
| 82 | 82 | ||
| 83 | @Query("DELETE FROM $TABLA_SERV_INV WHERE SER_DESC LIKE :description AND SER_DIR LIKE :dir") | 83 | @Query("DELETE FROM $TABLA_SERV_INV WHERE SER_DESC LIKE :description AND SER_DIR LIKE :dir") |
| 84 | suspend fun deleteServer(description: String, dir: String) | 84 | suspend fun deleteServer(description: String, dir: String) |
| 85 | 85 | ||
| 86 | @Query("SELECT SER_NUM FROM $TABLA_SERV_INV ORDER BY SER_NUM DESC") | 86 | @Query("SELECT SER_NUM FROM $TABLA_SERV_INV ORDER BY SER_NUM DESC") |
| 87 | suspend fun findLastServer(): Int | 87 | suspend fun findLastServer(): Int |
| 88 | 88 | ||
| 89 | @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=0") | 89 | @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=0") |
| 90 | suspend fun UpdateServerPreInZero() | 90 | suspend fun UpdateServerPreInZero() |
| 91 | 91 | ||
| 92 | @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=1 WHERE SER_DESC LIKE :description AND SER_DIR LIKE :dir") | 92 | @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=1 WHERE SER_DESC LIKE :description AND SER_DIR LIKE :dir") |
| 93 | suspend fun UpdateServerPre(description: String, dir: String) | 93 | suspend fun UpdateServerPre(description: String, dir: String) |
| 94 | 94 | ||
| 95 | @Query("SELECT * FROM $TABLA_SERV_INV WHERE SER_PRE =:sOne") | 95 | @Query("SELECT * FROM $TABLA_SERV_INV WHERE SER_PRE =:sOne") |
| 96 | suspend fun fetchServerPreOne(sOne: String): ServeInv | 96 | suspend fun fetchServerPreOne(sOne: String): ServeInv |
| 97 | } | 97 | } |
app/src/main/java/com/focasoftware/deboinventariov20/ui/actualizacionMaestros/ActuaMaestrosFragment.kt
| 1 | package com.focasoftware.deboinventariov20.ui.actualizacionMaestros | 1 | package com.focasoftware.deboinventariov20.ui.actualizacionMaestros |
| 2 | 2 | ||
| 3 | import android.os.Bundle | 3 | import android.os.Bundle |
| 4 | import android.view.LayoutInflater | 4 | import android.view.LayoutInflater |
| 5 | import android.view.View | 5 | import android.view.View |
| 6 | import android.view.ViewGroup | 6 | import android.view.ViewGroup |
| 7 | import android.widget.Button | 7 | import android.widget.Button |
| 8 | import androidx.fragment.app.Fragment | 8 | import androidx.fragment.app.Fragment |
| 9 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 9 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 10 | import com.focasoftware.deboinventariov20.Model.Articles | 10 | import com.focasoftware.deboinventariov20.Model.Articles |
| 11 | import com.focasoftware.deboinventariov20.Model.Productos | 11 | import com.focasoftware.deboinventariov20.Model.Productos |
| 12 | import com.focasoftware.deboinventariov20.Model.ProductosService | 12 | import com.focasoftware.deboinventariov20.Model.ProductosService |
| 13 | import com.focasoftware.deboinventariov20.Model.ServeInv | 13 | import com.focasoftware.deboinventariov20.Model.ServeInv |
| 14 | import com.focasoftware.deboinventariov20.R | 14 | import com.focasoftware.deboinventariov20.R |
| 15 | import com.google.android.material.bottomappbar.BottomAppBarTopEdgeTreatment | ||
| 15 | import kotlinx.android.synthetic.main.fragment_actua_maestros.* | 16 | import kotlinx.android.synthetic.main.fragment_actua_maestros.* |
| 16 | import kotlinx.coroutines.* | 17 | import kotlinx.coroutines.* |
| 17 | 18 | ||
| 18 | var BASE_URL ="" | 19 | var BASE_URL ="" |
| 19 | class ActuaMaestrosFragment : Fragment() { | 20 | class ActuaMaestrosFragment : Fragment() { |
| 20 | 21 | ||
| 21 | var job: Job? = null | 22 | var job: Job? = null |
| 22 | 23 | ||
| 23 | 24 | ||
| 24 | override fun onCreate(savedInstanceState: Bundle?) { | 25 | override fun onCreate(savedInstanceState: Bundle?) { |
| 25 | super.onCreate(savedInstanceState) | 26 | super.onCreate(savedInstanceState) |
| 26 | GlobalScope.launch(Dispatchers.Main) { | 27 | // GlobalScope.launch(Dispatchers.Main) { |
| 27 | BASE_URL = fetchServerPre().direccion.toString() | 28 | // |
| 28 | } | 29 | // BASE_URL = fetchServerPre().direccion.toString() |
| 29 | mostrarArticulos() | 30 | // } |
| 31 | BASE_URL="http://10.0.2.2:3000/" | ||
| 32 | // mostrarArticulos() | ||
| 30 | } | 33 | } |
| 31 | 34 | ||
| 32 | suspend fun fetchServerPre(): ServeInv { | 35 | suspend fun fetchServerPre(): ServeInv { |
| 33 | var busqueda: ServeInv | 36 | var busqueda: ServeInv |
| 34 | return GlobalScope.async(Dispatchers.IO) { | 37 | return GlobalScope.async(Dispatchers.IO) { |
| 35 | busqueda = AppDb.getAppDb(requireContext())!!.ServeInvDao()!!.fetchServerPreOne("1") | 38 | busqueda = AppDb.getAppDb(requireContext())!!.ServeInvDao()!!.fetchServerPreOne("1") |
| 36 | return@async busqueda | 39 | return@async busqueda |
| 37 | }.await() | 40 | }.await() |
| 38 | } | 41 | } |
| 39 | 42 | ||
| 40 | // return "http://10.0.2.2:3000/" | 43 | // return "http://10.0.2.2:3000/" |
| 41 | // } | 44 | // } |
| 42 | 45 | ||
| 43 | 46 | ||
| 44 | override fun onCreateView( | 47 | override fun onCreateView( |
| 45 | inflater: LayoutInflater, container: ViewGroup?, | 48 | inflater: LayoutInflater, container: ViewGroup?, |
| 46 | savedInstanceState: Bundle? | 49 | savedInstanceState: Bundle? |
| 47 | ): View? { | 50 | ): View? { |
| 48 | // Inflate the layout for this fragment | 51 | // Inflate the layout for this fragment |
| 49 | val v = inflater.inflate(R.layout.fragment_actua_maestros, container, false) | 52 | val v = inflater.inflate(R.layout.fragment_actua_maestros, container, false) |
| 50 | val bConfirmarAct = v.findViewById<Button>(R.id.btnConfirmarAct) | 53 | val bConfirmarAct = v.findViewById<Button>(R.id.btnConfirmarAct) |
| 51 | bConfirmarAct.setOnClickListener { | 54 | bConfirmarAct.setOnClickListener { |
| 52 | loading_view.visibility = View.VISIBLE | 55 | loading_view.visibility = View.VISIBLE |
| 53 | countriesList.text = "Obteniendo Maestros de artículos, aguarde por favor." | 56 | countriesList.text = "Obteniendo Maestros de artículos, aguarde por favor." |
| 54 | obtenerArticulos() | 57 | obtenerArticulos() |
| 55 | } | 58 | } |
| 56 | return v | 59 | return v |
| 57 | } | 60 | } |
| 58 | 61 | ||
| 59 | 62 | ||
| 60 | private fun obtenerArticulos() { | 63 | private fun obtenerArticulos() { |
| 61 | 64 | ||
| 62 | val productosService = ProductosService.getProductosService() | 65 | val productosService = ProductosService.getProductosService() |
| 63 | var index: Long = 1 | 66 | var index: Long = 1 |
| 64 | job = CoroutineScope(Dispatchers.IO).launch { | 67 | job = CoroutineScope(Dispatchers.IO).launch { |
| 65 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | 68 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! |
| 66 | .deleteAllArticulos() | 69 | .deleteAllArticulos() |
| 67 | val response = productosService.getProductos() | 70 | val response = productosService.getProductos() |
| 68 | if (response.isSuccessful) { | 71 | if (response.isSuccessful) { |
| 69 | for (pro in response.body()!!) { | 72 | for (pro in response.body()!!) { |
| 70 | val artiAcargar = Articles( | 73 | val artiAcargar = Articles( |
| 71 | pro.sector, | 74 | pro.sector, |
| 72 | pro.codigo, | 75 | pro.codigo, |
| 73 | pro.descripcion, | 76 | pro.descripcion, |
| 74 | pro.codBar, | 77 | pro.codBar, |
| 75 | pro.codOrigen, | 78 | pro.codOrigen, |
| 76 | pro.precio, | 79 | pro.precio, |
| 77 | pro.costo, | 80 | pro.costo, |
| 78 | pro.exiVenta, | 81 | pro.exiVenta, |
| 79 | pro.exiDeposito, | 82 | pro.exiDeposito, |
| 80 | pro.de, | 83 | pro.de, |
| 81 | pro.balanza, | 84 | pro.balanza, |
| 82 | pro.depSn, | 85 | pro.depSn, |
| 83 | pro.imagen | 86 | pro.imagen |
| 84 | ) | 87 | ) |
| 85 | index += index | 88 | index += index |
| 86 | 89 | ||
| 87 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | 90 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! |
| 88 | .insertArticulos(artiAcargar) | 91 | .insertArticulos(artiAcargar) |
| 89 | } | 92 | } |
| 90 | withContext(Dispatchers.Main) { | 93 | withContext(Dispatchers.Main) { |
| 91 | countriesList.visibility = View.VISIBLE | 94 | countriesList.visibility = View.VISIBLE |
| 92 | countriesList.text = "¡Datos Importados Correctamente!" | 95 | countriesList.text = "¡Datos Importados Correctamente!" |
| 93 | loading_view.visibility = View.GONE | 96 | loading_view.visibility = View.GONE |
| 94 | } | 97 | } |
| 95 | // | 98 | // |
| 96 | } else { | 99 | } else { |
| 97 | countriesList.text = "Error: ${response.message()}" | 100 | countriesList.text = "Error: ${response.message()}" |
| 98 | } | 101 | } |
| 99 | } | 102 | } |
| 100 | 103 | ||
| 101 | // withContext(Dispatchers.Main) { | 104 | // withContext(Dispatchers.Main) { |
| 102 | // if (response.isSuccessful) { | 105 | // if (response.isSuccessful) { |
| 103 | // val call = WebService | 106 | // val call = WebService |
| 104 | // .instance | 107 | // .instance |
| 105 | // ?.createService(WebServiceApi::class.java) | 108 | // ?.createService(WebServiceApi::class.java) |
| 106 | // ?.articulos | 109 | // ?.articulos |
| 107 | // call?.enqueue(object : Callback<List<productos?>?> { | 110 | // call?.enqueue(object : Callback<List<productos?>?> { |
| 108 | // override fun onResponse( | 111 | // override fun onResponse( |
| 109 | // call: Call<List<productos?>?>, | 112 | // call: Call<List<productos?>?>, |
| 110 | // response: Response<List<productos?>?> | 113 | // response: Response<List<productos?>?> |
| 111 | // ) { | 114 | // ) { |
| 112 | // if (response.code() == 200) { | 115 | // if (response.code() == 200) { |
| 113 | // for (i in response.body()!!.indices) { | 116 | // for (i in response.body()!!.indices) { |
| 114 | // //AppDb.getAppDb(requireActivity())!!.ArticulosDAO()?.insertArticulos(response.body()!![i]) | 117 | // //AppDb.getAppDb(requireActivity())!!.ArticulosDAO()?.insertArticulos(response.body()!![i]) |
| 115 | // cargarArticulos(2, 500, "sfas", "66666","2,2", "2,2", false, false, "") | 118 | // cargarArticulos(2, 500, "sfas", "66666","2,2", "2,2", false, false, "") |
| 116 | //// Log.d( | 119 | //// Log.d( |
| 117 | //// "TAG1", "Nombre Curso: " + response.body()!![i]?.sector | 120 | //// "TAG1", "Nombre Curso: " + response.body()!![i]?.sector |
| 118 | //// + "Codigo Profesor: " + response.body()!![i]?.descripcion | 121 | //// + "Codigo Profesor: " + response.body()!![i]?.descripcion |
| 119 | //// ) | 122 | //// ) |
| 120 | // mostrarArticulos() | 123 | // mostrarArticulos() |
| 121 | // } | 124 | // } |
| 122 | // } else if (response.code() == 404) { | 125 | // } else if (response.code() == 404) { |
| 123 | // Log.d("TAG1", "No hay cursos") | 126 | // Log.d("TAG1", "No hay cursos") |
| 124 | // } | 127 | // } |
| 125 | // | 128 | // |
| 126 | // } | 129 | // } |
| 127 | // | 130 | // |
| 128 | // override fun onFailure(call: Call<List<productos?>?>, t: Throwable) {} | 131 | // override fun onFailure(call: Call<List<productos?>?>, t: Throwable) {} |
| 129 | // }) | 132 | // }) |
| 130 | } | 133 | } |
| 131 | 134 | ||
| 132 | fun mostrarArticulos() { | 135 | fun mostrarArticulos() { |
| 133 | val Job = GlobalScope.launch { | 136 | val Job = GlobalScope.launch { |
| 134 | var listArticulos: List<Articles>? = null | 137 | var listArticulos: List<Articles>? = null |
| 135 | var temp: String = "" | 138 | var temp: String = "" |
| 136 | listArticulos = | 139 | listArticulos = |
| 137 | AppDb.getAppDb(requireActivity())?.ArticulosDAO()?.findAllArticulos() | 140 | AppDb.getAppDb(requireActivity())?.ArticulosDAO()?.findAllArticulos() |
| 138 | if (listArticulos != null) { | 141 | if (listArticulos != null) { |
| 139 | 142 | ||
| 140 | for (i in listArticulos.indices) | 143 | for (i in listArticulos.indices) |
| 141 | temp += listArticulos[i].codigo.toString() | 144 | temp += listArticulos[i].codigo.toString() |
| 142 | } | 145 | } |
| 143 | withContext(Dispatchers.Main) { | 146 | withContext(Dispatchers.Main) { |
| 144 | countriesList.visibility = View.VISIBLE | 147 | countriesList.visibility = View.VISIBLE |
| 145 | loading_view.visibility = View.GONE | 148 | loading_view.visibility = View.GONE |
| 146 | countriesList?.text = temp | 149 | countriesList?.text = temp |
| 147 | } | 150 | } |
| 148 | } | 151 | } |
| 149 | // for (professor in listArticulos!!) { | 152 | // for (professor in listArticulos!!) { |
| 150 | // editT.text= professor.id.toString() | 153 | // editT.text= professor.id.toString() |
| 151 | // } | 154 | // } |
| 152 | } | 155 | } |
| 153 | 156 | ||
| 154 | 157 | ||
| 155 | // fun observeViewModel() { | 158 | // fun observeViewModel() { |
| 156 | // | 159 | // |
| 157 | // val productosService = ProductosService.getProductosService() | 160 | // val productosService = ProductosService.getProductosService() |
| 158 | // var job: Job? = null | 161 | // var job: Job? = null |
| 159 | // | 162 | // |
| 160 | // | 163 | // |
| 161 | // //countriesList.text="Procesando..." | 164 | // //countriesList.text="Procesando..." |
| 162 | // //countriesList.visibility = View.VISIBLE | 165 | // //countriesList.visibility = View.VISIBLE |
| 163 | // // GlobalScope1.launch(Dispatchers.IO) { | 166 | // // GlobalScope1.launch(Dispatchers.IO) { |
| 164 | // val response = productosService.getProductos() | 167 | // val response = productosService.getProductos() |
| 165 | // if (response.isSuccessful) { | 168 | // if (response.isSuccessful) { |
| 166 | //// countriesList.layoutManager = LinearLayoutManager(context) | 169 | //// countriesList.layoutManager = LinearLayoutManager(context) |
| 167 | //// countriesList.itemAnimator = DefaultItemAnimator() | 170 | //// countriesList.itemAnimator = DefaultItemAnimator() |
| 168 | // | 171 | // |
| 169 | //// ProductAdapter.updateCountries(it) | 172 | //// ProductAdapter.updateCountries(it) |
| 170 | // // cargarArticulos(response.body()) | 173 | // // cargarArticulos(response.body()) |
| 171 | // | 174 | // |
| 172 | // | 175 | // |
| 173 | // val artiAcargar: Articulos? = null | 176 | // val artiAcargar: Articulos? = null |
| 174 | // var index: Long = 1 | 177 | // var index: Long = 1 |
| 175 | // | 178 | // |
| 176 | // for (pro in response.body()!!) { | 179 | // for (pro in response.body()!!) { |
| 177 | // //artiAcargar.id =index+1 | 180 | // //artiAcargar.id =index+1 |
| 178 | // artiAcargar!!.sector = pro.sector | 181 | // artiAcargar!!.sector = pro.sector |
| 179 | // artiAcargar.codigo = pro.codigo | 182 | // artiAcargar.codigo = pro.codigo |
| 180 | // artiAcargar.descripcion = pro.descripcion | 183 | // artiAcargar.descripcion = pro.descripcion |
| 181 | // artiAcargar.codBar = pro.codBar | 184 | // artiAcargar.codBar = pro.codBar |
| 182 | // artiAcargar.precio = pro.precio | 185 | // artiAcargar.precio = pro.precio |
| 183 | // artiAcargar.costo = pro.costo | 186 | // artiAcargar.costo = pro.costo |
| 184 | // artiAcargar.balanza = pro.balanza | 187 | // artiAcargar.balanza = pro.balanza |
| 185 | // artiAcargar.depSn = pro.depSn | 188 | // artiAcargar.depSn = pro.depSn |
| 186 | // artiAcargar.imagen = pro.imagen | 189 | // artiAcargar.imagen = pro.imagen |
| 187 | // index += index | 190 | // index += index |
| 188 | // | 191 | // |
| 189 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | 192 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! |
| 190 | // .insertArticulos(artiAcargar) | 193 | // .insertArticulos(artiAcargar) |
| 191 | // } | 194 | // } |
| 192 | // } | 195 | // } |
| 193 | // // } | 196 | // // } |
| 194 | // | 197 | // |
| 195 | // //job.cancel() | 198 | // //job.cancel() |
| 196 | // | 199 | // |
| 197 | // | 200 | // |
| 198 | // } | 201 | // } |
| 199 | 202 | ||
| 200 | // fun cargarArticulos(Productos: List<Productos>?) { | 203 | // fun cargarArticulos(Productos: List<Productos>?) { |
| 201 | // val artiAcargar: Articulos? = null | 204 | // val artiAcargar: Articulos? = null |
| 202 | // var index: Long = 1 | 205 | // var index: Long = 1 |
| 203 | // //val job4 = CoroutineScope(Dispatchers.Default).launch { | 206 | // //val job4 = CoroutineScope(Dispatchers.Default).launch { |
| 204 | // for (pro in Productos!!) { | 207 | // for (pro in Productos!!) { |
| 205 | // //artiAcargar.id =index+1 | 208 | // //artiAcargar.id =index+1 |
| 206 | // artiAcargar!!.sector = pro.sector | 209 | // artiAcargar!!.sector = pro.sector |
| 207 | // artiAcargar.codigo = pro.codigo | 210 | // artiAcargar.codigo = pro.codigo |
| 208 | // artiAcargar.descripcion = pro.descripcion | 211 | // artiAcargar.descripcion = pro.descripcion |
| 209 | // artiAcargar.codBar = pro.codBar | 212 | // artiAcargar.codBar = pro.codBar |
| 210 | // artiAcargar.precio = pro.precio | 213 | // artiAcargar.precio = pro.precio |
| 211 | // artiAcargar.costo = pro.costo | 214 | // artiAcargar.costo = pro.costo |
| 212 | // artiAcargar.balanza = pro.balanza | 215 | // artiAcargar.balanza = pro.balanza |
| 213 | // artiAcargar.depSn = pro.depSn | 216 | // artiAcargar.depSn = pro.depSn |
| 214 | // artiAcargar.imagen = pro.imagen | 217 | // artiAcargar.imagen = pro.imagen |
| 215 | // index += index | 218 | // index += index |
| 216 | // | 219 | // |
| 217 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | 220 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! |
| 218 | // .insertArticulos(artiAcargar) | 221 | // .insertArticulos(artiAcargar) |
| 219 | // } | 222 | // } |
| 220 | // } | 223 | // } |
| 221 | } | 224 | } |
| 222 | 225 | ||
| 223 | 226 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/configuracion/ConfiguracionFragment.kt
| 1 | package com.focasoftware.deboinventariov20.ui.configuracion | 1 | package com.focasoftware.deboinventariov20.ui.configuracion |
| 2 | 2 | ||
| 3 | import android.content.Context | 3 | import android.content.Context |
| 4 | import android.content.SharedPreferences | 4 | import android.content.SharedPreferences |
| 5 | import android.os.Bundle | 5 | import android.os.Bundle |
| 6 | import android.view.LayoutInflater | 6 | import android.view.LayoutInflater |
| 7 | import android.view.View | 7 | import android.view.View |
| 8 | import android.view.ViewGroup | 8 | import android.view.ViewGroup |
| 9 | import android.widget.* | 9 | import android.widget.* |
| 10 | import androidx.fragment.app.Fragment | 10 | import androidx.fragment.app.Fragment |
| 11 | import androidx.navigation.NavController | 11 | import androidx.navigation.NavController |
| 12 | import androidx.navigation.Navigation | 12 | import androidx.navigation.Navigation |
| 13 | import androidx.navigation.fragment.findNavController | 13 | import androidx.navigation.fragment.findNavController |
| 14 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 14 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 15 | import com.focasoftware.deboinventariov20.Model.ServeInv | 15 | import com.focasoftware.deboinventariov20.Model.ServeInv |
| 16 | import com.focasoftware.deboinventariov20.R | 16 | import com.focasoftware.deboinventariov20.R |
| 17 | import com.focasoftware.deboinventariov20.ui.servidores.ItemsServidores | 17 | import com.focasoftware.deboinventariov20.ui.servidores.SpinnerAdapterServidor |
| 18 | import kotlinx.android.synthetic.main.fragment_configuracion.* | 18 | import kotlinx.android.synthetic.main.fragment_configuracion.* |
| 19 | import kotlinx.coroutines.Dispatchers | 19 | import kotlinx.coroutines.Dispatchers |
| 20 | import kotlinx.coroutines.GlobalScope | 20 | import kotlinx.coroutines.GlobalScope |
| 21 | import kotlinx.coroutines.async | 21 | import kotlinx.coroutines.async |
| 22 | import kotlinx.coroutines.launch | 22 | import kotlinx.coroutines.launch |
| 23 | 23 | ||
| 24 | class ConfiguracionFragment : Fragment() { | 24 | class ConfiguracionFragment : Fragment() { |
| 25 | 25 | ||
| 26 | lateinit var sharedPreferences: SharedPreferences | 26 | lateinit var sharedPreferences: SharedPreferences |
| 27 | private lateinit var navController: NavController | 27 | private lateinit var navController: NavController |
| 28 | private lateinit var listaServers : MutableMap<Int,String> | 28 | lateinit var adapterSpinnerServidor: SpinnerAdapterServidor |
| 29 | var itemSelect: Int = 0 | ||
| 30 | |||
| 29 | override fun onCreate(savedInstanceState: Bundle?) { | 31 | override fun onCreate(savedInstanceState: Bundle?) { |
| 30 | super.onCreate(savedInstanceState) | 32 | super.onCreate(savedInstanceState) |
| 31 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 33 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 32 | } | 34 | } |
| 33 | 35 | ||
| 34 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 36 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
| 35 | super.onViewCreated(view, savedInstanceState) | 37 | super.onViewCreated(view, savedInstanceState) |
| 36 | navController = Navigation.findNavController(view) | 38 | navController = Navigation.findNavController(view) |
| 39 | |||
| 37 | } | 40 | } |
| 38 | 41 | ||
| 39 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 42 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
| 40 | 43 | ||
| 41 | var index=0 | ||
| 42 | val listServerDescription = arrayListOf<String>() | ||
| 43 | val v = inflater.inflate(R.layout.fragment_configuracion, container, false) | 44 | val v = inflater.inflate(R.layout.fragment_configuracion, container, false) |
| 44 | val etRuta = v.findViewById<EditText>(R.id.etRuta) | 45 | val etRuta = v.findViewById<EditText>(R.id.etRuta) |
| 45 | val btnGuardar = v.findViewById<Button>(R.id.btnGuardar) | 46 | val btnGuardar = v.findViewById<Button>(R.id.btnGuardar) |
| 46 | val rbProInclu = v.findViewById<RadioButton>(R.id.rbProInclu) | 47 | val rbProInclu = v.findViewById<RadioButton>(R.id.rbProInclu) |
| 47 | val rbProNoInclu = v.findViewById<RadioButton>(R.id.rbProNoInclu) | 48 | val rbProNoInclu = v.findViewById<RadioButton>(R.id.rbProNoInclu) |
| 48 | val cbHabiLectura = v.findViewById<CheckBox>(R.id.cbHabiLectura) | 49 | val cbHabiLectura = v.findViewById<CheckBox>(R.id.cbHabiLectura) |
| 49 | val cbMostrarStock = v.findViewById<CheckBox>(R.id.cbMostrarStock) | 50 | val cbMostrarStock = v.findViewById<CheckBox>(R.id.cbMostrarStock) |
| 50 | val rbCodigoBarras = v.findViewById<RadioButton>(R.id.rbCodigoBarras) | 51 | val rbCodigoBarras = v.findViewById<RadioButton>(R.id.rbCodigoBarras) |
| 51 | val rbCodigoDebo = v.findViewById<RadioButton>(R.id.rbCodigoDebo) | 52 | val rbCodigoDebo = v.findViewById<RadioButton>(R.id.rbCodigoDebo) |
| 52 | val rbCodigoOrigen = v.findViewById<RadioButton>(R.id.rbCodigoOrigen) | 53 | val rbCodigoOrigen = v.findViewById<RadioButton>(R.id.rbCodigoOrigen) |
| 53 | val rbDeposito = v.findViewById<RadioButton>(R.id.rbDeposito) | 54 | val rbDeposito = v.findViewById<RadioButton>(R.id.rbDeposito) |
| 54 | val rbVentas = v.findViewById<RadioButton>(R.id.rbVentas) | 55 | val rbVentas = v.findViewById<RadioButton>(R.id.rbVentas) |
| 55 | val cbMostrarExistencia = v.findViewById<CheckBox>(R.id.cbMostrarExistencia) | 56 | val cbMostrarExistencia = v.findViewById<CheckBox>(R.id.cbMostrarExistencia) |
| 56 | val cbMostrarPrecio = v.findViewById<CheckBox>(R.id.cbMostrarPrecio) | 57 | val cbMostrarPrecio = v.findViewById<CheckBox>(R.id.cbMostrarPrecio) |
| 57 | val btnAgregarServidor = v.findViewById<Button>(R.id.btnAgregarServidor) | 58 | val btnAgregarServidor = v.findViewById<Button>(R.id.btnAgregarServidor) |
| 58 | val spServidor = v.findViewById<Spinner>(R.id.spServidor) | 59 | val spServidor = v.findViewById<Spinner>(R.id.spServidor) |
| 59 | val btnValidarServidor = v.findViewById<Button>(R.id.btnValidarServidor) | 60 | val btnValidarServidor = v.findViewById<Button>(R.id.btnValidarServidor) |
| 60 | 61 | ||
| 61 | if (sharedPreferences.contains("etRuta")) | 62 | if (sharedPreferences.contains("etRuta")) if (sharedPreferences.contains("rbProInclu")) { |
| 62 | if (sharedPreferences.contains("rbProInclu")) { | 63 | if (sharedPreferences.getString("rbProInclu", "").toString() == "0") { |
| 63 | if (sharedPreferences.getString("rbProInclu", "").toString() == "0") { | 64 | rbProInclu.isChecked = false |
| 64 | rbProInclu.isChecked = false | 65 | rbProNoInclu.isChecked = true |
| 65 | rbProNoInclu.isChecked = true | 66 | } else if (sharedPreferences.getString("rbProInclu", "").toString() == "1") { |
| 66 | } else if (sharedPreferences.getString("rbProInclu", "").toString() == "1") { | 67 | rbProInclu.isChecked = true |
| 67 | rbProInclu.isChecked = true | 68 | rbProNoInclu.isChecked = false |
| 68 | rbProNoInclu.isChecked = false | 69 | } |
| 69 | } | 70 | } else (sharedPreferences.getString("rbProInclu", "").toString() == "") |
| 70 | } else (sharedPreferences.getString("rbProInclu", "").toString() == "") | ||
| 71 | 71 | ||
| 72 | if (sharedPreferences.contains("rbProNoInclu")) { | 72 | if (sharedPreferences.contains("rbProNoInclu")) { |
| 73 | if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") { | 73 | if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") { |
| 74 | rbProNoInclu.isChecked = false | 74 | rbProNoInclu.isChecked = false |
| 75 | rbProInclu.isChecked = true | 75 | rbProInclu.isChecked = true |
| 76 | } else if (sharedPreferences.getString("rbProNoInclu", "").toString() == "1") { | 76 | } else if (sharedPreferences.getString("rbProNoInclu", "").toString() == "1") { |
| 77 | rbProNoInclu.isChecked = true | 77 | rbProNoInclu.isChecked = true |
| 78 | rbProInclu.isChecked = false | 78 | rbProInclu.isChecked = false |
| 79 | } | 79 | } |
| 80 | } else (sharedPreferences.getString("rbProNoInclu", "").toString() == "") | 80 | } else (sharedPreferences.getString("rbProNoInclu", "").toString() == "") |
| 81 | 81 | ||
| 82 | if (sharedPreferences.contains("cbHabiLectura")) { | 82 | if (sharedPreferences.contains("cbHabiLectura")) { |
| 83 | if (sharedPreferences.getString("cbHabiLectura", "").toString() == "0") { | 83 | if (sharedPreferences.getString("cbHabiLectura", "").toString() == "0") { |
| 84 | cbHabiLectura.isChecked = false | 84 | cbHabiLectura.isChecked = false |
| 85 | } else if (sharedPreferences.getString("cbHabiLectura", "").toString() == "1") { | 85 | } else if (sharedPreferences.getString("cbHabiLectura", "").toString() == "1") { |
| 86 | cbHabiLectura.isChecked = true | 86 | cbHabiLectura.isChecked = true |
| 87 | } | 87 | } |
| 88 | } else (sharedPreferences.getString("cbHabiLectura", "").toString() == "") | 88 | } else (sharedPreferences.getString("cbHabiLectura", "").toString() == "") |
| 89 | 89 | ||
| 90 | if (sharedPreferences.contains("cbMostrarStock")) { | 90 | if (sharedPreferences.contains("cbMostrarStock")) { |
| 91 | if (sharedPreferences.getString("cbMostrarStock", "").toString() == "0") { | 91 | if (sharedPreferences.getString("cbMostrarStock", "").toString() == "0") { |
| 92 | cbMostrarStock.isChecked = false | 92 | cbMostrarStock.isChecked = false |
| 93 | } else if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") { | 93 | } else if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") { |
| 94 | cbMostrarStock.isChecked = true | 94 | cbMostrarStock.isChecked = true |
| 95 | } | 95 | } |
| 96 | } else (sharedPreferences.getString("cbMostrarStock", "").toString() == "") | 96 | } else (sharedPreferences.getString("cbMostrarStock", "").toString() == "") |
| 97 | 97 | ||
| 98 | if (sharedPreferences.contains("rbVentas")) { | 98 | if (sharedPreferences.contains("rbVentas")) { |
| 99 | if (sharedPreferences.getString("rbVentas", "").toString() == "0") { | 99 | if (sharedPreferences.getString("rbVentas", "").toString() == "0") { |
| 100 | rbVentas.isChecked = false | 100 | rbVentas.isChecked = false |
| 101 | rbDeposito.isChecked = true | 101 | rbDeposito.isChecked = true |
| 102 | } else if (sharedPreferences.getString("rbVentas", "").toString() == "1") { | 102 | } else if (sharedPreferences.getString("rbVentas", "").toString() == "1") { |
| 103 | rbVentas.isChecked = true | 103 | rbVentas.isChecked = true |
| 104 | rbDeposito.isChecked = false | 104 | rbDeposito.isChecked = false |
| 105 | } | 105 | } |
| 106 | } else (sharedPreferences.getString("rbVentas", "").toString() == "") | 106 | } else (sharedPreferences.getString("rbVentas", "").toString() == "") |
| 107 | 107 | ||
| 108 | if (sharedPreferences.contains("rbDeposito")) { | 108 | if (sharedPreferences.contains("rbDeposito")) { |
| 109 | if (sharedPreferences.getString("rbDeposito", "").toString() == "0") { | 109 | if (sharedPreferences.getString("rbDeposito", "").toString() == "0") { |
| 110 | rbDeposito.isChecked = false | 110 | rbDeposito.isChecked = false |
| 111 | rbVentas.isChecked = true | 111 | rbVentas.isChecked = true |
| 112 | } else if (sharedPreferences.getString("rbDeposito", "").toString() == "1") { | 112 | } else if (sharedPreferences.getString("rbDeposito", "").toString() == "1") { |
| 113 | rbDeposito.isChecked = true | 113 | rbDeposito.isChecked = true |
| 114 | rbVentas.isChecked = false | 114 | rbVentas.isChecked = false |
| 115 | } | 115 | } |
| 116 | } else (sharedPreferences.getString("rbDeposito", "").toString() == "") | 116 | } else (sharedPreferences.getString("rbDeposito", "").toString() == "") |
| 117 | 117 | ||
| 118 | if (sharedPreferences.contains("rbCodigoDebo")) { | 118 | if (sharedPreferences.contains("rbCodigoDebo")) { |
| 119 | if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "0") { | 119 | if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "0") { |
| 120 | rbCodigoDebo.isChecked = false | 120 | rbCodigoDebo.isChecked = false |
| 121 | rbCodigoOrigen.isChecked = false | 121 | rbCodigoOrigen.isChecked = false |
| 122 | rbCodigoBarras.isChecked = false | 122 | rbCodigoBarras.isChecked = false |
| 123 | } else if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "1") { | 123 | } else if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "1") { |
| 124 | rbCodigoDebo.isChecked = true | 124 | rbCodigoDebo.isChecked = true |
| 125 | rbCodigoOrigen.isChecked = false | 125 | rbCodigoOrigen.isChecked = false |
| 126 | rbCodigoBarras.isChecked = false | 126 | rbCodigoBarras.isChecked = false |
| 127 | } | 127 | } |
| 128 | } else (sharedPreferences.getString("rbCodigoDebo", "").toString() == "") | 128 | } else (sharedPreferences.getString("rbCodigoDebo", "").toString() == "") |
| 129 | 129 | ||
| 130 | if (sharedPreferences.contains("rbCodigoOrigen")) { | 130 | if (sharedPreferences.contains("rbCodigoOrigen")) { |
| 131 | if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "0") { | 131 | if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "0") { |
| 132 | rbCodigoOrigen.isChecked = false | 132 | rbCodigoOrigen.isChecked = false |
| 133 | } else if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "1") { | 133 | } else if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "1") { |
| 134 | rbCodigoOrigen.isChecked = true | 134 | rbCodigoOrigen.isChecked = true |
| 135 | } | 135 | } |
| 136 | } else (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "") | 136 | } else (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "") |
| 137 | 137 | ||
| 138 | if (sharedPreferences.contains("rbCodigoBarras")) { | 138 | if (sharedPreferences.contains("rbCodigoBarras")) { |
| 139 | if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "0") { | 139 | if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "0") { |
| 140 | rbCodigoBarras.isChecked = false | 140 | rbCodigoBarras.isChecked = false |
| 141 | } else if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "1") { | 141 | } else if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "1") { |
| 142 | rbCodigoBarras.isChecked = true | 142 | rbCodigoBarras.isChecked = true |
| 143 | } | 143 | } |
| 144 | } else (sharedPreferences.getString("rbCodigoBarras", "").toString() == "") | 144 | } else (sharedPreferences.getString("rbCodigoBarras", "").toString() == "") |
| 145 | 145 | ||
| 146 | if (sharedPreferences.contains("cbMostrarExistencia")) { | 146 | if (sharedPreferences.contains("cbMostrarExistencia")) { |
| 147 | if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "0") { | 147 | if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "0") { |
| 148 | cbMostrarExistencia.isChecked = false | 148 | cbMostrarExistencia.isChecked = false |
| 149 | } else if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "1") { | 149 | } else if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "1") { |
| 150 | cbMostrarExistencia.isChecked = true | 150 | cbMostrarExistencia.isChecked = true |
| 151 | } | 151 | } |
| 152 | } else (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "") | 152 | } else (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "") |
| 153 | 153 | ||
| 154 | if (sharedPreferences.contains("cbMostrarPrecio")) { | 154 | if (sharedPreferences.contains("cbMostrarPrecio")) { |
| 155 | if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "0") { | 155 | if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "0") { |
| 156 | cbMostrarPrecio.isChecked = false | 156 | cbMostrarPrecio.isChecked = false |
| 157 | } else if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "1") { | 157 | } else if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "1") { |
| 158 | cbMostrarPrecio.isChecked = true | 158 | cbMostrarPrecio.isChecked = true |
| 159 | } | 159 | } |
| 160 | } else (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "") | 160 | } else (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "") |
| 161 | 161 | ||
| 162 | btnGuardar.setOnClickListener { | 162 | btnGuardar.setOnClickListener { |
| 163 | guardarPreferencias() | 163 | guardarPreferencias() |
| 164 | Toast.makeText(v.context, "Los Datos se guardaron correctamente", Toast.LENGTH_LONG).show() | 164 | Toast.makeText(v.context, "Los Datos se guardaron correctamente", Toast.LENGTH_LONG).show() |
| 165 | navController.navigate(R.id.action_configuracionFragment_to_mainFragment2) | 165 | navController.navigate(R.id.action_configuracionFragment_to_mainFragment2) |
| 166 | } | 166 | } |
| 167 | btnAgregarServidor.setOnClickListener { findNavController().navigate(R.id.servidoresFragment) } | 167 | btnAgregarServidor.setOnClickListener { findNavController().navigate(R.id.servidoresFragment) } |
| 168 | btnValidarServidor.setOnClickListener { Toast.makeText(requireContext(), "Dirección correcta", Toast.LENGTH_LONG).show() } | 168 | btnValidarServidor.setOnClickListener { Toast.makeText(requireContext(), "Dirección correcta", Toast.LENGTH_LONG).show() } |
| 169 | 169 | spServidor?.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { | |
| 170 | override fun onNothingSelected(parent: AdapterView<*>?) {} | ||
| 171 | override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { itemSelect = position } | ||
| 172 | } | ||
| 170 | GlobalScope.launch(Dispatchers.Main) { | 173 | GlobalScope.launch(Dispatchers.Main) { |
| 174 | adapterSpinnerServidor = SpinnerAdapterServidor(requireContext(), getDescServers()) | ||
| 175 | spServidor.adapter = adapterSpinnerServidor | ||
| 171 | 176 | ||
| 172 | for (any in getDescServers()) { | 177 | if (sharedPreferences.contains("ServerPredeterminado")) { |
| 173 | listServerDescription.add(any.descripcion.toString()) | 178 | spServidor.setSelection(sharedPreferences.getString("ServerPredeterminado", "").toString().toInt()) |
| 174 | listaServers[index]=(any.direccion.toString()) | 179 | } else (spServidor.setSelection(0)) |
| 175 | index+=index | ||
| 176 | } | ||
| 177 | |||
| 178 | if (spServidor != null) { | ||
| 179 | val adapter = ArrayAdapter(requireContext(), android.R.layout.simple_spinner_item, listServerDescription) | ||
| 180 | spServidor.adapter = adapter | ||
| 181 | } | ||
| 182 | } | 180 | } |
| 183 | if (sharedPreferences.contains("ServerPredeterminado")) { | ||
| 184 | spServidor.setSelection(sharedPreferences.getString("ServerPredeterminado", "").toString().toInt()) | ||
| 185 | 181 | ||
| 186 | } else (spServidor.setSelection(2)) | ||
| 187 | |||
| 188 | spServidor.setOnItemClickListener { adapterView, view, i, l -> | ||
| 189 | |||
| 190 | } | ||
| 191 | return v | 182 | return v |
| 192 | } | 183 | } |
| 193 | 184 | ||
| 194 | suspend fun getDescServers(): List<ServeInv> { | 185 | suspend fun getDescServers(): List<ServeInv> { |
| 195 | return GlobalScope.async(Dispatchers.IO) { | 186 | return GlobalScope.async(Dispatchers.IO) { |
| 196 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchAllServers() | 187 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchAllServers() |
| 197 | }.await() | 188 | }.await() |
| 198 | } | 189 | } |
| 199 | 190 | ||
| 200 | fun guardarPreferencias() { | 191 | fun guardarPreferencias() { |
| 201 | try { | 192 | try { |
| 202 | val editor = sharedPreferences.edit() | 193 | val editor = sharedPreferences.edit() |
| 203 | 194 | ||
| 204 | if (etRuta.text.isNotEmpty()) editor?.putString("etRuta", etRuta.text.toString()) | 195 | if (etRuta.text.isNotEmpty()) editor?.putString("etRuta", etRuta.text.toString()) |
| 205 | 196 | ||
| 206 | if (rbProInclu.isChecked) editor?.putString("rbProInclu", "1") else editor?.putString("rbProInclu", "0") | 197 | if (rbProInclu.isChecked) editor?.putString("rbProInclu", "1") else editor?.putString("rbProInclu", "0") |
| 207 | if (rbProNoInclu.isChecked) editor?.putString("rbProNoInclu", "1") else editor?.putString("rbProNoInclu", "0") | 198 | if (rbProNoInclu.isChecked) editor?.putString("rbProNoInclu", "1") else editor?.putString("rbProNoInclu", "0") |
| 208 | 199 | ||
| 209 | if (cbHabiLectura.isChecked) editor?.putString("cbHabiLectura", "1") else editor?.putString("cbHabiLectura", "0") | 200 | if (cbHabiLectura.isChecked) editor?.putString("cbHabiLectura", "1") else editor?.putString("cbHabiLectura", "0") |
| 210 | if (cbMostrarStock.isChecked) editor?.putString("cbMostrarStock", "1") else editor?.putString("cbMostrarStock", "0") | 201 | if (cbMostrarStock.isChecked) editor?.putString("cbMostrarStock", "1") else editor?.putString("cbMostrarStock", "0") |
| 211 | if (rbVentas.isChecked) editor?.putString("rbVentas", "1") else editor?.putString("rbVentas", "0") | 202 | if (rbVentas.isChecked) editor?.putString("rbVentas", "1") else editor?.putString("rbVentas", "0") |
| 212 | if (rbDeposito.isChecked) editor?.putString("rbDeposito", "1") else editor?.putString("rbDeposito", "0") | 203 | if (rbDeposito.isChecked) editor?.putString("rbDeposito", "1") else editor?.putString("rbDeposito", "0") |
| 213 | if (rbCodigoDebo.isChecked) editor?.putString("rbCodigoDebo", "1") else editor?.putString("rbCodigoDebo", "0") | 204 | if (rbCodigoDebo.isChecked) editor?.putString("rbCodigoDebo", "1") else editor?.putString("rbCodigoDebo", "0") |
| 214 | if (rbCodigoOrigen.isChecked) editor?.putString("rbCodigoOrigen", "1") else editor?.putString("rbCodigoOrigen", "0") | 205 | if (rbCodigoOrigen.isChecked) editor?.putString("rbCodigoOrigen", "1") else editor?.putString("rbCodigoOrigen", "0") |
| 215 | if (rbCodigoBarras.isChecked) editor?.putString("rbCodigoBarras", "1") else editor?.putString("rbCodigoBarras", "0") | 206 | if (rbCodigoBarras.isChecked) editor?.putString("rbCodigoBarras", "1") else editor?.putString("rbCodigoBarras", "0") |
| 216 | if (cbMostrarExistencia.isChecked) editor?.putString("cbMostrarExistencia", "1") else editor?.putString("cbMostrarExistencia", "0") | 207 | if (cbMostrarExistencia.isChecked) editor?.putString("cbMostrarExistencia", "1") else editor?.putString("cbMostrarExistencia", "0") |
| 217 | if (cbMostrarPrecio.isChecked) editor?.putString("cbMostrarPrecio", "1") else editor?.putString("cbMostrarPrecio", "0") | 208 | if (cbMostrarPrecio.isChecked) editor?.putString("cbMostrarPrecio", "1") else editor?.putString("cbMostrarPrecio", "0") |
| 218 | editor?.putString("ServerPredeterminado", spServidor.selectedItemId.toString()) | 209 | editor?.putString("ServerPredeterminado", itemSelect.toString()) |
| 219 | 210 | ||
| 220 | editor?.apply() | 211 | editor?.apply() |
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/InventarioListAdapter.kt
| 1 | package com.focasoftware.deboinventariov20.ui.main | 1 | package com.focasoftware.deboinventariov20.ui.main |
| 2 | 2 | ||
| 3 | import android.content.Context | 3 | import android.content.Context |
| 4 | import android.view.LayoutInflater | 4 | import android.view.LayoutInflater |
| 5 | import android.view.View | 5 | import android.view.View |
| 6 | import android.view.ViewGroup | 6 | import android.view.ViewGroup |
| 7 | import androidx.recyclerview.widget.RecyclerView | 7 | import androidx.recyclerview.widget.RecyclerView |
| 8 | import com.focasoftware.deboinventariov20.Model.InvHead | 8 | import com.focasoftware.deboinventariov20.Model.InvHead |
| 9 | import com.focasoftware.deboinventariov20.R | 9 | import com.focasoftware.deboinventariov20.R |
| 10 | import com.focasoftware.deboinventariov20.ui.util.Base.BaseViewHolder | 10 | import com.focasoftware.deboinventariov20.ui.util.Base.BaseViewHolder |
| 11 | import kotlinx.android.synthetic.main.item_principal.view.* | 11 | import kotlinx.android.synthetic.main.item_principal.view.* |
| 12 | 12 | ||
| 13 | class InventarioListAdapter(private val context: Context, private val inv: List<InvHead>, private val itemClickListener: OnInventarioClickListener) : | 13 | class InventarioListAdapter(private val context: Context, private val inv: List<InvHead>, private val itemClickListener: OnInventarioClickListener) : |
| 14 | RecyclerView.Adapter<BaseViewHolder<*>>() { | 14 | RecyclerView.Adapter<BaseViewHolder<*>>() { |
| 15 | 15 | ||
| 16 | interface OnInventarioClickListener { | 16 | interface OnInventarioClickListener { |
| 17 | fun onItemClick(inventario: String?) | 17 | fun onItemClick(inventario: String?) |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(context).inflate(R.layout.item_principal, parent, false)) | 20 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(context).inflate(R.layout.item_principal, parent, false)) |
| 21 | 21 | ||
| 22 | override fun getItemCount() = inv.size | 22 | override fun getItemCount() = inv.size |
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | inner class ItemsViewHolder(itemView: View) : BaseViewHolder<InvHead>(itemView) { | 25 | inner class ItemsViewHolder(itemView: View) : BaseViewHolder<InvHead>(itemView) { |
| 26 | override fun bind(item: InvHead, position: Int) { | 26 | override fun bind(item: InvHead, position: Int) { |
| 27 | itemView.setOnClickListener {itemClickListener.onItemClick(item.invNum.toString())} | 27 | itemView.setOnClickListener {itemClickListener.onItemClick(item.invNum.toString())} |
| 28 | itemView.tvPrincipalinventario.text = item.invNum.toString() | 28 | itemView.tvPrincipalinventario.text = item.invNum.toString() |
| 29 | itemView.tvDescription.text=item.descripcion.toString() | ||
| 29 | } | 30 | } |
| 30 | } | 31 | } |
| 31 | 32 | ||
| 32 | override fun onBindViewHolder(holder: BaseViewHolder<*>, position: Int) { | 33 | override fun onBindViewHolder(holder: BaseViewHolder<*>, position: Int) { |
| 33 | when (holder) { | 34 | when (holder) { |
| 34 | is ItemsViewHolder -> holder.bind(inv[position], position) | 35 | is ItemsViewHolder -> holder.bind(inv[position], position) |
| 35 | else -> IllegalArgumentException("No se pudo pasar el ViewHolder") | 36 | else -> IllegalArgumentException("No se pudo pasar el ViewHolder") |
| 36 | } | 37 | } |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 39 | 40 | ||
| 40 | } | 41 | } |
| 41 | 42 | ||
| 42 | 43 | ||
| 43 | 44 | ||
| 44 | 45 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/ItemPrincipal.kt
| 1 | package com.focasoftware.deboinventariov20.ui.main | 1 | package com.focasoftware.deboinventariov20.ui.main |
| 2 | 2 | ||
| 3 | data class ItemInventario(val inventario: String?) |
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/MainFragment.kt
| 1 | package com.focasoftware.deboinventariov20.ui.main | 1 | package com.focasoftware.deboinventariov20.ui.main |
| 2 | 2 | ||
| 3 | import android.content.Context | 3 | import android.content.Context |
| 4 | import android.content.SharedPreferences | 4 | import android.content.SharedPreferences |
| 5 | import android.os.Bundle | 5 | import android.os.Bundle |
| 6 | import android.view.LayoutInflater | 6 | import android.view.LayoutInflater |
| 7 | import android.view.View | 7 | import android.view.View |
| 8 | import android.view.ViewGroup | 8 | import android.view.ViewGroup |
| 9 | import android.widget.* | 9 | import android.widget.* |
| 10 | import androidx.fragment.app.Fragment | 10 | import androidx.fragment.app.Fragment |
| 11 | import androidx.navigation.NavController | 11 | import androidx.navigation.NavController |
| 12 | import androidx.navigation.Navigation | 12 | import androidx.navigation.Navigation |
| 13 | import androidx.recyclerview.widget.LinearLayoutManager | 13 | import androidx.recyclerview.widget.LinearLayoutManager |
| 14 | import androidx.recyclerview.widget.RecyclerView | 14 | import androidx.recyclerview.widget.RecyclerView |
| 15 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 15 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
| 16 | import com.focasoftware.deboinventariov20.Model.InvHead | 16 | import com.focasoftware.deboinventariov20.Model.InvHead |
| 17 | import com.focasoftware.deboinventariov20.R | 17 | import com.focasoftware.deboinventariov20.R |
| 18 | import com.focasoftware.deboinventariov20.ui.inventario.ItemsRecycler | 18 | import com.focasoftware.deboinventariov20.ui.inventario.ItemsRecycler |
| 19 | import kotlinx.coroutines.Dispatchers | 19 | import kotlinx.coroutines.Dispatchers |
| 20 | import kotlinx.coroutines.GlobalScope | 20 | import kotlinx.coroutines.GlobalScope |
| 21 | import kotlinx.coroutines.async | 21 | import kotlinx.coroutines.async |
| 22 | import kotlinx.coroutines.launch | 22 | import kotlinx.coroutines.launch |
| 23 | import java.util.* | 23 | import java.util.* |
| 24 | 24 | ||
| 25 | class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener { | 25 | class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener { |
| 26 | private lateinit var inventarios: List<InvHead> | 26 | private lateinit var inventarios: List<InvHead> |
| 27 | private lateinit var ordenado: List<InvHead> | 27 | private lateinit var ordenado: List<InvHead> |
| 28 | private lateinit var rcInventario: RecyclerView | 28 | private lateinit var rcInventario: RecyclerView |
| 29 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | 29 | private lateinit var viewAdapter: RecyclerView.Adapter<*> |
| 30 | private lateinit var viewManager: RecyclerView.LayoutManager | 30 | private lateinit var viewManager: RecyclerView.LayoutManager |
| 31 | // private var listIvn2 = List<InvHead>() | 31 | // private var listIvn2 = List<InvHead>() |
| 32 | private var listIvn2 = ArrayList<InvHead>() | 32 | private var listIvn2 = ArrayList<InvHead>() |
| 33 | private lateinit var navController: NavController | 33 | private lateinit var navController: NavController |
| 34 | private lateinit var sharedPreferences: SharedPreferences | 34 | private lateinit var sharedPreferences: SharedPreferences |
| 35 | private var cantidadInventarios: Int = 0 | 35 | private var cantidadInventarios: Int = 0 |
| 36 | 36 | ||
| 37 | override fun onCreate(savedInstanceState: Bundle?) { | 37 | override fun onCreate(savedInstanceState: Bundle?) { |
| 38 | super.onCreate(savedInstanceState) | 38 | super.onCreate(savedInstanceState) |
| 39 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 39 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 42 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
| 43 | var bAbiertoCerrado = false | 43 | var bAbiertoCerrado = false |
| 44 | val v = inflater.inflate(R.layout.fragment_main, container, false) | 44 | val v = inflater.inflate(R.layout.fragment_main, container, false) |
| 45 | val tvInvDinamicos = v.findViewById<TextView>(R.id.tvInvDinamicos) | 45 | val tvInvDinamicos = v.findViewById<TextView>(R.id.tvInvDinamicos) |
| 46 | val txtDeposito = v.findViewById<TextView>(R.id.txtDeposito) | 46 | val txtDeposito = v.findViewById<TextView>(R.id.txtDeposito) |
| 47 | val ivSort19= v.findViewById<ImageButton>(R.id.ivSort19) | 47 | val ivSort19= v.findViewById<ImageButton>(R.id.ivSort19) |
| 48 | val ivSort91= v.findViewById<ImageButton>(R.id.ivSort91) | 48 | val ivSort91= v.findViewById<ImageButton>(R.id.ivSort91) |
| 49 | val cbVentas= v.findViewById<CheckBox>(R.id.cbVentas) | 49 | val cbVentas= v.findViewById<CheckBox>(R.id.cbVentas) |
| 50 | val cbDeposito= v.findViewById<CheckBox>(R.id.cbDeposito) | 50 | val cbDeposito= v.findViewById<CheckBox>(R.id.cbDeposito) |
| 51 | 51 | ||
| 52 | rcInventario = v.findViewById(R.id.rcInventario) | 52 | rcInventario = v.findViewById(R.id.rcInventario) |
| 53 | 53 | ||
| 54 | GlobalScope.launch(Dispatchers.Main) { | 54 | GlobalScope.launch(Dispatchers.Main) { |
| 55 | inventarios = buscarEnBDInvHead() | 55 | inventarios = buscarEnBDInvHead() |
| 56 | for ((i, item) in inventarios.withIndex()) { | 56 | for ((i, item) in inventarios.withIndex()) { |
| 57 | val inv = InvHead(inventarios[i].invNum, | 57 | val inv = InvHead(inventarios[i].invNum, |
| 58 | inventarios[i].descripcion, | 58 | inventarios[i].descripcion, |
| 59 | inventarios[i].estado, | 59 | inventarios[i].estado, |
| 60 | inventarios[i].fechaInicio, | 60 | inventarios[i].fechaInicio, |
| 61 | inventarios[i].fechaFinal, | 61 | inventarios[i].fechaFinal, |
| 62 | inventarios[i].prodContados, | 62 | inventarios[i].prodContados, |
| 63 | inventarios[i].lugar, | 63 | inventarios[i].lugar, |
| 64 | inventarios[i].stDesc, | 64 | inventarios[i].stDesc, |
| 65 | inventarios[i].proNoCont) | 65 | inventarios[i].proNoCont) |
| 66 | cargarRecicler(inv) | 66 | cargarRecicler(inv) |
| 67 | cantidadInventarios = i + 1 | 67 | cantidadInventarios = i + 1 |
| 68 | } | 68 | } |
| 69 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) +" | 69 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) +" |
| 70 | tvInvDinamicos.setOnClickListener { | 70 | tvInvDinamicos.setOnClickListener { |
| 71 | if (!bAbiertoCerrado) { | 71 | if (!bAbiertoCerrado) { |
| 72 | bAbiertoCerrado = true | 72 | bAbiertoCerrado = true |
| 73 | txtDeposito.visibility = View.GONE | 73 | txtDeposito.visibility = View.GONE |
| 74 | rcInventario.visibility = View.VISIBLE | 74 | rcInventario.visibility = View.VISIBLE |
| 75 | ivSort91.visibility = View.INVISIBLE | 75 | ivSort91.visibility = View.INVISIBLE |
| 76 | ivSort19.visibility = View.VISIBLE | 76 | ivSort19.visibility = View.VISIBLE |
| 77 | cbVentas.visibility = View.VISIBLE | 77 | cbVentas.visibility = View.VISIBLE |
| 78 | cbDeposito.visibility = View.VISIBLE | 78 | cbDeposito.visibility = View.VISIBLE |
| 79 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) -" | 79 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) -" |
| 80 | } else { | 80 | } else { |
| 81 | bAbiertoCerrado = false | 81 | bAbiertoCerrado = false |
| 82 | rcInventario.visibility = View.GONE | 82 | rcInventario.visibility = View.GONE |
| 83 | ivSort91.visibility = View.GONE | 83 | ivSort91.visibility = View.GONE |
| 84 | ivSort19.visibility = View.GONE | 84 | ivSort19.visibility = View.GONE |
| 85 | txtDeposito.visibility = View.VISIBLE | 85 | txtDeposito.visibility = View.VISIBLE |
| 86 | cbVentas.visibility = View.GONE | 86 | cbVentas.visibility = View.GONE |
| 87 | cbDeposito.visibility = View.GONE | 87 | cbDeposito.visibility = View.GONE |
| 88 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) +" | 88 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) +" |
| 89 | } | 89 | } |
| 90 | } | 90 | } |
| 91 | ivSort19.setOnClickListener { | 91 | ivSort19.setOnClickListener { |
| 92 | ordenado= inventarios.sortedByDescending { | 92 | ordenado= inventarios.sortedByDescending { |
| 93 | it.invNum | 93 | it.invNum |
| 94 | } | 94 | } |
| 95 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) | 95 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) |
| 96 | viewManager = LinearLayoutManager(requireContext()) | 96 | viewManager = LinearLayoutManager(requireContext()) |
| 97 | 97 | ||
| 98 | rcInventario.apply { | 98 | rcInventario.apply { |
| 99 | adapter = viewAdapter | 99 | adapter = viewAdapter |
| 100 | layoutManager = viewManager | 100 | layoutManager = viewManager |
| 101 | } | 101 | } |
| 102 | viewAdapter.notifyDataSetChanged() | 102 | viewAdapter.notifyDataSetChanged() |
| 103 | ivSort19.visibility=View.INVISIBLE | 103 | ivSort19.visibility=View.INVISIBLE |
| 104 | ivSort91.visibility=View.VISIBLE | 104 | ivSort91.visibility=View.VISIBLE |
| 105 | } | 105 | } |
| 106 | ivSort91.setOnClickListener { | 106 | ivSort91.setOnClickListener { |
| 107 | ordenado= inventarios.sortedBy { | 107 | ordenado= inventarios.sortedBy { |
| 108 | it.invNum | 108 | it.invNum |
| 109 | } | 109 | } |
| 110 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) | 110 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) |
| 111 | viewManager = LinearLayoutManager(requireContext()) | 111 | viewManager = LinearLayoutManager(requireContext()) |
| 112 | 112 | ||
| 113 | rcInventario.apply { | 113 | rcInventario.apply { |
| 114 | adapter = viewAdapter | 114 | adapter = viewAdapter |
| 115 | layoutManager = viewManager | 115 | layoutManager = viewManager |
| 116 | } | 116 | } |
| 117 | viewAdapter.notifyDataSetChanged() | 117 | viewAdapter.notifyDataSetChanged() |
| 118 | ivSort91.visibility=View.INVISIBLE | 118 | ivSort91.visibility=View.INVISIBLE |
| 119 | ivSort19.visibility=View.VISIBLE | 119 | ivSort19.visibility=View.VISIBLE |
| 120 | } | 120 | } |
| 121 | } | 121 | } |
| 122 | return v | 122 | return v |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | suspend fun buscarEnBDInvHead(): List<InvHead> { | 125 | suspend fun buscarEnBDInvHead(): List<InvHead> { |
| 126 | //TODO BUSQUEDA POR DESCRIPCION | 126 | //TODO BUSQUEDA POR DESCRIPCION |
| 127 | var busqueda: List<InvHead> | 127 | var busqueda: List<InvHead> |
| 128 | return GlobalScope.async(Dispatchers.IO) { | 128 | return GlobalScope.async(Dispatchers.IO) { |
| 129 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.fetchAllInvHead() | 129 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.fetchAllInvHead() |
| 130 | return@async busqueda | 130 | return@async busqueda |
| 131 | }.await() | 131 | }.await() |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | fun cargarRecicler(inv: InvHead) { | 134 | fun cargarRecicler(inv: InvHead) { |
| 135 | //TODO CARGO EN LE RV | 135 | //TODO CARGO EN LE RV |
| 136 | 136 | ||
| 137 | val number = if (inv.invNum.toLong() < 10) "0${inv.invNum.toLong()}" else inv.invNum.toString() | 137 | // val number = if (inv.invNum.toLong() < 10) "0${inv.invNum.toLong()}" else inv.invNum.toString() |
| 138 | val item = ItemInventario("N° $number ${inv.descripcion}. Fecha: ${inv.fechaFinal}") | 138 | // val item = ItemInventario("N° $number ${inv.descripcion}. Fecha: ${inv.fechaFinal}") |
| 139 | //(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar) | 139 | |
| 140 | // listIvn.add(item) | 140 | // listIvn.add(item) |
| 141 | listIvn2.add(inv) | 141 | listIvn2.add(inv) |
| 142 | viewAdapter = InventarioListAdapter(requireContext(), listIvn2, this) | 142 | viewAdapter = InventarioListAdapter(requireContext(), listIvn2, this) |
| 143 | viewManager = LinearLayoutManager(requireContext()) | 143 | viewManager = LinearLayoutManager(requireContext()) |
| 144 | 144 | ||
| 145 | rcInventario.apply { | 145 | rcInventario.apply { |
| 146 | adapter = viewAdapter | 146 | adapter = viewAdapter |
| 147 | layoutManager = viewManager | 147 | layoutManager = viewManager |
| 148 | } | 148 | } |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 151 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
| 152 | super.onViewCreated(view, savedInstanceState) | 152 | super.onViewCreated(view, savedInstanceState) |
| 153 | navController = Navigation.findNavController(view) | 153 | navController = Navigation.findNavController(view) |
| 154 | listIvn2.clear() | 154 | listIvn2.clear() |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | override fun onItemClick(inventario: String?) { | 157 | override fun onItemClick(inventario: String?) { |
| 158 | 158 | ||
| 159 | val editor = sharedPreferences.edit() | 159 | val editor = sharedPreferences.edit() |
| 160 | // var invSel: String = inventario.toString() | 160 | // var invSel: String = inventario.toString() |
| 161 | // invSel = invSel.substring(3, 5) | 161 | // invSel = invSel.substring(3, 5) |
| 162 | editor?.putString("Inventario", inventario) | 162 | editor?.putString("Inventario", inventario) |
| 163 | editor?.apply() | 163 | editor?.apply() |
| 164 | editor.commit() | 164 | editor.commit() |
| 165 | navController.navigate(R.id.action_mainFragment2_to_inventarioFragment) | 165 | navController.navigate(R.id.action_mainFragment2_to_inventarioFragment) |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | 168 | ||
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | 171 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/servidores/SpinnerAdapter.kt
| File was created | 1 | package com.focasoftware.deboinventariov20.ui.servidores | |
| 2 | |||
| 3 | import android.content.Context | ||
| 4 | import android.view.LayoutInflater | ||
| 5 | import android.view.View | ||
| 6 | import android.view.ViewGroup | ||
| 7 | import android.widget.BaseAdapter | ||
| 8 | import android.widget.TextView | ||
| 9 | import com.focasoftware.deboinventariov20.Model.ServeInv | ||
| 10 | import com.focasoftware.deboinventariov20.R | ||
| 11 | |||
| 12 | |||
| 13 | class SpinnerAdapterServidor internal constructor(internal var context: Context, internal var list: List<ServeInv>) : BaseAdapter() { | ||
| 14 | override fun getCount(): Int { | ||
| 15 | return list.size | ||
| 16 | } | ||
| 17 | |||
| 18 | override fun getItem(i: Int): Any? { | ||
| 19 | return null | ||
| 20 | } | ||
| 21 | |||
| 22 | override fun getItemId(i: Int): Long { | ||
| 23 | return 0 | ||
| 24 | } | ||
| 25 | |||
| 26 | override fun getView(i: Int, view1: View?, viewGroup: ViewGroup): View { | ||
| 27 | var views=view1 | ||
| 28 | if (views == null) { | ||
| 29 | val inflater = LayoutInflater.from(context) | ||
| 30 | |||
| 31 | views = inflater.inflate(R.layout.item_spinner, viewGroup, false) | ||
| 32 | } | ||
| 33 | |||
| 34 | val tvServidorDesc = views!!.findViewById<TextView>(R.id.tvServidorDesc) | ||
| 35 | tvServidorDesc.text=list[i].descripcion | ||
| 36 | return tvServidorDesc | ||
| 37 | |||
| 38 | } | ||
| 39 | } | ||
| 40 | |||
| 41 |
app/src/main/res/drawable-v24/boton_redondo2.xml
| File was created | 1 | <?xml version="1.0" encoding="utf-8"?> | |
| 2 | <shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | <solid android:color="#B6B7BC"/> | ||
| 4 | <corners android:radius="80dp"/> | ||
| 5 | </shape> |
app/src/main/res/drawable/boton_redondo.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <shape xmlns:android="http://schemas.android.com/apk/res/android"> | 2 | <shape xmlns:android="http://schemas.android.com/apk/res/android"> |
| 3 | <solid android:color="@color/colorAccent"/> | 3 | <solid android:color="@color/colorAccent"/> |
| 4 | <corners android:radius="80dp"/> | 4 | <corners android:radius="80dp"/> |
| 5 | |||
| 6 | |||
| 7 | |||
| 8 | </shape> | 5 | </shape> |
app/src/main/res/layout/fragment_configuracion.xml
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
| 5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
| 6 | android:layout_height="wrap_content" | 6 | android:layout_height="wrap_content" |
| 7 | tools:context=".ui.configuracion.ConfiguracionFragment"> | 7 | tools:context=".ui.configuracion.ConfiguracionFragment"> |
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | <androidx.appcompat.widget.AppCompatTextView | 10 | <androidx.appcompat.widget.AppCompatTextView |
| 11 | android:id="@+id/textView2" | 11 | android:id="@+id/textView2" |
| 12 | android:layout_width="match_parent" | 12 | android:layout_width="match_parent" |
| 13 | android:layout_height="wrap_content" | 13 | android:layout_height="wrap_content" |
| 14 | 14 | ||
| 15 | android:layout_marginTop="@dimen/MarginTopTitulos" | 15 | android:layout_marginTop="@dimen/MarginTopTitulos" |
| 16 | android:gravity="center" | 16 | android:gravity="center" |
| 17 | 17 | ||
| 18 | android:lines="1" | 18 | android:lines="1" |
| 19 | android:text="@string/tvTituloConf" | 19 | android:text="@string/tvTituloConf" |
| 20 | android:textColor="@color/colorAccent" | 20 | android:textColor="@color/colorAccent" |
| 21 | android:textSize="@dimen/Titulos" | 21 | android:textSize="@dimen/Titulos" |
| 22 | app:fontFamily="sans-serif-condensed" | 22 | app:fontFamily="sans-serif-condensed" |
| 23 | app:layout_constraintBottom_toTopOf="@+id/tvSeleccioneServidor" | 23 | app:layout_constraintBottom_toTopOf="@+id/tvSeleccioneServidor" |
| 24 | app:layout_constraintEnd_toEndOf="parent" | 24 | app:layout_constraintEnd_toEndOf="parent" |
| 25 | app:layout_constraintStart_toStartOf="parent" | 25 | app:layout_constraintStart_toStartOf="parent" |
| 26 | app:layout_constraintTop_toTopOf="parent" /> | 26 | app:layout_constraintTop_toTopOf="parent" /> |
| 27 | 27 | ||
| 28 | <TextView | 28 | <TextView |
| 29 | android:id="@+id/tvSeleccioneServidor" | 29 | android:id="@+id/tvSeleccioneServidor" |
| 30 | android:layout_width="0dp" | 30 | android:layout_width="0dp" |
| 31 | android:layout_height="wrap_content" | 31 | android:layout_height="wrap_content" |
| 32 | 32 | ||
| 33 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 33 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
| 34 | android:layout_marginTop="@dimen/MarginTopSubTitulos" | 34 | android:layout_marginTop="@dimen/MarginTopSubTitulos" |
| 35 | android:gravity="start" | 35 | android:gravity="start" |
| 36 | android:lines="1" | 36 | android:lines="1" |
| 37 | android:text="@string/tvSeleccioneServidor" | 37 | android:text="@string/tvSeleccioneServidor" |
| 38 | android:textColor="@android:color/black" | 38 | android:textColor="@android:color/black" |
| 39 | android:textSize="@dimen/SubTitulos" | 39 | android:textSize="@dimen/SubTitulos" |
| 40 | app:fontFamily="sans-serif-condensed" | 40 | app:fontFamily="sans-serif-condensed" |
| 41 | app:layout_constraintBottom_toTopOf="@+id/spServidor" | 41 | app:layout_constraintBottom_toTopOf="@+id/spServidor" |
| 42 | app:layout_constraintEnd_toEndOf="parent" | 42 | app:layout_constraintEnd_toEndOf="parent" |
| 43 | app:layout_constraintStart_toStartOf="parent" | 43 | app:layout_constraintStart_toStartOf="parent" |
| 44 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> | 44 | app:layout_constraintTop_toBottomOf="@+id/textView2" /> |
| 45 | 45 | ||
| 46 | <Spinner | 46 | <Spinner |
| 47 | android:id="@+id/spServidor" | 47 | android:id="@+id/spServidor" |
| 48 | style="@android:style/Widget.Holo.Light.Spinner" | ||
| 48 | android:layout_width="0dp" | 49 | android:layout_width="0dp" |
| 49 | android:layout_height="wrap_content" | 50 | android:layout_height="wrap_content" |
| 50 | android:backgroundTint="@color/LightGray" | ||
| 51 | android:elevation="5dp" | 51 | android:elevation="5dp" |
| 52 | android:fadeScrollbars="true" | ||
| 53 | android:foregroundTint="@android:color/holo_orange_dark" | ||
| 54 | android:soundEffectsEnabled="true" | ||
| 55 | android:spinnerMode="dropdown" | ||
| 56 | 52 | ||
| 57 | android:splitMotionEvents="true" | ||
| 58 | android:textAlignment="textStart" | ||
| 59 | android:textSize="@dimen/NormalText" | 53 | android:textSize="@dimen/NormalText" |
| 60 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" | 54 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" |
| 61 | app:layout_constraintEnd_toStartOf="@+id/btnValidarServidor" | 55 | app:layout_constraintEnd_toStartOf="@+id/btnValidarServidor" |
| 62 | app:layout_constraintHorizontal_chainStyle="packed" | 56 | app:layout_constraintHorizontal_chainStyle="packed" |
| 63 | app:layout_constraintStart_toStartOf="parent" | 57 | app:layout_constraintStart_toStartOf="parent" |
| 64 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" | 58 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" |
| 65 | android:prompt="@string/leyendaSpinner"/> | 59 | /> |
| 66 | 60 | ||
| 67 | <Button | 61 | <Button |
| 68 | android:id="@+id/btnValidarServidor" | 62 | android:id="@+id/btnValidarServidor" |
| 69 | android:layout_width="wrap_content" | 63 | android:layout_width="wrap_content" |
| 70 | android:layout_height="wrap_content" | 64 | android:layout_height="wrap_content" |
| 71 | android:textColor="@android:color/white" | 65 | android:textColor="@android:color/white" |
| 72 | android:padding="10dp" | 66 | android:padding="10dp" |
| 73 | android:background="@drawable/boton_borde_redondeado" | 67 | android:background="@drawable/boton_borde_redondeado" |
| 74 | android:text="@string/btnValidarServidor" | 68 | android:text="@string/btnValidarServidor" |
| 75 | android:textSize="@dimen/NormalText" | 69 | android:textSize="@dimen/NormalText" |
| 76 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" | 70 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" |
| 77 | app:layout_constraintEnd_toEndOf="parent" | 71 | app:layout_constraintEnd_toEndOf="parent" |
| 78 | app:layout_constraintHorizontal_chainStyle="packed" | 72 | app:layout_constraintHorizontal_chainStyle="packed" |
| 79 | app:layout_constraintStart_toEndOf="@id/spServidor" | 73 | app:layout_constraintStart_toEndOf="@id/spServidor" |
| 80 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" /> | 74 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" /> |
| 81 | 75 | ||
| 82 | <Button | 76 | <Button |
| 83 | android:id="@+id/btnAgregarServidor" | 77 | android:id="@+id/btnAgregarServidor" |
| 84 | android:layout_width="0dp" | 78 | android:layout_width="0dp" |
| 85 | android:layout_height="wrap_content" | 79 | android:layout_height="wrap_content" |
| 86 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 80 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
| 87 | android:layout_marginEnd="@dimen/MarginBotAgreSer" | 81 | android:layout_marginEnd="@dimen/MarginBotAgreSer" |
| 88 | android:text="@string/btnAgregarServidor" | 82 | android:text="@string/btnAgregarServidor" |
| 89 | android:textSize="@dimen/NormalText" | 83 | android:textSize="@dimen/NormalText" |
| 90 | android:textColor="@android:color/white" | 84 | android:textColor="@android:color/white" |
| 91 | android:padding="10dp" | 85 | android:padding="10dp" |
| 92 | android:background="@drawable/boton_borde_redondeado" | 86 | android:background="@drawable/boton_borde_redondeado" |
| 93 | app:layout_constraintBottom_toTopOf="@+id/tvUbicacionCarpetas" | 87 | app:layout_constraintBottom_toTopOf="@+id/tvUbicacionCarpetas" |
| 94 | app:layout_constraintEnd_toEndOf="parent" | 88 | app:layout_constraintEnd_toEndOf="parent" |
| 95 | app:layout_constraintStart_toStartOf="parent" | 89 | app:layout_constraintStart_toStartOf="parent" |
| 96 | app:layout_constraintTop_toBottomOf="@+id/btnValidarServidor" /> | 90 | app:layout_constraintTop_toBottomOf="@+id/btnValidarServidor" /> |
| 97 | 91 | ||
| 98 | 92 | ||
| 99 | <TextView | 93 | <TextView |
| 100 | android:id="@+id/tvUbicacionCarpetas" | 94 | android:id="@+id/tvUbicacionCarpetas" |
| 101 | android:layout_width="0dp" | 95 | android:layout_width="0dp" |
| 102 | android:layout_height="wrap_content" | 96 | android:layout_height="wrap_content" |
| 103 | 97 | ||
| 104 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 98 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
| 105 | android:layout_marginTop="@dimen/MarginTopSubTitulos" | 99 | android:layout_marginTop="@dimen/MarginTopSubTitulos" |
| 106 | android:gravity="start" | 100 | android:gravity="start" |
| 107 | android:lines="1" | 101 | android:lines="1" |
| 108 | android:text="@string/tvUbicacionCarpetas" | 102 | android:text="@string/tvUbicacionCarpetas" |
| 109 | android:textColor="@android:color/black" | 103 | android:textColor="@android:color/black" |
| 110 | android:textSize="@dimen/SubTitulos" | 104 | android:textSize="@dimen/SubTitulos" |
| 111 | app:fontFamily="sans-serif-condensed" | 105 | app:fontFamily="sans-serif-condensed" |
| 112 | app:layout_constraintBottom_toTopOf="@+id/ibSearch" | 106 | app:layout_constraintBottom_toTopOf="@+id/ibSearch" |
| 113 | app:layout_constraintEnd_toEndOf="parent" | 107 | app:layout_constraintEnd_toEndOf="parent" |
| 114 | app:layout_constraintStart_toStartOf="parent" | 108 | app:layout_constraintStart_toStartOf="parent" |
| 115 | app:layout_constraintTop_toBottomOf="@+id/btnAgregarServidor" /> | 109 | app:layout_constraintTop_toBottomOf="@+id/btnAgregarServidor" /> |
| 116 | 110 | ||
| 117 | <ImageButton | 111 | <ImageButton |
| 118 | android:id="@+id/ibSearch" | 112 | android:id="@+id/ibSearch" |
| 119 | android:layout_width="36dp" | 113 | android:layout_width="36dp" |
| 120 | android:layout_height="37dp" | 114 | android:layout_height="37dp" |
| 121 | android:layout_margin="10dp" | 115 | android:layout_margin="10dp" |
| 122 | android:src="@drawable/search" | 116 | android:src="@drawable/search" |
| 123 | android:textColor="@android:color/white" | 117 | android:textColor="@android:color/white" |
| 124 | android:padding="10dp" | 118 | android:padding="10dp" |
| 125 | android:background="@drawable/boton_borde_redondeado" | 119 | android:background="@drawable/boton_borde_redondeado" |
| 126 | app:layout_constraintEnd_toStartOf="@+id/etRuta" | 120 | app:layout_constraintEnd_toStartOf="@+id/etRuta" |
| 127 | app:layout_constraintStart_toStartOf="parent" | 121 | app:layout_constraintStart_toStartOf="parent" |
| 128 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> | 122 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> |
| 129 | 123 | ||
| 130 | <EditText | 124 | <EditText |
| 131 | android:id="@+id/etRuta" | 125 | android:id="@+id/etRuta" |
| 132 | android:layout_width="0dp" | 126 | android:layout_width="0dp" |
| 133 | android:layout_height="wrap_content" | 127 | android:layout_height="wrap_content" |
| 134 | android:layout_marginTop="10dp" | 128 | android:layout_marginTop="10dp" |
| 135 | android:layout_marginEnd="10dp" | 129 | android:layout_marginEnd="10dp" |
| 136 | android:clickable="true" | 130 | android:clickable="true" |
| 137 | android:ems="10" | 131 | android:ems="10" |
| 138 | android:focusable="true" | 132 | android:focusable="true" |
| 139 | android:inputType="textPersonName" | 133 | android:inputType="textPersonName" |
| 140 | android:lines="1" | 134 | android:lines="1" |
| 141 | android:text="" | 135 | android:text="" |
| 142 | android:textSize="@dimen/NormalText" | 136 | android:textSize="@dimen/NormalText" |
| 143 | app:layout_constraintEnd_toEndOf="parent" | 137 | app:layout_constraintEnd_toEndOf="parent" |
| 144 | app:layout_constraintStart_toEndOf="@id/ibSearch" | 138 | app:layout_constraintStart_toEndOf="@id/ibSearch" |
| 145 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> | 139 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> |
| 146 | 140 | ||
| 147 | <TextView | 141 | <TextView |
| 148 | android:id="@+id/tvActuFecha" | 142 | android:id="@+id/tvActuFecha" |
| 149 | android:layout_width="0dp" | 143 | android:layout_width="0dp" |
| 150 | android:layout_height="wrap_content" | 144 | android:layout_height="wrap_content" |
| 151 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 145 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
| 152 | android:layout_marginTop="@dimen/MarginTopSubTitulos" | 146 | android:layout_marginTop="@dimen/MarginTopSubTitulos" |
| 153 | android:gravity="start" | 147 | android:gravity="start" |
| 154 | android:lines="1" | 148 | android:lines="1" |
| 155 | android:text="@string/tvTituloArea" | 149 | android:text="@string/tvTituloArea" |
| 156 | android:textColor="@android:color/black" | 150 | android:textColor="@android:color/black" |
| 157 | android:textSize="@dimen/SubTitulos" | 151 | android:textSize="@dimen/SubTitulos" |
| 158 | app:fontFamily="sans-serif-condensed" | 152 | app:fontFamily="sans-serif-condensed" |
| 159 | app:layout_constraintEnd_toEndOf="parent" | 153 | app:layout_constraintEnd_toEndOf="parent" |
| 160 | app:layout_constraintStart_toStartOf="parent" | 154 | app:layout_constraintStart_toStartOf="parent" |
| 161 | app:layout_constraintTop_toBottomOf="@+id/etRuta" /> | 155 | app:layout_constraintTop_toBottomOf="@+id/etRuta" /> |
| 162 | 156 | ||
| 163 | <RadioGroup | 157 | <RadioGroup |
| 164 | android:id="@+id/rgFechaHora" | 158 | android:id="@+id/rgFechaHora" |
| 165 | android:layout_width="0dp" | 159 | android:layout_width="0dp" |
| 166 | android:layout_height="wrap_content" | 160 | android:layout_height="wrap_content" |
| 167 | 161 | ||
| 168 | android:gravity="center" | 162 | android:gravity="center" |
| 169 | android:orientation="horizontal" | 163 | android:orientation="horizontal" |
| 170 | app:layout_constraintEnd_toEndOf="parent" | 164 | app:layout_constraintEnd_toEndOf="parent" |
| 171 | app:layout_constraintStart_toStartOf="parent" | 165 | app:layout_constraintStart_toStartOf="parent" |
| 172 | app:layout_constraintTop_toBottomOf="@+id/tvActuFecha"> | 166 | app:layout_constraintTop_toBottomOf="@+id/tvActuFecha"> |
| 173 | 167 | ||
| 174 | <RadioButton | 168 | <RadioButton |
| 175 | android:id="@+id/rbVentas" | 169 | android:id="@+id/rbVentas" |
| 176 | android:layout_width="wrap_content" | 170 | android:layout_width="wrap_content" |
| 177 | android:layout_height="wrap_content" | 171 | android:layout_height="wrap_content" |
| 178 | android:layout_margin="5dp" | 172 | android:layout_margin="5dp" |
| 179 | android:checked="true" | 173 | android:checked="true" |
| 180 | android:padding="5dp" | 174 | android:padding="5dp" |
| 181 | android:text="@string/rbVentas" | 175 | android:text="@string/rbVentas" |
| 182 | android:textSize="@dimen/NormalText" /> | 176 | android:textSize="@dimen/NormalText" /> |
| 183 | 177 | ||
| 184 | <RadioButton | 178 | <RadioButton |
| 185 | android:id="@+id/rbDeposito" | 179 | android:id="@+id/rbDeposito" |
| 186 | android:layout_width="wrap_content" | 180 | android:layout_width="wrap_content" |
| 187 | android:layout_height="wrap_content" | 181 | android:layout_height="wrap_content" |
| 188 | android:layout_margin="5dp" | 182 | android:layout_margin="5dp" |
| 189 | android:checked="false" | 183 | android:checked="false" |
| 190 | android:padding="5dp" | 184 | android:padding="5dp" |
| 191 | android:text="@string/rbDeposito" | 185 | android:text="@string/rbDeposito" |
| 192 | android:textSize="@dimen/NormalText" /> | 186 | android:textSize="@dimen/NormalText" /> |
| 193 | 187 | ||
| 194 | </RadioGroup> | 188 | </RadioGroup> |
| 195 | 189 | ||
| 196 | <TextView | 190 | <TextView |
| 197 | android:id="@+id/tvLosProductos" | 191 | android:id="@+id/tvLosProductos" |
| 198 | android:layout_width="0dp" | 192 | android:layout_width="0dp" |
| 199 | android:layout_height="wrap_content" | 193 | android:layout_height="wrap_content" |
| 200 | 194 | ||
| 201 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 195 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
| 202 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" | 196 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" |
| 203 | android:gravity="start" | 197 | android:gravity="start" |
| 204 | android:lines="1" | 198 | android:lines="1" |
| 205 | android:text="@string/tvLosProductos" | 199 | android:text="@string/tvLosProductos" |
| 206 | android:textColor="@android:color/black" | 200 | android:textColor="@android:color/black" |
| 207 | android:textSize="@dimen/SubTitulos" | 201 | android:textSize="@dimen/SubTitulos" |
| 208 | app:fontFamily="sans-serif-condensed" | 202 | app:fontFamily="sans-serif-condensed" |
| 209 | app:layout_constraintEnd_toEndOf="parent" | 203 | app:layout_constraintEnd_toEndOf="parent" |
| 210 | app:layout_constraintStart_toStartOf="parent" | 204 | app:layout_constraintStart_toStartOf="parent" |
| 211 | app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> | 205 | app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> |
| 212 | 206 | ||
| 213 | <RadioGroup | 207 | <RadioGroup |
| 214 | android:id="@+id/rgLosProductos" | 208 | android:id="@+id/rgLosProductos" |
| 215 | android:layout_width="0dp" | 209 | android:layout_width="0dp" |
| 216 | android:layout_height="wrap_content" | 210 | android:layout_height="wrap_content" |
| 217 | 211 | ||
| 218 | android:gravity="center" | 212 | android:gravity="center" |
| 219 | android:orientation="vertical" | 213 | android:orientation="vertical" |
| 220 | app:layout_constraintEnd_toEndOf="parent" | 214 | app:layout_constraintEnd_toEndOf="parent" |
| 221 | app:layout_constraintStart_toStartOf="parent" | 215 | app:layout_constraintStart_toStartOf="parent" |
| 222 | app:layout_constraintTop_toBottomOf="@+id/tvLosProductos"> | 216 | app:layout_constraintTop_toBottomOf="@+id/tvLosProductos"> |
| 223 | 217 | ||
| 224 | <RadioButton | 218 | <RadioButton |
| 225 | android:id="@+id/rbProInclu" | 219 | android:id="@+id/rbProInclu" |
| 226 | android:layout_width="match_parent" | 220 | android:layout_width="match_parent" |
| 227 | android:layout_height="wrap_content" | 221 | android:layout_height="wrap_content" |
| 228 | 222 | ||
| 229 | android:layout_margin="@dimen/PadingCbyRb" | 223 | android:layout_margin="@dimen/PadingCbyRb" |
| 230 | android:checked="true" | 224 | android:checked="true" |
| 231 | android:padding="@dimen/PadingCbyRb" | 225 | android:padding="@dimen/PadingCbyRb" |
| 232 | android:text="@string/rbProInclu" | 226 | android:text="@string/rbProInclu" |
| 233 | android:textSize="@dimen/NormalText" /> | 227 | android:textSize="@dimen/NormalText" /> |
| 234 | 228 | ||
| 235 | <RadioButton | 229 | <RadioButton |
| 236 | android:id="@+id/rbProNoInclu" | 230 | android:id="@+id/rbProNoInclu" |
| 237 | android:layout_width="match_parent" | 231 | android:layout_width="match_parent" |
| 238 | android:layout_height="wrap_content" | 232 | android:layout_height="wrap_content" |
| 239 | android:layout_margin="@dimen/PadingCbyRb" | 233 | android:layout_margin="@dimen/PadingCbyRb" |
| 240 | android:checked="false" | 234 | android:checked="false" |
| 241 | android:padding="@dimen/PadingCbyRb" | 235 | android:padding="@dimen/PadingCbyRb" |
| 242 | android:text="@string/rbProNoInclu" | 236 | android:text="@string/rbProNoInclu" |
| 243 | android:textSize="@dimen/NormalText" /> | 237 | android:textSize="@dimen/NormalText" /> |
| 244 | 238 | ||
| 245 | </RadioGroup> | 239 | </RadioGroup> |
| 246 | 240 | ||
| 247 | <CheckBox | 241 | <CheckBox |
| 248 | android:id="@+id/cbHabiLectura" | 242 | android:id="@+id/cbHabiLectura" |
| 249 | android:layout_width="0dp" | 243 | android:layout_width="0dp" |
| 250 | android:layout_height="wrap_content" | 244 | android:layout_height="wrap_content" |
| 251 | android:layout_margin="@dimen/PadingCbyRb" | 245 | android:layout_margin="@dimen/PadingCbyRb" |
| 252 | android:padding="@dimen/PadingCbyRb" | 246 | android:padding="@dimen/PadingCbyRb" |
| 253 | android:text="@string/cbHabiLectura" | 247 | android:text="@string/cbHabiLectura" |
| 254 | android:textSize="@dimen/NormalText" | 248 | android:textSize="@dimen/NormalText" |
| 255 | app:layout_constraintEnd_toEndOf="parent" | 249 | app:layout_constraintEnd_toEndOf="parent" |
| 256 | app:layout_constraintStart_toStartOf="parent" | 250 | app:layout_constraintStart_toStartOf="parent" |
| 257 | app:layout_constraintTop_toBottomOf="@+id/rgLosProductos" /> | 251 | app:layout_constraintTop_toBottomOf="@+id/rgLosProductos" /> |
| 258 | 252 | ||
| 259 | <CheckBox | 253 | <CheckBox |
| 260 | android:id="@+id/cbMostrarStock" | 254 | android:id="@+id/cbMostrarStock" |
| 261 | android:layout_width="0dp" | 255 | android:layout_width="0dp" |
| 262 | android:layout_height="wrap_content" | 256 | android:layout_height="wrap_content" |
| 263 | android:layout_margin="@dimen/PadingCbyRb" | 257 | android:layout_margin="@dimen/PadingCbyRb" |
| 264 | android:padding="@dimen/PadingCbyRb" | 258 | android:padding="@dimen/PadingCbyRb" |
| 265 | android:text="@string/cbMostrarStock" | 259 | android:text="@string/cbMostrarStock" |
| 266 | android:textSize="@dimen/NormalText" | 260 | android:textSize="@dimen/NormalText" |
| 267 | app:layout_constraintEnd_toEndOf="parent" | 261 | app:layout_constraintEnd_toEndOf="parent" |
| 268 | app:layout_constraintStart_toStartOf="parent" | 262 | app:layout_constraintStart_toStartOf="parent" |
| 269 | app:layout_constraintTop_toBottomOf="@+id/cbHabiLectura" /> | 263 | app:layout_constraintTop_toBottomOf="@+id/cbHabiLectura" /> |
| 270 | 264 | ||
| 271 | <TextView | 265 | <TextView |
| 272 | android:id="@+id/tvColumMostrar" | 266 | android:id="@+id/tvColumMostrar" |
| 273 | android:layout_width="0dp" | 267 | android:layout_width="0dp" |
| 274 | android:layout_height="wrap_content" | 268 | android:layout_height="wrap_content" |
| 275 | 269 | ||
| 276 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 270 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
| 277 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" | 271 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" |
| 278 | android:gravity="start" | 272 | android:gravity="start" |
| 279 | android:lines="1" | 273 | android:lines="1" |
| 280 | android:text="@string/tvColumMostrar" | 274 | android:text="@string/tvColumMostrar" |
| 281 | android:textColor="@android:color/black" | 275 | android:textColor="@android:color/black" |
| 282 | android:textSize="@dimen/SubTitulos" | 276 | android:textSize="@dimen/SubTitulos" |
| 283 | app:fontFamily="sans-serif-condensed" | 277 | app:fontFamily="sans-serif-condensed" |
| 284 | app:layout_constraintEnd_toEndOf="parent" | 278 | app:layout_constraintEnd_toEndOf="parent" |
| 285 | app:layout_constraintStart_toStartOf="parent" | 279 | app:layout_constraintStart_toStartOf="parent" |
| 286 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarStock" /> | 280 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarStock" /> |
| 287 | 281 | ||
| 288 | <RadioGroup | 282 | <RadioGroup |
| 289 | android:id="@+id/rgCodigosMostrar" | 283 | android:id="@+id/rgCodigosMostrar" |
| 290 | android:layout_width="0dp" | 284 | android:layout_width="0dp" |
| 291 | android:layout_height="wrap_content" | 285 | android:layout_height="wrap_content" |
| 292 | 286 | ||
| 293 | android:gravity="center" | 287 | android:gravity="center" |
| 294 | android:orientation="horizontal" | 288 | android:orientation="horizontal" |
| 295 | app:layout_constraintEnd_toEndOf="parent" | 289 | app:layout_constraintEnd_toEndOf="parent" |
| 296 | app:layout_constraintStart_toStartOf="parent" | 290 | app:layout_constraintStart_toStartOf="parent" |
| 297 | app:layout_constraintTop_toBottomOf="@+id/tvColumMostrar"> | 291 | app:layout_constraintTop_toBottomOf="@+id/tvColumMostrar"> |
| 298 | 292 | ||
| 299 | <RadioButton | 293 | <RadioButton |
| 300 | android:id="@+id/rbCodigoDebo" | 294 | android:id="@+id/rbCodigoDebo" |
| 301 | android:layout_width="wrap_content" | 295 | android:layout_width="wrap_content" |
| 302 | android:layout_height="wrap_content" | 296 | android:layout_height="wrap_content" |
| 303 | android:layout_margin="5dp" | 297 | android:layout_margin="5dp" |
| 304 | android:checked="true" | 298 | android:checked="true" |
| 305 | android:padding="5dp" | 299 | android:padding="5dp" |
| 306 | android:text="@string/rbCodigoDebo" | 300 | android:text="@string/rbCodigoDebo" |
| 307 | android:textSize="@dimen/NormalText" /> | 301 | android:textSize="@dimen/NormalText" /> |
| 308 | 302 | ||
| 309 | <RadioButton | 303 | <RadioButton |
| 310 | android:id="@+id/rbCodigoOrigen" | 304 | android:id="@+id/rbCodigoOrigen" |
| 311 | android:layout_width="wrap_content" | 305 | android:layout_width="wrap_content" |
| 312 | android:layout_height="wrap_content" | 306 | android:layout_height="wrap_content" |
| 313 | android:layout_margin="5dp" | 307 | android:layout_margin="5dp" |
| 314 | android:checked="false" | 308 | android:checked="false" |
| 315 | android:padding="5dp" | 309 | android:padding="5dp" |
| 316 | android:text="@string/rbCodigoOrigen" | 310 | android:text="@string/rbCodigoOrigen" |
| 317 | android:textSize="@dimen/NormalText" /> | 311 | android:textSize="@dimen/NormalText" /> |
| 318 | 312 | ||
| 319 | <RadioButton | 313 | <RadioButton |
| 320 | android:id="@+id/rbCodigoBarras" | 314 | android:id="@+id/rbCodigoBarras" |
| 321 | android:layout_width="wrap_content" | 315 | android:layout_width="wrap_content" |
| 322 | android:layout_height="wrap_content" | 316 | android:layout_height="wrap_content" |
| 323 | android:layout_margin="5dp" | 317 | android:layout_margin="5dp" |
| 324 | android:padding="5dp" | 318 | android:padding="5dp" |
| 325 | android:text="@string/rbCodigoBarras" | 319 | android:text="@string/rbCodigoBarras" |
| 326 | android:textSize="@dimen/NormalText" /> | 320 | android:textSize="@dimen/NormalText" /> |
| 327 | </RadioGroup> | 321 | </RadioGroup> |
| 328 | 322 | ||
| 329 | <CheckBox | 323 | <CheckBox |
| 330 | android:id="@+id/cbMostrarExistencia" | 324 | android:id="@+id/cbMostrarExistencia" |
| 331 | android:layout_width="wrap_content" | 325 | android:layout_width="wrap_content" |
| 332 | android:layout_height="wrap_content" | 326 | android:layout_height="wrap_content" |
| 333 | android:layout_margin="@dimen/PadingCbyRb" | 327 | android:layout_margin="@dimen/PadingCbyRb" |
| 334 | android:padding="@dimen/PadingCbyRb" | 328 | android:padding="@dimen/PadingCbyRb" |
| 335 | android:text="@string/cbMostrarExistencia" | 329 | android:text="@string/cbMostrarExistencia" |
| 336 | android:textSize="@dimen/NormalText" | 330 | android:textSize="@dimen/NormalText" |
| 337 | android:checked="false" | 331 | android:checked="false" |
| 338 | app:layout_constraintEnd_toStartOf="@+id/cbMostrarPrecio" | 332 | app:layout_constraintEnd_toStartOf="@+id/cbMostrarPrecio" |
| 339 | app:layout_constraintStart_toStartOf="parent" | 333 | app:layout_constraintStart_toStartOf="parent" |
| 340 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> | 334 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> |
| 341 | 335 | ||
| 342 | <CheckBox | 336 | <CheckBox |
| 343 | android:id="@+id/cbMostrarPrecio" | 337 | android:id="@+id/cbMostrarPrecio" |
| 344 | android:layout_width="wrap_content" | 338 | android:layout_width="wrap_content" |
| 345 | android:layout_height="wrap_content" | 339 | android:layout_height="wrap_content" |
| 346 | android:layout_margin="@dimen/PadingCbyRb" | 340 | android:layout_margin="@dimen/PadingCbyRb" |
| 347 | android:padding="@dimen/PadingCbyRb" | 341 | android:padding="@dimen/PadingCbyRb" |
| 348 | android:text="@string/cbMostrarPrecio" | 342 | android:text="@string/cbMostrarPrecio" |
| 349 | android:textSize="@dimen/NormalText" | 343 | android:textSize="@dimen/NormalText" |
| 350 | android:checked="false" | 344 | android:checked="false" |
| 351 | app:layout_constraintEnd_toEndOf="parent" | 345 | app:layout_constraintEnd_toEndOf="parent" |
| 352 | app:layout_constraintStart_toEndOf="@+id/cbMostrarExistencia" | 346 | app:layout_constraintStart_toEndOf="@+id/cbMostrarExistencia" |
| 353 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> | 347 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> |
| 354 | 348 | ||
| 355 | <Button | 349 | <Button |
| 356 | android:id="@+id/btnGuardar" | 350 | android:id="@+id/btnGuardar" |
| 357 | android:layout_width="wrap_content" | 351 | android:layout_width="wrap_content" |
| 358 | android:layout_height="wrap_content" | 352 | android:layout_height="wrap_content" |
| 359 | android:text="@string/btnGuardar" | 353 | android:text="@string/btnGuardar" |
| 360 | android:textSize="@dimen/NormalText" | 354 | android:textSize="@dimen/NormalText" |
| 361 | app:layout_constraintEnd_toEndOf="parent" | 355 | app:layout_constraintEnd_toEndOf="parent" |
| 362 | android:textColor="@android:color/white" | 356 | android:textColor="@android:color/white" |
| 363 | android:padding="10dp" | 357 | android:padding="10dp" |
| 364 | android:background="@drawable/boton_borde_redondeado" | 358 | android:background="@drawable/boton_borde_redondeado" |
| 365 | app:layout_constraintStart_toStartOf="parent" | 359 | app:layout_constraintStart_toStartOf="parent" |
| 366 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarPrecio" /> | 360 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarPrecio" /> |
| 361 | |||
| 367 | </androidx.constraintlayout.widget.ConstraintLayout> | 362 | </androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/layout/item_principal.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <androidx.cardview.widget.CardView | 2 | <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 4 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 5 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
| 6 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
| 7 | android:layout_height="wrap_content" | 6 | android:layout_height="wrap_content" |
| 8 | android:layout_margin="5dp" | 7 | android:layout_margin="5dp" |
| 9 | app:cardCornerRadius="2dp" | 8 | app:cardCornerRadius="5dp" |
| 10 | app:cardElevation="10dp" | 9 | app:cardElevation="10dp" |
| 11 | app:contentPadding="5dp" | ||
| 12 | app:cardPreventCornerOverlap="false"> | 10 | app:cardPreventCornerOverlap="false"> |
| 13 | 11 | ||
| 14 | <LinearLayout | 12 | <androidx.constraintlayout.widget.ConstraintLayout |
| 15 | android:layout_width="wrap_content" | 13 | android:layout_width="match_parent" |
| 16 | android:layout_height="wrap_content" | 14 | android:layout_height="wrap_content" |
| 17 | android:layout_gravity="center_horizontal|center_vertical" | 15 | android:layout_gravity="center_horizontal|center_vertical" |
| 18 | android:orientation="vertical"> | 16 | android:orientation="vertical"> |
| 19 | 17 | ||
| 20 | <androidx.appcompat.widget.AppCompatImageView | 18 | <!-- <androidx.appcompat.widget.AppCompatImageView--> |
| 21 | android:layout_width="wrap_content" | 19 | <!-- android:id="@+id/ivCamara"--> |
| 22 | android:layout_height="wrap_content" | 20 | <!-- android:layout_width="80dp"--> |
| 23 | android:layout_gravity="center_horizontal" | 21 | <!-- android:layout_height="80dp"--> |
| 24 | android:src="@drawable/inventario" /> | 22 | <!-- android:layout_margin="10dp"--> |
| 23 | <!-- android:layout_marginTop="15dp"--> | ||
| 24 | <!-- android:background="@drawable/boton_redondo2"--> | ||
| 25 | <!-- android:clickable="true"--> | ||
| 26 | <!-- android:contentDescription="@string/ibBusCB"--> | ||
| 27 | <!-- android:elevation="5dp"--> | ||
| 28 | <!-- android:focusable="false"--> | ||
| 29 | <!-- android:scaleType="fitEnd"--> | ||
| 30 | <!-- --> | ||
| 31 | <!-- app:layout_constraintBottom_toTopOf="@+id/ivFondo"--> | ||
| 32 | <!-- app:layout_constraintCircleRadius="40dp"--> | ||
| 33 | <!-- app:layout_constraintStart_toStartOf="parent"--> | ||
| 34 | <!-- app:layout_constraintTop_toTopOf="parent"--> | ||
| 35 | <!-- />--> | ||
| 25 | 36 | ||
| 26 | <TextView | 37 | <TextView |
| 27 | android:id="@+id/tvPrincipalinventario" | 38 | android:id="@+id/tvPrincipalinventario" |
| 28 | android:layout_width="wrap_content" | 39 | android:layout_width="50dp" |
| 29 | android:layout_height="wrap_content" | 40 | android:layout_height="50dp" |
| 41 | android:layout_margin="10dp" | ||
| 30 | android:gravity="center" | 42 | android:gravity="center" |
| 31 | android:lines="2" | 43 | android:lines="2" |
| 32 | tools:text="Demo text" | 44 | android:background="@drawable/boton_redondo2" |
| 33 | android:textColor="@android:color/black" | 45 | android:textColor="@android:color/black" |
| 34 | android:textStyle="bold" /> | 46 | android:textSize="@dimen/TitulosMedios" |
| 35 | </LinearLayout> | 47 | android:textStyle="bold" |
| 48 | app:layout_constraintBottom_toTopOf="@+id/ivFondo" | ||
| 49 | app:layout_constraintStart_toStartOf="parent" | ||
| 50 | app:layout_constraintTop_toTopOf="parent" | ||
| 51 | tools:text="99" /> | ||
| 52 | |||
| 53 | <TextView | ||
| 54 | android:id="@+id/tvDescription" | ||
| 55 | android:layout_width="wrap_content" | ||
| 56 | android:layout_height="wrap_content" | ||
| 57 | android:text="prueba" | ||
| 58 | app:layout_constraintBottom_toTopOf="@id/ivFondo" | ||
| 59 | app:layout_constraintEnd_toEndOf="parent" | ||
| 60 | app:layout_constraintHorizontal_bias="0.046" | ||
| 61 | app:layout_constraintStart_toEndOf="@id/tvPrincipalinventario" | ||
| 62 | app:layout_constraintTop_toTopOf="parent" | ||
| 63 | app:layout_constraintVertical_bias="0.607" /> | ||
| 64 | |||
| 65 | <androidx.appcompat.widget.AppCompatImageView | ||
| 66 | android:id="@+id/ivFondo" | ||
| 67 | android:layout_width="0dp" | ||
| 68 | android:layout_height="10dp" | ||
| 69 | android:background="@android:drawable/progress_horizontal" | ||
| 70 | android:elevation="10dp" | ||
| 71 | app:layout_constraintBottom_toBottomOf="parent" | ||
| 72 | app:layout_constraintCircleRadius="5dp" | ||
| 73 | app:layout_constraintEnd_toEndOf="parent" | ||
| 74 | app:layout_constraintStart_toStartOf="parent" | ||
| 75 | tools:srcCompat="@android:drawable/progress_horizontal" /> | ||
| 76 | </androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/layout/item_spinner.xml
| File was created | 1 | <?xml version="1.0" encoding="utf-8"?> | |
| 2 | <LinearLayout | ||
| 3 | xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 4 | android:layout_width="match_parent" | ||
| 5 | android:layout_height="match_parent"> | ||
| 6 | |||
| 7 | <TextView | ||
| 8 | android:layout_width="wrap_content" | ||
| 9 | android:layout_height="wrap_content" | ||
| 10 | android:textSize="18sp" | ||
| 11 | android:textStyle="bold" | ||
| 12 | android:id="@+id/tvServidorDesc"/> | ||
| 13 | </LinearLayout> | ||
| 14 |
app/src/main/res/layout/nav_header_main.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
| 5 | android:layout_height="@dimen/nav_header_height" | 5 | android:layout_height="@dimen/nav_header_height" |
| 6 | android:background="@drawable/side_nav_bar" | 6 | android:background="@drawable/side_nav_bar" |
| 7 | android:gravity="bottom" | 7 | android:gravity="bottom" |
| 8 | android:orientation="vertical" | 8 | android:orientation="vertical" |
| 9 | android:paddingLeft="@dimen/activity_horizontal_margin" | 9 | android:paddingLeft="@dimen/activity_horizontal_margin" |
| 10 | android:paddingTop="@dimen/activity_vertical_margin" | 10 | android:paddingTop="@dimen/activity_vertical_margin" |
| 11 | android:paddingRight="@dimen/activity_horizontal_margin" | 11 | android:paddingRight="@dimen/activity_horizontal_margin" |
| 12 | android:paddingBottom="@dimen/activity_vertical_margin" | 12 | android:paddingBottom="@dimen/activity_vertical_margin" |
| 13 | android:theme="@style/ThemeOverlay.AppCompat.Dark"> | 13 | android:theme="@style/ThemeOverlay.AppCompat.Dark"> |
| 14 | 14 | ||
| 15 | <ImageView | 15 | <ImageView |
| 16 | android:id="@+id/imageView" | 16 | android:id="@+id/imageView" |
| 17 | android:layout_width="141dp" | 17 | android:layout_width="141dp" |
| 18 | android:layout_height="wrap_content" | 18 | android:layout_height="wrap_content" |
| 19 | android:contentDescription=" " | 19 | android:contentDescription=" " |
| 20 | android:paddingTop="@dimen/nav_header_vertical_spacing" | 20 | android:paddingTop="@dimen/nav_header_vertical_spacing" |
| 21 | app:srcCompat="@drawable/logo" /> | 21 | app:srcCompat="@drawable/logo" /> |
| 22 | 22 | ||
| 23 | <TextView | 23 | <TextView |
| 24 | android:layout_width="match_parent" | 24 | android:layout_width="match_parent" |
| 25 | android:layout_height="wrap_content" | 25 | android:layout_height="wrap_content" |
| 26 | android:paddingTop="@dimen/nav_header_vertical_spacing" | 26 | android:paddingTop="@dimen/nav_header_vertical_spacing" |
| 27 | android:textSize="@dimen/md_message_textsize" | 27 | android:textSize="@dimen/md_message_textsize" |
| 28 | android:text="Debo Inventario" | 28 | android:text="Debo Inventario" |
| 29 | android:textAppearance="@style/TextAppearance.AppCompat.Body1" /> | 29 | android:textAppearance="@style/TextAppearance.AppCompat.Body1" /> |
| 30 | 30 | ||
| 31 | <TextView | 31 | <TextView |
| 32 | android:id="@+id/textView" | 32 | android:id="@+id/textView1" |
| 33 | android:layout_width="wrap_content" | 33 | android:layout_width="wrap_content" |
| 34 | android:layout_height="wrap_content" | 34 | android:layout_height="wrap_content" |
| 35 | android:text="FocaSoftware SA" /> | 35 | android:text="FocaSoftware SA" /> |
| 36 | </LinearLayout> | 36 | </LinearLayout> |
app/src/main/res/navigation/mobile_navigation.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <navigation xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <navigation xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
| 5 | android:id="@+id/mobile_navigation" | 5 | android:id="@+id/mobile_navigation" |
| 6 | app:startDestination="@id/mainFragment2"> | 6 | app:startDestination="@id/mainFragment2"> |
| 7 | 7 | ||
| 8 | <activity | 8 | <activity |
| 9 | android:id="@+id/mainActivity" | 9 | android:id="@+id/mainActivity" |
| 10 | android:name="com.focasoftware.deboinventariov20.ui.MainActivity" | 10 | android:name="com.focasoftware.deboinventariov20.ui.MainActivity" |
| 11 | android:label="app_bar_main" | 11 | android:label="app_bar_main" |
| 12 | tools:layout="@layout/app_bar_main" /> | 12 | tools:layout="@layout/app_bar_main" /> |
| 13 | <fragment | 13 | <fragment |
| 14 | android:id="@+id/mainFragment2" | 14 | android:id="@+id/mainFragment2" |
| 15 | android:name="com.focasoftware.deboinventariov20.ui.main.MainFragment" | 15 | android:name="com.focasoftware.deboinventariov20.ui.main.MainFragment" |
| 16 | android:label="Principal" | 16 | android:label="Principal" |
| 17 | tools:layout="@layout/fragment_main" > | 17 | tools:layout="@layout/fragment_main" > |
| 18 | <action | 18 | <action |
| 19 | android:id="@+id/action_mainFragment2_to_configuracionFragment" | 19 | android:id="@+id/action_mainFragment2_to_configuracionFragment" |
| 20 | app:destination="@id/configuracionFragment" | 20 | app:destination="@id/configuracionFragment" |
| 21 | app:popEnterAnim="@anim/slide_in_left" | 21 | app:popEnterAnim="@anim/slide_in_left" |
| 22 | app:popExitAnim="@anim/slide_out_right" | 22 | app:popExitAnim="@anim/slide_out_right" |
| 23 | app:enterAnim="@anim/slide_in_right" | 23 | app:enterAnim="@anim/slide_in_right" |
| 24 | app:exitAnim="@anim/slide_out_left" /> | 24 | app:exitAnim="@anim/slide_out_left" /> |
| 25 | <action | 25 | <action |
| 26 | android:id="@+id/action_mainFragment2_to_actuaMaestrosFragment" | 26 | android:id="@+id/action_mainFragment2_to_actuaMaestrosFragment" |
| 27 | app:destination="@id/actuaMaestrosFragment" | 27 | app:destination="@id/actuaMaestrosFragment" |
| 28 | app:popEnterAnim="@anim/slide_in_left" | 28 | app:popEnterAnim="@anim/slide_in_left" |
| 29 | app:popExitAnim="@anim/slide_out_right" | 29 | app:popExitAnim="@anim/slide_out_right" |
| 30 | app:enterAnim="@anim/slide_in_right" | 30 | app:enterAnim="@anim/slide_in_right" |
| 31 | app:exitAnim="@anim/slide_out_left" /> | 31 | app:exitAnim="@anim/slide_out_left" /> |
| 32 | <action | 32 | <action |
| 33 | android:id="@+id/action_mainFragment2_to_inventarioFragment" | 33 | android:id="@+id/action_mainFragment2_to_inventarioFragment" |
| 34 | app:destination="@id/inventarioFragment" | 34 | app:destination="@id/inventarioFragment" |
| 35 | app:popEnterAnim="@anim/slide_in_left" | 35 | app:popEnterAnim="@anim/slide_in_left" |
| 36 | app:popExitAnim="@anim/slide_out_right" | 36 | app:popExitAnim="@anim/slide_out_right" |
| 37 | app:enterAnim="@anim/slide_in_right" | 37 | app:enterAnim="@anim/slide_in_right" |
| 38 | app:exitAnim="@anim/slide_out_left" /> | 38 | app:exitAnim="@anim/slide_out_left" /> |
| 39 | </fragment> | 39 | </fragment> |
| 40 | <fragment | 40 | <fragment |
| 41 | android:id="@+id/actuaMaestrosFragment" | 41 | android:id="@+id/actuaMaestrosFragment" |
| 42 | android:name="com.focasoftware.deboinventariov20.ui.actualizacionMaestros.ActuaMaestrosFragment" | 42 | android:name="com.focasoftware.deboinventariov20.ui.actualizacionMaestros.ActuaMaestrosFragment" |
| 43 | android:label="Importaciones Varias" | 43 | android:label="Importaciones Varias" |
| 44 | tools:layout="@layout/fragment_actua_maestros" /> | 44 | tools:layout="@layout/fragment_actua_maestros" /> |
| 45 | |||
| 45 | <fragment | 46 | <fragment |
| 46 | android:id="@+id/servidoresFragment" | 47 | android:id="@+id/servidoresFragment" |
| 47 | android:name="com.focasoftware.deboinventariov20.ui.servidores.ServidoresFragment" | 48 | android:name="com.focasoftware.deboinventariov20.ui.servidores.ServidoresFragment" |
| 48 | android:label="Alta Servidores" | 49 | android:label="Alta Servidores" |
| 49 | tools:layout="@layout/fragment_servidores"> | 50 | tools:layout="@layout/fragment_servidores"> |
| 50 | <action | 51 | <action |
| 51 | android:id="@+id/action_servidoresFragment_to_configuracionFragment" | 52 | android:id="@+id/action_servidoresFragment_to_configuracionFragment" |
| 52 | app:destination="@id/configuracionFragment" | 53 | app:destination="@id/configuracionFragment" |
| 53 | app:enterAnim="@anim/slide_in_right" | 54 | app:popUpTo="@id/servidoresFragment" |
| 54 | app:exitAnim="@anim/slide_out_left" | 55 | app:popUpToInclusive="true" /> |
| 55 | app:popEnterAnim="@anim/slide_in_left" | ||
| 56 | app:popExitAnim="@anim/slide_out_right" /> | ||
| 57 | </fragment> | 56 | </fragment> |
| 57 | |||
| 58 | <fragment | 58 | <fragment |
| 59 | android:id="@+id/inventarioFragment" | 59 | android:id="@+id/inventarioFragment" |
| 60 | android:name="com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment" | 60 | android:name="com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment" |
| 61 | android:label="Inventario Dinamico" | 61 | android:label="Inventario Dinamico" |
| 62 | tools:layout="@layout/fragment_inventario" > | 62 | tools:layout="@layout/fragment_inventario" > |
| 63 | <action | 63 | <action |
| 64 | android:id="@+id/action_inventarioFragment_to_descripcionFragment" | 64 | android:id="@+id/action_inventarioFragment_to_descripcionFragment" |
| 65 | app:destination="@id/descripcionFragment" | 65 | app:destination="@id/descripcionFragment" |
| 66 | app:popEnterAnim="@anim/slide_in_left" | 66 | app:popEnterAnim="@anim/slide_in_left" |
| 67 | app:popExitAnim="@anim/slide_out_right" | 67 | app:popExitAnim="@anim/slide_out_right" |
| 68 | app:enterAnim="@anim/slide_in_right" | 68 | app:enterAnim="@anim/slide_in_right" |
| 69 | app:exitAnim="@anim/slide_out_left" /> | 69 | app:exitAnim="@anim/slide_out_left" |
| 70 | app:popUpTo="@+id/inventarioFragment" | ||
| 71 | app:popUpToInclusive="true"/> | ||
| 70 | <action | 72 | <action |
| 71 | android:id="@+id/action_inventarioFragment_to_mainFragment2" | 73 | android:id="@+id/action_inventarioFragment_to_mainFragment2" |
| 72 | app:destination="@id/mainFragment2" | 74 | app:destination="@id/mainFragment2" |
| 73 | app:popEnterAnim="@anim/slide_in_left" | 75 | app:popEnterAnim="@anim/slide_in_left" |
| 74 | app:popExitAnim="@anim/slide_out_right" | 76 | app:popExitAnim="@anim/slide_out_right" |
| 75 | app:enterAnim="@anim/slide_in_right" | 77 | app:enterAnim="@anim/slide_in_right" |
| 76 | app:exitAnim="@anim/slide_out_left"/> | 78 | app:exitAnim="@anim/slide_out_left"/> |
| 77 | <action | 79 | <action |
| 78 | android:id="@+id/action_inventarioFragment_to_detalleArtFragment" | 80 | android:id="@+id/action_inventarioFragment_to_detalleArtFragment" |
| 79 | app:destination="@id/detalleArtFragment" /> | 81 | app:destination="@id/detalleArtFragment" /> |
| 80 | 82 | ||
| 81 | </fragment> | 83 | </fragment> |
| 82 | <fragment | 84 | <fragment |
| 83 | android:id="@+id/configuracionFragment" | 85 | android:id="@+id/configuracionFragment" |
| 84 | android:name="com.focasoftware.deboinventariov20.ui.configuracion.ConfiguracionFragment" | 86 | android:name="com.focasoftware.deboinventariov20.ui.configuracion.ConfiguracionFragment" |
| 85 | android:label="Configuraciones" | 87 | android:label="Configuraciones" |
| 86 | tools:layout="@layout/fragment_configuracion" > | 88 | tools:layout="@layout/fragment_configuracion" > |
| 87 | <action | 89 | <action |
| 88 | android:id="@+id/action_configuracionFragment_to_servidoresFragment" | 90 | android:id="@+id/action_configuracionFragment_to_servidoresFragment" |
| 89 | app:destination="@id/servidoresFragment" | 91 | app:destination="@id/servidoresFragment" |
| 90 | app:popEnterAnim="@anim/slide_in_left" | 92 | app:popEnterAnim="@anim/slide_in_left" |
| 91 | app:popExitAnim="@anim/slide_out_right" | 93 | app:popExitAnim="@anim/slide_out_right" |
| 92 | app:enterAnim="@anim/slide_in_right" | 94 | app:enterAnim="@anim/slide_in_right" |
| 93 | app:exitAnim="@anim/slide_out_left" /> | 95 | app:exitAnim="@anim/slide_out_left" |
| 96 | app:popUpTo="@id/configuracionFragment" | ||
| 97 | app:popUpToInclusive="true" /> | ||
| 94 | <action | 98 | <action |
| 95 | android:id="@+id/action_configuracionFragment_to_mainFragment2" | 99 | android:id="@+id/action_configuracionFragment_to_mainFragment2" |
| 96 | app:destination="@id/mainFragment2" /> | 100 | app:destination="@id/mainFragment2" /> |
| 97 | </fragment> | 101 | </fragment> |
| 98 | <fragment | 102 | <fragment |
| 99 | android:id="@+id/descripcionFragment" | 103 | android:id="@+id/descripcionFragment" |
| 100 | android:name="com.focasoftware.deboinventariov20.ui.descripcionFragment.DescripcionFragment" | 104 | android:name="com.focasoftware.deboinventariov20.ui.descripcionFragment.DescripcionFragment" |
| 101 | android:label="Productos Encontrados"> | 105 | android:label="Productos Encontrados"> |
| 102 | 106 | ||
| 103 | <action | 107 | <action |
| 104 | android:id="@+id/action_descripcionFragment_to_inventarioFragment" | 108 | android:id="@+id/action_descripcionFragment_to_inventarioFragment" |
| 105 | app:destination="@id/inventarioFragment" | 109 | app:destination="@id/inventarioFragment" |
| 106 | app:popEnterAnim="@anim/slide_in_left" | 110 | app:popEnterAnim="@anim/slide_in_left" |
| 107 | app:popExitAnim="@anim/slide_out_right" | 111 | app:popExitAnim="@anim/slide_out_right" |
| 108 | app:enterAnim="@anim/slide_in_right" | 112 | app:enterAnim="@anim/slide_in_right" |
| 109 | app:exitAnim="@anim/slide_out_left" | 113 | app:exitAnim="@anim/slide_out_left" |
| 110 | app:popUpTo="@+id/descripcionFragment" | 114 | app:popUpTo="@+id/descripcionFragment" |
| 111 | app:popUpToInclusive="true"/> | 115 | app:popUpToInclusive="true"/> |
| 112 | </fragment> | 116 | </fragment> |
| 113 | <dialog | 117 | <dialog |
| 114 | android:id="@+id/dialogNoEncontrado" | 118 | android:id="@+id/dialogNoEncontrado" |
| 115 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.DialogNoEncontrado" | 119 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.DialogNoEncontrado" |
| 116 | android:label="DialogNoEncontrado" /> | 120 | android:label="DialogNoEncontrado" /> |
| 117 | <fragment | 121 | <fragment |
| 118 | android:id="@+id/dialogoLogin" | 122 | android:id="@+id/dialogoLogin" |
| 119 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.dialogoLogin" | 123 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.DialogoLogin" |
| 120 | android:label="dialogoLogin" /> | 124 | android:label="dialogoLogin" /> |
| 121 | <fragment | 125 | <fragment |
| 122 | android:id="@+id/singleChoiceAlertDialog" | 126 | android:id="@+id/singleChoiceAlertDialog" |
| 123 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.SingleChoiceAlertDialog" | 127 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.SingleChoiceAlertDialog" |
| 124 | android:label="SingleChoiceAlertDialog" /> | 128 | android:label="SingleChoiceAlertDialog" /> |
| 129 | |||
| 125 | <fragment | 130 | <fragment |
| 126 | android:id="@+id/detalleArtFragment" | 131 | android:id="@+id/detalleArtFragment" |
| 127 | android:name="com.focasoftware.deboinventariov20.ui.detalleProducto.DetalleArtFragment" | 132 | android:name="com.focasoftware.deboinventariov20.ui.detalleProducto.DetalleArtFragment" |
| 128 | android:label="Detalle Articulo" | 133 | android:label="Detalle Articulo" |
| 129 | tools:layout="@layout/fragment_detalle_art"> | 134 | tools:layout="@layout/fragment_detalle_art"> |
| 130 | <action | 135 | <action |
| 131 | android:id="@+id/action_detalleArtFragment_to_inventarioFragment" | 136 | android:id="@+id/action_detalleArtFragment_to_inventarioFragment" |
| 132 | app:destination="@id/inventarioFragment" /> | 137 | app:destination="@id/inventarioFragment" /> |
app/src/main/res/values/arrays.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | File was deleted | |
| 2 | <resources> | ||
| 3 | <string-array name="sort_array"> | ||
| 4 | <item>Suma</item> | ||
| 5 | <item>Resta</item> | ||
| 6 | <item>Modifica</item> | ||
| 7 | </string-array> | ||
| 8 | </resources> |
app/src/main/res/values/colors.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <resources> | 2 | <resources> |
| 3 | <color name="colorPrimaryDark">#085394</color> | 3 | <color name="colorPrimaryDark">#085394</color> |
| 4 | <color name="colorAccent">#3F51B5</color> | 4 | <color name="colorAccent">#3F51B5</color> |
| 5 | <color name="colorPrimary">#085394</color> | 5 | <color name="colorPrimary">#085394</color> |
| 6 | <color name="backMenu">#dddddd</color> | 6 | <color name="backMenu">#dddddd</color> |
| 7 | <color name="LightGray">#E0E0E0</color> | 7 | <color name="LightGray">#E0E0E0</color> |
| 8 | <!-- TODO: ITEM PRINCIPAL--> | ||
| 9 | <color name="barrainferior">#074865</color> | ||
| 8 | </resources> | 10 | </resources> |