Commit 7483a587d551113ac6342b2e7b461d48da2b717f
1 parent
a0d8dd74dd
Exists in
master
01092020 1658
Showing
8 changed files
with
68 additions
and
35 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") |
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 | |||
95 | @Query("SELECT * FROM $TABLA_SERV_INV WHERE SER_PRE =:sOne") | ||
96 | suspend fun fetchServerPreOne(sOne: String): ServeInv | ||
94 | } | 97 | } |
app/src/main/java/com/focasoftware/deboinventariov20/Model/ProductosService.kt
1 | package com.focasoftware.deboinventariov20.Model | 1 | package com.focasoftware.deboinventariov20.Model |
2 | 2 | ||
3 | import com.focasoftware.deboinventariov20.ui.actualizacionMaestros.BASE_URL | ||
3 | import retrofit2.Retrofit | 4 | import retrofit2.Retrofit |
4 | import retrofit2.converter.gson.GsonConverterFactory | 5 | import retrofit2.converter.gson.GsonConverterFactory |
5 | 6 | ||
6 | object ProductosService { | 7 | object ProductosService { |
7 | private val BASE_URL ="http://10.0.2.2:3000/" | 8 | // private val BASE_URL ="http://10.0.2.2:3000/" |
8 | //"http://192.168.0.2:3000/" | 9 | // // //"http://192.168.0.2:3000/" |
9 | 10 | ||
10 | 11 | ||
11 | fun getProductosService(): ProductosApi { | 12 | fun getProductosService(): ProductosApi { |
12 | return Retrofit.Builder() | 13 | return Retrofit.Builder() |
13 | .baseUrl(BASE_URL) | 14 | .baseUrl(BASE_URL) |
14 | .addConverterFactory(GsonConverterFactory.create()) | 15 | .addConverterFactory(GsonConverterFactory.create()) |
15 | .build() | 16 | .build() |
16 | .create(ProductosApi::class.java) | 17 | .create(ProductosApi::class.java) |
17 | } | 18 | } |
18 | } | 19 | } |
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.R | 14 | import com.focasoftware.deboinventariov20.R |
14 | import kotlinx.android.synthetic.main.fragment_actua_maestros.* | 15 | import kotlinx.android.synthetic.main.fragment_actua_maestros.* |
15 | import kotlinx.coroutines.* | 16 | import kotlinx.coroutines.* |
16 | 17 | ||
18 | var BASE_URL ="" | ||
17 | class ActuaMaestrosFragment : Fragment() { | 19 | class ActuaMaestrosFragment : Fragment() { |
18 | 20 | ||
19 | var job: Job? = null | 21 | var job: Job? = null |
20 | 22 | ||
21 | 23 | ||
22 | override fun onCreate(savedInstanceState: Bundle?) { | 24 | override fun onCreate(savedInstanceState: Bundle?) { |
23 | super.onCreate(savedInstanceState) | 25 | super.onCreate(savedInstanceState) |
26 | GlobalScope.launch(Dispatchers.Main) { | ||
27 | BASE_URL = fetchServerPre().direccion.toString() | ||
28 | } | ||
29 | mostrarArticulos() | ||
30 | } | ||
24 | 31 | ||
25 | 32 | suspend fun fetchServerPre(): ServeInv { | |
26 | //mostrarArticulos() | 33 | var busqueda: ServeInv |
34 | return GlobalScope.async(Dispatchers.IO) { | ||
35 | busqueda = AppDb.getAppDb(requireContext())!!.ServeInvDao()!!.fetchServerPreOne("1") | ||
36 | return@async busqueda | ||
37 | }.await() | ||
27 | } | 38 | } |
28 | 39 | ||
40 | // return "http://10.0.2.2:3000/" | ||
41 | // } | ||
42 | |||
29 | 43 | ||
30 | override fun onCreateView( | 44 | override fun onCreateView( |
31 | inflater: LayoutInflater, container: ViewGroup?, | 45 | inflater: LayoutInflater, container: ViewGroup?, |
32 | savedInstanceState: Bundle? | 46 | savedInstanceState: Bundle? |
33 | ): View? { | 47 | ): View? { |
34 | // Inflate the layout for this fragment | 48 | // Inflate the layout for this fragment |
35 | val v = inflater.inflate(R.layout.fragment_actua_maestros, container, false) | 49 | val v = inflater.inflate(R.layout.fragment_actua_maestros, container, false) |
36 | val bConfirmarAct = v.findViewById<Button>(R.id.btnConfirmarAct) | 50 | val bConfirmarAct = v.findViewById<Button>(R.id.btnConfirmarAct) |
37 | bConfirmarAct.setOnClickListener { | 51 | bConfirmarAct.setOnClickListener { |
38 | loading_view.visibility = View.VISIBLE | 52 | loading_view.visibility = View.VISIBLE |
39 | countriesList.text = "Obteniendo Maestros de artículos, aguarde por favor." | 53 | countriesList.text = "Obteniendo Maestros de artículos, aguarde por favor." |
40 | obtenerArticulos() | 54 | obtenerArticulos() |
41 | } | 55 | } |
42 | return v | 56 | return v |
43 | } | 57 | } |
44 | 58 | ||
45 | 59 | ||
46 | private fun obtenerArticulos() { | 60 | private fun obtenerArticulos() { |
47 | 61 | ||
48 | val productosService = ProductosService.getProductosService() | 62 | val productosService = ProductosService.getProductosService() |
49 | var index: Long = 1 | 63 | var index: Long = 1 |
50 | job = CoroutineScope(Dispatchers.IO).launch { | 64 | job = CoroutineScope(Dispatchers.IO).launch { |
51 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | 65 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! |
52 | .deleteAllArticulos() | 66 | .deleteAllArticulos() |
53 | val response = productosService.getProductos() | 67 | val response = productosService.getProductos() |
54 | if (response.isSuccessful) { | 68 | if (response.isSuccessful) { |
55 | for (pro in response.body()!!) { | 69 | for (pro in response.body()!!) { |
56 | val artiAcargar = Articles( | 70 | val artiAcargar = Articles( |
57 | pro.sector, | 71 | pro.sector, |
58 | pro.codigo, | 72 | pro.codigo, |
59 | pro.descripcion, | 73 | pro.descripcion, |
60 | pro.codBar, | 74 | pro.codBar, |
61 | pro.codOrigen, | 75 | pro.codOrigen, |
62 | pro.precio, | 76 | pro.precio, |
63 | pro.costo, | 77 | pro.costo, |
64 | pro.exiVenta, | 78 | pro.exiVenta, |
65 | pro.exiDeposito, | 79 | pro.exiDeposito, |
66 | pro.de, | 80 | pro.de, |
67 | pro.balanza, | 81 | pro.balanza, |
68 | pro.depSn, | 82 | pro.depSn, |
69 | pro.imagen | 83 | pro.imagen |
70 | ) | 84 | ) |
71 | index += index | 85 | index += index |
72 | 86 | ||
73 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | 87 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! |
74 | .insertArticulos(artiAcargar) | 88 | .insertArticulos(artiAcargar) |
75 | } | 89 | } |
76 | withContext(Dispatchers.Main) { | 90 | withContext(Dispatchers.Main) { |
77 | countriesList.visibility = View.VISIBLE | 91 | countriesList.visibility = View.VISIBLE |
78 | countriesList.text = "¡Datos Importados Correctamente!" | 92 | countriesList.text = "¡Datos Importados Correctamente!" |
79 | loading_view.visibility = View.GONE | 93 | loading_view.visibility = View.GONE |
80 | } | 94 | } |
81 | // | 95 | // |
82 | } else { | 96 | } else { |
83 | countriesList.text = "Error: ${response.message()}" | 97 | countriesList.text = "Error: ${response.message()}" |
84 | } | 98 | } |
85 | } | 99 | } |
86 | 100 | ||
87 | // withContext(Dispatchers.Main) { | 101 | // withContext(Dispatchers.Main) { |
88 | // if (response.isSuccessful) { | 102 | // if (response.isSuccessful) { |
89 | // val call = WebService | 103 | // val call = WebService |
90 | // .instance | 104 | // .instance |
91 | // ?.createService(WebServiceApi::class.java) | 105 | // ?.createService(WebServiceApi::class.java) |
92 | // ?.articulos | 106 | // ?.articulos |
93 | // call?.enqueue(object : Callback<List<productos?>?> { | 107 | // call?.enqueue(object : Callback<List<productos?>?> { |
94 | // override fun onResponse( | 108 | // override fun onResponse( |
95 | // call: Call<List<productos?>?>, | 109 | // call: Call<List<productos?>?>, |
96 | // response: Response<List<productos?>?> | 110 | // response: Response<List<productos?>?> |
97 | // ) { | 111 | // ) { |
98 | // if (response.code() == 200) { | 112 | // if (response.code() == 200) { |
99 | // for (i in response.body()!!.indices) { | 113 | // for (i in response.body()!!.indices) { |
100 | // //AppDb.getAppDb(requireActivity())!!.ArticulosDAO()?.insertArticulos(response.body()!![i]) | 114 | // //AppDb.getAppDb(requireActivity())!!.ArticulosDAO()?.insertArticulos(response.body()!![i]) |
101 | // cargarArticulos(2, 500, "sfas", "66666","2,2", "2,2", false, false, "") | 115 | // cargarArticulos(2, 500, "sfas", "66666","2,2", "2,2", false, false, "") |
102 | //// Log.d( | 116 | //// Log.d( |
103 | //// "TAG1", "Nombre Curso: " + response.body()!![i]?.sector | 117 | //// "TAG1", "Nombre Curso: " + response.body()!![i]?.sector |
104 | //// + "Codigo Profesor: " + response.body()!![i]?.descripcion | 118 | //// + "Codigo Profesor: " + response.body()!![i]?.descripcion |
105 | //// ) | 119 | //// ) |
106 | // mostrarArticulos() | 120 | // mostrarArticulos() |
107 | // } | 121 | // } |
108 | // } else if (response.code() == 404) { | 122 | // } else if (response.code() == 404) { |
109 | // Log.d("TAG1", "No hay cursos") | 123 | // Log.d("TAG1", "No hay cursos") |
110 | // } | 124 | // } |
111 | // | 125 | // |
112 | // } | 126 | // } |
113 | // | 127 | // |
114 | // override fun onFailure(call: Call<List<productos?>?>, t: Throwable) {} | 128 | // override fun onFailure(call: Call<List<productos?>?>, t: Throwable) {} |
115 | // }) | 129 | // }) |
116 | } | 130 | } |
117 | 131 | ||
118 | fun mostrarArticulos() { | 132 | fun mostrarArticulos() { |
119 | val Job = GlobalScope.launch { | 133 | val Job = GlobalScope.launch { |
120 | var listArticulos: List<Articles>? = null | 134 | var listArticulos: List<Articles>? = null |
121 | var temp: String = "" | 135 | var temp: String = "" |
122 | listArticulos = | 136 | listArticulos = |
123 | AppDb.getAppDb(requireActivity())?.ArticulosDAO()?.findAllArticulos() | 137 | AppDb.getAppDb(requireActivity())?.ArticulosDAO()?.findAllArticulos() |
124 | if (listArticulos != null) { | 138 | if (listArticulos != null) { |
125 | 139 | ||
126 | for (i in listArticulos.indices) | 140 | for (i in listArticulos.indices) |
127 | temp += listArticulos[i].codigo.toString() | 141 | temp += listArticulos[i].codigo.toString() |
128 | } | 142 | } |
129 | withContext(Dispatchers.Main) { | 143 | withContext(Dispatchers.Main) { |
130 | countriesList.visibility = View.VISIBLE | 144 | countriesList.visibility = View.VISIBLE |
131 | loading_view.visibility = View.GONE | 145 | loading_view.visibility = View.GONE |
132 | countriesList?.text = temp | 146 | countriesList?.text = temp |
133 | } | 147 | } |
134 | } | 148 | } |
135 | // for (professor in listArticulos!!) { | 149 | // for (professor in listArticulos!!) { |
136 | // editT.text= professor.id.toString() | 150 | // editT.text= professor.id.toString() |
137 | // } | 151 | // } |
138 | } | 152 | } |
139 | 153 | ||
140 | 154 | ||
141 | // fun observeViewModel() { | 155 | // fun observeViewModel() { |
142 | // | 156 | // |
143 | // val productosService = ProductosService.getProductosService() | 157 | // val productosService = ProductosService.getProductosService() |
144 | // var job: Job? = null | 158 | // var job: Job? = null |
145 | // | 159 | // |
146 | // | 160 | // |
147 | // //countriesList.text="Procesando..." | 161 | // //countriesList.text="Procesando..." |
148 | // //countriesList.visibility = View.VISIBLE | 162 | // //countriesList.visibility = View.VISIBLE |
149 | // // GlobalScope1.launch(Dispatchers.IO) { | 163 | // // GlobalScope1.launch(Dispatchers.IO) { |
150 | // val response = productosService.getProductos() | 164 | // val response = productosService.getProductos() |
151 | // if (response.isSuccessful) { | 165 | // if (response.isSuccessful) { |
152 | //// countriesList.layoutManager = LinearLayoutManager(context) | 166 | //// countriesList.layoutManager = LinearLayoutManager(context) |
153 | //// countriesList.itemAnimator = DefaultItemAnimator() | 167 | //// countriesList.itemAnimator = DefaultItemAnimator() |
154 | // | 168 | // |
155 | //// ProductAdapter.updateCountries(it) | 169 | //// ProductAdapter.updateCountries(it) |
156 | // // cargarArticulos(response.body()) | 170 | // // cargarArticulos(response.body()) |
157 | // | 171 | // |
158 | // | 172 | // |
159 | // val artiAcargar: Articulos? = null | 173 | // val artiAcargar: Articulos? = null |
160 | // var index: Long = 1 | 174 | // var index: Long = 1 |
161 | // | 175 | // |
162 | // for (pro in response.body()!!) { | 176 | // for (pro in response.body()!!) { |
163 | // //artiAcargar.id =index+1 | 177 | // //artiAcargar.id =index+1 |
164 | // artiAcargar!!.sector = pro.sector | 178 | // artiAcargar!!.sector = pro.sector |
165 | // artiAcargar.codigo = pro.codigo | 179 | // artiAcargar.codigo = pro.codigo |
166 | // artiAcargar.descripcion = pro.descripcion | 180 | // artiAcargar.descripcion = pro.descripcion |
167 | // artiAcargar.codBar = pro.codBar | 181 | // artiAcargar.codBar = pro.codBar |
168 | // artiAcargar.precio = pro.precio | 182 | // artiAcargar.precio = pro.precio |
169 | // artiAcargar.costo = pro.costo | 183 | // artiAcargar.costo = pro.costo |
170 | // artiAcargar.balanza = pro.balanza | 184 | // artiAcargar.balanza = pro.balanza |
171 | // artiAcargar.depSn = pro.depSn | 185 | // artiAcargar.depSn = pro.depSn |
172 | // artiAcargar.imagen = pro.imagen | 186 | // artiAcargar.imagen = pro.imagen |
173 | // index += index | 187 | // index += index |
174 | // | 188 | // |
175 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | 189 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! |
176 | // .insertArticulos(artiAcargar) | 190 | // .insertArticulos(artiAcargar) |
177 | // } | 191 | // } |
178 | // } | 192 | // } |
179 | // // } | 193 | // // } |
180 | // | 194 | // |
181 | // //job.cancel() | 195 | // //job.cancel() |
182 | // | 196 | // |
183 | // | 197 | // |
184 | // } | 198 | // } |
185 | 199 | ||
186 | // fun cargarArticulos(Productos: List<Productos>?) { | 200 | // fun cargarArticulos(Productos: List<Productos>?) { |
187 | // val artiAcargar: Articulos? = null | 201 | // val artiAcargar: Articulos? = null |
188 | // var index: Long = 1 | 202 | // var index: Long = 1 |
189 | // //val job4 = CoroutineScope(Dispatchers.Default).launch { | 203 | // //val job4 = CoroutineScope(Dispatchers.Default).launch { |
190 | // for (pro in Productos!!) { | 204 | // for (pro in Productos!!) { |
191 | // //artiAcargar.id =index+1 | 205 | // //artiAcargar.id =index+1 |
192 | // artiAcargar!!.sector = pro.sector | 206 | // artiAcargar!!.sector = pro.sector |
193 | // artiAcargar.codigo = pro.codigo | 207 | // artiAcargar.codigo = pro.codigo |
194 | // artiAcargar.descripcion = pro.descripcion | 208 | // artiAcargar.descripcion = pro.descripcion |
195 | // artiAcargar.codBar = pro.codBar | 209 | // artiAcargar.codBar = pro.codBar |
196 | // artiAcargar.precio = pro.precio | 210 | // artiAcargar.precio = pro.precio |
197 | // artiAcargar.costo = pro.costo | 211 | // artiAcargar.costo = pro.costo |
198 | // artiAcargar.balanza = pro.balanza | 212 | // artiAcargar.balanza = pro.balanza |
199 | // artiAcargar.depSn = pro.depSn | 213 | // artiAcargar.depSn = pro.depSn |
200 | // artiAcargar.imagen = pro.imagen | 214 | // artiAcargar.imagen = pro.imagen |
201 | // index += index | 215 | // index += index |
202 | // | 216 | // |
203 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | 217 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! |
204 | // .insertArticulos(artiAcargar) | 218 | // .insertArticulos(artiAcargar) |
205 | // } | 219 | // } |
206 | // } | 220 | // } |
207 | } | 221 | } |
208 | 222 | ||
209 | 223 |
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 | ||
12 | import androidx.navigation.Navigation | ||
11 | import androidx.navigation.fragment.findNavController | 13 | import androidx.navigation.fragment.findNavController |
12 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 14 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
13 | import com.focasoftware.deboinventariov20.Model.ServeInv | 15 | import com.focasoftware.deboinventariov20.Model.ServeInv |
14 | import com.focasoftware.deboinventariov20.R | 16 | import com.focasoftware.deboinventariov20.R |
17 | import com.focasoftware.deboinventariov20.ui.servidores.ItemsServidores | ||
15 | import kotlinx.android.synthetic.main.fragment_configuracion.* | 18 | import kotlinx.android.synthetic.main.fragment_configuracion.* |
16 | import kotlinx.coroutines.Dispatchers | 19 | import kotlinx.coroutines.Dispatchers |
17 | import kotlinx.coroutines.GlobalScope | 20 | import kotlinx.coroutines.GlobalScope |
18 | import kotlinx.coroutines.async | 21 | import kotlinx.coroutines.async |
19 | import kotlinx.coroutines.launch | 22 | import kotlinx.coroutines.launch |
20 | 23 | ||
21 | class ConfiguracionFragment : Fragment() { | 24 | class ConfiguracionFragment : Fragment() { |
22 | 25 | ||
23 | lateinit var sharedPreferences: SharedPreferences | 26 | lateinit var sharedPreferences: SharedPreferences |
24 | 27 | private lateinit var navController: NavController | |
28 | private lateinit var listaServers : MutableMap<Int,String> | ||
25 | override fun onCreate(savedInstanceState: Bundle?) { | 29 | override fun onCreate(savedInstanceState: Bundle?) { |
26 | super.onCreate(savedInstanceState) | 30 | super.onCreate(savedInstanceState) |
27 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 31 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
28 | } | 32 | } |
29 | 33 | ||
34 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
35 | super.onViewCreated(view, savedInstanceState) | ||
36 | navController = Navigation.findNavController(view) | ||
37 | } | ||
38 | |||
30 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 39 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
31 | val v = inflater.inflate(R.layout.fragment_configuracion, container, false) | ||
32 | 40 | ||
41 | var index=0 | ||
42 | val listServerDescription = arrayListOf<String>() | ||
43 | val v = inflater.inflate(R.layout.fragment_configuracion, container, false) | ||
33 | val etRuta = v.findViewById<EditText>(R.id.etRuta) | 44 | val etRuta = v.findViewById<EditText>(R.id.etRuta) |
34 | val btnGuardar = v.findViewById<Button>(R.id.btnGuardar) | 45 | val btnGuardar = v.findViewById<Button>(R.id.btnGuardar) |
35 | val rbProInclu = v.findViewById<RadioButton>(R.id.rbProInclu) | 46 | val rbProInclu = v.findViewById<RadioButton>(R.id.rbProInclu) |
36 | val rbProNoInclu = v.findViewById<RadioButton>(R.id.rbProNoInclu) | 47 | val rbProNoInclu = v.findViewById<RadioButton>(R.id.rbProNoInclu) |
37 | val cbHabiLectura = v.findViewById<CheckBox>(R.id.cbHabiLectura) | 48 | val cbHabiLectura = v.findViewById<CheckBox>(R.id.cbHabiLectura) |
38 | val cbMostrarStock = v.findViewById<CheckBox>(R.id.cbMostrarStock) | 49 | val cbMostrarStock = v.findViewById<CheckBox>(R.id.cbMostrarStock) |
39 | val rbCodigoBarras = v.findViewById<RadioButton>(R.id.rbCodigoBarras) | 50 | val rbCodigoBarras = v.findViewById<RadioButton>(R.id.rbCodigoBarras) |
40 | val rbCodigoDebo = v.findViewById<RadioButton>(R.id.rbCodigoDebo) | 51 | val rbCodigoDebo = v.findViewById<RadioButton>(R.id.rbCodigoDebo) |
41 | val rbCodigoOrigen = v.findViewById<RadioButton>(R.id.rbCodigoOrigen) | 52 | val rbCodigoOrigen = v.findViewById<RadioButton>(R.id.rbCodigoOrigen) |
42 | val rbDeposito = v.findViewById<RadioButton>(R.id.rbDeposito) | 53 | val rbDeposito = v.findViewById<RadioButton>(R.id.rbDeposito) |
43 | val rbVentas = v.findViewById<RadioButton>(R.id.rbVentas) | 54 | val rbVentas = v.findViewById<RadioButton>(R.id.rbVentas) |
44 | val cbMostrarExistencia = v.findViewById<CheckBox>(R.id.cbMostrarExistencia) | 55 | val cbMostrarExistencia = v.findViewById<CheckBox>(R.id.cbMostrarExistencia) |
45 | val cbMostrarPrecio = v.findViewById<CheckBox>(R.id.cbMostrarPrecio) | 56 | val cbMostrarPrecio = v.findViewById<CheckBox>(R.id.cbMostrarPrecio) |
46 | val btnAgregarServidor = v.findViewById<Button>(R.id.btnAgregarServidor) | 57 | val btnAgregarServidor = v.findViewById<Button>(R.id.btnAgregarServidor) |
47 | val spServidor = v.findViewById<Spinner>(R.id.spServidor) | 58 | val spServidor = v.findViewById<Spinner>(R.id.spServidor) |
48 | val btnValidarServidor = v.findViewById<Button>(R.id.btnValidarServidor) | 59 | val btnValidarServidor = v.findViewById<Button>(R.id.btnValidarServidor) |
49 | 60 | ||
50 | if (sharedPreferences.contains("etRuta")) etRuta.setText(sharedPreferences.getString("etRuta", "").toString()) | 61 | if (sharedPreferences.contains("etRuta")) |
51 | 62 | if (sharedPreferences.contains("rbProInclu")) { | |
52 | if (sharedPreferences.contains("rbProInclu")) { | 63 | if (sharedPreferences.getString("rbProInclu", "").toString() == "0") { |
53 | if (sharedPreferences.getString("rbProInclu", "").toString() == "0") { | 64 | rbProInclu.isChecked = false |
54 | rbProInclu.isChecked = false | 65 | rbProNoInclu.isChecked = true |
55 | rbProNoInclu.isChecked = true | 66 | } else if (sharedPreferences.getString("rbProInclu", "").toString() == "1") { |
56 | } else if (sharedPreferences.getString("rbProInclu", "").toString() == "1") { | 67 | rbProInclu.isChecked = true |
57 | rbProInclu.isChecked = true | 68 | rbProNoInclu.isChecked = false |
58 | rbProNoInclu.isChecked = false | 69 | } |
59 | } | 70 | } else (sharedPreferences.getString("rbProInclu", "").toString() == "") |
60 | } else (sharedPreferences.getString("rbProInclu", "").toString() == "") | ||
61 | 71 | ||
62 | if (sharedPreferences.contains("rbProNoInclu")) { | 72 | if (sharedPreferences.contains("rbProNoInclu")) { |
63 | if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") { | 73 | if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") { |
64 | rbProNoInclu.isChecked = false | 74 | rbProNoInclu.isChecked = false |
65 | rbProInclu.isChecked = true | 75 | rbProInclu.isChecked = true |
66 | } else if (sharedPreferences.getString("rbProNoInclu", "").toString() == "1") { | 76 | } else if (sharedPreferences.getString("rbProNoInclu", "").toString() == "1") { |
67 | rbProNoInclu.isChecked = true | 77 | rbProNoInclu.isChecked = true |
68 | rbProInclu.isChecked = false | 78 | rbProInclu.isChecked = false |
69 | } | 79 | } |
70 | } else (sharedPreferences.getString("rbProNoInclu", "").toString() == "") | 80 | } else (sharedPreferences.getString("rbProNoInclu", "").toString() == "") |
71 | 81 | ||
72 | |||
73 | if (sharedPreferences.contains("cbHabiLectura")) { | 82 | if (sharedPreferences.contains("cbHabiLectura")) { |
74 | if (sharedPreferences.getString("cbHabiLectura", "").toString() == "0") { | 83 | if (sharedPreferences.getString("cbHabiLectura", "").toString() == "0") { |
75 | cbHabiLectura.isChecked = false | 84 | cbHabiLectura.isChecked = false |
76 | } else if (sharedPreferences.getString("cbHabiLectura", "").toString() == "1") { | 85 | } else if (sharedPreferences.getString("cbHabiLectura", "").toString() == "1") { |
77 | cbHabiLectura.isChecked = true | 86 | cbHabiLectura.isChecked = true |
78 | } | 87 | } |
79 | } else (sharedPreferences.getString("cbHabiLectura", "").toString() == "") | 88 | } else (sharedPreferences.getString("cbHabiLectura", "").toString() == "") |
80 | 89 | ||
81 | |||
82 | if (sharedPreferences.contains("cbMostrarStock")) { | 90 | if (sharedPreferences.contains("cbMostrarStock")) { |
83 | if (sharedPreferences.getString("cbMostrarStock", "").toString() == "0") { | 91 | if (sharedPreferences.getString("cbMostrarStock", "").toString() == "0") { |
84 | cbMostrarStock.isChecked = false | 92 | cbMostrarStock.isChecked = false |
85 | } else if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") { | 93 | } else if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") { |
86 | cbMostrarStock.isChecked = true | 94 | cbMostrarStock.isChecked = true |
87 | } | 95 | } |
88 | } else (sharedPreferences.getString("cbMostrarStock", "").toString() == "") | 96 | } else (sharedPreferences.getString("cbMostrarStock", "").toString() == "") |
89 | 97 | ||
90 | |||
91 | if (sharedPreferences.contains("rbVentas")) { | 98 | if (sharedPreferences.contains("rbVentas")) { |
92 | if (sharedPreferences.getString("rbVentas", "").toString() == "0") { | 99 | if (sharedPreferences.getString("rbVentas", "").toString() == "0") { |
93 | rbVentas.isChecked = false | 100 | rbVentas.isChecked = false |
94 | rbDeposito.isChecked = true | 101 | rbDeposito.isChecked = true |
95 | } else if (sharedPreferences.getString("rbVentas", "").toString() == "1") { | 102 | } else if (sharedPreferences.getString("rbVentas", "").toString() == "1") { |
96 | rbVentas.isChecked = true | 103 | rbVentas.isChecked = true |
97 | rbDeposito.isChecked = false | 104 | rbDeposito.isChecked = false |
98 | } | 105 | } |
99 | } else (sharedPreferences.getString("rbVentas", "").toString() == "") | 106 | } else (sharedPreferences.getString("rbVentas", "").toString() == "") |
100 | 107 | ||
101 | if (sharedPreferences.contains("rbDeposito")) { | 108 | if (sharedPreferences.contains("rbDeposito")) { |
102 | if (sharedPreferences.getString("rbDeposito", "").toString() == "0") { | 109 | if (sharedPreferences.getString("rbDeposito", "").toString() == "0") { |
103 | rbDeposito.isChecked = false | 110 | rbDeposito.isChecked = false |
104 | rbVentas.isChecked = true | 111 | rbVentas.isChecked = true |
105 | } else if (sharedPreferences.getString("rbDeposito", "").toString() == "1") { | 112 | } else if (sharedPreferences.getString("rbDeposito", "").toString() == "1") { |
106 | rbDeposito.isChecked = true | 113 | rbDeposito.isChecked = true |
107 | rbVentas.isChecked = false | 114 | rbVentas.isChecked = false |
108 | } | 115 | } |
109 | } else (sharedPreferences.getString("rbDeposito", "").toString() == "") | 116 | } else (sharedPreferences.getString("rbDeposito", "").toString() == "") |
110 | 117 | ||
111 | if (sharedPreferences.contains("rbCodigoDebo")) { | 118 | if (sharedPreferences.contains("rbCodigoDebo")) { |
112 | if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "0") { | 119 | if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "0") { |
113 | rbCodigoDebo.isChecked = false | 120 | rbCodigoDebo.isChecked = false |
114 | rbCodigoOrigen.isChecked = false | 121 | rbCodigoOrigen.isChecked = false |
115 | rbCodigoBarras.isChecked = false | 122 | rbCodigoBarras.isChecked = false |
116 | } else if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "1") { | 123 | } else if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "1") { |
117 | rbCodigoDebo.isChecked = true | 124 | rbCodigoDebo.isChecked = true |
118 | rbCodigoOrigen.isChecked = false | 125 | rbCodigoOrigen.isChecked = false |
119 | rbCodigoBarras.isChecked = false | 126 | rbCodigoBarras.isChecked = false |
120 | } | 127 | } |
121 | } else (sharedPreferences.getString("rbCodigoDebo", "").toString() == "") | 128 | } else (sharedPreferences.getString("rbCodigoDebo", "").toString() == "") |
122 | 129 | ||
123 | if (sharedPreferences.contains("rbCodigoOrigen")) { | 130 | if (sharedPreferences.contains("rbCodigoOrigen")) { |
124 | if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "0") { | 131 | if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "0") { |
125 | rbCodigoOrigen.isChecked = false | 132 | rbCodigoOrigen.isChecked = false |
126 | } else if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "1") { | 133 | } else if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "1") { |
127 | rbCodigoOrigen.isChecked = true | 134 | rbCodigoOrigen.isChecked = true |
128 | } | 135 | } |
129 | } else (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "") | 136 | } else (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "") |
137 | |||
130 | if (sharedPreferences.contains("rbCodigoBarras")) { | 138 | if (sharedPreferences.contains("rbCodigoBarras")) { |
131 | if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "0") { | 139 | if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "0") { |
132 | rbCodigoBarras.isChecked = false | 140 | rbCodigoBarras.isChecked = false |
133 | } else if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "1") { | 141 | } else if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "1") { |
134 | rbCodigoBarras.isChecked = true | 142 | rbCodigoBarras.isChecked = true |
135 | } | 143 | } |
136 | } else (sharedPreferences.getString("rbCodigoBarras", "").toString() == "") | 144 | } else (sharedPreferences.getString("rbCodigoBarras", "").toString() == "") |
137 | 145 | ||
138 | |||
139 | if (sharedPreferences.contains("cbMostrarExistencia")) { | 146 | if (sharedPreferences.contains("cbMostrarExistencia")) { |
140 | if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "0") { | 147 | if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "0") { |
141 | cbMostrarExistencia.isChecked = false | 148 | cbMostrarExistencia.isChecked = false |
142 | } else if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "1") { | 149 | } else if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "1") { |
143 | cbMostrarExistencia.isChecked = true | 150 | cbMostrarExistencia.isChecked = true |
144 | } | 151 | } |
145 | } else (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "") | 152 | } else (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "") |
146 | 153 | ||
147 | |||
148 | if (sharedPreferences.contains("cbMostrarPrecio")) { | 154 | if (sharedPreferences.contains("cbMostrarPrecio")) { |
149 | if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "0") { | 155 | if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "0") { |
150 | cbMostrarPrecio.isChecked = false | 156 | cbMostrarPrecio.isChecked = false |
151 | } else if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "1") { | 157 | } else if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "1") { |
152 | cbMostrarPrecio.isChecked = true | 158 | cbMostrarPrecio.isChecked = true |
153 | } | 159 | } |
154 | } else (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "") | 160 | } else (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "") |
155 | 161 | ||
156 | btnGuardar.setOnClickListener { | 162 | btnGuardar.setOnClickListener { |
157 | guardarPreferencias() | 163 | guardarPreferencias() |
158 | 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) | ||
159 | } | 166 | } |
160 | 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() } | ||
161 | 169 | ||
162 | GlobalScope.launch(Dispatchers.Main) { | 170 | GlobalScope.launch(Dispatchers.Main) { |
163 | val listServerDescription = arrayListOf<String>() | 171 | |
164 | for (any in getDescServers()) { | 172 | for (any in getDescServers()) { |
165 | listServerDescription.add(any.descripcion.toString()) | 173 | listServerDescription.add(any.descripcion.toString()) |
174 | listaServers[index]=(any.direccion.toString()) | ||
175 | index+=index | ||
166 | } | 176 | } |
177 | |||
167 | if (spServidor != null) { | 178 | if (spServidor != null) { |
168 | val adapter = ArrayAdapter(requireContext(), android.R.layout.simple_spinner_item, listServerDescription) | 179 | val adapter = ArrayAdapter(requireContext(), android.R.layout.simple_spinner_item, listServerDescription) |
169 | spServidor.adapter = adapter | 180 | spServidor.adapter = adapter |
170 | } | 181 | } |
171 | } | 182 | } |
172 | btnValidarServidor.setOnClickListener { | 183 | if (sharedPreferences.contains("ServerPredeterminado")) { |
173 | Toast.makeText(requireContext(), "Dirección correcta", Toast.LENGTH_LONG).show() | 184 | spServidor.setSelection(sharedPreferences.getString("ServerPredeterminado", "").toString().toInt()) |
185 | |||
186 | } else (spServidor.setSelection(2)) | ||
187 | |||
188 | spServidor.setOnItemClickListener { adapterView, view, i, l -> | ||
189 | |||
174 | } | 190 | } |
175 | return v | 191 | return v |
176 | } | 192 | } |
177 | 193 | ||
178 | suspend fun getDescServers(): List<ServeInv> { | 194 | suspend fun getDescServers(): List<ServeInv> { |
179 | return GlobalScope.async(Dispatchers.IO) { | 195 | return GlobalScope.async(Dispatchers.IO) { |
180 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchAllServers() | 196 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchAllServers() |
181 | }.await() | 197 | }.await() |
182 | } | 198 | } |
183 | 199 | ||
184 | fun guardarPreferencias() { | 200 | fun guardarPreferencias() { |
185 | try { | 201 | try { |
186 | val editor = sharedPreferences.edit() | 202 | val editor = sharedPreferences.edit() |
187 | 203 | ||
188 | if (etRuta.text.isNotEmpty()) editor?.putString("etRuta", etRuta.text.toString()) | 204 | if (etRuta.text.isNotEmpty()) editor?.putString("etRuta", etRuta.text.toString()) |
189 | 205 | ||
190 | if (rbProInclu.isChecked) editor?.putString("rbProInclu", "1") else editor?.putString("rbProInclu", "0") | 206 | if (rbProInclu.isChecked) editor?.putString("rbProInclu", "1") else editor?.putString("rbProInclu", "0") |
191 | if (rbProNoInclu.isChecked) editor?.putString("rbProNoInclu", "1") else editor?.putString("rbProNoInclu", "0") | 207 | if (rbProNoInclu.isChecked) editor?.putString("rbProNoInclu", "1") else editor?.putString("rbProNoInclu", "0") |
192 | 208 | ||
193 | if (cbHabiLectura.isChecked) editor?.putString("cbHabiLectura", "1") else editor?.putString("cbHabiLectura", "0") | 209 | if (cbHabiLectura.isChecked) editor?.putString("cbHabiLectura", "1") else editor?.putString("cbHabiLectura", "0") |
194 | if (cbMostrarStock.isChecked) editor?.putString("cbMostrarStock", "1") else editor?.putString("cbMostrarStock", "0") | 210 | if (cbMostrarStock.isChecked) editor?.putString("cbMostrarStock", "1") else editor?.putString("cbMostrarStock", "0") |
195 | if (rbVentas.isChecked) editor?.putString("rbVentas", "1") else editor?.putString("rbVentas", "0") | 211 | if (rbVentas.isChecked) editor?.putString("rbVentas", "1") else editor?.putString("rbVentas", "0") |
196 | if (rbDeposito.isChecked) editor?.putString("rbDeposito", "1") else editor?.putString("rbDeposito", "0") | 212 | if (rbDeposito.isChecked) editor?.putString("rbDeposito", "1") else editor?.putString("rbDeposito", "0") |
197 | if (rbCodigoDebo.isChecked) editor?.putString("rbCodigoDebo", "1") else editor?.putString("rbCodigoDebo", "0") | 213 | if (rbCodigoDebo.isChecked) editor?.putString("rbCodigoDebo", "1") else editor?.putString("rbCodigoDebo", "0") |
198 | if (rbCodigoOrigen.isChecked) editor?.putString("rbCodigoOrigen", "1") else editor?.putString("rbCodigoOrigen", "0") | 214 | if (rbCodigoOrigen.isChecked) editor?.putString("rbCodigoOrigen", "1") else editor?.putString("rbCodigoOrigen", "0") |
199 | if (rbCodigoBarras.isChecked) editor?.putString("rbCodigoBarras", "1") else editor?.putString("rbCodigoBarras", "0") | 215 | if (rbCodigoBarras.isChecked) editor?.putString("rbCodigoBarras", "1") else editor?.putString("rbCodigoBarras", "0") |
200 | if (cbMostrarExistencia.isChecked) editor?.putString("cbMostrarExistencia", "1") else editor?.putString("cbMostrarExistencia", "0") | 216 | if (cbMostrarExistencia.isChecked) editor?.putString("cbMostrarExistencia", "1") else editor?.putString("cbMostrarExistencia", "0") |
201 | if (cbMostrarPrecio.isChecked) editor?.putString("cbMostrarPrecio", "1") else editor?.putString("cbMostrarPrecio", "0") | 217 | if (cbMostrarPrecio.isChecked) editor?.putString("cbMostrarPrecio", "1") else editor?.putString("cbMostrarPrecio", "0") |
218 | editor?.putString("ServerPredeterminado", spServidor.selectedItemId.toString()) | ||
202 | 219 | ||
203 | editor?.apply() | 220 | editor?.apply() |
204 | editor.commit() | 221 | editor.commit() |
app/src/main/java/com/focasoftware/deboinventariov20/ui/detalleProducto/DetalleArtFragment.kt
1 | package com.focasoftware.deboinventariov20.ui.detalleProducto | 1 | package com.focasoftware.deboinventariov20.ui.detalleProducto |
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 androidx.fragment.app.Fragment | 9 | import androidx.fragment.app.Fragment |
10 | import androidx.navigation.NavController | 10 | import androidx.navigation.NavController |
11 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 11 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
12 | import com.focasoftware.deboinventariov20.Model.Articles | 12 | import com.focasoftware.deboinventariov20.Model.Articles |
13 | import com.focasoftware.deboinventariov20.R | 13 | import com.focasoftware.deboinventariov20.R |
14 | import kotlinx.android.synthetic.main.fragment_detalle_art.* | 14 | import kotlinx.android.synthetic.main.fragment_detalle_art.* |
15 | import kotlinx.coroutines.Dispatchers | 15 | import kotlinx.coroutines.Dispatchers |
16 | import kotlinx.coroutines.GlobalScope | 16 | import kotlinx.coroutines.GlobalScope |
17 | import kotlinx.coroutines.async | 17 | import kotlinx.coroutines.async |
18 | import kotlinx.coroutines.launch | 18 | import kotlinx.coroutines.launch |
19 | 19 | ||
20 | |||
21 | class DetalleArtFragment : Fragment() { | 20 | class DetalleArtFragment : Fragment() { |
22 | 21 | ||
23 | private lateinit var navController: NavController | ||
24 | private var Inventario: Int = 0 | 22 | private var Inventario: Int = 0 |
25 | private var sector: String? = null | 23 | private var sector: String? = null |
26 | private var codigo: String? = null | 24 | private var codigo: String? = null |
27 | private var artSerch: Articles? = null | 25 | private var artSerch: Articles? = null |
28 | lateinit var sharedPreferences: SharedPreferences | 26 | lateinit var sharedPreferences: SharedPreferences |
29 | 27 | ||
30 | override fun onCreate(savedInstanceState: Bundle?) { | 28 | override fun onCreate(savedInstanceState: Bundle?) { |
31 | super.onCreate(savedInstanceState) | 29 | super.onCreate(savedInstanceState) |
32 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 30 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
33 | arguments?.let { | 31 | arguments?.let { |
34 | sector = it.getString("sector") | 32 | sector = it.getString("sector") |
35 | codigo = it.getString("codigo") | 33 | codigo = it.getString("codigo") |
36 | Inventario= it.getInt("numeroInv") | 34 | Inventario= it.getInt("numeroInv") |
37 | } | 35 | } |
38 | marcarInventario() | 36 | marcarInventario() |
39 | GlobalScope.launch(Dispatchers.Main) { | 37 | GlobalScope.launch(Dispatchers.Main) { |
40 | 38 | ||
41 | artSerch = buscarCodigoDeboEnBD(sector, codigo) | 39 | artSerch = buscarCodigoDeboEnBD(sector, codigo) |
42 | if (artSerch == null) { | 40 | if (artSerch == null) { |
43 | 41 | ||
44 | // val type = InputType.TYPE_CLASS_NUMBER | 42 | // val type = InputType.TYPE_CLASS_NUMBER |
45 | // MaterialDialog(requireContext()).show { | 43 | // MaterialDialog(requireContext()).show { |
46 | // | 44 | // |
47 | // title(text = "Producto '$sChangeUpper', se encuentra cargado.") | 45 | // title(text = "Producto '$sChangeUpper', se encuentra cargado.") |
48 | // message(R.string.sCantidadNueva) | 46 | // message(R.string.sCantidadNueva) |
49 | // input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | 47 | // input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> |
50 | // fCant = 0F | 48 | // fCant = 0F |
51 | // fCant = charSequence.toString().toFloat() | 49 | // fCant = charSequence.toString().toFloat() |
52 | // } | 50 | // } |
53 | // positiveButton(R.string.btnOk) { | 51 | // positiveButton(R.string.btnOk) { |
54 | // //TODO ACTUALIZO CANTIADAD EN BD | 52 | // //TODO ACTUALIZO CANTIADAD EN BD |
55 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 53 | // updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
56 | // //TODO ACTUALIZO CANTIDAD EN RV | 54 | // //TODO ACTUALIZO CANTIDAD EN RV |
57 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 55 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
58 | // viewAdapter.notifyDataSetChanged() | 56 | // viewAdapter.notifyDataSetChanged() |
59 | // dismiss() | 57 | // dismiss() |
60 | // } | 58 | // } |
61 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 59 | // }.cancelOnTouchOutside(false).cornerRadius(10F) |
62 | } else if (artSerch != null) { | 60 | } else if (artSerch != null) { |
63 | tvSector.text=sector | 61 | tvSector.text=sector |
64 | tvCodigo.text=codigo | 62 | tvCodigo.text=codigo |
65 | tvDeposito.text=if(artSerch!!.depSn!!.toInt() ==0)"No" else "Si" | 63 | tvDeposito.text=if(artSerch!!.depSn!!.toInt() ==0)"No" else "Si" |
66 | tvDescripcion.text=artSerch!!.descripcion.toString() | 64 | tvDescripcion.text=artSerch!!.descripcion.toString() |
67 | tvCodigoBarras.text=artSerch!!.codBar.toString() | 65 | tvCodigoBarras.text=artSerch!!.codBar.toString() |
68 | tvCodigoOrigen.text=artSerch!!.codOrigen.toString() | 66 | tvCodigoOrigen.text=artSerch!!.codOrigen.toString() |
69 | tvExiVenta.text=artSerch!!.exiVenta.toString() | 67 | tvExiVenta.text=artSerch!!.exiVenta.toString() |
70 | tvExiDeposito.text=artSerch!!.exiDeposito.toString() | 68 | tvExiDeposito.text=artSerch!!.exiDeposito.toString() |
71 | tvBal.text=artSerch!!.balanza.toString() | 69 | tvBal.text=artSerch!!.balanza.toString() |
72 | tvDE.text=artSerch!!.de.toString() | 70 | tvDE.text=artSerch!!.de.toString() |
73 | } | 71 | } |
74 | } | 72 | } |
75 | } | 73 | } |
76 | 74 | ||
77 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 75 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
78 | 76 | ||
79 | return inflater.inflate(R.layout.fragment_detalle_art, container, false) | 77 | return inflater.inflate(R.layout.fragment_detalle_art, container, false) |
80 | } | 78 | } |
81 | 79 | ||
82 | suspend fun buscarCodigoDeboEnBD(sector: String?, codigo: String?): Articles? { | 80 | suspend fun buscarCodigoDeboEnBD(sector: String?, codigo: String?): Articles? { |
83 | //TODO BUSQUEDA POR CODIGO DE BARRAS | 81 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
84 | var busqueda: Articles? = null | 82 | var busqueda: Articles? = null |
85 | return GlobalScope.async(Dispatchers.IO) { | 83 | return GlobalScope.async(Dispatchers.IO) { |
86 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.fetchArticuloByCodSec(sector, codigo) | 84 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.fetchArticuloByCodSec(sector, codigo) |
87 | return@async busqueda | 85 | return@async busqueda |
88 | }.await() | 86 | }.await() |
89 | } | 87 | } |
90 | fun marcarInventario() { | 88 | fun marcarInventario() { |
91 | 89 | ||
92 | val editor = sharedPreferences.edit() | 90 | val editor = sharedPreferences.edit() |
93 | editor?.putString("Inventario", Inventario.toString()) | 91 | editor?.putString("Inventario", Inventario.toString()) |
94 | editor?.apply() | 92 | editor?.apply() |
95 | editor.commit() | 93 | editor.commit() |
96 | // navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) | 94 | // navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) |
97 | } | 95 | } |
98 | } | 96 | } |
app/src/main/java/com/focasoftware/deboinventariov20/ui/servidores/ServidoresFragment.kt
1 | package com.focasoftware.deboinventariov20.ui.servidores | 1 | package com.focasoftware.deboinventariov20.ui.servidores |
2 | 2 | ||
3 | import android.graphics.Canvas | 3 | import android.graphics.Canvas |
4 | import android.graphics.Color | 4 | import android.graphics.Color |
5 | import android.graphics.drawable.Drawable | 5 | import android.graphics.drawable.Drawable |
6 | import android.os.Bundle | 6 | import android.os.Bundle |
7 | import android.view.LayoutInflater | 7 | import android.view.LayoutInflater |
8 | import android.view.View | 8 | import android.view.View |
9 | import android.view.ViewGroup | 9 | import android.view.ViewGroup |
10 | import android.widget.Toast | 10 | import android.widget.Toast |
11 | import androidx.core.content.ContextCompat | 11 | import androidx.core.content.ContextCompat |
12 | import androidx.fragment.app.Fragment | 12 | import androidx.fragment.app.Fragment |
13 | import androidx.lifecycle.lifecycleScope | 13 | import androidx.lifecycle.lifecycleScope |
14 | import androidx.recyclerview.widget.ItemTouchHelper | 14 | import androidx.recyclerview.widget.ItemTouchHelper |
15 | import androidx.recyclerview.widget.LinearLayoutManager | 15 | import androidx.recyclerview.widget.LinearLayoutManager |
16 | import androidx.recyclerview.widget.RecyclerView | 16 | import androidx.recyclerview.widget.RecyclerView |
17 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 17 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
18 | import com.focasoftware.deboinventariov20.Model.ServeInv | 18 | import com.focasoftware.deboinventariov20.Model.ServeInv |
19 | import com.focasoftware.deboinventariov20.R | 19 | import com.focasoftware.deboinventariov20.R |
20 | import kotlinx.android.synthetic.main.fragment_servidores.* | 20 | import kotlinx.android.synthetic.main.fragment_servidores.* |
21 | import kotlinx.coroutines.* | 21 | import kotlinx.coroutines.* |
22 | 22 | ||
23 | class ServidoresFragment : Fragment() { | 23 | class ServidoresFragment : Fragment() { |
24 | 24 | ||
25 | private lateinit var rvServidores: RecyclerView | 25 | private lateinit var rvServidores: RecyclerView |
26 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | 26 | private lateinit var viewAdapter: RecyclerView.Adapter<*> |
27 | private lateinit var viewManager: RecyclerView.LayoutManager | 27 | private lateinit var viewManager: RecyclerView.LayoutManager |
28 | private var listServ = ArrayList<ItemsServidores>() | 28 | private var listServ = ArrayList<ItemsServidores>() |
29 | private lateinit var servidores: List<ServeInv> | 29 | private lateinit var servidores: List<ServeInv> |
30 | private lateinit var deleteIcon: Drawable | 30 | private lateinit var deleteIcon: Drawable |
31 | 31 | ||
32 | override fun onCreate(savedInstanceState: Bundle?) { | 32 | override fun onCreate(savedInstanceState: Bundle?) { |
33 | super.onCreate(savedInstanceState) | 33 | super.onCreate(savedInstanceState) |
34 | CargarRV() | 34 | CargarRV() |
35 | } | 35 | } |
36 | 36 | ||
37 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 37 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
38 | super.onViewCreated(view, savedInstanceState) | 38 | super.onViewCreated(view, savedInstanceState) |
39 | 39 | ||
40 | btnGuardarServidores.setOnClickListener { | 40 | btnGuardarServidores.setOnClickListener { |
41 | if (etNombreServidor.text.isNullOrBlank()) { | 41 | if (etNombreServidor.text.isNullOrBlank()) { |
42 | etNombreServidor.error = "Nombre no valido" | 42 | etNombreServidor.error = "Nombre no valido" |
43 | etNombreServidor.requestFocus() | 43 | etNombreServidor.requestFocus() |
44 | etNombreServidor.hint = "Nombre no valido" | 44 | etNombreServidor.hint = "Nombre no valido" |
45 | } | 45 | } |
46 | if (etDireccionServidor.text.isNullOrBlank()) { | 46 | if (etDireccionServidor.text.isNullOrBlank()) { |
47 | etDireccionServidor.error = "Dirección no valida" | 47 | etDireccionServidor.error = "Dirección no valida" |
48 | etDireccionServidor.requestFocus() | 48 | etDireccionServidor.requestFocus() |
49 | etDireccionServidor.hint = "Dirección no valida" | 49 | etDireccionServidor.hint = "Dirección no valida" |
50 | } | 50 | } |
51 | if (!etDireccionServidor.text.isNullOrBlank() || !etNombreServidor.text.isNullOrBlank()) { | 51 | if (!etDireccionServidor.text.isNullOrBlank() || !etNombreServidor.text.isNullOrBlank()) { |
52 | // GlobalScope.launch(Dispatchers.Main) { | 52 | // GlobalScope.launch(Dispatchers.Main) { |
53 | // ServerNew =AppDb.getAppDb(requireContext())?.ServeInvDao()?.findLastServer()?.plus(1) ?: 1 | 53 | // ServerNew =AppDb.getAppDb(requireContext())?.ServeInvDao()?.findLastServer()?.plus(1) ?: 1 |
54 | val servidor = ServeInv(etNombreServidor.text.toString(), "http://${etDireccionServidor.text}/", "0") | 54 | val servidor = ServeInv(etNombreServidor.text.toString(), "http://${etDireccionServidor.text}/", "0") |
55 | ingresarDatos(servidor) | 55 | ingresarDatos(servidor) |
56 | cargarRecicler(servidor) | 56 | cargarRecicler(servidor) |
57 | Toast.makeText(requireContext(), "Servidor ${etNombreServidor.text} Guardado", Toast.LENGTH_LONG).show() | 57 | Toast.makeText(requireContext(), "Servidor ${etNombreServidor.text} Guardado", Toast.LENGTH_LONG).show() |
58 | etNombreServidor.text.clear() | 58 | etNombreServidor.text.clear() |
59 | etDireccionServidor.text.clear() | 59 | etDireccionServidor.text.clear() |
60 | // } | 60 | // } |
61 | } | 61 | } |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 65 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
66 | val v = inflater.inflate(R.layout.fragment_servidores, container, false) | 66 | val v = inflater.inflate(R.layout.fragment_servidores, container, false) |
67 | rvServidores = v.findViewById(R.id.rvServidores) | 67 | rvServidores = v.findViewById(R.id.rvServidores) |
68 | return v | 68 | return v |
69 | } | 69 | } |
70 | 70 | ||
71 | fun ingresarDatos(servidor: ServeInv) { | 71 | fun ingresarDatos(servidor: ServeInv) { |
72 | val Job = GlobalScope.launch { | 72 | val Job = GlobalScope.launch { |
73 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.insertServer(servidor) | 73 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.insertServer(servidor) |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | suspend fun buscarEnBD(): List<ServeInv> { | 77 | suspend fun buscarEnBD(): List<ServeInv> { |
78 | //TODO BUSQUEDA POR DESCRIPCION | ||
79 | var busqueda: List<ServeInv> | 78 | var busqueda: List<ServeInv> |
80 | return GlobalScope.async(Dispatchers.IO) { | 79 | return GlobalScope.async(Dispatchers.IO) { |
81 | busqueda = AppDb.getAppDb(requireContext())!!.ServeInvDao()!!.fetchAllServers() | 80 | busqueda = AppDb.getAppDb(requireContext())!!.ServeInvDao()!!.fetchAllServers() |
82 | return@async busqueda | 81 | return@async busqueda |
83 | }.await() | 82 | }.await() |
84 | } | 83 | } |
85 | 84 | ||
86 | fun CargarRV() { | 85 | fun CargarRV() { |
87 | GlobalScope.launch(Dispatchers.Main) { | 86 | GlobalScope.launch(Dispatchers.Main) { |
88 | servidores = buscarEnBD() | 87 | servidores = buscarEnBD() |
89 | for ((i, item) in servidores.withIndex()) { | 88 | for ((i, item) in servidores.withIndex()) { |
90 | val ser = ServeInv(servidores[i].descripcion, servidores[i].direccion, servidores[i].predeterminado) | 89 | val ser = ServeInv(servidores[i].descripcion, servidores[i].direccion, servidores[i].predeterminado) |
91 | cargarRecicler(ser) | 90 | cargarRecicler(ser) |
92 | } | 91 | } |
93 | } | 92 | } |
94 | } | 93 | } |
95 | 94 | ||
96 | fun cargarRecicler(ser: ServeInv) { | 95 | fun cargarRecicler(ser: ServeInv) { |
97 | //TODO CARGO EN LE RV | 96 | //TODO CARGO EN LE RV |
98 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! | 97 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! |
99 | val item = ItemsServidores(ser.descripcion, ser.direccion, ser.predeterminado) | 98 | val item = ItemsServidores(ser.descripcion, ser.direccion, ser.predeterminado) |
100 | 99 | ||
101 | listServ.add(item) | 100 | listServ.add(item) |
102 | 101 | ||
103 | viewAdapter = AdapterServidores(listServ, requireContext()) | 102 | viewAdapter = AdapterServidores(listServ, requireContext()) |
104 | viewManager = LinearLayoutManager(requireContext()) | 103 | viewManager = LinearLayoutManager(requireContext()) |
105 | 104 | ||
106 | rvServidores.apply { | 105 | rvServidores.apply { |
107 | adapter = viewAdapter | 106 | adapter = viewAdapter |
108 | layoutManager = viewManager | 107 | layoutManager = viewManager |
109 | } | 108 | } |
110 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { | 109 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { |
111 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | 110 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { |
112 | return false | 111 | return false |
113 | } | 112 | } |
114 | 113 | ||
115 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { | 114 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { |
116 | GlobalScope.launch(Dispatchers.Main) { | 115 | GlobalScope.launch(Dispatchers.Main) { |
117 | deleteServer(listServ[viewHolder.adapterPosition].descripcion.toString(), listServ[viewHolder.adapterPosition].direccion.toString()) | 116 | deleteServer(listServ[viewHolder.adapterPosition].descripcion.toString(), listServ[viewHolder.adapterPosition].direccion.toString()) |
118 | 117 | ||
119 | (viewAdapter as AdapterServidores).removeItem(viewHolder) | 118 | (viewAdapter as AdapterServidores).removeItem(viewHolder) |
120 | viewAdapter.notifyDataSetChanged() | 119 | viewAdapter.notifyDataSetChanged() |
121 | } | 120 | } |
122 | } | 121 | } |
123 | 122 | ||
124 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | 123 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
125 | val itemView = viewHolder.itemView | 124 | val itemView = viewHolder.itemView |
126 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 | 125 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 |
127 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | 126 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) |
128 | 127 | ||
129 | if (dX > 0) { | 128 | if (dX > 0) { |
130 | 129 | ||
131 | if (dX < c.width / 2) c.drawColor(Color.GREEN) | 130 | if (dX < c.width / 2) c.drawColor(Color.GREEN) |
132 | else c.drawColor(Color.RED) | 131 | else c.drawColor(Color.RED) |
133 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) | 132 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) |
134 | } else { | 133 | } else { |
135 | } | 134 | } |
136 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 135 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
137 | deleteIcon.draw(c) | 136 | deleteIcon.draw(c) |
138 | } | 137 | } |
139 | } | 138 | } |
140 | 139 | ||
141 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) | 140 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) |
142 | itemTouchHelper.attachToRecyclerView(rvServidores) | 141 | itemTouchHelper.attachToRecyclerView(rvServidores) |
143 | } | 142 | } |
144 | 143 | ||
145 | suspend fun deleteServer(serverName: String, serverDir: String) { | 144 | suspend fun deleteServer(serverName: String, serverDir: String) { |
146 | lifecycleScope.launch { | 145 | lifecycleScope.launch { |
147 | withContext(Dispatchers.IO) { | 146 | withContext(Dispatchers.IO) { |
148 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.deleteServer(serverName, serverDir) | 147 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.deleteServer(serverName, serverDir) |
149 | } | 148 | } |
150 | } | 149 | } |
151 | } | 150 | } |
152 | } | 151 | } |
153 | 152 |
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 | android:layout_width="0dp" | 48 | android:layout_width="0dp" |
49 | android:layout_height="wrap_content" | 49 | android:layout_height="wrap_content" |
50 | android:backgroundTint="@color/LightGray" | 50 | android:backgroundTint="@color/LightGray" |
51 | android:elevation="5dp" | 51 | android:elevation="5dp" |
52 | android:fadeScrollbars="true" | 52 | android:fadeScrollbars="true" |
53 | android:foregroundTint="@android:color/holo_orange_dark" | 53 | android:foregroundTint="@android:color/holo_orange_dark" |
54 | android:soundEffectsEnabled="true" | 54 | android:soundEffectsEnabled="true" |
55 | android:spinnerMode="dialog" | 55 | android:spinnerMode="dropdown" |
56 | android:splitMotionEvents="false" | 56 | |
57 | android:textAlignment="center" | 57 | android:splitMotionEvents="true" |
58 | android:textAlignment="textStart" | ||
58 | android:textSize="@dimen/NormalText" | 59 | android:textSize="@dimen/NormalText" |
59 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" | 60 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" |
60 | app:layout_constraintEnd_toStartOf="@+id/btnValidarServidor" | 61 | app:layout_constraintEnd_toStartOf="@+id/btnValidarServidor" |
61 | app:layout_constraintHorizontal_chainStyle="packed" | 62 | app:layout_constraintHorizontal_chainStyle="packed" |
62 | app:layout_constraintStart_toStartOf="parent" | 63 | app:layout_constraintStart_toStartOf="parent" |
63 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" | 64 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" |
64 | android:entries="@array/spinnerServidor" | ||
65 | android:prompt="@string/leyendaSpinner"/> | 65 | android:prompt="@string/leyendaSpinner"/> |
66 | 66 | ||
67 | <Button | 67 | <Button |
68 | android:id="@+id/btnValidarServidor" | 68 | android:id="@+id/btnValidarServidor" |
69 | android:layout_width="wrap_content" | 69 | android:layout_width="wrap_content" |
70 | android:layout_height="wrap_content" | 70 | android:layout_height="wrap_content" |
71 | android:textColor="@android:color/white" | 71 | android:textColor="@android:color/white" |
72 | android:padding="10dp" | 72 | android:padding="10dp" |
73 | android:background="@drawable/boton_borde_redondeado" | 73 | android:background="@drawable/boton_borde_redondeado" |
74 | android:text="@string/btnValidarServidor" | 74 | android:text="@string/btnValidarServidor" |
75 | android:textSize="@dimen/NormalText" | 75 | android:textSize="@dimen/NormalText" |
76 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" | 76 | app:layout_constraintBottom_toTopOf="@+id/btnAgregarServidor" |
77 | app:layout_constraintEnd_toEndOf="parent" | 77 | app:layout_constraintEnd_toEndOf="parent" |
78 | app:layout_constraintHorizontal_chainStyle="packed" | 78 | app:layout_constraintHorizontal_chainStyle="packed" |
79 | app:layout_constraintStart_toEndOf="@id/spServidor" | 79 | app:layout_constraintStart_toEndOf="@id/spServidor" |
80 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" /> | 80 | app:layout_constraintTop_toBottomOf="@+id/tvSeleccioneServidor" /> |
81 | 81 | ||
82 | <Button | 82 | <Button |
83 | android:id="@+id/btnAgregarServidor" | 83 | android:id="@+id/btnAgregarServidor" |
84 | android:layout_width="0dp" | 84 | android:layout_width="0dp" |
85 | android:layout_height="wrap_content" | 85 | android:layout_height="wrap_content" |
86 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 86 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
87 | android:layout_marginEnd="@dimen/MarginBotAgreSer" | 87 | android:layout_marginEnd="@dimen/MarginBotAgreSer" |
88 | android:text="@string/btnAgregarServidor" | 88 | android:text="@string/btnAgregarServidor" |
89 | android:textSize="@dimen/NormalText" | 89 | android:textSize="@dimen/NormalText" |
90 | android:textColor="@android:color/white" | 90 | android:textColor="@android:color/white" |
91 | android:padding="10dp" | 91 | android:padding="10dp" |
92 | android:background="@drawable/boton_borde_redondeado" | 92 | android:background="@drawable/boton_borde_redondeado" |
93 | app:layout_constraintBottom_toTopOf="@+id/tvUbicacionCarpetas" | 93 | app:layout_constraintBottom_toTopOf="@+id/tvUbicacionCarpetas" |
94 | app:layout_constraintEnd_toEndOf="parent" | 94 | app:layout_constraintEnd_toEndOf="parent" |
95 | app:layout_constraintStart_toStartOf="parent" | 95 | app:layout_constraintStart_toStartOf="parent" |
96 | app:layout_constraintTop_toBottomOf="@+id/btnValidarServidor" /> | 96 | app:layout_constraintTop_toBottomOf="@+id/btnValidarServidor" /> |
97 | 97 | ||
98 | 98 | ||
99 | <TextView | 99 | <TextView |
100 | android:id="@+id/tvUbicacionCarpetas" | 100 | android:id="@+id/tvUbicacionCarpetas" |
101 | android:layout_width="0dp" | 101 | android:layout_width="0dp" |
102 | android:layout_height="wrap_content" | 102 | android:layout_height="wrap_content" |
103 | 103 | ||
104 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 104 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
105 | android:layout_marginTop="@dimen/MarginTopSubTitulos" | 105 | android:layout_marginTop="@dimen/MarginTopSubTitulos" |
106 | android:gravity="start" | 106 | android:gravity="start" |
107 | android:lines="1" | 107 | android:lines="1" |
108 | android:text="@string/tvUbicacionCarpetas" | 108 | android:text="@string/tvUbicacionCarpetas" |
109 | android:textColor="@android:color/black" | 109 | android:textColor="@android:color/black" |
110 | android:textSize="@dimen/SubTitulos" | 110 | android:textSize="@dimen/SubTitulos" |
111 | app:fontFamily="sans-serif-condensed" | 111 | app:fontFamily="sans-serif-condensed" |
112 | app:layout_constraintBottom_toTopOf="@+id/ibSearch" | 112 | app:layout_constraintBottom_toTopOf="@+id/ibSearch" |
113 | app:layout_constraintEnd_toEndOf="parent" | 113 | app:layout_constraintEnd_toEndOf="parent" |
114 | app:layout_constraintStart_toStartOf="parent" | 114 | app:layout_constraintStart_toStartOf="parent" |
115 | app:layout_constraintTop_toBottomOf="@+id/btnAgregarServidor" /> | 115 | app:layout_constraintTop_toBottomOf="@+id/btnAgregarServidor" /> |
116 | 116 | ||
117 | <ImageButton | 117 | <ImageButton |
118 | android:id="@+id/ibSearch" | 118 | android:id="@+id/ibSearch" |
119 | android:layout_width="36dp" | 119 | android:layout_width="36dp" |
120 | android:layout_height="37dp" | 120 | android:layout_height="37dp" |
121 | android:layout_margin="10dp" | 121 | android:layout_margin="10dp" |
122 | android:src="@drawable/search" | 122 | android:src="@drawable/search" |
123 | android:textColor="@android:color/white" | 123 | android:textColor="@android:color/white" |
124 | android:padding="10dp" | 124 | android:padding="10dp" |
125 | android:background="@drawable/boton_borde_redondeado" | 125 | android:background="@drawable/boton_borde_redondeado" |
126 | app:layout_constraintEnd_toStartOf="@+id/etRuta" | 126 | app:layout_constraintEnd_toStartOf="@+id/etRuta" |
127 | app:layout_constraintStart_toStartOf="parent" | 127 | app:layout_constraintStart_toStartOf="parent" |
128 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> | 128 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> |
129 | 129 | ||
130 | <EditText | 130 | <EditText |
131 | android:id="@+id/etRuta" | 131 | android:id="@+id/etRuta" |
132 | android:layout_width="0dp" | 132 | android:layout_width="0dp" |
133 | android:layout_height="wrap_content" | 133 | android:layout_height="wrap_content" |
134 | android:layout_marginTop="10dp" | 134 | android:layout_marginTop="10dp" |
135 | android:layout_marginEnd="10dp" | 135 | android:layout_marginEnd="10dp" |
136 | android:clickable="true" | 136 | android:clickable="true" |
137 | android:ems="10" | 137 | android:ems="10" |
138 | android:focusable="true" | 138 | android:focusable="true" |
139 | android:inputType="textPersonName" | 139 | android:inputType="textPersonName" |
140 | android:lines="1" | 140 | android:lines="1" |
141 | android:text="" | 141 | android:text="" |
142 | android:textSize="@dimen/NormalText" | 142 | android:textSize="@dimen/NormalText" |
143 | app:layout_constraintEnd_toEndOf="parent" | 143 | app:layout_constraintEnd_toEndOf="parent" |
144 | app:layout_constraintStart_toEndOf="@id/ibSearch" | 144 | app:layout_constraintStart_toEndOf="@id/ibSearch" |
145 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> | 145 | app:layout_constraintTop_toBottomOf="@+id/tvUbicacionCarpetas" /> |
146 | 146 | ||
147 | <TextView | 147 | <TextView |
148 | android:id="@+id/tvActuFecha" | 148 | android:id="@+id/tvActuFecha" |
149 | android:layout_width="0dp" | 149 | android:layout_width="0dp" |
150 | android:layout_height="wrap_content" | 150 | android:layout_height="wrap_content" |
151 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 151 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
152 | android:layout_marginTop="@dimen/MarginTopSubTitulos" | 152 | android:layout_marginTop="@dimen/MarginTopSubTitulos" |
153 | android:gravity="start" | 153 | android:gravity="start" |
154 | android:lines="1" | 154 | android:lines="1" |
155 | android:text="@string/tvTituloArea" | 155 | android:text="@string/tvTituloArea" |
156 | android:textColor="@android:color/black" | 156 | android:textColor="@android:color/black" |
157 | android:textSize="@dimen/SubTitulos" | 157 | android:textSize="@dimen/SubTitulos" |
158 | app:fontFamily="sans-serif-condensed" | 158 | app:fontFamily="sans-serif-condensed" |
159 | app:layout_constraintEnd_toEndOf="parent" | 159 | app:layout_constraintEnd_toEndOf="parent" |
160 | app:layout_constraintStart_toStartOf="parent" | 160 | app:layout_constraintStart_toStartOf="parent" |
161 | app:layout_constraintTop_toBottomOf="@+id/etRuta" /> | 161 | app:layout_constraintTop_toBottomOf="@+id/etRuta" /> |
162 | 162 | ||
163 | <RadioGroup | 163 | <RadioGroup |
164 | android:id="@+id/rgFechaHora" | 164 | android:id="@+id/rgFechaHora" |
165 | android:layout_width="0dp" | 165 | android:layout_width="0dp" |
166 | android:layout_height="wrap_content" | 166 | android:layout_height="wrap_content" |
167 | 167 | ||
168 | android:gravity="center" | 168 | android:gravity="center" |
169 | android:orientation="horizontal" | 169 | android:orientation="horizontal" |
170 | app:layout_constraintEnd_toEndOf="parent" | 170 | app:layout_constraintEnd_toEndOf="parent" |
171 | app:layout_constraintStart_toStartOf="parent" | 171 | app:layout_constraintStart_toStartOf="parent" |
172 | app:layout_constraintTop_toBottomOf="@+id/tvActuFecha"> | 172 | app:layout_constraintTop_toBottomOf="@+id/tvActuFecha"> |
173 | 173 | ||
174 | <RadioButton | 174 | <RadioButton |
175 | android:id="@+id/rbVentas" | 175 | android:id="@+id/rbVentas" |
176 | android:layout_width="wrap_content" | 176 | android:layout_width="wrap_content" |
177 | android:layout_height="wrap_content" | 177 | android:layout_height="wrap_content" |
178 | android:layout_margin="5dp" | 178 | android:layout_margin="5dp" |
179 | android:checked="true" | 179 | android:checked="true" |
180 | android:padding="5dp" | 180 | android:padding="5dp" |
181 | android:text="@string/rbVentas" | 181 | android:text="@string/rbVentas" |
182 | android:textSize="@dimen/NormalText" /> | 182 | android:textSize="@dimen/NormalText" /> |
183 | 183 | ||
184 | <RadioButton | 184 | <RadioButton |
185 | android:id="@+id/rbDeposito" | 185 | android:id="@+id/rbDeposito" |
186 | android:layout_width="wrap_content" | 186 | android:layout_width="wrap_content" |
187 | android:layout_height="wrap_content" | 187 | android:layout_height="wrap_content" |
188 | android:layout_margin="5dp" | 188 | android:layout_margin="5dp" |
189 | android:checked="false" | 189 | android:checked="false" |
190 | android:padding="5dp" | 190 | android:padding="5dp" |
191 | android:text="@string/rbDeposito" | 191 | android:text="@string/rbDeposito" |
192 | android:textSize="@dimen/NormalText" /> | 192 | android:textSize="@dimen/NormalText" /> |
193 | 193 | ||
194 | </RadioGroup> | 194 | </RadioGroup> |
195 | 195 | ||
196 | <TextView | 196 | <TextView |
197 | android:id="@+id/tvLosProductos" | 197 | android:id="@+id/tvLosProductos" |
198 | android:layout_width="0dp" | 198 | android:layout_width="0dp" |
199 | android:layout_height="wrap_content" | 199 | android:layout_height="wrap_content" |
200 | 200 | ||
201 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 201 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
202 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" | 202 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" |
203 | android:gravity="start" | 203 | android:gravity="start" |
204 | android:lines="1" | 204 | android:lines="1" |
205 | android:text="@string/tvLosProductos" | 205 | android:text="@string/tvLosProductos" |
206 | android:textColor="@android:color/black" | 206 | android:textColor="@android:color/black" |
207 | android:textSize="@dimen/SubTitulos" | 207 | android:textSize="@dimen/SubTitulos" |
208 | app:fontFamily="sans-serif-condensed" | 208 | app:fontFamily="sans-serif-condensed" |
209 | app:layout_constraintEnd_toEndOf="parent" | 209 | app:layout_constraintEnd_toEndOf="parent" |
210 | app:layout_constraintStart_toStartOf="parent" | 210 | app:layout_constraintStart_toStartOf="parent" |
211 | app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> | 211 | app:layout_constraintTop_toBottomOf="@+id/rgFechaHora" /> |
212 | 212 | ||
213 | <RadioGroup | 213 | <RadioGroup |
214 | android:id="@+id/rgLosProductos" | 214 | android:id="@+id/rgLosProductos" |
215 | android:layout_width="0dp" | 215 | android:layout_width="0dp" |
216 | android:layout_height="wrap_content" | 216 | android:layout_height="wrap_content" |
217 | 217 | ||
218 | android:gravity="center" | 218 | android:gravity="center" |
219 | android:orientation="vertical" | 219 | android:orientation="vertical" |
220 | app:layout_constraintEnd_toEndOf="parent" | 220 | app:layout_constraintEnd_toEndOf="parent" |
221 | app:layout_constraintStart_toStartOf="parent" | 221 | app:layout_constraintStart_toStartOf="parent" |
222 | app:layout_constraintTop_toBottomOf="@+id/tvLosProductos"> | 222 | app:layout_constraintTop_toBottomOf="@+id/tvLosProductos"> |
223 | 223 | ||
224 | <RadioButton | 224 | <RadioButton |
225 | android:id="@+id/rbProInclu" | 225 | android:id="@+id/rbProInclu" |
226 | android:layout_width="match_parent" | 226 | android:layout_width="match_parent" |
227 | android:layout_height="wrap_content" | 227 | android:layout_height="wrap_content" |
228 | 228 | ||
229 | android:layout_margin="@dimen/PadingCbyRb" | 229 | android:layout_margin="@dimen/PadingCbyRb" |
230 | android:checked="true" | 230 | android:checked="true" |
231 | android:padding="@dimen/PadingCbyRb" | 231 | android:padding="@dimen/PadingCbyRb" |
232 | android:text="@string/rbProInclu" | 232 | android:text="@string/rbProInclu" |
233 | android:textSize="@dimen/NormalText" /> | 233 | android:textSize="@dimen/NormalText" /> |
234 | 234 | ||
235 | <RadioButton | 235 | <RadioButton |
236 | android:id="@+id/rbProNoInclu" | 236 | android:id="@+id/rbProNoInclu" |
237 | android:layout_width="match_parent" | 237 | android:layout_width="match_parent" |
238 | android:layout_height="wrap_content" | 238 | android:layout_height="wrap_content" |
239 | android:layout_margin="@dimen/PadingCbyRb" | 239 | android:layout_margin="@dimen/PadingCbyRb" |
240 | android:checked="false" | 240 | android:checked="false" |
241 | android:padding="@dimen/PadingCbyRb" | 241 | android:padding="@dimen/PadingCbyRb" |
242 | android:text="@string/rbProNoInclu" | 242 | android:text="@string/rbProNoInclu" |
243 | android:textSize="@dimen/NormalText" /> | 243 | android:textSize="@dimen/NormalText" /> |
244 | 244 | ||
245 | </RadioGroup> | 245 | </RadioGroup> |
246 | 246 | ||
247 | <CheckBox | 247 | <CheckBox |
248 | android:id="@+id/cbHabiLectura" | 248 | android:id="@+id/cbHabiLectura" |
249 | android:layout_width="0dp" | 249 | android:layout_width="0dp" |
250 | android:layout_height="wrap_content" | 250 | android:layout_height="wrap_content" |
251 | android:layout_margin="@dimen/PadingCbyRb" | 251 | android:layout_margin="@dimen/PadingCbyRb" |
252 | android:padding="@dimen/PadingCbyRb" | 252 | android:padding="@dimen/PadingCbyRb" |
253 | android:text="@string/cbHabiLectura" | 253 | android:text="@string/cbHabiLectura" |
254 | android:textSize="@dimen/NormalText" | 254 | android:textSize="@dimen/NormalText" |
255 | app:layout_constraintEnd_toEndOf="parent" | 255 | app:layout_constraintEnd_toEndOf="parent" |
256 | app:layout_constraintStart_toStartOf="parent" | 256 | app:layout_constraintStart_toStartOf="parent" |
257 | app:layout_constraintTop_toBottomOf="@+id/rgLosProductos" /> | 257 | app:layout_constraintTop_toBottomOf="@+id/rgLosProductos" /> |
258 | 258 | ||
259 | <CheckBox | 259 | <CheckBox |
260 | android:id="@+id/cbMostrarStock" | 260 | android:id="@+id/cbMostrarStock" |
261 | android:layout_width="0dp" | 261 | android:layout_width="0dp" |
262 | android:layout_height="wrap_content" | 262 | android:layout_height="wrap_content" |
263 | android:layout_margin="@dimen/PadingCbyRb" | 263 | android:layout_margin="@dimen/PadingCbyRb" |
264 | android:padding="@dimen/PadingCbyRb" | 264 | android:padding="@dimen/PadingCbyRb" |
265 | android:text="@string/cbMostrarStock" | 265 | android:text="@string/cbMostrarStock" |
266 | android:textSize="@dimen/NormalText" | 266 | android:textSize="@dimen/NormalText" |
267 | app:layout_constraintEnd_toEndOf="parent" | 267 | app:layout_constraintEnd_toEndOf="parent" |
268 | app:layout_constraintStart_toStartOf="parent" | 268 | app:layout_constraintStart_toStartOf="parent" |
269 | app:layout_constraintTop_toBottomOf="@+id/cbHabiLectura" /> | 269 | app:layout_constraintTop_toBottomOf="@+id/cbHabiLectura" /> |
270 | 270 | ||
271 | <TextView | 271 | <TextView |
272 | android:id="@+id/tvColumMostrar" | 272 | android:id="@+id/tvColumMostrar" |
273 | android:layout_width="0dp" | 273 | android:layout_width="0dp" |
274 | android:layout_height="wrap_content" | 274 | android:layout_height="wrap_content" |
275 | 275 | ||
276 | android:layout_marginStart="@dimen/MarginBotAgreSer" | 276 | android:layout_marginStart="@dimen/MarginBotAgreSer" |
277 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" | 277 | android:layout_marginEnd="@dimen/MarginTopSubTitulos" |
278 | android:gravity="start" | 278 | android:gravity="start" |
279 | android:lines="1" | 279 | android:lines="1" |
280 | android:text="@string/tvColumMostrar" | 280 | android:text="@string/tvColumMostrar" |
281 | android:textColor="@android:color/black" | 281 | android:textColor="@android:color/black" |
282 | android:textSize="@dimen/SubTitulos" | 282 | android:textSize="@dimen/SubTitulos" |
283 | app:fontFamily="sans-serif-condensed" | 283 | app:fontFamily="sans-serif-condensed" |
284 | app:layout_constraintEnd_toEndOf="parent" | 284 | app:layout_constraintEnd_toEndOf="parent" |
285 | app:layout_constraintStart_toStartOf="parent" | 285 | app:layout_constraintStart_toStartOf="parent" |
286 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarStock" /> | 286 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarStock" /> |
287 | 287 | ||
288 | <RadioGroup | 288 | <RadioGroup |
289 | android:id="@+id/rgCodigosMostrar" | 289 | android:id="@+id/rgCodigosMostrar" |
290 | android:layout_width="0dp" | 290 | android:layout_width="0dp" |
291 | android:layout_height="wrap_content" | 291 | android:layout_height="wrap_content" |
292 | 292 | ||
293 | android:gravity="center" | 293 | android:gravity="center" |
294 | android:orientation="horizontal" | 294 | android:orientation="horizontal" |
295 | app:layout_constraintEnd_toEndOf="parent" | 295 | app:layout_constraintEnd_toEndOf="parent" |
296 | app:layout_constraintStart_toStartOf="parent" | 296 | app:layout_constraintStart_toStartOf="parent" |
297 | app:layout_constraintTop_toBottomOf="@+id/tvColumMostrar"> | 297 | app:layout_constraintTop_toBottomOf="@+id/tvColumMostrar"> |
298 | 298 | ||
299 | <RadioButton | 299 | <RadioButton |
300 | android:id="@+id/rbCodigoDebo" | 300 | android:id="@+id/rbCodigoDebo" |
301 | android:layout_width="wrap_content" | 301 | android:layout_width="wrap_content" |
302 | android:layout_height="wrap_content" | 302 | android:layout_height="wrap_content" |
303 | android:layout_margin="5dp" | 303 | android:layout_margin="5dp" |
304 | android:checked="true" | 304 | android:checked="true" |
305 | android:padding="5dp" | 305 | android:padding="5dp" |
306 | android:text="@string/rbCodigoDebo" | 306 | android:text="@string/rbCodigoDebo" |
307 | android:textSize="@dimen/NormalText" /> | 307 | android:textSize="@dimen/NormalText" /> |
308 | 308 | ||
309 | <RadioButton | 309 | <RadioButton |
310 | android:id="@+id/rbCodigoOrigen" | 310 | android:id="@+id/rbCodigoOrigen" |
311 | android:layout_width="wrap_content" | 311 | android:layout_width="wrap_content" |
312 | android:layout_height="wrap_content" | 312 | android:layout_height="wrap_content" |
313 | android:layout_margin="5dp" | 313 | android:layout_margin="5dp" |
314 | android:checked="false" | 314 | android:checked="false" |
315 | android:padding="5dp" | 315 | android:padding="5dp" |
316 | android:text="@string/rbCodigoOrigen" | 316 | android:text="@string/rbCodigoOrigen" |
317 | android:textSize="@dimen/NormalText" /> | 317 | android:textSize="@dimen/NormalText" /> |
318 | 318 | ||
319 | <RadioButton | 319 | <RadioButton |
320 | android:id="@+id/rbCodigoBarras" | 320 | android:id="@+id/rbCodigoBarras" |
321 | android:layout_width="wrap_content" | 321 | android:layout_width="wrap_content" |
322 | android:layout_height="wrap_content" | 322 | android:layout_height="wrap_content" |
323 | android:layout_margin="5dp" | 323 | android:layout_margin="5dp" |
324 | android:padding="5dp" | 324 | android:padding="5dp" |
325 | android:text="@string/rbCodigoBarras" | 325 | android:text="@string/rbCodigoBarras" |
326 | android:textSize="@dimen/NormalText" /> | 326 | android:textSize="@dimen/NormalText" /> |
327 | </RadioGroup> | 327 | </RadioGroup> |
328 | 328 | ||
329 | <CheckBox | 329 | <CheckBox |
330 | android:id="@+id/cbMostrarExistencia" | 330 | android:id="@+id/cbMostrarExistencia" |
331 | android:layout_width="wrap_content" | 331 | android:layout_width="wrap_content" |
332 | android:layout_height="wrap_content" | 332 | android:layout_height="wrap_content" |
333 | android:layout_margin="@dimen/PadingCbyRb" | 333 | android:layout_margin="@dimen/PadingCbyRb" |
334 | android:padding="@dimen/PadingCbyRb" | 334 | android:padding="@dimen/PadingCbyRb" |
335 | android:text="@string/cbMostrarExistencia" | 335 | android:text="@string/cbMostrarExistencia" |
336 | android:textSize="@dimen/NormalText" | 336 | android:textSize="@dimen/NormalText" |
337 | android:checked="false" | 337 | android:checked="false" |
338 | app:layout_constraintEnd_toStartOf="@+id/cbMostrarPrecio" | 338 | app:layout_constraintEnd_toStartOf="@+id/cbMostrarPrecio" |
339 | app:layout_constraintStart_toStartOf="parent" | 339 | app:layout_constraintStart_toStartOf="parent" |
340 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> | 340 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> |
341 | 341 | ||
342 | <CheckBox | 342 | <CheckBox |
343 | android:id="@+id/cbMostrarPrecio" | 343 | android:id="@+id/cbMostrarPrecio" |
344 | android:layout_width="wrap_content" | 344 | android:layout_width="wrap_content" |
345 | android:layout_height="wrap_content" | 345 | android:layout_height="wrap_content" |
346 | android:layout_margin="@dimen/PadingCbyRb" | 346 | android:layout_margin="@dimen/PadingCbyRb" |
347 | android:padding="@dimen/PadingCbyRb" | 347 | android:padding="@dimen/PadingCbyRb" |
348 | android:text="@string/cbMostrarPrecio" | 348 | android:text="@string/cbMostrarPrecio" |
349 | android:textSize="@dimen/NormalText" | 349 | android:textSize="@dimen/NormalText" |
350 | android:checked="false" | 350 | android:checked="false" |
351 | app:layout_constraintEnd_toEndOf="parent" | 351 | app:layout_constraintEnd_toEndOf="parent" |
352 | app:layout_constraintStart_toEndOf="@+id/cbMostrarExistencia" | 352 | app:layout_constraintStart_toEndOf="@+id/cbMostrarExistencia" |
353 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> | 353 | app:layout_constraintTop_toBottomOf="@+id/rgCodigosMostrar" /> |
354 | 354 | ||
355 | <Button | 355 | <Button |
356 | android:id="@+id/btnGuardar" | 356 | android:id="@+id/btnGuardar" |
357 | android:layout_width="wrap_content" | 357 | android:layout_width="wrap_content" |
358 | android:layout_height="wrap_content" | 358 | android:layout_height="wrap_content" |
359 | android:text="@string/btnGuardar" | 359 | android:text="@string/btnGuardar" |
360 | android:textSize="@dimen/NormalText" | 360 | android:textSize="@dimen/NormalText" |
361 | app:layout_constraintEnd_toEndOf="parent" | 361 | app:layout_constraintEnd_toEndOf="parent" |
362 | android:textColor="@android:color/white" | 362 | android:textColor="@android:color/white" |
363 | android:padding="10dp" | 363 | android:padding="10dp" |
364 | android:background="@drawable/boton_borde_redondeado" | 364 | android:background="@drawable/boton_borde_redondeado" |
365 | app:layout_constraintStart_toStartOf="parent" | 365 | app:layout_constraintStart_toStartOf="parent" |
366 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarPrecio" /> | 366 | app:layout_constraintTop_toBottomOf="@+id/cbMostrarPrecio" /> |
367 | </androidx.constraintlayout.widget.ConstraintLayout> | 367 | </androidx.constraintlayout.widget.ConstraintLayout> |
368 | 368 |
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 | <fragment | 45 | <fragment |
46 | android:id="@+id/servidoresFragment" | 46 | android:id="@+id/servidoresFragment" |
47 | android:name="com.focasoftware.deboinventariov20.ui.servidores.ServidoresFragment" | 47 | android:name="com.focasoftware.deboinventariov20.ui.servidores.ServidoresFragment" |
48 | android:label="Alta Servidores" | 48 | android:label="Alta Servidores" |
49 | tools:layout="@layout/fragment_servidores"> | 49 | tools:layout="@layout/fragment_servidores"> |
50 | <action | 50 | <action |
51 | android:id="@+id/action_servidoresFragment_to_configuracionFragment" | 51 | android:id="@+id/action_servidoresFragment_to_configuracionFragment" |
52 | app:destination="@id/configuracionFragment" | 52 | app:destination="@id/configuracionFragment" |
53 | app:enterAnim="@anim/slide_in_right" | 53 | app:enterAnim="@anim/slide_in_right" |
54 | app:exitAnim="@anim/slide_out_left" | 54 | app:exitAnim="@anim/slide_out_left" |
55 | app:popEnterAnim="@anim/slide_in_left" | 55 | app:popEnterAnim="@anim/slide_in_left" |
56 | app:popExitAnim="@anim/slide_out_right" /> | 56 | app:popExitAnim="@anim/slide_out_right" /> |
57 | </fragment> | 57 | </fragment> |
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 | <action | 70 | <action |
71 | android:id="@+id/action_inventarioFragment_to_mainFragment2" | 71 | android:id="@+id/action_inventarioFragment_to_mainFragment2" |
72 | app:destination="@id/mainFragment2" | 72 | app:destination="@id/mainFragment2" |
73 | app:popEnterAnim="@anim/slide_in_left" | 73 | app:popEnterAnim="@anim/slide_in_left" |
74 | app:popExitAnim="@anim/slide_out_right" | 74 | app:popExitAnim="@anim/slide_out_right" |
75 | app:enterAnim="@anim/slide_in_right" | 75 | app:enterAnim="@anim/slide_in_right" |
76 | app:exitAnim="@anim/slide_out_left"/> | 76 | app:exitAnim="@anim/slide_out_left"/> |
77 | <action | 77 | <action |
78 | android:id="@+id/action_inventarioFragment_to_detalleArtFragment" | 78 | android:id="@+id/action_inventarioFragment_to_detalleArtFragment" |
79 | app:destination="@id/detalleArtFragment" /> | 79 | app:destination="@id/detalleArtFragment" /> |
80 | 80 | ||
81 | </fragment> | 81 | </fragment> |
82 | <fragment | 82 | <fragment |
83 | android:id="@+id/configuracionFragment" | 83 | android:id="@+id/configuracionFragment" |
84 | android:name="com.focasoftware.deboinventariov20.ui.configuracion.ConfiguracionFragment" | 84 | android:name="com.focasoftware.deboinventariov20.ui.configuracion.ConfiguracionFragment" |
85 | android:label="Configuraciones" | 85 | android:label="Configuraciones" |
86 | tools:layout="@layout/fragment_configuracion" > | 86 | tools:layout="@layout/fragment_configuracion" > |
87 | <action | 87 | <action |
88 | android:id="@+id/action_configuracionFragment_to_servidoresFragment" | 88 | android:id="@+id/action_configuracionFragment_to_servidoresFragment" |
89 | app:destination="@id/servidoresFragment" | 89 | app:destination="@id/servidoresFragment" |
90 | app:popEnterAnim="@anim/slide_in_left" | 90 | app:popEnterAnim="@anim/slide_in_left" |
91 | app:popExitAnim="@anim/slide_out_right" | 91 | app:popExitAnim="@anim/slide_out_right" |
92 | app:enterAnim="@anim/slide_in_right" | 92 | app:enterAnim="@anim/slide_in_right" |
93 | app:exitAnim="@anim/slide_out_left" /> | 93 | app:exitAnim="@anim/slide_out_left" /> |
94 | <action | ||
95 | android:id="@+id/action_configuracionFragment_to_mainFragment2" | ||
96 | app:destination="@id/mainFragment2" /> | ||
94 | </fragment> | 97 | </fragment> |
95 | <fragment | 98 | <fragment |
96 | android:id="@+id/descripcionFragment" | 99 | android:id="@+id/descripcionFragment" |
97 | android:name="com.focasoftware.deboinventariov20.ui.descripcionFragment.DescripcionFragment" | 100 | android:name="com.focasoftware.deboinventariov20.ui.descripcionFragment.DescripcionFragment" |
98 | android:label="Productos Encontrados"> | 101 | android:label="Productos Encontrados"> |
99 | 102 | ||
100 | <action | 103 | <action |
101 | android:id="@+id/action_descripcionFragment_to_inventarioFragment" | 104 | android:id="@+id/action_descripcionFragment_to_inventarioFragment" |
102 | app:destination="@id/inventarioFragment" | 105 | app:destination="@id/inventarioFragment" |
103 | app:popEnterAnim="@anim/slide_in_left" | 106 | app:popEnterAnim="@anim/slide_in_left" |
104 | app:popExitAnim="@anim/slide_out_right" | 107 | app:popExitAnim="@anim/slide_out_right" |
105 | app:enterAnim="@anim/slide_in_right" | 108 | app:enterAnim="@anim/slide_in_right" |
106 | app:exitAnim="@anim/slide_out_left" | 109 | app:exitAnim="@anim/slide_out_left" |
107 | app:popUpTo="@+id/descripcionFragment" | 110 | app:popUpTo="@+id/descripcionFragment" |
108 | app:popUpToInclusive="true"/> | 111 | app:popUpToInclusive="true"/> |
109 | </fragment> | 112 | </fragment> |
110 | <dialog | 113 | <dialog |
111 | android:id="@+id/dialogNoEncontrado" | 114 | android:id="@+id/dialogNoEncontrado" |
112 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.DialogNoEncontrado" | 115 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.DialogNoEncontrado" |
113 | android:label="DialogNoEncontrado" /> | 116 | android:label="DialogNoEncontrado" /> |
114 | <fragment | 117 | <fragment |
115 | android:id="@+id/dialogoLogin" | 118 | android:id="@+id/dialogoLogin" |
116 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.dialogoLogin" | 119 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.dialogoLogin" |
117 | android:label="dialogoLogin" /> | 120 | android:label="dialogoLogin" /> |
118 | <fragment | 121 | <fragment |
119 | android:id="@+id/singleChoiceAlertDialog" | 122 | android:id="@+id/singleChoiceAlertDialog" |
120 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.SingleChoiceAlertDialog" | 123 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.SingleChoiceAlertDialog" |
121 | android:label="SingleChoiceAlertDialog" /> | 124 | android:label="SingleChoiceAlertDialog" /> |
122 | <fragment | 125 | <fragment |
123 | android:id="@+id/detalleArtFragment" | 126 | android:id="@+id/detalleArtFragment" |
124 | android:name="com.focasoftware.deboinventariov20.ui.detalleProducto.DetalleArtFragment" | 127 | android:name="com.focasoftware.deboinventariov20.ui.detalleProducto.DetalleArtFragment" |
125 | android:label="Detalle Articulo" | 128 | android:label="Detalle Articulo" |
126 | tools:layout="@layout/fragment_detalle_art"> | 129 | tools:layout="@layout/fragment_detalle_art"> |
127 | <action | 130 | <action |
128 | android:id="@+id/action_detalleArtFragment_to_inventarioFragment" | 131 | android:id="@+id/action_detalleArtFragment_to_inventarioFragment" |
129 | app:destination="@id/inventarioFragment" /> | 132 | app:destination="@id/inventarioFragment" /> |
130 | </fragment> | 133 | </fragment> |
131 | </navigation> | 134 | </navigation> |