Commit a0d8dd74dd0d924dbcc9e0a269fb346485ef05f8
1 parent
15c37e974e
Exists in
master
01092020 0128
Showing
10 changed files
with
98 additions
and
112 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 ServeInv") | 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 ServeInv WHERE SER_NUM = :number") | 83 | @Query("DELETE FROM $TABLA_SERV_INV WHERE SER_DESC LIKE :description AND SER_DIR LIKE :dir") |
84 | suspend fun deleteServer(number: Long) | 84 | suspend fun deleteServer(description: String, dir: String) |
85 | 85 | ||
86 | @Query("SELECT SER_NUM FROM ServeInv ORDER BY SER_NUM DESC") | 86 | @Query("SELECT SER_NUM FROM $TABLA_SERV_INV ORDER BY SER_NUM DESC") |
87 | suspend fun findLastSer(): Long | 87 | suspend fun findLastServer(): Int |
88 | |||
89 | @Query("UPDATE $TABLA_SERV_INV SET SER_PRE=0") | ||
90 | suspend fun UpdateServerPreInZero() | ||
91 | |||
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) | ||
88 | } | 94 | } |
app/src/main/java/com/focasoftware/deboinventariov20/Model/Tablas.kt
1 | package com.focasoftware.deboinventariov20.Model | 1 | package com.focasoftware.deboinventariov20.Model |
2 | 2 | ||
3 | import androidx.room.ColumnInfo | 3 | import androidx.room.ColumnInfo |
4 | import androidx.room.Entity | 4 | import androidx.room.Entity |
5 | import androidx.room.PrimaryKey | 5 | import androidx.room.PrimaryKey |
6 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_ART | 6 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_ART |
7 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_B | 7 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_B |
8 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_H | 8 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_INV_H |
9 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_SERV_INV | 9 | import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Companion.TABLA_SERV_INV |
10 | import com.google.gson.annotations.SerializedName | 10 | import com.google.gson.annotations.SerializedName |
11 | import java.io.Serializable | 11 | import java.io.Serializable |
12 | 12 | ||
13 | data class Productos(@SerializedName("SEC") var sector: String?, | 13 | data class Productos(@SerializedName("SEC") var sector: String?, |
14 | @SerializedName("COD") var codigo: String?, | 14 | @SerializedName("COD") var codigo: String?, |
15 | @SerializedName("DESC") var descripcion: String?, | 15 | @SerializedName("DESC") var descripcion: String?, |
16 | @SerializedName("CB") var codBar: String?, | 16 | @SerializedName("CB") var codBar: String?, |
17 | @SerializedName("CBC") var codOrigen: String?, | 17 | @SerializedName("CBC") var codOrigen: String?, |
18 | @SerializedName("PRE_VTA") var precio: String?, | 18 | @SerializedName("PRE_VTA") var precio: String?, |
19 | @SerializedName("PRE_COS") var costo: String?, | 19 | @SerializedName("PRE_COS") var costo: String?, |
20 | @SerializedName( "EV") var exiVenta: String?, | 20 | @SerializedName( "EV") var exiVenta: String?, |
21 | @SerializedName( "ED") var exiDeposito: String?, | 21 | @SerializedName( "ED") var exiDeposito: String?, |
22 | @SerializedName( "DE") var de: String?, | 22 | @SerializedName( "DE") var de: String?, |
23 | @SerializedName( "BAL") var balanza: Int?, | 23 | @SerializedName( "BAL") var balanza: Int?, |
24 | @SerializedName("DEPSN") var depSn: Int?, | 24 | @SerializedName("DEPSN") var depSn: Int?, |
25 | @SerializedName("FOTO") var imagen: String?) | 25 | @SerializedName("FOTO") var imagen: String?) |
26 | 26 | ||
27 | @Entity(tableName = TABLA_ART) | 27 | @Entity(tableName = TABLA_ART) |
28 | data class Articles(@ColumnInfo(name = "SEC") var sector: String?, | 28 | data class Articles(@ColumnInfo(name = "SEC") var sector: String?, |
29 | @ColumnInfo(name = "COD") var codigo: String?, | 29 | @ColumnInfo(name = "COD") var codigo: String?, |
30 | @ColumnInfo(name = "DES") var descripcion: String?, | 30 | @ColumnInfo(name = "DES") var descripcion: String?, |
31 | @ColumnInfo(name = "CB") var codBar: String?, | 31 | @ColumnInfo(name = "CB") var codBar: String?, |
32 | @ColumnInfo(name = "CBC") var codOrigen: String?, | 32 | @ColumnInfo(name = "CBC") var codOrigen: String?, |
33 | @ColumnInfo(name = "PRE_VTA") var precio: String?, | 33 | @ColumnInfo(name = "PRE_VTA") var precio: String?, |
34 | @ColumnInfo(name = "PRE_COS") var costo: String?, | 34 | @ColumnInfo(name = "PRE_COS") var costo: String?, |
35 | @ColumnInfo(name = "EV") var exiVenta: String?, | 35 | @ColumnInfo(name = "EV") var exiVenta: String?, |
36 | @ColumnInfo(name = "ED") var exiDeposito: String?, | 36 | @ColumnInfo(name = "ED") var exiDeposito: String?, |
37 | @ColumnInfo(name = "DE") var de: String?, | 37 | @ColumnInfo(name = "DE") var de: String?, |
38 | @ColumnInfo(name = "BAL") var balanza: Int?, | 38 | @ColumnInfo(name = "BAL") var balanza: Int?, |
39 | @ColumnInfo(name = "DEPSN") var depSn: Int?, | 39 | @ColumnInfo(name = "DEPSN") var depSn: Int?, |
40 | @ColumnInfo(name = "FOTO") var imagen: String?) : Serializable { | 40 | @ColumnInfo(name = "FOTO") var imagen: String?) : Serializable { |
41 | @PrimaryKey(autoGenerate = true) | 41 | @PrimaryKey(autoGenerate = true) |
42 | @ColumnInfo(name = "id") | 42 | @ColumnInfo(name = "id") |
43 | var id: Long = 0 | 43 | var id: Long = 0 |
44 | } | 44 | } |
45 | 45 | ||
46 | 46 | ||
47 | @Entity(tableName = TABLA_INV_H) | 47 | @Entity(tableName = TABLA_INV_H) |
48 | data class InvHead(@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "INV_NUM") var invNum: Int, | 48 | data class InvHead(@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "INV_NUM") var invNum: Int, |
49 | @ColumnInfo(name = "INV_DESC") var descripcion: String?, | 49 | @ColumnInfo(name = "INV_DESC") var descripcion: String?, |
50 | @ColumnInfo(name = "ESTADO") var estado: Int?, | 50 | @ColumnInfo(name = "ESTADO") var estado: Int?, |
51 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, | 51 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, |
52 | @ColumnInfo(name = "INV_FEF") var fechaFinal: String?, | 52 | @ColumnInfo(name = "INV_FEF") var fechaFinal: String?, |
53 | // productos contados en el inventario | 53 | // productos contados en el inventario |
54 | @ColumnInfo(name = "INV_PRODCONT") var prodContados: Long?, | 54 | @ColumnInfo(name = "INV_PRODCONT") var prodContados: Long?, |
55 | @ColumnInfo(name = "INV_LUG") var lugar: Int?, | 55 | @ColumnInfo(name = "INV_LUG") var lugar: Int?, |
56 | // Solo se ajustan los productos incluidos en el conteo=0 | 56 | // Solo se ajustan los productos incluidos en el conteo=0 |
57 | // Ajusta productos no incluidos en el conteo con stock en cero=1 | 57 | // Ajusta productos no incluidos en el conteo con stock en cero=1 |
58 | @ColumnInfo(name = "PRO_NO_CONTA") var stDesc: Int?, | 58 | @ColumnInfo(name = "PRO_NO_CONTA") var stDesc: Int?, |
59 | // Mostror stock en el sistema al momento de la descarga del maestro. | 59 | // Mostror stock en el sistema al momento de la descarga del maestro. |
60 | @ColumnInfo(name = "MOSTRAR_STOCK") var proNoCont: Int?) | 60 | @ColumnInfo(name = "MOSTRAR_STOCK") var proNoCont: Int?) |
61 | 61 | ||
62 | 62 | ||
63 | @Entity(tableName = TABLA_INV_B) | 63 | @Entity(tableName = TABLA_INV_B) |
64 | data class InvBody(@ColumnInfo(name = "INV_NUM") var invNum: Int, | 64 | data class InvBody(@ColumnInfo(name = "INV_NUM") var invNum: Int, |
65 | @ColumnInfo(name = "SEC") var sector: String?, | 65 | @ColumnInfo(name = "SEC") var sector: String?, |
66 | @ColumnInfo(name = "COD") var codigo: String?, | 66 | @ColumnInfo(name = "COD") var codigo: String?, |
67 | @ColumnInfo(name = "DES") var descripcion: String?, | 67 | @ColumnInfo(name = "DES") var descripcion: String?, |
68 | @ColumnInfo(name = "CANT") var cantTomada: String?, | 68 | @ColumnInfo(name = "CANT") var cantTomada: String?, |
69 | @ColumnInfo(name = "CB") var codBar: String?, | 69 | @ColumnInfo(name = "CB") var codBar: String?, |
70 | @ColumnInfo(name = "CBC") var codOrigen: String?, | 70 | @ColumnInfo(name = "CBC") var codOrigen: String?, |
71 | @ColumnInfo(name = "PRE_VTA") var precio: String?, | 71 | @ColumnInfo(name = "PRE_VTA") var precio: String?, |
72 | @ColumnInfo(name = "PRE_COS") var costo: String?, | 72 | @ColumnInfo(name = "PRE_COS") var costo: String?, |
73 | @ColumnInfo(name = "BAL") var balanza: Int?, | 73 | @ColumnInfo(name = "BAL") var balanza: Int?, |
74 | @ColumnInfo(name = "DSN") var depSn: Int?, | 74 | @ColumnInfo(name = "DSN") var depSn: Int?, |
75 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, | 75 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, |
76 | @ColumnInfo(name = "INV_FEF") var fechaFinal: String?) : Serializable { | 76 | @ColumnInfo(name = "INV_FEF") var fechaFinal: String?) : Serializable { |
77 | @PrimaryKey(autoGenerate = true) | 77 | @PrimaryKey(autoGenerate = true) |
78 | @ColumnInfo(name = "id") | 78 | @ColumnInfo(name = "id") |
79 | var id: Long = 0 | 79 | var id: Long = 0 |
80 | } | 80 | } |
81 | 81 | ||
82 | @Entity(tableName = TABLA_SERV_INV) | 82 | @Entity(tableName = TABLA_SERV_INV) |
83 | data class ServeInv( | 83 | data class ServeInv( |
84 | |||
85 | @PrimaryKey(autoGenerate = true) @ColumnInfo(name = "SER_NUM") var SER_NUM: Long, | ||
86 | @ColumnInfo(name = "SER_DESC") var descripcion: String?, | 84 | @ColumnInfo(name = "SER_DESC") var descripcion: String?, |
87 | @ColumnInfo(name = "SER_DIR") var direccion: String?, | 85 | @ColumnInfo(name = "SER_DIR") var direccion: String?, |
88 | @ColumnInfo(name = "SER_PRE") var predeterminado: String?) | 86 | @ColumnInfo(name = "SER_PRE") var predeterminado: String?): |
87 | Serializable { @PrimaryKey(autoGenerate = true) | ||
88 | @ColumnInfo(name = "SER_NUM") | ||
89 | var servNum: Int=0 | ||
90 | } | ||
89 | 91 |
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.R | 13 | import com.focasoftware.deboinventariov20.R |
14 | import kotlinx.android.synthetic.main.fragment_actua_maestros.* | 14 | import kotlinx.android.synthetic.main.fragment_actua_maestros.* |
15 | import kotlinx.coroutines.* | 15 | import kotlinx.coroutines.* |
16 | 16 | ||
17 | class ActuaMaestrosFragment : Fragment() { | 17 | class ActuaMaestrosFragment : Fragment() { |
18 | 18 | ||
19 | var job: Job? = null | 19 | var job: Job? = null |
20 | 20 | ||
21 | 21 | ||
22 | override fun onCreate(savedInstanceState: Bundle?) { | 22 | override fun onCreate(savedInstanceState: Bundle?) { |
23 | super.onCreate(savedInstanceState) | 23 | super.onCreate(savedInstanceState) |
24 | 24 | ||
25 | 25 | ||
26 | //mostrarArticulos() | 26 | //mostrarArticulos() |
27 | } | 27 | } |
28 | 28 | ||
29 | 29 | ||
30 | override fun onCreateView( | 30 | override fun onCreateView( |
31 | inflater: LayoutInflater, container: ViewGroup?, | 31 | inflater: LayoutInflater, container: ViewGroup?, |
32 | savedInstanceState: Bundle? | 32 | savedInstanceState: Bundle? |
33 | ): View? { | 33 | ): View? { |
34 | // Inflate the layout for this fragment | 34 | // Inflate the layout for this fragment |
35 | val v = inflater.inflate(R.layout.fragment_actua_maestros, container, false) | 35 | val v = inflater.inflate(R.layout.fragment_actua_maestros, container, false) |
36 | val bConfirmarAct = v.findViewById<Button>(R.id.btnConfirmarAct) | 36 | val bConfirmarAct = v.findViewById<Button>(R.id.btnConfirmarAct) |
37 | bConfirmarAct.setOnClickListener { | 37 | bConfirmarAct.setOnClickListener { |
38 | loading_view.visibility = View.VISIBLE | 38 | loading_view.visibility = View.VISIBLE |
39 | countriesList.text = "Obteniendo Maestros Aguarde,por favor." | 39 | countriesList.text = "Obteniendo Maestros de artículos, aguarde por favor." |
40 | obtenerArticulos() | 40 | obtenerArticulos() |
41 | } | 41 | } |
42 | return v | 42 | return v |
43 | } | 43 | } |
44 | 44 | ||
45 | 45 | ||
46 | private fun obtenerArticulos() { | 46 | private fun obtenerArticulos() { |
47 | 47 | ||
48 | val productosService = ProductosService.getProductosService() | 48 | val productosService = ProductosService.getProductosService() |
49 | var index: Long = 1 | 49 | var index: Long = 1 |
50 | job = CoroutineScope(Dispatchers.IO).launch { | 50 | job = CoroutineScope(Dispatchers.IO).launch { |
51 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | 51 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! |
52 | .deleteAllArticulos() | 52 | .deleteAllArticulos() |
53 | val response = productosService.getProductos() | 53 | val response = productosService.getProductos() |
54 | if (response.isSuccessful) { | 54 | if (response.isSuccessful) { |
55 | for (pro in response.body()!!) { | 55 | for (pro in response.body()!!) { |
56 | val artiAcargar = Articles( | 56 | val artiAcargar = Articles( |
57 | pro.sector, | 57 | pro.sector, |
58 | pro.codigo, | 58 | pro.codigo, |
59 | pro.descripcion, | 59 | pro.descripcion, |
60 | pro.codBar, | 60 | pro.codBar, |
61 | pro.codOrigen, | 61 | pro.codOrigen, |
62 | pro.precio, | 62 | pro.precio, |
63 | pro.costo, | 63 | pro.costo, |
64 | pro.exiVenta, | 64 | pro.exiVenta, |
65 | pro.exiDeposito, | 65 | pro.exiDeposito, |
66 | pro.de, | 66 | pro.de, |
67 | pro.balanza, | 67 | pro.balanza, |
68 | pro.depSn, | 68 | pro.depSn, |
69 | pro.imagen | 69 | pro.imagen |
70 | ) | 70 | ) |
71 | index += index | 71 | index += index |
72 | 72 | ||
73 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | 73 | AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! |
74 | .insertArticulos(artiAcargar) | 74 | .insertArticulos(artiAcargar) |
75 | } | 75 | } |
76 | withContext(Dispatchers.Main) { | 76 | withContext(Dispatchers.Main) { |
77 | countriesList.visibility = View.VISIBLE | 77 | countriesList.visibility = View.VISIBLE |
78 | countriesList.text = "¡Datos Importados Correctamente!" | 78 | countriesList.text = "¡Datos Importados Correctamente!" |
79 | loading_view.visibility = View.GONE | 79 | loading_view.visibility = View.GONE |
80 | } | 80 | } |
81 | // | 81 | // |
82 | } else { | 82 | } else { |
83 | countriesList.text = "Error: ${response.message()}" | 83 | countriesList.text = "Error: ${response.message()}" |
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | // withContext(Dispatchers.Main) { | 87 | // withContext(Dispatchers.Main) { |
88 | // if (response.isSuccessful) { | 88 | // if (response.isSuccessful) { |
89 | // val call = WebService | 89 | // val call = WebService |
90 | // .instance | 90 | // .instance |
91 | // ?.createService(WebServiceApi::class.java) | 91 | // ?.createService(WebServiceApi::class.java) |
92 | // ?.articulos | 92 | // ?.articulos |
93 | // call?.enqueue(object : Callback<List<productos?>?> { | 93 | // call?.enqueue(object : Callback<List<productos?>?> { |
94 | // override fun onResponse( | 94 | // override fun onResponse( |
95 | // call: Call<List<productos?>?>, | 95 | // call: Call<List<productos?>?>, |
96 | // response: Response<List<productos?>?> | 96 | // response: Response<List<productos?>?> |
97 | // ) { | 97 | // ) { |
98 | // if (response.code() == 200) { | 98 | // if (response.code() == 200) { |
99 | // for (i in response.body()!!.indices) { | 99 | // for (i in response.body()!!.indices) { |
100 | // //AppDb.getAppDb(requireActivity())!!.ArticulosDAO()?.insertArticulos(response.body()!![i]) | 100 | // //AppDb.getAppDb(requireActivity())!!.ArticulosDAO()?.insertArticulos(response.body()!![i]) |
101 | // cargarArticulos(2, 500, "sfas", "66666","2,2", "2,2", false, false, "") | 101 | // cargarArticulos(2, 500, "sfas", "66666","2,2", "2,2", false, false, "") |
102 | //// Log.d( | 102 | //// Log.d( |
103 | //// "TAG1", "Nombre Curso: " + response.body()!![i]?.sector | 103 | //// "TAG1", "Nombre Curso: " + response.body()!![i]?.sector |
104 | //// + "Codigo Profesor: " + response.body()!![i]?.descripcion | 104 | //// + "Codigo Profesor: " + response.body()!![i]?.descripcion |
105 | //// ) | 105 | //// ) |
106 | // mostrarArticulos() | 106 | // mostrarArticulos() |
107 | // } | 107 | // } |
108 | // } else if (response.code() == 404) { | 108 | // } else if (response.code() == 404) { |
109 | // Log.d("TAG1", "No hay cursos") | 109 | // Log.d("TAG1", "No hay cursos") |
110 | // } | 110 | // } |
111 | // | 111 | // |
112 | // } | 112 | // } |
113 | // | 113 | // |
114 | // override fun onFailure(call: Call<List<productos?>?>, t: Throwable) {} | 114 | // override fun onFailure(call: Call<List<productos?>?>, t: Throwable) {} |
115 | // }) | 115 | // }) |
116 | } | 116 | } |
117 | 117 | ||
118 | fun mostrarArticulos() { | 118 | fun mostrarArticulos() { |
119 | val Job = GlobalScope.launch { | 119 | val Job = GlobalScope.launch { |
120 | var listArticulos: List<Articles>? = null | 120 | var listArticulos: List<Articles>? = null |
121 | var temp: String = "" | 121 | var temp: String = "" |
122 | listArticulos = | 122 | listArticulos = |
123 | AppDb.getAppDb(requireActivity())?.ArticulosDAO()?.findAllArticulos() | 123 | AppDb.getAppDb(requireActivity())?.ArticulosDAO()?.findAllArticulos() |
124 | if (listArticulos != null) { | 124 | if (listArticulos != null) { |
125 | 125 | ||
126 | for (i in listArticulos.indices) | 126 | for (i in listArticulos.indices) |
127 | temp += listArticulos[i].codigo.toString() | 127 | temp += listArticulos[i].codigo.toString() |
128 | } | 128 | } |
129 | withContext(Dispatchers.Main) { | 129 | withContext(Dispatchers.Main) { |
130 | countriesList.visibility = View.VISIBLE | 130 | countriesList.visibility = View.VISIBLE |
131 | loading_view.visibility = View.GONE | 131 | loading_view.visibility = View.GONE |
132 | countriesList?.text = temp | 132 | countriesList?.text = temp |
133 | } | 133 | } |
134 | } | 134 | } |
135 | // for (professor in listArticulos!!) { | 135 | // for (professor in listArticulos!!) { |
136 | // editT.text= professor.id.toString() | 136 | // editT.text= professor.id.toString() |
137 | // } | 137 | // } |
138 | } | 138 | } |
139 | 139 | ||
140 | 140 | ||
141 | // fun observeViewModel() { | 141 | // fun observeViewModel() { |
142 | // | 142 | // |
143 | // val productosService = ProductosService.getProductosService() | 143 | // val productosService = ProductosService.getProductosService() |
144 | // var job: Job? = null | 144 | // var job: Job? = null |
145 | // | 145 | // |
146 | // | 146 | // |
147 | // //countriesList.text="Procesando..." | 147 | // //countriesList.text="Procesando..." |
148 | // //countriesList.visibility = View.VISIBLE | 148 | // //countriesList.visibility = View.VISIBLE |
149 | // // GlobalScope1.launch(Dispatchers.IO) { | 149 | // // GlobalScope1.launch(Dispatchers.IO) { |
150 | // val response = productosService.getProductos() | 150 | // val response = productosService.getProductos() |
151 | // if (response.isSuccessful) { | 151 | // if (response.isSuccessful) { |
152 | //// countriesList.layoutManager = LinearLayoutManager(context) | 152 | //// countriesList.layoutManager = LinearLayoutManager(context) |
153 | //// countriesList.itemAnimator = DefaultItemAnimator() | 153 | //// countriesList.itemAnimator = DefaultItemAnimator() |
154 | // | 154 | // |
155 | //// ProductAdapter.updateCountries(it) | 155 | //// ProductAdapter.updateCountries(it) |
156 | // // cargarArticulos(response.body()) | 156 | // // cargarArticulos(response.body()) |
157 | // | 157 | // |
158 | // | 158 | // |
159 | // val artiAcargar: Articulos? = null | 159 | // val artiAcargar: Articulos? = null |
160 | // var index: Long = 1 | 160 | // var index: Long = 1 |
161 | // | 161 | // |
162 | // for (pro in response.body()!!) { | 162 | // for (pro in response.body()!!) { |
163 | // //artiAcargar.id =index+1 | 163 | // //artiAcargar.id =index+1 |
164 | // artiAcargar!!.sector = pro.sector | 164 | // artiAcargar!!.sector = pro.sector |
165 | // artiAcargar.codigo = pro.codigo | 165 | // artiAcargar.codigo = pro.codigo |
166 | // artiAcargar.descripcion = pro.descripcion | 166 | // artiAcargar.descripcion = pro.descripcion |
167 | // artiAcargar.codBar = pro.codBar | 167 | // artiAcargar.codBar = pro.codBar |
168 | // artiAcargar.precio = pro.precio | 168 | // artiAcargar.precio = pro.precio |
169 | // artiAcargar.costo = pro.costo | 169 | // artiAcargar.costo = pro.costo |
170 | // artiAcargar.balanza = pro.balanza | 170 | // artiAcargar.balanza = pro.balanza |
171 | // artiAcargar.depSn = pro.depSn | 171 | // artiAcargar.depSn = pro.depSn |
172 | // artiAcargar.imagen = pro.imagen | 172 | // artiAcargar.imagen = pro.imagen |
173 | // index += index | 173 | // index += index |
174 | // | 174 | // |
175 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | 175 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! |
176 | // .insertArticulos(artiAcargar) | 176 | // .insertArticulos(artiAcargar) |
177 | // } | 177 | // } |
178 | // } | 178 | // } |
179 | // // } | 179 | // // } |
180 | // | 180 | // |
181 | // //job.cancel() | 181 | // //job.cancel() |
182 | // | 182 | // |
183 | // | 183 | // |
184 | // } | 184 | // } |
185 | 185 | ||
186 | // fun cargarArticulos(Productos: List<Productos>?) { | 186 | // fun cargarArticulos(Productos: List<Productos>?) { |
187 | // val artiAcargar: Articulos? = null | 187 | // val artiAcargar: Articulos? = null |
188 | // var index: Long = 1 | 188 | // var index: Long = 1 |
189 | // //val job4 = CoroutineScope(Dispatchers.Default).launch { | 189 | // //val job4 = CoroutineScope(Dispatchers.Default).launch { |
190 | // for (pro in Productos!!) { | 190 | // for (pro in Productos!!) { |
191 | // //artiAcargar.id =index+1 | 191 | // //artiAcargar.id =index+1 |
192 | // artiAcargar!!.sector = pro.sector | 192 | // artiAcargar!!.sector = pro.sector |
193 | // artiAcargar.codigo = pro.codigo | 193 | // artiAcargar.codigo = pro.codigo |
194 | // artiAcargar.descripcion = pro.descripcion | 194 | // artiAcargar.descripcion = pro.descripcion |
195 | // artiAcargar.codBar = pro.codBar | 195 | // artiAcargar.codBar = pro.codBar |
196 | // artiAcargar.precio = pro.precio | 196 | // artiAcargar.precio = pro.precio |
197 | // artiAcargar.costo = pro.costo | 197 | // artiAcargar.costo = pro.costo |
198 | // artiAcargar.balanza = pro.balanza | 198 | // artiAcargar.balanza = pro.balanza |
199 | // artiAcargar.depSn = pro.depSn | 199 | // artiAcargar.depSn = pro.depSn |
200 | // artiAcargar.imagen = pro.imagen | 200 | // artiAcargar.imagen = pro.imagen |
201 | // index += index | 201 | // index += index |
202 | // | 202 | // |
203 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! | 203 | // AppDb.getAppDb(requireActivity())!!.ArticulosDAO()!! |
204 | // .insertArticulos(artiAcargar) | 204 | // .insertArticulos(artiAcargar) |
205 | // } | 205 | // } |
206 | // } | 206 | // } |
207 | } | 207 | } |
208 | 208 | ||
209 | 209 |
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 androidx.fragment.app.Fragment | ||
7 | import android.view.LayoutInflater | 6 | import android.view.LayoutInflater |
8 | import android.view.View | 7 | import android.view.View |
9 | import android.view.ViewGroup | 8 | import android.view.ViewGroup |
10 | import android.widget.* | 9 | import android.widget.* |
10 | import androidx.fragment.app.Fragment | ||
11 | import androidx.navigation.fragment.findNavController | 11 | import androidx.navigation.fragment.findNavController |
12 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | ||
13 | import com.focasoftware.deboinventariov20.Model.ServeInv | ||
12 | import com.focasoftware.deboinventariov20.R | 14 | import com.focasoftware.deboinventariov20.R |
13 | import kotlinx.android.synthetic.main.fragment_configuracion.* | 15 | import kotlinx.android.synthetic.main.fragment_configuracion.* |
16 | import kotlinx.coroutines.Dispatchers | ||
17 | import kotlinx.coroutines.GlobalScope | ||
18 | import kotlinx.coroutines.async | ||
19 | import kotlinx.coroutines.launch | ||
14 | 20 | ||
15 | class ConfiguracionFragment : Fragment() { | 21 | class ConfiguracionFragment : Fragment() { |
16 | 22 | ||
17 | lateinit var sharedPreferences: SharedPreferences | 23 | lateinit var sharedPreferences: SharedPreferences |
18 | 24 | ||
19 | override fun onCreate(savedInstanceState: Bundle?) { | 25 | override fun onCreate(savedInstanceState: Bundle?) { |
20 | super.onCreate(savedInstanceState) | 26 | super.onCreate(savedInstanceState) |
21 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 27 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
22 | } | 28 | } |
23 | 29 | ||
24 | override fun onCreateView( | 30 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
25 | inflater: LayoutInflater, container: ViewGroup?, | ||
26 | savedInstanceState: Bundle? | ||
27 | ): View? { | ||
28 | val v = inflater.inflate(R.layout.fragment_configuracion, container, false) | 31 | val v = inflater.inflate(R.layout.fragment_configuracion, container, false) |
29 | 32 | ||
30 | val etRuta = v.findViewById<EditText>(R.id.etRuta) | 33 | val etRuta = v.findViewById<EditText>(R.id.etRuta) |
31 | val btnGuardar = v.findViewById<Button>(R.id.btnGuardar) | 34 | val btnGuardar = v.findViewById<Button>(R.id.btnGuardar) |
32 | val rbProInclu = v.findViewById<RadioButton>(R.id.rbProInclu) | 35 | val rbProInclu = v.findViewById<RadioButton>(R.id.rbProInclu) |
33 | val rbProNoInclu = v.findViewById<RadioButton>(R.id.rbProNoInclu) | 36 | val rbProNoInclu = v.findViewById<RadioButton>(R.id.rbProNoInclu) |
34 | val cbHabiLectura = v.findViewById<CheckBox>(R.id.cbHabiLectura) | 37 | val cbHabiLectura = v.findViewById<CheckBox>(R.id.cbHabiLectura) |
35 | val cbMostrarStock = v.findViewById<CheckBox>(R.id.cbMostrarStock) | 38 | val cbMostrarStock = v.findViewById<CheckBox>(R.id.cbMostrarStock) |
36 | val rbCodigoBarras = v.findViewById<RadioButton>(R.id.rbCodigoBarras) | 39 | val rbCodigoBarras = v.findViewById<RadioButton>(R.id.rbCodigoBarras) |
37 | val rbCodigoDebo = v.findViewById<RadioButton>(R.id.rbCodigoDebo) | 40 | val rbCodigoDebo = v.findViewById<RadioButton>(R.id.rbCodigoDebo) |
38 | val rbCodigoOrigen = v.findViewById<RadioButton>(R.id.rbCodigoOrigen) | 41 | val rbCodigoOrigen = v.findViewById<RadioButton>(R.id.rbCodigoOrigen) |
39 | val rbDeposito = v.findViewById<RadioButton>(R.id.rbDeposito) | 42 | val rbDeposito = v.findViewById<RadioButton>(R.id.rbDeposito) |
40 | val rbVentas = v.findViewById<RadioButton>(R.id.rbVentas) | 43 | val rbVentas = v.findViewById<RadioButton>(R.id.rbVentas) |
41 | val cbMostrarExistencia = v.findViewById<CheckBox>(R.id.cbMostrarExistencia) | 44 | val cbMostrarExistencia = v.findViewById<CheckBox>(R.id.cbMostrarExistencia) |
42 | val cbMostrarPrecio = v.findViewById<CheckBox>(R.id.cbMostrarPrecio) | 45 | val cbMostrarPrecio = v.findViewById<CheckBox>(R.id.cbMostrarPrecio) |
43 | val btnAgregarServidor = v.findViewById<Button>(R.id.btnAgregarServidor) | 46 | val btnAgregarServidor = v.findViewById<Button>(R.id.btnAgregarServidor) |
47 | val spServidor = v.findViewById<Spinner>(R.id.spServidor) | ||
48 | val btnValidarServidor = v.findViewById<Button>(R.id.btnValidarServidor) | ||
44 | 49 | ||
45 | if (sharedPreferences.contains("etRuta")) etRuta.setText( | 50 | if (sharedPreferences.contains("etRuta")) etRuta.setText(sharedPreferences.getString("etRuta", "").toString()) |
46 | sharedPreferences.getString("etRuta", "").toString() | ||
47 | ) | ||
48 | 51 | ||
49 | if (sharedPreferences.contains("rbProInclu")) { | 52 | if (sharedPreferences.contains("rbProInclu")) { |
50 | if (sharedPreferences.getString("rbProInclu", "").toString() == "0") { | 53 | if (sharedPreferences.getString("rbProInclu", "").toString() == "0") { |
51 | rbProInclu.isChecked=false | 54 | rbProInclu.isChecked = false |
52 | rbProNoInclu.isChecked = true | 55 | rbProNoInclu.isChecked = true |
53 | } else if (sharedPreferences.getString("rbProInclu", "").toString() == "1") { | 56 | } else if (sharedPreferences.getString("rbProInclu", "").toString() == "1") { |
54 | rbProInclu.isChecked = true | 57 | rbProInclu.isChecked = true |
55 | rbProNoInclu.isChecked = false | 58 | rbProNoInclu.isChecked = false |
56 | } | 59 | } |
57 | } else (sharedPreferences.getString("rbProInclu", "").toString() == "") | 60 | } else (sharedPreferences.getString("rbProInclu", "").toString() == "") |
58 | 61 | ||
59 | if (sharedPreferences.contains("rbProNoInclu")) { | 62 | if (sharedPreferences.contains("rbProNoInclu")) { |
60 | if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") { | 63 | if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") { |
61 | rbProNoInclu.isChecked = false | 64 | rbProNoInclu.isChecked = false |
62 | rbProInclu.isChecked = true | 65 | rbProInclu.isChecked = true |
63 | } else if (sharedPreferences.getString("rbProNoInclu", "").toString() == "1") { | 66 | } else if (sharedPreferences.getString("rbProNoInclu", "").toString() == "1") { |
64 | rbProNoInclu.isChecked = true | 67 | rbProNoInclu.isChecked = true |
65 | rbProInclu.isChecked=false | 68 | rbProInclu.isChecked = false |
66 | } | 69 | } |
67 | } else (sharedPreferences.getString("rbProNoInclu", "").toString() == "") | 70 | } else (sharedPreferences.getString("rbProNoInclu", "").toString() == "") |
68 | 71 | ||
69 | 72 | ||
70 | if (sharedPreferences.contains("cbHabiLectura")) { | 73 | if (sharedPreferences.contains("cbHabiLectura")) { |
71 | if (sharedPreferences.getString("cbHabiLectura", "").toString() == "0") { | 74 | if (sharedPreferences.getString("cbHabiLectura", "").toString() == "0") { |
72 | cbHabiLectura.isChecked=false | 75 | cbHabiLectura.isChecked = false |
73 | } else if (sharedPreferences.getString("cbHabiLectura", "").toString() == "1") { | 76 | } else if (sharedPreferences.getString("cbHabiLectura", "").toString() == "1") { |
74 | cbHabiLectura.isChecked = true | 77 | cbHabiLectura.isChecked = true |
75 | } | 78 | } |
76 | } else (sharedPreferences.getString("cbHabiLectura", "").toString() == "") | 79 | } else (sharedPreferences.getString("cbHabiLectura", "").toString() == "") |
77 | 80 | ||
78 | 81 | ||
79 | if (sharedPreferences.contains("cbMostrarStock")) { | 82 | if (sharedPreferences.contains("cbMostrarStock")) { |
80 | if (sharedPreferences.getString("cbMostrarStock", "").toString() == "0") { | 83 | if (sharedPreferences.getString("cbMostrarStock", "").toString() == "0") { |
81 | cbMostrarStock.isChecked = false | 84 | cbMostrarStock.isChecked = false |
82 | } else if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") { | 85 | } else if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") { |
83 | cbMostrarStock.isChecked = true | 86 | cbMostrarStock.isChecked = true |
84 | } | 87 | } |
85 | } else (sharedPreferences.getString("cbMostrarStock", "").toString() == "") | 88 | } else (sharedPreferences.getString("cbMostrarStock", "").toString() == "") |
86 | 89 | ||
87 | 90 | ||
88 | if (sharedPreferences.contains("rbVentas")) { | 91 | if (sharedPreferences.contains("rbVentas")) { |
89 | if (sharedPreferences.getString("rbVentas", "").toString() == "0") { | 92 | if (sharedPreferences.getString("rbVentas", "").toString() == "0") { |
90 | rbVentas.isChecked=false | 93 | rbVentas.isChecked = false |
91 | rbDeposito.isChecked = true | 94 | rbDeposito.isChecked = true |
92 | } else if (sharedPreferences.getString("rbVentas", "").toString() == "1") { | 95 | } else if (sharedPreferences.getString("rbVentas", "").toString() == "1") { |
93 | rbVentas.isChecked = true | 96 | rbVentas.isChecked = true |
94 | rbDeposito.isChecked = false | 97 | rbDeposito.isChecked = false |
95 | } | 98 | } |
96 | } else (sharedPreferences.getString("rbVentas", "").toString() == "") | 99 | } else (sharedPreferences.getString("rbVentas", "").toString() == "") |
97 | 100 | ||
98 | if (sharedPreferences.contains("rbDeposito")) { | 101 | if (sharedPreferences.contains("rbDeposito")) { |
99 | if (sharedPreferences.getString("rbDeposito", "").toString() == "0") { | 102 | if (sharedPreferences.getString("rbDeposito", "").toString() == "0") { |
100 | rbDeposito.isChecked = false | 103 | rbDeposito.isChecked = false |
101 | rbVentas.isChecked = true | 104 | rbVentas.isChecked = true |
102 | } else if (sharedPreferences.getString("rbDeposito", "").toString() == "1") { | 105 | } else if (sharedPreferences.getString("rbDeposito", "").toString() == "1") { |
103 | rbDeposito.isChecked = true | 106 | rbDeposito.isChecked = true |
104 | rbVentas.isChecked=false | 107 | rbVentas.isChecked = false |
105 | } | 108 | } |
106 | } else (sharedPreferences.getString("rbDeposito", "").toString() == "") | 109 | } else (sharedPreferences.getString("rbDeposito", "").toString() == "") |
107 | 110 | ||
108 | |||
109 | |||
110 | if (sharedPreferences.contains("rbCodigoDebo")) { | 111 | if (sharedPreferences.contains("rbCodigoDebo")) { |
111 | if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "0") { | 112 | if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "0") { |
112 | rbCodigoDebo.isChecked=false | 113 | rbCodigoDebo.isChecked = false |
113 | rbCodigoOrigen.isChecked = false | 114 | rbCodigoOrigen.isChecked = false |
114 | rbCodigoBarras.isChecked = false | 115 | rbCodigoBarras.isChecked = false |
115 | } else if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "1") { | 116 | } else if (sharedPreferences.getString("rbCodigoDebo", "").toString() == "1") { |
116 | rbCodigoDebo.isChecked = true | 117 | rbCodigoDebo.isChecked = true |
117 | rbCodigoOrigen.isChecked = false | 118 | rbCodigoOrigen.isChecked = false |
118 | rbCodigoBarras.isChecked = false | 119 | rbCodigoBarras.isChecked = false |
119 | } | 120 | } |
120 | } else (sharedPreferences.getString("rbCodigoDebo", "").toString() == "") | 121 | } else (sharedPreferences.getString("rbCodigoDebo", "").toString() == "") |
121 | 122 | ||
122 | if (sharedPreferences.contains("rbCodigoOrigen")) { | 123 | if (sharedPreferences.contains("rbCodigoOrigen")) { |
123 | if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "0") { | 124 | if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "0") { |
124 | rbCodigoOrigen.isChecked = false | 125 | rbCodigoOrigen.isChecked = false |
125 | } else if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "1") { | 126 | } else if (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "1") { |
126 | rbCodigoOrigen.isChecked = true | 127 | rbCodigoOrigen.isChecked = true |
127 | } | 128 | } |
128 | } else (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "") | 129 | } else (sharedPreferences.getString("rbCodigoOrigen", "").toString() == "") |
129 | if (sharedPreferences.contains("rbCodigoBarras")) { | 130 | if (sharedPreferences.contains("rbCodigoBarras")) { |
130 | if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "0") { | 131 | if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "0") { |
131 | rbCodigoBarras.isChecked = false | 132 | rbCodigoBarras.isChecked = false |
132 | } else if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "1") { | 133 | } else if (sharedPreferences.getString("rbCodigoBarras", "").toString() == "1") { |
133 | rbCodigoBarras.isChecked = true | 134 | rbCodigoBarras.isChecked = true |
134 | } | 135 | } |
135 | } else (sharedPreferences.getString("rbCodigoBarras", "").toString() == "") | 136 | } else (sharedPreferences.getString("rbCodigoBarras", "").toString() == "") |
136 | 137 | ||
137 | 138 | ||
138 | if (sharedPreferences.contains("cbMostrarExistencia")) { | 139 | if (sharedPreferences.contains("cbMostrarExistencia")) { |
139 | if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "0") { | 140 | if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "0") { |
140 | cbMostrarExistencia.isChecked=false | 141 | cbMostrarExistencia.isChecked = false |
141 | } else if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "1") { | 142 | } else if (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "1") { |
142 | cbMostrarExistencia.isChecked = true | 143 | cbMostrarExistencia.isChecked = true |
143 | } | 144 | } |
144 | } else (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "") | 145 | } else (sharedPreferences.getString("cbMostrarExistencia", "").toString() == "") |
145 | 146 | ||
146 | 147 | ||
147 | if (sharedPreferences.contains("cbMostrarPrecio")) { | 148 | if (sharedPreferences.contains("cbMostrarPrecio")) { |
148 | if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "0") { | 149 | if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "0") { |
149 | cbMostrarPrecio.isChecked = false | 150 | cbMostrarPrecio.isChecked = false |
150 | } else if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "1") { | 151 | } else if (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "1") { |
151 | cbMostrarPrecio.isChecked = true | 152 | cbMostrarPrecio.isChecked = true |
152 | } | 153 | } |
153 | } else (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "") | 154 | } else (sharedPreferences.getString("cbMostrarPrecio", "").toString() == "") |
154 | 155 | ||
155 | btnGuardar.setOnClickListener { | 156 | btnGuardar.setOnClickListener { |
156 | guardarPreferencias() | 157 | guardarPreferencias() |
157 | Toast.makeText(v.context, "Los Datos se guardaron correctamente", Toast.LENGTH_LONG) | 158 | Toast.makeText(v.context, "Los Datos se guardaron correctamente", Toast.LENGTH_LONG).show() |
158 | .show() | ||
159 | } | 159 | } |
160 | btnAgregarServidor.setOnClickListener { | 160 | btnAgregarServidor.setOnClickListener { findNavController().navigate(R.id.servidoresFragment) } |
161 | 161 | ||
162 | findNavController().navigate(R.id.servidoresFragment) | 162 | GlobalScope.launch(Dispatchers.Main) { |
163 | val listServerDescription = arrayListOf<String>() | ||
164 | for (any in getDescServers()) { | ||
165 | listServerDescription.add(any.descripcion.toString()) | ||
166 | } | ||
167 | if (spServidor != null) { | ||
168 | val adapter = ArrayAdapter(requireContext(), android.R.layout.simple_spinner_item, listServerDescription) | ||
169 | spServidor.adapter = adapter | ||
170 | } | ||
171 | } | ||
172 | btnValidarServidor.setOnClickListener { | ||
173 | Toast.makeText(requireContext(), "Dirección correcta", Toast.LENGTH_LONG).show() | ||
163 | } | 174 | } |
164 | |||
165 | return v | 175 | return v |
166 | } | 176 | } |
167 | 177 | ||
178 | suspend fun getDescServers(): List<ServeInv> { | ||
179 | return GlobalScope.async(Dispatchers.IO) { | ||
180 | return@async AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.fetchAllServers() | ||
181 | }.await() | ||
182 | } | ||
183 | |||
168 | fun guardarPreferencias() { | 184 | fun guardarPreferencias() { |
169 | try { | 185 | try { |
170 | val editor = sharedPreferences.edit() | 186 | val editor = sharedPreferences.edit() |
171 | 187 | ||
172 | if (etRuta.text.isNotEmpty()) editor?.putString("etRuta", etRuta.text.toString()) | 188 | if (etRuta.text.isNotEmpty()) editor?.putString("etRuta", etRuta.text.toString()) |
173 | 189 | ||
174 | if (rbProInclu.isChecked) editor?.putString("rbProInclu", "1") else editor?.putString("rbProInclu", "0") | 190 | if (rbProInclu.isChecked) editor?.putString("rbProInclu", "1") else editor?.putString("rbProInclu", "0") |
175 | if (rbProNoInclu.isChecked) editor?.putString("rbProNoInclu", "1") else editor?.putString("rbProNoInclu", "0") | 191 | if (rbProNoInclu.isChecked) editor?.putString("rbProNoInclu", "1") else editor?.putString("rbProNoInclu", "0") |
176 | 192 | ||
177 | if (cbHabiLectura.isChecked) editor?.putString( | 193 | if (cbHabiLectura.isChecked) editor?.putString("cbHabiLectura", "1") else editor?.putString("cbHabiLectura", "0") |
178 | "cbHabiLectura", "1" | 194 | if (cbMostrarStock.isChecked) editor?.putString("cbMostrarStock", "1") else editor?.putString("cbMostrarStock", "0") |
179 | ) else editor?.putString("cbHabiLectura", "0") | 195 | if (rbVentas.isChecked) editor?.putString("rbVentas", "1") else editor?.putString("rbVentas", "0") |
180 | if (cbMostrarStock.isChecked) editor?.putString( | 196 | if (rbDeposito.isChecked) editor?.putString("rbDeposito", "1") else editor?.putString("rbDeposito", "0") |
181 | "cbMostrarStock", "1" | 197 | if (rbCodigoDebo.isChecked) editor?.putString("rbCodigoDebo", "1") else editor?.putString("rbCodigoDebo", "0") |
182 | ) else editor?.putString("cbMostrarStock", "0") | 198 | if (rbCodigoOrigen.isChecked) editor?.putString("rbCodigoOrigen", "1") else editor?.putString("rbCodigoOrigen", "0") |
183 | if (rbVentas.isChecked) editor?.putString( | 199 | if (rbCodigoBarras.isChecked) editor?.putString("rbCodigoBarras", "1") else editor?.putString("rbCodigoBarras", "0") |
184 | "rbVentas", "1" | 200 | if (cbMostrarExistencia.isChecked) editor?.putString("cbMostrarExistencia", "1") else editor?.putString("cbMostrarExistencia", "0") |
185 | ) else editor?.putString("rbVentas", "0") | 201 | if (cbMostrarPrecio.isChecked) editor?.putString("cbMostrarPrecio", "1") else editor?.putString("cbMostrarPrecio", "0") |
186 | if (rbDeposito.isChecked) editor?.putString( | ||
187 | "rbDeposito", "1" |
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/MainFragment.kt
1 | package com.focasoftware.deboinventariov20.ui.main | 1 | package com.focasoftware.deboinventariov20.ui.main |
2 | 2 | ||
3 | import android.content.Context | 3 | import android.content.Context |
4 | import android.content.SharedPreferences | 4 | import android.content.SharedPreferences |
5 | import android.os.Bundle | 5 | import android.os.Bundle |
6 | import android.view.LayoutInflater | 6 | import android.view.LayoutInflater |
7 | import android.view.View | 7 | import android.view.View |
8 | import android.view.ViewGroup | 8 | import android.view.ViewGroup |
9 | import android.widget.CheckBox | 9 | import android.widget.* |
10 | import android.widget.ImageView | ||
11 | import android.widget.LinearLayout | ||
12 | import android.widget.TextView | ||
13 | import androidx.fragment.app.Fragment | 10 | import androidx.fragment.app.Fragment |
14 | import androidx.navigation.NavController | 11 | import androidx.navigation.NavController |
15 | import androidx.navigation.Navigation | 12 | import androidx.navigation.Navigation |
16 | import androidx.recyclerview.widget.LinearLayoutManager | 13 | import androidx.recyclerview.widget.LinearLayoutManager |
17 | import androidx.recyclerview.widget.RecyclerView | 14 | import androidx.recyclerview.widget.RecyclerView |
18 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 15 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
19 | import com.focasoftware.deboinventariov20.Model.InvHead | 16 | import com.focasoftware.deboinventariov20.Model.InvHead |
20 | import com.focasoftware.deboinventariov20.R | 17 | import com.focasoftware.deboinventariov20.R |
21 | import com.focasoftware.deboinventariov20.ui.inventario.ItemsRecycler | 18 | import com.focasoftware.deboinventariov20.ui.inventario.ItemsRecycler |
22 | import kotlinx.coroutines.Dispatchers | 19 | import kotlinx.coroutines.Dispatchers |
23 | import kotlinx.coroutines.GlobalScope | 20 | import kotlinx.coroutines.GlobalScope |
24 | import kotlinx.coroutines.async | 21 | import kotlinx.coroutines.async |
25 | import kotlinx.coroutines.launch | 22 | import kotlinx.coroutines.launch |
26 | import java.util.* | 23 | import java.util.* |
27 | 24 | ||
28 | class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener { | 25 | class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener { |
29 | private lateinit var inventarios: List<InvHead> | 26 | private lateinit var inventarios: List<InvHead> |
30 | private lateinit var ordenado: List<InvHead> | 27 | private lateinit var ordenado: List<InvHead> |
31 | private lateinit var rcInventario: RecyclerView | 28 | private lateinit var rcInventario: RecyclerView |
32 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | 29 | private lateinit var viewAdapter: RecyclerView.Adapter<*> |
33 | private lateinit var viewManager: RecyclerView.LayoutManager | 30 | private lateinit var viewManager: RecyclerView.LayoutManager |
34 | // private var listIvn2 = List<InvHead>() | 31 | // private var listIvn2 = List<InvHead>() |
35 | private var listIvn2 = ArrayList<InvHead>() | 32 | private var listIvn2 = ArrayList<InvHead>() |
36 | private lateinit var navController: NavController | 33 | private lateinit var navController: NavController |
37 | private lateinit var sharedPreferences: SharedPreferences | 34 | private lateinit var sharedPreferences: SharedPreferences |
38 | private var cantidadInventarios: Int = 0 | 35 | private var cantidadInventarios: Int = 0 |
39 | 36 | ||
40 | override fun onCreate(savedInstanceState: Bundle?) { | 37 | override fun onCreate(savedInstanceState: Bundle?) { |
41 | super.onCreate(savedInstanceState) | 38 | super.onCreate(savedInstanceState) |
42 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 39 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
43 | } | 40 | } |
44 | 41 | ||
45 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 42 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
46 | var bAbiertoCerrado = false | 43 | var bAbiertoCerrado = false |
47 | val v = inflater.inflate(R.layout.fragment_main, container, false) | 44 | val v = inflater.inflate(R.layout.fragment_main, container, false) |
48 | val tvInvDinamicos = v.findViewById<TextView>(R.id.tvInvDinamicos) | 45 | val tvInvDinamicos = v.findViewById<TextView>(R.id.tvInvDinamicos) |
49 | val txtDeposito = v.findViewById<TextView>(R.id.txtDeposito) | 46 | val txtDeposito = v.findViewById<TextView>(R.id.txtDeposito) |
50 | val ivSort19= v.findViewById<ImageView>(R.id.ivSort19) | 47 | val ivSort19= v.findViewById<ImageButton>(R.id.ivSort19) |
51 | val ivSort91= v.findViewById<ImageView>(R.id.ivSort91) | 48 | val ivSort91= v.findViewById<ImageButton>(R.id.ivSort91) |
52 | val cbVentas= v.findViewById<CheckBox>(R.id.cbVentas) | 49 | val cbVentas= v.findViewById<CheckBox>(R.id.cbVentas) |
53 | val cbDeposito= v.findViewById<CheckBox>(R.id.cbDeposito) | 50 | val cbDeposito= v.findViewById<CheckBox>(R.id.cbDeposito) |
54 | 51 | ||
55 | rcInventario = v.findViewById(R.id.rcInventario) | 52 | rcInventario = v.findViewById(R.id.rcInventario) |
56 | 53 | ||
57 | GlobalScope.launch(Dispatchers.Main) { | 54 | GlobalScope.launch(Dispatchers.Main) { |
58 | inventarios = buscarEnBDInvHead() | 55 | inventarios = buscarEnBDInvHead() |
59 | for ((i, item) in inventarios.withIndex()) { | 56 | for ((i, item) in inventarios.withIndex()) { |
60 | val inv = InvHead(inventarios[i].invNum, | 57 | val inv = InvHead(inventarios[i].invNum, |
61 | inventarios[i].descripcion, | 58 | inventarios[i].descripcion, |
62 | inventarios[i].estado, | 59 | inventarios[i].estado, |
63 | inventarios[i].fechaInicio, | 60 | inventarios[i].fechaInicio, |
64 | inventarios[i].fechaFinal, | 61 | inventarios[i].fechaFinal, |
65 | inventarios[i].prodContados, | 62 | inventarios[i].prodContados, |
66 | inventarios[i].lugar, | 63 | inventarios[i].lugar, |
67 | inventarios[i].stDesc, | 64 | inventarios[i].stDesc, |
68 | inventarios[i].proNoCont) | 65 | inventarios[i].proNoCont) |
69 | cargarRecicler(inv) | 66 | cargarRecicler(inv) |
70 | cantidadInventarios = i + 1 | 67 | cantidadInventarios = i + 1 |
71 | } | 68 | } |
72 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) +" | 69 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) +" |
73 | tvInvDinamicos.setOnClickListener { | 70 | tvInvDinamicos.setOnClickListener { |
74 | if (!bAbiertoCerrado) { | 71 | if (!bAbiertoCerrado) { |
75 | bAbiertoCerrado = true | 72 | bAbiertoCerrado = true |
76 | txtDeposito.visibility = View.GONE | 73 | txtDeposito.visibility = View.GONE |
77 | rcInventario.visibility = View.VISIBLE | 74 | rcInventario.visibility = View.VISIBLE |
78 | ivSort91.visibility = View.INVISIBLE | 75 | ivSort91.visibility = View.INVISIBLE |
79 | ivSort19.visibility = View.VISIBLE | 76 | ivSort19.visibility = View.VISIBLE |
80 | cbVentas.visibility = View.VISIBLE | 77 | cbVentas.visibility = View.VISIBLE |
81 | cbDeposito.visibility = View.VISIBLE | 78 | cbDeposito.visibility = View.VISIBLE |
82 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) -" | 79 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) -" |
83 | } else { | 80 | } else { |
84 | bAbiertoCerrado = false | 81 | bAbiertoCerrado = false |
85 | rcInventario.visibility = View.GONE | 82 | rcInventario.visibility = View.GONE |
86 | ivSort91.visibility = View.GONE | 83 | ivSort91.visibility = View.GONE |
87 | ivSort19.visibility = View.GONE | 84 | ivSort19.visibility = View.GONE |
88 | txtDeposito.visibility = View.VISIBLE | 85 | txtDeposito.visibility = View.VISIBLE |
89 | cbVentas.visibility = View.GONE | 86 | cbVentas.visibility = View.GONE |
90 | cbDeposito.visibility = View.GONE | 87 | cbDeposito.visibility = View.GONE |
91 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) +" | 88 | tvInvDinamicos.text = "Inventarios Dinamicos (${cantidadInventarios.toString()}) +" |
92 | } | 89 | } |
93 | } | 90 | } |
94 | ivSort19.setOnClickListener { | 91 | ivSort19.setOnClickListener { |
95 | ordenado= inventarios.sortedByDescending { | 92 | ordenado= inventarios.sortedByDescending { |
96 | it.invNum | 93 | it.invNum |
97 | } | 94 | } |
98 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) | 95 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) |
99 | viewManager = LinearLayoutManager(requireContext()) | 96 | viewManager = LinearLayoutManager(requireContext()) |
100 | 97 | ||
101 | rcInventario.apply { | 98 | rcInventario.apply { |
102 | adapter = viewAdapter | 99 | adapter = viewAdapter |
103 | layoutManager = viewManager | 100 | layoutManager = viewManager |
104 | } | 101 | } |
105 | viewAdapter.notifyDataSetChanged() | 102 | viewAdapter.notifyDataSetChanged() |
106 | ivSort19.visibility=View.INVISIBLE | 103 | ivSort19.visibility=View.INVISIBLE |
107 | ivSort91.visibility=View.VISIBLE | 104 | ivSort91.visibility=View.VISIBLE |
108 | } | 105 | } |
109 | ivSort91.setOnClickListener { | 106 | ivSort91.setOnClickListener { |
110 | ordenado= inventarios.sortedBy { | 107 | ordenado= inventarios.sortedBy { |
111 | it.invNum | 108 | it.invNum |
112 | } | 109 | } |
113 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) | 110 | viewAdapter = InventarioListAdapter(requireContext(), ordenado, this@MainFragment) |
114 | viewManager = LinearLayoutManager(requireContext()) | 111 | viewManager = LinearLayoutManager(requireContext()) |
115 | 112 | ||
116 | rcInventario.apply { | 113 | rcInventario.apply { |
117 | adapter = viewAdapter | 114 | adapter = viewAdapter |
118 | layoutManager = viewManager | 115 | layoutManager = viewManager |
119 | } | 116 | } |
120 | viewAdapter.notifyDataSetChanged() | 117 | viewAdapter.notifyDataSetChanged() |
121 | ivSort91.visibility=View.INVISIBLE | 118 | ivSort91.visibility=View.INVISIBLE |
122 | ivSort19.visibility=View.VISIBLE | 119 | ivSort19.visibility=View.VISIBLE |
123 | } | 120 | } |
124 | } | 121 | } |
125 | return v | 122 | return v |
126 | } | 123 | } |
127 | 124 | ||
128 | suspend fun buscarEnBDInvHead(): List<InvHead> { | 125 | suspend fun buscarEnBDInvHead(): List<InvHead> { |
129 | //TODO BUSQUEDA POR DESCRIPCION | 126 | //TODO BUSQUEDA POR DESCRIPCION |
130 | var busqueda: List<InvHead> | 127 | var busqueda: List<InvHead> |
131 | return GlobalScope.async(Dispatchers.IO) { | 128 | return GlobalScope.async(Dispatchers.IO) { |
132 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.fetchAllInvHead() | 129 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.fetchAllInvHead() |
133 | return@async busqueda | 130 | return@async busqueda |
134 | }.await() | 131 | }.await() |
135 | } | 132 | } |
136 | 133 | ||
137 | fun cargarRecicler(inv: InvHead) { | 134 | fun cargarRecicler(inv: InvHead) { |
138 | //TODO CARGO EN LE RV | 135 | //TODO CARGO EN LE RV |
139 | 136 | ||
140 | val number = if (inv.invNum.toLong() < 10) "0${inv.invNum.toLong()}" else inv.invNum.toString() | 137 | val number = if (inv.invNum.toLong() < 10) "0${inv.invNum.toLong()}" else inv.invNum.toString() |
141 | val item = ItemInventario("N° $number ${inv.descripcion}. Fecha: ${inv.fechaFinal}") | 138 | val item = ItemInventario("N° $number ${inv.descripcion}. Fecha: ${inv.fechaFinal}") |
142 | //(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar) | 139 | //(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar) |
143 | // listIvn.add(item) | 140 | // listIvn.add(item) |
144 | listIvn2.add(inv) | 141 | listIvn2.add(inv) |
145 | viewAdapter = InventarioListAdapter(requireContext(), listIvn2, this) | 142 | viewAdapter = InventarioListAdapter(requireContext(), listIvn2, this) |
146 | viewManager = LinearLayoutManager(requireContext()) | 143 | viewManager = LinearLayoutManager(requireContext()) |
147 | 144 | ||
148 | rcInventario.apply { | 145 | rcInventario.apply { |
149 | adapter = viewAdapter | 146 | adapter = viewAdapter |
150 | layoutManager = viewManager | 147 | layoutManager = viewManager |
151 | } | 148 | } |
152 | } | 149 | } |
153 | 150 | ||
154 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 151 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
155 | super.onViewCreated(view, savedInstanceState) | 152 | super.onViewCreated(view, savedInstanceState) |
156 | navController = Navigation.findNavController(view) | 153 | navController = Navigation.findNavController(view) |
157 | listIvn2.clear() | 154 | listIvn2.clear() |
158 | } | 155 | } |
159 | 156 | ||
160 | override fun onItemClick(inventario: String?) { | 157 | override fun onItemClick(inventario: String?) { |
161 | 158 | ||
162 | val editor = sharedPreferences.edit() | 159 | val editor = sharedPreferences.edit() |
163 | // var invSel: String = inventario.toString() | 160 | // var invSel: String = inventario.toString() |
164 | // invSel = invSel.substring(3, 5) | 161 | // invSel = invSel.substring(3, 5) |
165 | editor?.putString("Inventario", inventario) | 162 | editor?.putString("Inventario", inventario) |
166 | editor?.apply() | 163 | editor?.apply() |
167 | editor.commit() | 164 | editor.commit() |
168 | navController.navigate(R.id.action_mainFragment2_to_inventarioFragment) | 165 | navController.navigate(R.id.action_mainFragment2_to_inventarioFragment) |
169 | } | 166 | } |
170 | 167 | ||
171 | 168 | ||
172 | } | 169 | } |
173 | 170 | ||
174 | 171 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/servidores/AdapterServidores.kt
1 | package com.focasoftware.deboinventariov20.ui.servidores | 1 | package com.focasoftware.deboinventariov20.ui.servidores |
2 | 2 | ||
3 | import android.content.Context | 3 | import android.content.Context |
4 | import android.view.LayoutInflater | 4 | import android.view.LayoutInflater |
5 | import android.view.View | 5 | import android.view.View |
6 | import android.view.ViewGroup | 6 | import android.view.ViewGroup |
7 | import androidx.recyclerview.widget.RecyclerView | 7 | import androidx.recyclerview.widget.RecyclerView |
8 | import com.focasoftware.deboinventariov20.R | 8 | import com.focasoftware.deboinventariov20.R |
9 | import com.focasoftware.deboinventariov20.ui.inventario.ItemsRecycler | 9 | import com.focasoftware.deboinventariov20.ui.inventario.ItemsRecycler |
10 | import com.google.android.material.snackbar.Snackbar | 10 | import com.google.android.material.snackbar.Snackbar |
11 | import kotlinx.android.synthetic.main.item_servidores.view.* | 11 | import kotlinx.android.synthetic.main.item_servidores.view.* |
12 | 12 | ||
13 | class AdapterServidores(private val servidor: ArrayList<ItemsServidores>, private var contexto: Context) : | 13 | class AdapterServidores(private val servidor: ArrayList<ItemsServidores>, private var contexto: Context) : |
14 | RecyclerView.Adapter<AdapterServidores.ViewHolder>() { | 14 | RecyclerView.Adapter<AdapterServidores.ViewHolder>() { |
15 | private var removePosition: Int = 0 | 15 | private var removePosition: Int = 0 |
16 | private var removedItem: ItemsServidores? = null | 16 | private var removedItem: ItemsServidores? = null |
17 | 17 | ||
18 | class ViewHolder(var vista: View) : RecyclerView.ViewHolder(vista) { | 18 | class ViewHolder(var vista: View) : RecyclerView.ViewHolder(vista) { |
19 | fun bind(itemsServidores: ItemsServidores) { | 19 | fun bind(itemsServidores: ItemsServidores) { |
20 | vista.tvDescServidor.text = itemsServidores.descripcion | 20 | vista.tvDescServidor.text = itemsServidores.descripcion |
21 | vista.tvDireccionServidor.text = itemsServidores.direccion | 21 | vista.tvDireccionServidor.text = itemsServidores.direccion |
22 | 22 | ||
23 | } | 23 | } |
24 | } | 24 | } |
25 | 25 | ||
26 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { | 26 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { |
27 | return ViewHolder( | 27 | return ViewHolder( |
28 | LayoutInflater.from(parent.context).inflate(R.layout.item_servidores, parent, false) | 28 | LayoutInflater.from(parent.context).inflate(R.layout.item_servidores, parent, false) |
29 | ) | 29 | ) |
30 | } | 30 | } |
31 | 31 | ||
32 | override fun getItemCount(): Int { | 32 | override fun getItemCount(): Int { |
33 | return servidor.size | 33 | return servidor.size |
34 | } | 34 | } |
35 | 35 | ||
36 | override fun onBindViewHolder(holder: ViewHolder, position: Int) { | 36 | override fun onBindViewHolder(holder: ViewHolder, position: Int) { |
37 | holder.bind(servidor[position]) | 37 | holder.bind(servidor[position]) |
38 | } | 38 | } |
39 | fun removeItem(viewHolder: RecyclerView.ViewHolder) { | 39 | fun removeItem(viewHolder: RecyclerView.ViewHolder) { |
40 | removePosition = viewHolder.adapterPosition | 40 | removePosition = viewHolder.adapterPosition |
41 | removedItem = servidor[viewHolder.adapterPosition] | 41 | removedItem = servidor[viewHolder.adapterPosition] |
42 | 42 | ||
43 | servidor.removeAt(viewHolder.adapterPosition) | 43 | servidor.removeAt(viewHolder.adapterPosition) |
44 | notifyItemRemoved(viewHolder.adapterPosition) | 44 | notifyItemRemoved(viewHolder.adapterPosition) |
45 | |||
46 | Snackbar.make(viewHolder.itemView, "El articulo fue ${removedItem!!.descripcion} eliminado", Snackbar.LENGTH_LONG).setAction("Rehacer") { | ||
47 | servidor.add(removePosition, removedItem!!) | ||
48 | notifyItemInserted(removePosition) | ||
49 | }.show() | ||
50 | } | 45 | } |
51 | } | 46 | } |
app/src/main/java/com/focasoftware/deboinventariov20/ui/servidores/ItemsServidores.kt
1 | package com.focasoftware.deboinventariov20.ui.servidores | 1 | package com.focasoftware.deboinventariov20.ui.servidores |
2 | 2 | ||
3 | data class ItemsServidores(val ID: Long?, val descripcion: String?, var direccion: String?, var predeterminado: String?) |
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 listIvn = java.util.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 | // rvServidores.layoutManager = LinearLayoutManager(context) | ||
41 | // rvServidores.itemAnimator = DefaultItemAnimator() | ||
42 | |||
43 | btnGuardarServidores.setOnClickListener { | 40 | btnGuardarServidores.setOnClickListener { |
44 | if (etNombreServidor.text.isNullOrBlank()) { | 41 | if (etNombreServidor.text.isNullOrBlank()) { |
45 | etNombreServidor.error = "Nombre no valido" | 42 | etNombreServidor.error = "Nombre no valido" |
46 | etNombreServidor.requestFocus() | 43 | etNombreServidor.requestFocus() |
47 | etNombreServidor.hint = "Nombre no valido" | 44 | etNombreServidor.hint = "Nombre no valido" |
48 | } | 45 | } |
49 | if (etDireccionServidor.text.isNullOrBlank()) { | 46 | if (etDireccionServidor.text.isNullOrBlank()) { |
50 | etDireccionServidor.error = "Dirección no valida" | 47 | etDireccionServidor.error = "Dirección no valida" |
51 | etDireccionServidor.requestFocus() | 48 | etDireccionServidor.requestFocus() |
52 | etDireccionServidor.hint = "Dirección no valida" | 49 | etDireccionServidor.hint = "Dirección no valida" |
53 | } | 50 | } |
54 | if (!etDireccionServidor.text.isNullOrBlank() || !etNombreServidor.text.isNullOrBlank()) { | 51 | if (!etDireccionServidor.text.isNullOrBlank() || !etNombreServidor.text.isNullOrBlank()) { |
52 | // GlobalScope.launch(Dispatchers.Main) { | ||
53 | // ServerNew =AppDb.getAppDb(requireContext())?.ServeInvDao()?.findLastServer()?.plus(1) ?: 1 | ||
54 | val servidor = ServeInv(etNombreServidor.text.toString(), "http://${etDireccionServidor.text}/", "0") | ||
55 | ingresarDatos(servidor) | ||
56 | cargarRecicler(servidor) | ||
55 | Toast.makeText(requireContext(), "Servidor ${etNombreServidor.text} Guardado", Toast.LENGTH_LONG).show() | 57 | Toast.makeText(requireContext(), "Servidor ${etNombreServidor.text} Guardado", Toast.LENGTH_LONG).show() |
56 | GlobalScope.launch(Dispatchers.Main) { | ||
57 | val num: Long = buscaUltimoNroEnBD() | ||
58 | val servidor = ServeInv(num, etNombreServidor.text.toString(), "http://${etDireccionServidor.text}/", "0") | ||
59 | ingresarDatos(servidor) | ||
60 | cargarRecicler(servidor) | ||
61 | } | ||
62 | etNombreServidor.text.clear() | 58 | etNombreServidor.text.clear() |
63 | etDireccionServidor.text.clear() | 59 | etDireccionServidor.text.clear() |
60 | // } | ||
64 | } | 61 | } |
65 | } | 62 | } |
66 | } | 63 | } |
67 | 64 | ||
68 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 65 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
69 | val v = inflater.inflate(R.layout.fragment_servidores, container, false) | 66 | val v = inflater.inflate(R.layout.fragment_servidores, container, false) |
70 | rvServidores = v.findViewById(R.id.rvServidores) | 67 | rvServidores = v.findViewById(R.id.rvServidores) |
71 | return v | 68 | return v |
72 | } | 69 | } |
73 | 70 | ||
74 | 71 | fun ingresarDatos(servidor: ServeInv) { | |
75 | suspend fun buscaUltimoNroEnBD(): Long { | ||
76 | |||
77 | var busqueda: Long | ||
78 | return GlobalScope.async(Dispatchers.IO) { | ||
79 | busqueda = AppDb.getAppDb(requireContext())!!.ServeInvDao()!!.findLastSer() | ||
80 | return@async busqueda | ||
81 | }.await() | ||
82 | } | ||
83 | |||
84 | fun ingresarDatos(servidor:ServeInv) { | ||
85 | val Job = GlobalScope.launch { | 72 | val Job = GlobalScope.launch { |
86 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.insertServer(servidor) | 73 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.insertServer(servidor) |
87 | } | 74 | } |
88 | } | 75 | } |
89 | 76 | ||
90 | suspend fun buscarEnBD(): List<ServeInv> { | 77 | suspend fun buscarEnBD(): List<ServeInv> { |
91 | //TODO BUSQUEDA POR DESCRIPCION | 78 | //TODO BUSQUEDA POR DESCRIPCION |
92 | var busqueda: List<ServeInv> | 79 | var busqueda: List<ServeInv> |
93 | return GlobalScope.async(Dispatchers.IO) { | 80 | return GlobalScope.async(Dispatchers.IO) { |
94 | busqueda = AppDb.getAppDb(requireContext())!!.ServeInvDao()!!.fetchAllServers() | 81 | busqueda = AppDb.getAppDb(requireContext())!!.ServeInvDao()!!.fetchAllServers() |
95 | return@async busqueda | 82 | return@async busqueda |
96 | }.await() | 83 | }.await() |
97 | } | 84 | } |
98 | 85 | ||
99 | fun CargarRV() { | 86 | fun CargarRV() { |
100 | GlobalScope.launch(Dispatchers.Main) { | 87 | GlobalScope.launch(Dispatchers.Main) { |
101 | servidores = buscarEnBD() | 88 | servidores = buscarEnBD() |
102 | for ((i, item) in servidores.withIndex()) { | 89 | for ((i, item) in servidores.withIndex()) { |
103 | val ser = ServeInv(servidores[i].SER_NUM, servidores[i].descripcion, servidores[i].direccion, servidores[i].predeterminado) | 90 | val ser = ServeInv(servidores[i].descripcion, servidores[i].direccion, servidores[i].predeterminado) |
104 | cargarRecicler(ser) | 91 | cargarRecicler(ser) |
105 | } | 92 | } |
106 | } | 93 | } |
107 | } | 94 | } |
108 | 95 | ||
109 | fun cargarRecicler(ser: ServeInv) { | 96 | fun cargarRecicler(ser: ServeInv) { |
110 | //TODO CARGO EN LE RV | 97 | //TODO CARGO EN LE RV |
111 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! | 98 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! |
112 | val item = ItemsServidores(ser.SER_NUM, ser.descripcion, ser.direccion, ser.predeterminado) | 99 | val item = ItemsServidores(ser.descripcion, ser.direccion, ser.predeterminado) |
113 | 100 | ||
114 | listIvn.add(item) | 101 | listServ.add(item) |
115 | 102 | ||
116 | viewAdapter = AdapterServidores(listIvn, requireContext()) | 103 | viewAdapter = AdapterServidores(listServ, requireContext()) |
117 | viewManager = LinearLayoutManager(requireContext()) | 104 | viewManager = LinearLayoutManager(requireContext()) |
118 | 105 | ||
119 | rvServidores.apply { | 106 | rvServidores.apply { |
120 | adapter = viewAdapter | 107 | adapter = viewAdapter |
121 | layoutManager = viewManager | 108 | layoutManager = viewManager |
122 | } | 109 | } |
123 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { | 110 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { |
124 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | 111 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { |
125 | return false | 112 | return false |
126 | } | 113 | } |
127 | 114 | ||
128 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { | 115 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { |
129 | // viewManager[ | 116 | GlobalScope.launch(Dispatchers.Main) { |
130 | // BorrarInvActual(viewHolder.adapterPosition.toInt()) | 117 | deleteServer(listServ[viewHolder.adapterPosition].descripcion.toString(), listServ[viewHolder.adapterPosition].direccion.toString()) |
131 | 118 | ||
132 | (viewAdapter as AdapterServidores).removeItem(viewHolder) | 119 | (viewAdapter as AdapterServidores).removeItem(viewHolder) |
133 | viewAdapter.notifyDataSetChanged() | 120 | viewAdapter.notifyDataSetChanged() |
121 | } | ||
134 | } | 122 | } |
135 | 123 | ||
136 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | 124 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
137 | val itemView = viewHolder.itemView | 125 | val itemView = viewHolder.itemView |
138 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 | 126 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 |
139 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | 127 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) |
140 | 128 | ||
141 | if (dX > 0) { | 129 | if (dX > 0) { |
142 | 130 | ||
143 | if (dX < c.width / 2) c.drawColor(Color.GREEN) | 131 | if (dX < c.width / 2) c.drawColor(Color.GREEN) |
144 | else c.drawColor(Color.RED) | 132 | else c.drawColor(Color.RED) |
145 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) | 133 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) |
146 | } else { | 134 | } else { |
147 | } | 135 | } |
148 | |||
149 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 136 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
150 | deleteIcon.draw(c) | 137 | deleteIcon.draw(c) |
151 | |||
152 | } | 138 | } |
153 | } | 139 | } |
154 | 140 | ||
155 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) | 141 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) |
156 | itemTouchHelper.attachToRecyclerView(rvServidores) | 142 | itemTouchHelper.attachToRecyclerView(rvServidores) |
157 | } | 143 | } |
158 | 144 | ||
159 | private fun BorrarInvActual(idServer: Long) { | 145 | suspend fun deleteServer(serverName: String, serverDir: String) { |
160 | lifecycleScope.launch { | 146 | lifecycleScope.launch { |
app/src/main/res/layout/fragment_main.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="match_parent"> | 6 | android:layout_height="match_parent"> |
7 | 7 | ||
8 | <androidx.appcompat.widget.AppCompatTextView | 8 | <androidx.appcompat.widget.AppCompatTextView |
9 | android:id="@+id/tvInvDinamicos" | 9 | android:id="@+id/tvInvDinamicos" |
10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
11 | android:layout_height="90dp" | 11 | android:layout_height="90dp" |
12 | android:autoSizeMaxTextSize="150sp" | 12 | android:autoSizeMaxTextSize="150sp" |
13 | android:autoSizeMinTextSize="25sp" | 13 | android:autoSizeMinTextSize="25sp" |
14 | android:autoSizeStepGranularity="5sp" | 14 | android:autoSizeStepGranularity="5sp" |
15 | android:autoSizeTextType="uniform" | 15 | android:autoSizeTextType="uniform" |
16 | android:gravity="center" | 16 | android:gravity="center" |
17 | android:padding="10dp" | 17 | android:padding="10dp" |
18 | android:text="@string/invDinamicoVenta" | 18 | android:text="@string/invDinamicoVenta" |
19 | android:textColor="@color/colorAccent" | 19 | android:textColor="@color/colorAccent" |
20 | android:visibility="visible" | 20 | android:visibility="visible" |
21 | app:fontFamily="sans-serif" | 21 | app:fontFamily="sans-serif" |
22 | app:layout_constraintEnd_toEndOf="parent" | 22 | app:layout_constraintEnd_toEndOf="parent" |
23 | app:layout_constraintStart_toStartOf="parent" | 23 | app:layout_constraintStart_toStartOf="parent" |
24 | app:layout_constraintTop_toTopOf="parent" /> | 24 | app:layout_constraintTop_toTopOf="parent" /> |
25 | 25 | ||
26 | <ImageView | 26 | <androidx.appcompat.widget.AppCompatImageButton |
27 | android:id="@+id/ivSort19" | 27 | android:id="@+id/ivSort19" |
28 | android:layout_width="35dp" | 28 | android:layout_width="50dp" |
29 | android:layout_height="35dp" | 29 | android:layout_height="50dp" |
30 | android:layout_margin="10dp" | 30 | android:layout_margin="10dp" |
31 | android:padding="5dp" | 31 | android:padding="5dp" |
32 | android:contentDescription=" " | ||
33 | android:visibility="gone" | 32 | android:visibility="gone" |
34 | android:src="@drawable/ic_sort19" | 33 | android:src="@drawable/ic_sort19" |
35 | app:layout_constraintHorizontal_bias="0.0" | 34 | app:layout_constraintHorizontal_bias="0.0" |
36 | app:layout_constraintHorizontal_chainStyle="packed" | 35 | app:layout_constraintHorizontal_chainStyle="packed" |
37 | app:layout_constraintStart_toStartOf="parent" | 36 | app:layout_constraintStart_toStartOf="parent" |
38 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" /> | 37 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" /> |
39 | 38 | ||
40 | <ImageView | 39 | <androidx.appcompat.widget.AppCompatImageButton |
41 | android:id="@+id/ivSort91" | 40 | android:id="@+id/ivSort91" |
42 | android:layout_width="35dp" | 41 | android:layout_width="50dp" |
43 | android:layout_height="35dp" | 42 | android:layout_height="50dp" |
44 | android:layout_margin="10dp" | 43 | android:layout_margin="10dp" |
45 | android:padding="5dp" | 44 | android:padding="5dp" |
46 | android:layout_marginTop="12dp" | 45 | android:layout_marginTop="12dp" |
47 | android:contentDescription="Fecha" | ||
48 | android:visibility="gone" | 46 | android:visibility="gone" |
49 | android:src="@drawable/ic_sort91" | 47 | android:src="@drawable/ic_sort91" |
50 | app:layout_constraintHorizontal_bias="1.0" | 48 | app:layout_constraintHorizontal_bias="1.0" |
51 | app:layout_constraintHorizontal_chainStyle="packed" | 49 | app:layout_constraintHorizontal_chainStyle="packed" |
52 | app:layout_constraintStart_toStartOf="parent" | 50 | app:layout_constraintStart_toStartOf="parent" |
53 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" /> | 51 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" /> |
54 | 52 | ||
55 | 53 | ||
56 | <androidx.recyclerview.widget.RecyclerView | 54 | <androidx.recyclerview.widget.RecyclerView |
57 | android:id="@+id/rcInventario" | 55 | android:id="@+id/rcInventario" |
58 | android:layout_width="match_parent" | 56 | android:layout_width="match_parent" |
59 | android:layout_height="0dp" | 57 | android:layout_height="0dp" |
60 | android:background="@android:color/darker_gray" | 58 | android:background="@android:color/darker_gray" |
61 | android:scrollbars="vertical" | 59 | android:scrollbars="vertical" |
62 | android:visibility="gone" | 60 | android:visibility="gone" |
63 | app:layout_constraintEnd_toEndOf="parent" | 61 | app:layout_constraintEnd_toEndOf="parent" |
64 | app:layout_constraintStart_toStartOf="parent" | 62 | app:layout_constraintStart_toStartOf="parent" |
65 | app:layout_constraintTop_toBottomOf="@id/ivSort19" | 63 | app:layout_constraintTop_toBottomOf="@id/ivSort19" |
66 | tools:listitem="@layout/item_principal" /> | 64 | tools:listitem="@layout/item_principal" /> |
67 | 65 | ||
68 | <com.google.android.material.checkbox.MaterialCheckBox | 66 | <com.google.android.material.checkbox.MaterialCheckBox |
69 | android:id="@+id/cbVentas" | 67 | android:id="@+id/cbVentas" |
70 | android:layout_width="wrap_content" | 68 | android:layout_width="wrap_content" |
71 | android:layout_height="wrap_content" | 69 | android:layout_height="wrap_content" |
72 | android:layout_margin="5dp" | 70 | android:layout_margin="5dp" |
73 | android:text="Ventas" | 71 | android:text="Ventas" |
74 | android:checked="true" | 72 | android:checked="true" |
75 | android:visibility="gone" | 73 | android:visibility="gone" |
76 | app:layout_constraintEnd_toStartOf="@+id/cbDeposito" | 74 | app:layout_constraintEnd_toStartOf="@+id/cbDeposito" |
77 | app:layout_constraintTop_toBottomOf="@+id/tvInvDinamicos" /> | 75 | app:layout_constraintTop_toBottomOf="@+id/tvInvDinamicos" /> |
78 | 76 | ||
79 | <com.google.android.material.checkbox.MaterialCheckBox | 77 | <com.google.android.material.checkbox.MaterialCheckBox |
80 | android:id="@+id/cbDeposito" | 78 | android:id="@+id/cbDeposito" |
81 | android:layout_width="wrap_content" | 79 | android:layout_width="wrap_content" |
82 | android:layout_height="wrap_content" | 80 | android:layout_height="wrap_content" |
83 | android:layout_margin="5dp" | 81 | android:layout_margin="5dp" |
84 | android:visibility="gone" | 82 | android:visibility="gone" |
85 | android:text="Deposito" | 83 | android:text="Deposito" |
86 | android:checked="true" | 84 | android:checked="true" |
87 | app:layout_constraintEnd_toEndOf="parent" | 85 | app:layout_constraintEnd_toEndOf="parent" |
88 | app:layout_constraintTop_toBottomOf="@+id/tvInvDinamicos" /> | 86 | app:layout_constraintTop_toBottomOf="@+id/tvInvDinamicos" /> |
89 | 87 | ||
90 | <androidx.appcompat.widget.AppCompatTextView | 88 | <androidx.appcompat.widget.AppCompatTextView |
91 | android:id="@+id/txtDeposito" | 89 | android:id="@+id/txtDeposito" |
92 | android:layout_width="match_parent" | 90 | android:layout_width="match_parent" |
93 | android:layout_height="90dp" | 91 | android:layout_height="90dp" |
94 | android:autoSizeMaxTextSize="150sp" | 92 | android:autoSizeMaxTextSize="150sp" |
95 | android:autoSizeMinTextSize="25sp" | 93 | android:autoSizeMinTextSize="25sp" |
96 | android:autoSizeStepGranularity="5sp" | 94 | android:autoSizeStepGranularity="5sp" |
97 | android:autoSizeTextType="uniform" | 95 | android:autoSizeTextType="uniform" |
98 | android:gravity="start" | 96 | android:gravity="start" |
99 | android:lines="1" | 97 | android:lines="1" |
100 | android:padding="10dp" | 98 | android:padding="10dp" |
101 | android:text="@string/invDinamicoCompra" | 99 | android:text="@string/invDinamicoCompra" |
102 | android:textColor="@color/colorAccent" | 100 | android:textColor="@color/colorAccent" |
103 | android:visibility="visible" | 101 | android:visibility="visible" |
104 | app:fontFamily="sans-serif-condensed" | 102 | app:fontFamily="sans-serif-condensed" |
105 | app:layout_constraintBottom_toBottomOf="parent" | 103 | app:layout_constraintBottom_toBottomOf="parent" |
106 | app:layout_constraintEnd_toEndOf="parent" | 104 | app:layout_constraintEnd_toEndOf="parent" |
107 | app:layout_constraintStart_toStartOf="parent" | 105 | app:layout_constraintStart_toStartOf="parent" |
108 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" | 106 | app:layout_constraintTop_toBottomOf="@id/tvInvDinamicos" |
109 | app:layout_constraintVertical_bias="0.0" /> | 107 | app:layout_constraintVertical_bias="0.0" /> |
110 | </androidx.constraintlayout.widget.ConstraintLayout> | 108 | </androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/values/strings.xml
1 | <resources> | 1 | <resources> |
2 | 2 | ||
3 | <string name="action_settings">Ayuda</string> | 3 | <string name="action_settings">Ayuda</string> |
4 | <string name="app_name">DEBO Inventarios</string> | 4 | <string name="app_name">DEBO Inventarios</string> |
5 | 5 | ||
6 | <!-- menu--> | 6 | <!-- menu--> |
7 | <string name="menuInicio">Principal</string> | 7 | <string name="menuInicio">Principal</string> |
8 | <string name="menuNueInv">Nuevo Inventario</string> | 8 | <string name="menuNueInv">Nuevo Inventario</string> |
9 | <string name="menuActMae">Importaciones</string> | 9 | <string name="menuActMae">Importaciones</string> |
10 | <string name="menuConf">Configuraciones</string> | 10 | <string name="menuConf">Configuraciones</string> |
11 | <string name="menuSal">Salir</string> | 11 | <string name="menuSal">Salir</string> |
12 | 12 | ||
13 | <!-- Menu header--> | 13 | <!-- Menu header--> |
14 | <string name="menuLeyenda">Debo Inventario</string> | 14 | <string name="menuLeyenda">Debo Inventario</string> |
15 | 15 | ||
16 | <string name="navigation_drawer_open">Open navigation drawer</string> | 16 | <string name="navigation_drawer_open">Open navigation drawer</string> |
17 | <string name="navigation_drawer_close">Close navigation drawer</string> | 17 | <string name="navigation_drawer_close">Close navigation drawer</string> |
18 | 18 | ||
19 | <!-- Pantalla de inicio--> | 19 | <!-- Pantalla de inicio--> |
20 | <string name="bien">Bienvenido</string> | 20 | <string name="bien">Bienvenido</string> |
21 | <string name="debo">DEBO®</string> | 21 | <string name="debo">DEBO®</string> |
22 | <string name="inventario">Inventario</string> | 22 | <string name="inventario">Inventario</string> |
23 | <string name="todo">TODO</string> | 23 | <string name="todo">TODO</string> |
24 | <string name="hello_blank_fragment">Hello blank fragment</string> | 24 | <string name="hello_blank_fragment">Hello blank fragment</string> |
25 | 25 | ||
26 | <!-- inventarios dinamicos--> | 26 | <!-- inventarios dinamicos--> |
27 | <string name="invDinamicoVenta">Inventarios Dinamicos</string> | 27 | <string name="invDinamicoVenta">Inventarios Dinamicos</string> |
28 | <string name="invDinamicoCompra">Inventarios Importados(0)+</string> | 28 | <string name="invDinamicoCompra">Inventarios Importados(0) +</string> |
29 | 29 | ||
30 | <!-- ventana emergente--> | 30 | <!-- ventana emergente--> |
31 | <string name="adv">Ingrese la cantidad contada</string> | 31 | <string name="adv">Ingrese la cantidad contada</string> |
32 | <string name="invVentas">Inventarios Dinamicos de Ventas</string> | 32 | <string name="invVentas">Inventarios Dinamicos de Ventas</string> |
33 | <string name="btnConfirmar">Confirmar</string> | 33 | <string name="btnConfirmar">Confirmar</string> |
34 | <string name="btnCancela">Cancelar</string> | 34 | <string name="btnCancela">Cancelar</string> |
35 | 35 | ||
36 | 36 | ||
37 | <!-- Fragment Inventario--> | 37 | <!-- Fragment Inventario--> |
38 | <string name="invTitulo">Inventarios Dinámicos</string> | 38 | <string name="invTitulo">Inventarios Dinámicos</string> |
39 | <string name="invTituloV">Inventarios de Ventas</string> | 39 | <string name="invTituloV">Inventarios de Ventas</string> |
40 | <string name="invTituloD">Inventarios de Depositos</string> | 40 | <string name="invTituloD">Inventarios de Depositos</string> |
41 | <string name="invCodigoBarras">Código Barras:</string> | 41 | <string name="invCodigoBarras">Código Barras:</string> |
42 | <string name="btnExportarInv">Exportar Inventario</string> | 42 | <string name="btnExportarInv">Exportar Inventario</string> |
43 | <string name="btnBorrarInv">Borrar Inventario</string> | 43 | <string name="btnBorrarInv">Borrar Inventario</string> |
44 | <string name="ibBusDesc">Busqueda por Descripción</string> | 44 | <string name="ibBusDesc">Busqueda por Descripción</string> |
45 | <string name="ibBusCB">Busqueda por C. Barras</string> | 45 | <string name="ibBusCB">Busqueda por C. Barras</string> |
46 | <string name="ibBusCO">Busqueda por Código de Origen</string> | 46 | <string name="ibBusCO">Busqueda por Código de Origen</string> |
47 | <string name="switch_1">+ 1</string> | 47 | <string name="switch_1">+ 1</string> |
48 | 48 | ||
49 | <!-- Fragmento Configuraciones--> | 49 | <!-- Fragmento Configuraciones--> |
50 | <string name="tvTituloConf">Configuraciones</string> | 50 | <string name="tvTituloConf">Configuraciones</string> |
51 | <string name="tvSeleccioneServidor">Seleccione un Servidor</string> | 51 | <string name="tvSeleccioneServidor">Seleccione un Servidor</string> |
52 | <string name="btnValidarServidor">Validar</string> | 52 | <string name="btnValidarServidor">Validar</string> |
53 | <string name="btnAgregarServidor">Agregar un nuevo servidor</string> | 53 | <string name="btnAgregarServidor">Agregar un nuevo servidor</string> |
54 | <string name="tvUbicacionCarpetas">Ubicación de las carpetas de uso interno</string> | 54 | <string name="tvUbicacionCarpetas">Ubicación de las carpetas de uso interno</string> |
55 | <string name="tvTituloArea">Area de Invetnario</string> | 55 | <string name="tvTituloArea">Area de Invetnario</string> |
56 | <string name="rbVentas">Inventarios de Ventas</string> | 56 | <string name="rbVentas">Inventarios de Ventas</string> |
57 | <string name="rbDeposito">Inventarios de Depositos</string> | 57 | <string name="rbDeposito">Inventarios de Depositos</string> |
58 | <string name="tvLosProductos">Los productos no contabilizados en Inventarios</string> | 58 | <string name="tvLosProductos">Los productos no contabilizados en Inventarios</string> |
59 | <string name="tvColumnas">Columnas a Visualizar</string> | 59 | <string name="tvColumnas">Columnas a Visualizar</string> |
60 | 60 | ||
61 | <string name="rbProInclu">Solo se ajustan los productos incluidos en el conteo.</string> | 61 | <string name="rbProInclu">Solo se ajustan los productos incluidos en el conteo.</string> |
62 | <string name="rbProNoInclu">Ajusta productos no incluidos en el conteo con stock en cero.</string> | 62 | <string name="rbProNoInclu">Ajusta productos no incluidos en el conteo con stock en cero.</string> |
63 | 63 | ||
64 | <string name="cbMostrarStock">Mostror stock en el sistema al momento de la descarga del maestro.</string> | 64 | <string name="cbMostrarStock">Mostror stock en el sistema al momento de la descarga del maestro.</string> |
65 | <string name="cbHabiLectura">Habilitar Lectura de codigo de barras en balanza.</string> | 65 | <string name="cbHabiLectura">Habilitar Lectura de codigo de barras en balanza.</string> |
66 | 66 | ||
67 | <string name="tvColumMostrar">Columnas a mostrar en inventario</string> | 67 | <string name="tvColumMostrar">Columnas a mostrar en inventario</string> |
68 | 68 | ||
69 | <string name="rbCodigoDebo">Código DEBO</string> | 69 | <string name="rbCodigoDebo">Código DEBO</string> |
70 | <string name="rbCodigoOrigen">Código Origen</string> | 70 | <string name="rbCodigoOrigen">Código Origen</string> |
71 | <string name="rbCodigoBarras">Código de Barras</string> | 71 | <string name="rbCodigoBarras">Código de Barras</string> |
72 | 72 | ||
73 | 73 | ||
74 | <!-- Spinner servidor--> | 74 | <!-- Spinner servidor--> |
75 | <string-array name="spinnerServidor"> | 75 | <string-array name="spinnerServidor"> |
76 | <item>Servidor Laboratorio 1</item> | 76 | <item>Servidor Laboratorio 1</item> |
77 | <item>Servidor Laboratorio 2</item> | 77 | <item>Servidor Laboratorio 2</item> |
78 | <item>Servidor Laboratorio 3</item> | 78 | <item>Servidor Laboratorio 3</item> |
79 | </string-array> | 79 | </string-array> |
80 | <string name="leyendaSpinner">Seleccione Servidor Predeterminado</string> | 80 | <string name="leyendaSpinner">Seleccione Servidor Predeterminado</string> |
81 | 81 | ||
82 | <string name="cbMostrarExistencia">Existencia</string> | 82 | <string name="cbMostrarExistencia">Existencia</string> |
83 | <string name="cbMostrarPrecio">Precio</string> | 83 | <string name="cbMostrarPrecio">Precio</string> |
84 | 84 | ||
85 | <string name="btnGuardar">Guardar Cambios</string> | 85 | <string name="btnGuardar">Guardar Cambios</string> |
86 | 86 | ||
87 | <!-- fragment Actualizacion de Maestros--> | 87 | <!-- fragment Actualizacion de Maestros--> |
88 | <string name="tvActMaestros">Importaciones</string> | 88 | <string name="tvActMaestros">Importaciones</string> |
89 | <string name="tvMedio">Seleccione que tipo de importación desea realizar</string> | 89 | <string name="tvMedio">Seleccione que tipo de importación desea realizar</string> |
90 | <string name="obPorWifi">Importación de artículos</string> | 90 | <string name="obPorWifi">Importación de artículos</string> |
91 | <string name="obViaArchivo">Importación de inventarios</string> | 91 | <string name="obViaArchivo">Importación de inventarios</string> |
92 | 92 | ||
93 | <string name="btnConfirmarAct">Confirmar Importación</string> | 93 | <string name="btnConfirmarAct">Confirmar Importación</string> |
94 | 94 | ||
95 | <!-- Fragment Save--> | 95 | <!-- Fragment Save--> |
96 | <string name="tvConfServi">Configuración de Servidores</string> | 96 | <string name="tvConfServi">Configuración de Servidores</string> |
97 | <string name="server">Ingrese la direccion del servidor</string> | 97 | <string name="server">Ingrese la direccion del servidor</string> |
98 | <string name="etNomServer">Ingrese una descripción para la conexión</string> | 98 | <string name="etNomServer">Ingrese una descripción para la conexión</string> |
99 | <string name="btnGuardarConfServ">Guardar Conexión</string> | 99 | <string name="btnGuardarConfServ">Guardar Conexión</string> |
100 | 100 | ||
101 | <!-- Dialog--> | 101 | <!-- Dialog--> |
102 | <string name="sTitulo">Producto Buscado</string> | 102 | <string name="sTitulo">Producto Buscado</string> |
103 | <string name="btnOk">Aceptar</string> | 103 | <string name="btnOk">Aceptar</string> |
104 | <string name="btnCancelar">Cancelar</string> | 104 | <string name="btnCancelar">Cancelar</string> |
105 | <string name="sMensaje">¡No se encontro el producto ingresado!</string> | 105 | <string name="sMensaje">¡No se encontro el producto ingresado!</string> |
106 | <string name="sMensajeEncontrado">¡Ingrese nueva cantidad!</string> | 106 | <string name="sMensajeEncontrado">¡Ingrese nueva cantidad!</string> |
107 | <string name="sTituloNueva">Producto ingresado esta cargado</string> | 107 | <string name="sTituloNueva">Producto ingresado esta cargado</string> |
108 | <string name="sCantidadNueva">¡Por favor ingrese la nueva Cantidad!</string> | 108 | <string name="sCantidadNueva">¡Por favor ingrese la nueva Cantidad!</string> |
109 | 109 | ||
110 | <string name="sMensajeExportar">¡Confirma que exporta el Inventario!</string> | 110 | <string name="sMensajeExportar">¡Confirma que exporta el Inventario!</string> |
111 | <string name="sTituloExportar">Exportación de Inventarios</string> | 111 | <string name="sTituloExportar">Exportación de Inventarios</string> |
112 | 112 | ||
113 | <!-- FRAGMENT SERVIDOR--> | 113 | <!-- FRAGMENT SERVIDOR--> |
114 | <string name="tvTitutloServer">Alta de Servidores</string> | 114 | <string name="tvTitutloServer">Alta de Servidores</string> |
115 | <string name="tvNomServer">Ingrese un nombre para identificar al servidor</string> | 115 | <string name="tvNomServer">Ingrese un nombre para identificar al servidor</string> |
116 | <string name="tvDirServer">Ingrese la dirección del servidor</string> | 116 | <string name="tvDirServer">Ingrese la dirección del servidor</string> |
117 | <string name="btnGuardarServidores">Guardar Servidor</string> | 117 | <string name="btnGuardarServidores">Guardar Servidor</string> |
118 | 118 | ||
119 | <string name="tvSeleccion">Toque sobre la operación que desea realizar</string> | 119 | <string name="tvSeleccion">Toque sobre la operación que desea realizar</string> |
120 | <string name="rbSumar">Sumar</string> | 120 | <string name="rbSumar">Sumar</string> |
121 | <string name="rbRestar">Restar</string> | 121 | <string name="rbRestar">Restar</string> |
122 | <string name="rbModificar">Reemplazar</string> | 122 | <string name="rbModificar">Reemplazar</string> |
123 | <string name="tvTotal">Cantidad Final</string>tvTotal | 123 | <string name="tvTotal">Cantidad Final</string>tvTotal |
124 | <string name="tvResultado">Cantidad final:</string>tvTotal | 124 | <string name="tvResultado">Cantidad final:</string>tvTotal |
125 | 125 | ||
126 | <string name="large_text"> | 126 | <string name="large_text"> |
127 | "Material is the metaphor.\n\n" | 127 | "Material is the metaphor.\n\n" |
128 | 128 | ||
129 | "A material metaphor is the unifying theory of a rationalized space and a system of motion." | 129 | "A material metaphor is the unifying theory of a rationalized space and a system of motion." |
130 | "The material is grounded in tactile reality, inspired by the study of paper and ink, yet " | 130 | "The material is grounded in tactile reality, inspired by the study of paper and ink, yet " |
131 | "technologically advanced and open to imagination and magic.\n" | 131 | "technologically advanced and open to imagination and magic.\n" |
132 | "Surfaces and edges of the material provide visual cues that are grounded in reality. The " | 132 | "Surfaces and edges of the material provide visual cues that are grounded in reality. The " |
133 | "use of familiar tactile attributes helps users quickly understand affordances. Yet the " | 133 | "use of familiar tactile attributes helps users quickly understand affordances. Yet the " |
134 | "flexibility of the material creates new affordances that supercede those in the physical " | 134 | "flexibility of the material creates new affordances that supercede those in the physical " |
135 | "world, without breaking the rules of physics.\n" | 135 | "world, without breaking the rules of physics.\n" |
136 | "The fundamentals of light, surface, and movement are key to conveying how objects move, " | 136 | "The fundamentals of light, surface, and movement are key to conveying how objects move, " |
137 | "interact, and exist in space and in relation to each other. Realistic lighting shows " | 137 | "interact, and exist in space and in relation to each other. Realistic lighting shows " |
138 | "seams, divides space, and indicates moving parts.\n\n" | 138 | "seams, divides space, and indicates moving parts.\n\n" |
139 | 139 | ||
140 | "Bold, graphic, intentional.\n\n" | 140 | "Bold, graphic, intentional.\n\n" |
141 | 141 | ||
142 | "The foundational elements of print based design typography, grids, space, scale, color, " | 142 | "The foundational elements of print based design typography, grids, space, scale, color, " |
143 | "and use of imagery guide visual treatments. These elements do far more than please the " | 143 | "and use of imagery guide visual treatments. These elements do far more than please the " |
144 | "eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge " | 144 | "eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge " |
145 | "imagery, large scale typography, and intentional white space create a bold and graphic " | 145 | "imagery, large scale typography, and intentional white space create a bold and graphic " |
146 | "interface that immerse the user in the experience.\n" | 146 | "interface that immerse the user in the experience.\n" |
147 | "An emphasis on user actions makes core functionality immediately apparent and provides " | 147 | "An emphasis on user actions makes core functionality immediately apparent and provides " |
148 | "waypoints for the user.\n\n" | 148 | "waypoints for the user.\n\n" |
149 | 149 | ||
150 | "Motion provides meaning.\n\n" | 150 | "Motion provides meaning.\n\n" |
151 | 151 | ||
152 | "Motion respects and reinforces the user as the prime mover. Primary user actions are " | 152 | "Motion respects and reinforces the user as the prime mover. Primary user actions are " |
153 | "inflection points that initiate motion, transforming the whole design.\n" | 153 | "inflection points that initiate motion, transforming the whole design.\n" |
154 | "All action takes place in a single environment. Objects are presented to the user without " | 154 | "All action takes place in a single environment. Objects are presented to the user without " |
155 | "breaking the continuity of experience even as they transform and reorganize.\n" | 155 | "breaking the continuity of experience even as they transform and reorganize.\n" |
156 | "Motion is meaningful and appropriate, serving to focus attention and maintain continuity. " | 156 | "Motion is meaningful and appropriate, serving to focus attention and maintain continuity. " |
157 | "Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n" | 157 | "Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n" |
158 | 158 | ||
159 | "3D world.\n\n" | 159 | "3D world.\n\n" |
160 | 160 | ||
161 | "The material environment is a 3D space, which means all objects have x, y, and z " | 161 | "The material environment is a 3D space, which means all objects have x, y, and z " |
162 | "dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the " | 162 | "dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the " |
163 | "positive z-axis extending towards the viewer. Every sheet of material occupies a single " | 163 | "positive z-axis extending towards the viewer. Every sheet of material occupies a single " |
164 | "position along the z-axis and has a standard 1dp thickness.\n" | 164 | "position along the z-axis and has a standard 1dp thickness.\n" |
165 | "On the web, the z-axis is used for layering and not for perspective. The 3D world is " | 165 | "On the web, the z-axis is used for layering and not for perspective. The 3D world is " |
166 | "emulated by manipulating the y-axis.\n\n" | 166 | "emulated by manipulating the y-axis.\n\n" |
167 | 167 | ||
168 | "Light and shadow.\n\n" | 168 | "Light and shadow.\n\n" |
169 | 169 | ||
170 | "Within the material environment, virtual lights illuminate the scene. Key lights create " | 170 | "Within the material environment, virtual lights illuminate the scene. Key lights create " |
171 | "directional shadows, while ambient light creates soft shadows from all angles.\n" | 171 | "directional shadows, while ambient light creates soft shadows from all angles.\n" |
172 | "Shadows in the material environment are cast by these two light sources. In Android " | 172 | "Shadows in the material environment are cast by these two light sources. In Android " |
173 | "development, shadows occur when light sources are blocked by sheets of material at " | 173 | "development, shadows occur when light sources are blocked by sheets of material at " |
174 | "various positions along the z-axis. On the web, shadows are depicted by manipulating the " | 174 | "various positions along the z-axis. On the web, shadows are depicted by manipulating the " |
175 | "y-axis only. The following example shows the card with a height of 6dp.\n\n" | 175 | "y-axis only. The following example shows the card with a height of 6dp.\n\n" |
176 | 176 | ||
177 | "Resting elevation.\n\n" | 177 | "Resting elevation.\n\n" |
178 | 178 | ||
179 | "All material objects, regardless of size, have a resting elevation, or default elevation " | 179 | "All material objects, regardless of size, have a resting elevation, or default elevation " |
180 | "that does not change. If an object changes elevation, it should return to its resting " | 180 | "that does not change. If an object changes elevation, it should return to its resting " |
181 | "elevation as soon as possible.\n\n" | 181 | "elevation as soon as possible.\n\n" |
182 | 182 | ||
183 | "Component elevations.\n\n" | 183 | "Component elevations.\n\n" |
184 | 184 | ||
185 | "The resting elevation for a component type is consistent across apps (e.g., FAB elevation " | 185 | "The resting elevation for a component type is consistent across apps (e.g., FAB elevation " |
186 | "does not vary from 6dp in one app to 16dp in another app).\n" | 186 | "does not vary from 6dp in one app to 16dp in another app).\n" |
187 | "Components may have different resting elevations across platforms, depending on the depth " | 187 | "Components may have different resting elevations across platforms, depending on the depth " |
188 | "of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n" | 188 | "of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n" |
189 | 189 | ||
190 | "Responsive elevation and dynamic elevation offsets.\n\n" | 190 | "Responsive elevation and dynamic elevation offsets.\n\n" |
191 | 191 | ||
192 | "Some component types have responsive elevation, meaning they change elevation in response " | 192 | "Some component types have responsive elevation, meaning they change elevation in response " |
193 | "to user input (e.g., normal, focused, and pressed) or system events. These elevation " | 193 | "to user input (e.g., normal, focused, and pressed) or system events. These elevation " |
194 | "changes are consistently implemented using dynamic elevation offsets.\n" | 194 | "changes are consistently implemented using dynamic elevation offsets.\n" |
195 | "Dynamic elevation offsets are the goal elevation that a component moves towards, relative " | 195 | "Dynamic elevation offsets are the goal elevation that a component moves towards, relative " |
196 | "to the component’s resting state. They ensure that elevation changes are consistent " | 196 | "to the component’s resting state. They ensure that elevation changes are consistent " |
197 | "across actions and component types. For example, all components that lift on press have " | 197 | "across actions and component types. For example, all components that lift on press have " |
198 | "the same elevation change relative to their resting elevation.\n" | 198 | "the same elevation change relative to their resting elevation.\n" |
199 | "Once the input event is completed or cancelled, the component will return to its resting " | 199 | "Once the input event is completed or cancelled, the component will return to its resting " |
200 | "elevation.\n\n" | 200 | "elevation.\n\n" |
201 | 201 | ||
202 | "Avoiding elevation interference.\n\n" | 202 | "Avoiding elevation interference.\n\n" |
203 | 203 | ||
204 | "Components with responsive elevations may encounter other components as they move between " | 204 | "Components with responsive elevations may encounter other components as they move between " |
205 | "their resting elevations and dynamic elevation offsets. Because material cannot pass " | 205 | "their resting elevations and dynamic elevation offsets. Because material cannot pass " |
206 | "through other material, components avoid interfering with one another any number of ways, " | 206 | "through other material, components avoid interfering with one another any number of ways, " |
207 | "whether on a per component basis or using the entire app layout.\n" | 207 | "whether on a per component basis or using the entire app layout.\n" |
208 | "On a component level, components can move or be removed before they cause interference. " | 208 | "On a component level, components can move or be removed before they cause interference. " |
209 | "For example, a floating action button (FAB) can disappear or move off screen before a " | 209 | "For example, a floating action button (FAB) can disappear or move off screen before a " |
210 | "user picks up a card, or it can move if a snackbar appears.\n" | 210 | "user picks up a card, or it can move if a snackbar appears.\n" |
211 | "On the layout level, design your app layout to minimize opportunities for interference. " | 211 | "On the layout level, design your app layout to minimize opportunities for interference. " |
212 | "For example, position the FAB to one side of stream of a cards so the FAB won’t interfere " | 212 | "For example, position the FAB to one side of stream of a cards so the FAB won’t interfere " |
213 | "when a user tries to pick up one of cards.\n\n" | 213 | "when a user tries to pick up one of cards.\n\n" |
214 | </string> | 214 | </string> |
215 | </resources> | 215 | </resources> |