Commit 2734bbec8718f14c921c6b752a5d244a7218b3af
1 parent
b5325948ae
Exists in
master
25022020 1340
Showing
21 changed files
with
353 additions
and
296 deletions
Show diff stats
app/src/main/AndroidManifest.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
3 | package="com.focasoftware.deboinventariov20"> | 3 | package="com.focasoftware.deboinventariov20"> |
4 | 4 | ||
5 | <uses-permission android:name="android.permission.VIBRATE" /> | 5 | <uses-permission android:name="android.permission.VIBRATE" /> |
6 | <uses-permission android:name="android.permission.INTERNET" /> | 6 | <uses-permission android:name="android.permission.INTERNET" /> |
7 | 7 | ||
8 | <application | 8 | <application |
9 | android:allowBackup="true" | 9 | android:allowBackup="true" |
10 | android:icon="@mipmap/ic_launcher" | 10 | android:icon="@mipmap/ic_launcher" |
11 | android:label="@string/app_name" | 11 | android:label="@string/app_name" |
12 | android:roundIcon="@mipmap/ic_launcher_round" | 12 | android:roundIcon="@mipmap/ic_launcher_round" |
13 | android:supportsRtl="true" | 13 | android:supportsRtl="true" |
14 | android:theme="@style/AppTheme" | 14 | android:theme="@style/AppTheme" |
15 | android:usesCleartextTraffic="true"> | 15 | android:usesCleartextTraffic="true"> |
16 | <activity | 16 | <activity |
17 | android:name=".MainActivity" | 17 | android:name=".ui.SplashActivity" |
18 | android:label="@string/app_name" | 18 | android:label="@string/app_name" |
19 | android:theme="@style/AppTheme.NoActionBar"> | 19 | android:theme="@style/AppTheme.NoActionBar"> |
20 | <intent-filter> | 20 | <intent-filter> |
21 | <action android:name="android.intent.action.MAIN" /> | 21 | <action android:name="android.intent.action.MAIN" /> |
22 | 22 | ||
23 | <category android:name="android.intent.category.LAUNCHER" /> | 23 | <category android:name="android.intent.category.LAUNCHER" /> |
24 | </intent-filter> | 24 | </intent-filter> |
25 | </activity> | 25 | </activity> |
26 | <activity | ||
27 | android:name=".ui.MainActivity" | ||
28 | android:label="@string/app_name" | ||
29 | android:theme="@style/AppTheme.NoActionBar"> | ||
30 | |||
31 | </activity> | ||
26 | </application> | 32 | </application> |
27 | 33 | ||
28 | </manifest> | 34 | </manifest> |
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 | 9 | ||
10 | @Dao | 10 | @Dao |
11 | interface ArticulosDAO { | 11 | interface ArticulosDAO { |
12 | 12 | ||
13 | // TABLA ARTICULOS | 13 | // TABLA ARTICULOS |
14 | @Insert(onConflict = OnConflictStrategy.REPLACE) | 14 | @Insert(onConflict = OnConflictStrategy.REPLACE) |
15 | suspend fun insertArticulos(articulos: Articles?) | 15 | suspend fun insertArticulos(articulos: Articles?) |
16 | 16 | ||
17 | @Query("SELECT * FROM $TABLA_ART ORDER BY DES DESC") | 17 | @Query("SELECT * FROM $TABLA_ART ORDER BY DES DESC") |
18 | suspend fun findAllArticulos(): List<Articles> | 18 | suspend fun findAllArticulos(): List<Articles> |
19 | 19 | ||
20 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND DES LIKE '%' || :description || '%' GROUP BY DES ORDER BY DES") | 20 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND DES LIKE '%' || :description || '%' GROUP BY DES ORDER BY DES") |
21 | suspend fun findArticuloByDesc(description: String?, dep: Int): List<Articles> | 21 | suspend fun findArticuloByDesc(description: String?, dep: Int): List<Articles> |
22 | 22 | ||
23 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND CB LIKE :codBarra") | 23 | @Query("SELECT * FROM $TABLA_ART WHERE DEPSN=:dep AND CB LIKE :codBarra") |
24 | suspend fun findArticuloByCodBar(codBarra: String?, dep: Int): Articles? | 24 | suspend fun findArticuloByCodBar(codBarra: String?, dep: Int): Articles? |
25 | 25 | ||
26 | @Query("DELETE FROM $TABLA_ART") | 26 | @Query("DELETE FROM $TABLA_ART") |
27 | suspend fun deleteAllArticulos() | 27 | suspend fun deleteAllArticulos() |
28 | } | 28 | } |
29 | 29 | ||
30 | @Dao | 30 | @Dao |
31 | interface InvHeadDAO { | 31 | interface InvHeadDAO { |
32 | @Insert() | 32 | @Insert() |
33 | suspend fun insertInvHead(invHead: InvHead?) | 33 | suspend fun insertInvHead(invHead: InvHead?) |
34 | 34 | ||
35 | @Query("SELECT INV_NUM FROM $TABLA_INV_H ORDER BY INV_NUM DESC") | 35 | @Query("SELECT INV_NUM FROM $TABLA_INV_H ORDER BY INV_NUM DESC") |
36 | suspend fun findLastInv(): Int | 36 | suspend fun findLastInv(): Int |
37 | 37 | ||
38 | @Query("DELETE FROM $TABLA_INV_H") | 38 | @Query("DELETE FROM $TABLA_INV_H") |
39 | suspend fun deleteAllArticulos() | 39 | suspend fun deleteAllArticulos() |
40 | 40 | ||
41 | @Query("DELETE FROM $TABLA_INV_H WHERE INV_NUM=:inven") | 41 | @Query("DELETE FROM $TABLA_INV_H WHERE INV_NUM=:inven") |
42 | suspend fun deleteinvHead(inven: Int) | 42 | suspend fun deleteinvHead(inven: Int) |
43 | 43 | ||
44 | @Query("SELECT * FROM $TABLA_INV_H ORDER BY INV_FEI") | 44 | @Query("SELECT * FROM $TABLA_INV_H ORDER BY INV_FEI") |
45 | suspend fun fetchAllInvHead(): List<InvHead> | 45 | suspend fun fetchAllInvHead(): List<InvHead> |
46 | } | 46 | } |
47 | 47 | ||
48 | @Dao | 48 | @Dao |
49 | interface InvBodyDAO { | 49 | interface InvBodyDAO { |
50 | @Insert() | 50 | @Insert() |
51 | suspend fun insertInvBody(invBody: InvBody?) | 51 | suspend fun insertInvBody(invBody: InvBody?) |
52 | 52 | ||
53 | @Query("DELETE FROM $TABLA_INV_B") | 53 | @Query("DELETE FROM $TABLA_INV_B") |
54 | suspend fun deleteAllInvBody() | 54 | suspend fun deleteAllInvBody() |
55 | 55 | ||
56 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:inven") | 56 | @Query("DELETE FROM $TABLA_INV_B WHERE INV_NUM =:inven") |
57 | suspend fun deleteInvBody(inven: Int) | 57 | suspend fun deleteInvBody(inven: Int) |
58 | 58 | ||
59 | @Query("UPDATE $TABLA_INV_B SET CANT=:cant WHERE SEC=:sec AND COD=:cod") | 59 | @Query("UPDATE $TABLA_INV_B SET CANT=:cant WHERE SEC=:sec AND COD=:cod") |
60 | suspend fun UpdateInvBody(cant: Float, sec: String, cod: String) | 60 | suspend fun UpdateInvBody(cant: Float, sec: String, cod: String) |
61 | 61 | ||
62 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:inven ORDER BY INV_FEI DESC") | 62 | @Query("SELECT * FROM $TABLA_INV_B WHERE INV_NUM =:inven ORDER BY INV_FEI DESC") |
63 | suspend fun fetchAllInvBody(inven:Int): List<InvBody> | 63 | suspend fun fetchAllInvBody(inven:Int): List<InvBody> |
64 | } | 64 | } |
65 | @Dao | 65 | @Dao |
66 | interface ServeInvDao { | 66 | interface ServeInvDao { |
67 | @Insert(onConflict = OnConflictStrategy.REPLACE) | 67 | @Insert(onConflict = OnConflictStrategy.REPLACE) |
68 | fun insertServer(servidor: ServeInv) | 68 | fun insertServer(servidor: ServeInv) |
69 | 69 | ||
70 | @Query("SELECT SER_NUM,SER_DESC, SER_DIR FROM $TABLA_SERV_INV") | 70 | @Query("SELECT * FROM ServeInv") |
71 | suspend fun fetchAllServers(): List<ServeInv> | 71 | suspend fun fetchAllServers(): List<ServeInv> |
72 | 72 | ||
73 | @Query("DELETE FROM ServeInv WHERE SER_NUM = :number") | 73 | @Query("DELETE FROM ServeInv WHERE SER_NUM = :number") |
74 | suspend fun deleteServer(number: Long) | 74 | suspend fun deleteServer(number: Long) |
75 | |||
76 | @Query("SELECT SER_NUM FROM ServeInv ORDER BY SER_NUM DESC") | ||
77 | suspend fun findLastSer(): Long | ||
75 | } | 78 | } |
app/src/main/java/com/focasoftware/deboinventariov20/MainActivity.kt
1 | package com.focasoftware.deboinventariov20 | File was deleted | |
2 | |||
3 | import android.os.Bundle | ||
4 | import android.view.Menu | ||
5 | import com.google.android.material.floatingactionbutton.FloatingActionButton | ||
6 | import com.google.android.material.snackbar.Snackbar | ||
7 | import com.google.android.material.navigation.NavigationView | ||
8 | import androidx.navigation.findNavController | ||
9 | import androidx.navigation.ui.AppBarConfiguration | ||
10 | import androidx.navigation.ui.navigateUp | ||
11 | import androidx.navigation.ui.setupActionBarWithNavController | ||
12 | import androidx.navigation.ui.setupWithNavController | ||
13 | import androidx.drawerlayout.widget.DrawerLayout | ||
14 | import androidx.appcompat.app.AppCompatActivity | ||
15 | import androidx.appcompat.widget.Toolbar | ||
16 | |||
17 | class MainActivity : AppCompatActivity() { | ||
18 | |||
19 | private lateinit var appBarConfiguration: AppBarConfiguration | ||
20 | |||
21 | override fun onCreate(savedInstanceState: Bundle?) { | ||
22 | super.onCreate(savedInstanceState) | ||
23 | setContentView(R.layout.activity_main) | ||
24 | val toolbar: Toolbar = findViewById(R.id.toolbar) | ||
25 | setSupportActionBar(toolbar) | ||
26 | |||
27 | |||
28 | val drawerLayout: DrawerLayout = findViewById(R.id.drawer_layout) | ||
29 | val navView: NavigationView = findViewById(R.id.nav_view) | ||
30 | val navController = findNavController(R.id.nav_host_fragment) | ||
31 | |||
32 | appBarConfiguration = AppBarConfiguration(setOf( | ||
33 | R.id.mainFragment2,R.id.inventarioFragment, R.id.actuaMaestrosFragment, R.id.configuracionFragment), drawerLayout) | ||
34 | setupActionBarWithNavController(navController, appBarConfiguration) | ||
35 | navView.setupWithNavController(navController) | ||
36 | } | ||
37 | |||
38 | override fun onCreateOptionsMenu(menu: Menu): Boolean { | ||
39 | // Inflate the menu; this adds items to the action bar if it is present. | ||
40 | menuInflater.inflate(R.menu.main, menu) | ||
41 | return true | ||
42 | } | ||
43 | |||
44 | override fun onSupportNavigateUp(): Boolean { | ||
45 | val navController = findNavController(R.id.nav_host_fragment) | ||
46 | return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp() | ||
47 | } | ||
48 | } |
app/src/main/java/com/focasoftware/deboinventariov20/Model/ProductosService.kt
1 | package com.focasoftware.deboinventariov20.Model | 1 | package com.focasoftware.deboinventariov20.Model |
2 | 2 | ||
3 | import retrofit2.Retrofit | 3 | import retrofit2.Retrofit |
4 | import retrofit2.converter.gson.GsonConverterFactory | 4 | import retrofit2.converter.gson.GsonConverterFactory |
5 | 5 | ||
6 | object ProductosService { | 6 | object ProductosService { |
7 | private val BASE_URL ="http://10.0.2.2:3000/" | 7 | private val BASE_URL ="http://192.168.0.8:3000/" |
8 | //"http://10.231.45.83:3000/" | 8 | //"http://10.0.2.2:3000/" |
9 | 9 | ||
10 | 10 | ||
11 | fun getProductosService(): ProductosApi { | 11 | fun getProductosService(): ProductosApi { |
12 | return Retrofit.Builder() | 12 | return Retrofit.Builder() |
13 | .baseUrl(BASE_URL) | 13 | .baseUrl(BASE_URL) |
14 | .addConverterFactory(GsonConverterFactory.create()) | 14 | .addConverterFactory(GsonConverterFactory.create()) |
15 | .build() | 15 | .build() |
16 | .create(ProductosApi::class.java) | 16 | .create(ProductosApi::class.java) |
17 | } | 17 | } |
18 | } | 18 | } |
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( | 13 | data class Productos(@SerializedName("SEC") var sector: String?, |
14 | @SerializedName("SEC")var sector: String?, | ||
15 | @SerializedName("COD") var codigo: String?, | 14 | @SerializedName("COD") var codigo: String?, |
16 | @SerializedName("DESC") var descripcion: String?, | 15 | @SerializedName("DESC") var descripcion: String?, |
17 | @SerializedName("CB") var codBar: String?, | 16 | @SerializedName("CB") var codBar: String?, |
18 | @SerializedName("CBC") var codOrigen: String?, | 17 | @SerializedName("CBC") var codOrigen: String?, |
19 | @SerializedName("PRE_VTA") var precio: String?, | 18 | @SerializedName("PRE_VTA") var precio: String?, |
20 | @SerializedName("PRE_COS") var costo: String?, | 19 | @SerializedName("PRE_COS") var costo: String?, |
21 | @SerializedName("BAL") var balanza: Int?, | 20 | @SerializedName("BAL") var balanza: Int?, |
22 | @SerializedName("DEPSN") var depSn: Int?, | 21 | @SerializedName("DEPSN") var depSn: Int?, |
23 | @SerializedName("FOTO") var imagen: String?) | 22 | @SerializedName("FOTO") var imagen: String?) |
24 | 23 | ||
25 | @Entity(tableName = TABLA_ART) | 24 | @Entity(tableName = TABLA_ART) |
26 | data class Articles( | 25 | data class Articles(@ColumnInfo(name = "SEC") var sector: String?, |
27 | @ColumnInfo(name = "SEC") var sector: String?, | ||
28 | @ColumnInfo(name = "COD") var codigo: String?, | 26 | @ColumnInfo(name = "COD") var codigo: String?, |
29 | @ColumnInfo(name = "DES") var descripcion: String?, | 27 | @ColumnInfo(name = "DES") var descripcion: String?, |
30 | @ColumnInfo(name = "CB") var codBar: String?, | 28 | @ColumnInfo(name = "CB") var codBar: String?, |
31 | @ColumnInfo(name = "CBC") var codOrigen: String?, | 29 | @ColumnInfo(name = "CBC") var codOrigen: String?, |
32 | @ColumnInfo(name = "PRE_VTA") var precio: String?, | 30 | @ColumnInfo(name = "PRE_VTA") var precio: String?, |
33 | @ColumnInfo(name = "PRE_COS") var costo: String?, | 31 | @ColumnInfo(name = "PRE_COS") var costo: String?, |
34 | @ColumnInfo(name = "BAL") var balanza: Int?, | 32 | @ColumnInfo(name = "BAL") var balanza: Int?, |
35 | @ColumnInfo(name = "DEPSN") var depSn: Int?, | 33 | @ColumnInfo(name = "DEPSN") var depSn: Int?, |
36 | @ColumnInfo(name = "FOTO") var imagen: String?) : Serializable { | 34 | @ColumnInfo(name = "FOTO") var imagen: String?) : Serializable { |
37 | @PrimaryKey(autoGenerate = true) | 35 | @PrimaryKey(autoGenerate = true) |
38 | @ColumnInfo(name = "id") var id: Long = 0 | 36 | @ColumnInfo(name = "id") |
37 | var id: Long = 0 | ||
39 | } | 38 | } |
40 | 39 | ||
41 | 40 | ||
42 | @Entity(tableName = TABLA_INV_H) | 41 | @Entity(tableName = TABLA_INV_H) |
43 | data class InvHead(@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "INV_NUM") var invNum: Int, | 42 | data class InvHead(@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "INV_NUM") var invNum: Int, |
44 | @ColumnInfo(name = "INV_DESC") var descripcion: String?, | 43 | @ColumnInfo(name = "INV_DESC") var descripcion: String?, |
45 | @ColumnInfo(name = "ESTADO") var estado: Int?, | 44 | @ColumnInfo(name = "ESTADO") var estado: Int?, |
46 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, | 45 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, |
47 | @ColumnInfo(name = "INV_FEF") var fechaFinal: String?, | 46 | @ColumnInfo(name = "INV_FEF") var fechaFinal: String?, |
48 | // productos contados en el inventario | 47 | // productos contados en el inventario |
49 | @ColumnInfo(name = "INV_PRODCONT") var prodContados: Long?, | 48 | @ColumnInfo(name = "INV_PRODCONT") var prodContados: Long?, |
50 | @ColumnInfo(name = "INV_LUG") var lugar: Int?, | 49 | @ColumnInfo(name = "INV_LUG") var lugar: Int?, |
51 | // Solo se ajustan los productos incluidos en el conteo=0 | 50 | // Solo se ajustan los productos incluidos en el conteo=0 |
52 | // Ajusta productos no incluidos en el conteo con stock en cero=1 | 51 | // Ajusta productos no incluidos en el conteo con stock en cero=1 |
53 | @ColumnInfo(name = "PRO_NO_CONTA") var stDesc: Int?, | 52 | @ColumnInfo(name = "PRO_NO_CONTA") var stDesc: Int?, |
54 | // Mostror stock en el sistema al momento de la descarga del maestro. | 53 | // Mostror stock en el sistema al momento de la descarga del maestro. |
55 | @ColumnInfo(name = "MOSTRAR_STOCK") var proNoCont: Int?) | 54 | @ColumnInfo(name = "MOSTRAR_STOCK") var proNoCont: Int?) |
56 | 55 | ||
57 | 56 | ||
58 | @Entity(tableName = TABLA_INV_B) | 57 | @Entity(tableName = TABLA_INV_B) |
59 | data class InvBody( | 58 | data class InvBody(@ColumnInfo(name = "INV_NUM") var invNum: Int, |
60 | @ColumnInfo(name = "INV_NUM") var invNum: Int, | ||
61 | @ColumnInfo(name = "SEC") var sector: String?, | 59 | @ColumnInfo(name = "SEC") var sector: String?, |
62 | @ColumnInfo(name = "COD") var codigo: String?, | 60 | @ColumnInfo(name = "COD") var codigo: String?, |
63 | @ColumnInfo(name = "DES") var descripcion: String?, | 61 | @ColumnInfo(name = "DES") var descripcion: String?, |
64 | @ColumnInfo(name = "CANT") var cantTomada: String?, | 62 | @ColumnInfo(name = "CANT") var cantTomada: String?, |
65 | @ColumnInfo(name = "CB") var codBar: String?, | 63 | @ColumnInfo(name = "CB") var codBar: String?, |
66 | @ColumnInfo(name = "CBC") var codOrigen: String?, | 64 | @ColumnInfo(name = "CBC") var codOrigen: String?, |
67 | @ColumnInfo(name = "PRE_VTA") var precio: String?, | 65 | @ColumnInfo(name = "PRE_VTA") var precio: String?, |
68 | @ColumnInfo(name = "PRE_COS") var costo: String?, | 66 | @ColumnInfo(name = "PRE_COS") var costo: String?, |
69 | @ColumnInfo(name = "BAL") var balanza: Int?, | 67 | @ColumnInfo(name = "BAL") var balanza: Int?, |
70 | @ColumnInfo(name = "DSN") var depSn: Int?, | 68 | @ColumnInfo(name = "DSN") var depSn: Int?, |
71 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, | 69 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, |
72 | @ColumnInfo(name = "INV_FEF") var fechaFinal: String?):Serializable{ | 70 | @ColumnInfo(name = "INV_FEF") var fechaFinal: String?) : Serializable { |
73 | @PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") var id: Long = 0 | 71 | @PrimaryKey(autoGenerate = true) |
72 | @ColumnInfo(name = "id") | ||
73 | var id: Long = 0 | ||
74 | } | 74 | } |
75 | 75 | ||
76 | @Entity(tableName = TABLA_SERV_INV) | 76 | @Entity(tableName = TABLA_SERV_INV) |
77 | data class ServeInv( | 77 | data class ServeInv( |
78 | 78 | ||
79 | @ColumnInfo(name = "SER_DESC") var descripcion: String?, @ColumnInfo(name = "SER_DIR") var direccion: String?, @ColumnInfo(name = "SER_PRE") var predeterminado: String?) : Serializable { | 79 | @PrimaryKey(autoGenerate = true) @ColumnInfo(name = "SER_NUM") var SER_NUM: Long, |
80 | @PrimaryKey(autoGenerate = true) | 80 | @ColumnInfo(name = "SER_DESC") var descripcion: String?, |
81 | @ColumnInfo(name = "SER_NUM") | 81 | @ColumnInfo(name = "SER_DIR") var direccion: String?, |
82 | var ID: Int = 0 | 82 | @ColumnInfo(name = "SER_PRE") var predeterminado: String?) |
app/src/main/java/com/focasoftware/deboinventariov20/ui/MainActivity.kt
File was created | 1 | package com.focasoftware.deboinventariov20.ui | |
2 | |||
3 | import android.os.Bundle | ||
4 | import android.view.Menu | ||
5 | import com.google.android.material.navigation.NavigationView | ||
6 | import androidx.navigation.findNavController | ||
7 | import androidx.navigation.ui.AppBarConfiguration | ||
8 | import androidx.navigation.ui.navigateUp | ||
9 | import androidx.navigation.ui.setupActionBarWithNavController | ||
10 | import androidx.navigation.ui.setupWithNavController | ||
11 | import androidx.drawerlayout.widget.DrawerLayout | ||
12 | import androidx.appcompat.app.AppCompatActivity | ||
13 | import androidx.appcompat.widget.Toolbar | ||
14 | import com.focasoftware.deboinventariov20.R | ||
15 | |||
16 | class MainActivity : AppCompatActivity() { | ||
17 | |||
18 | private lateinit var appBarConfiguration: AppBarConfiguration | ||
19 | |||
20 | override fun onCreate(savedInstanceState: Bundle?) { | ||
21 | super.onCreate(savedInstanceState) | ||
22 | setContentView(R.layout.activity_main) | ||
23 | val toolbar: Toolbar = findViewById(R.id.toolbar) | ||
24 | setSupportActionBar(toolbar) | ||
25 | |||
26 | |||
27 | val drawerLayout: DrawerLayout = findViewById(R.id.drawer_layout) | ||
28 | val navView: NavigationView = findViewById(R.id.nav_view) | ||
29 | val navController = findNavController(R.id.nav_host_fragment) | ||
30 | |||
31 | appBarConfiguration = AppBarConfiguration(setOf(R.id.mainFragment2, R.id.inventarioFragment, R.id.actuaMaestrosFragment, R.id.configuracionFragment), drawerLayout) | ||
32 | setupActionBarWithNavController(navController, appBarConfiguration) | ||
33 | navView.setupWithNavController(navController) | ||
34 | } | ||
35 | |||
36 | override fun onCreateOptionsMenu(menu: Menu): Boolean { | ||
37 | // Inflate the menu; this adds items to the action bar if it is present. | ||
38 | menuInflater.inflate(R.menu.main, menu) | ||
39 | return true | ||
40 | } | ||
41 | |||
42 | override fun onSupportNavigateUp(): Boolean { | ||
43 | val navController = findNavController(R.id.nav_host_fragment) | ||
44 | return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp() | ||
45 | } | ||
46 | } |
app/src/main/java/com/focasoftware/deboinventariov20/ui/SplashActivity.kt
File was created | 1 | package com.focasoftware.deboinventariov20.ui | |
2 | |||
3 | import android.app.Activity | ||
4 | import android.content.Intent | ||
5 | import android.os.Bundle | ||
6 | import com.focasoftware.deboinventariov20.R | ||
7 | |||
8 | class SplashActivity : Activity() { | ||
9 | |||
10 | override fun onCreate(savedInstanceState: Bundle?) { | ||
11 | super.onCreate(savedInstanceState) | ||
12 | setContentView(R.layout.activity_splash) | ||
13 | //window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_FULLSCREEN or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | ||
14 | |||
15 | val bac = object : Thread(){ | ||
16 | override fun run(){ | ||
17 | try { | ||
18 | Thread.sleep(500) | ||
19 | val intent = Intent(baseContext, MainActivity:: class.java) | ||
20 | startActivity(intent) | ||
21 | finish() | ||
22 | } catch (e : Exception){ | ||
23 | e.printStackTrace() | ||
24 | } | ||
25 | } | ||
26 | } | ||
27 | bac.start() | ||
28 | } | ||
29 | } | ||
30 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/descripcionFragment/DescripcionFragment.kt
1 | package com.focasoftware.deboinventariov20.ui.descripcionFragment | 1 | package com.focasoftware.deboinventariov20.ui.descripcionFragment |
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.graphics.Canvas | 5 | import android.graphics.Canvas |
6 | import android.graphics.Color | 6 | import android.graphics.Color |
7 | import android.graphics.drawable.ColorDrawable | 7 | import android.graphics.drawable.ColorDrawable |
8 | import android.os.Bundle | 8 | import android.os.Bundle |
9 | import android.text.InputType | 9 | import android.text.InputType |
10 | import android.view.LayoutInflater | 10 | import android.view.LayoutInflater |
11 | import android.view.View | 11 | import android.view.View |
12 | import android.view.ViewGroup | 12 | import android.view.ViewGroup |
13 | import android.widget.Button | 13 | import android.widget.Button |
14 | import androidx.fragment.app.Fragment | 14 | import androidx.fragment.app.Fragment |
15 | import androidx.lifecycle.lifecycleScope | 15 | import androidx.lifecycle.lifecycleScope |
16 | import androidx.navigation.NavController | 16 | import androidx.navigation.NavController |
17 | import androidx.navigation.Navigation | 17 | import androidx.navigation.Navigation |
18 | import androidx.recyclerview.widget.ItemTouchHelper | 18 | import androidx.recyclerview.widget.ItemTouchHelper |
19 | import androidx.recyclerview.widget.LinearLayoutManager | 19 | import androidx.recyclerview.widget.LinearLayoutManager |
20 | import androidx.recyclerview.widget.RecyclerView | 20 | import androidx.recyclerview.widget.RecyclerView |
21 | import com.afollestad.materialdialogs.MaterialDialog | 21 | import com.afollestad.materialdialogs.MaterialDialog |
22 | import com.afollestad.materialdialogs.input.input | 22 | import com.afollestad.materialdialogs.input.input |
23 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 23 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
24 | import com.focasoftware.deboinventariov20.Model.Articles | 24 | import com.focasoftware.deboinventariov20.Model.Articles |
25 | import com.focasoftware.deboinventariov20.Model.InvBody | 25 | import com.focasoftware.deboinventariov20.Model.InvBody |
26 | import com.focasoftware.deboinventariov20.R | 26 | import com.focasoftware.deboinventariov20.R |
27 | import com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment | 27 | import com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment |
28 | import kotlinx.coroutines.Dispatchers | 28 | import kotlinx.coroutines.Dispatchers |
29 | import kotlinx.coroutines.launch | 29 | import kotlinx.coroutines.launch |
30 | import kotlinx.coroutines.withContext | 30 | import kotlinx.coroutines.withContext |
31 | 31 | ||
32 | class DescripcionFragment : Fragment() { | 32 | class DescripcionFragment : Fragment() { |
33 | private var artAcargar2: List<Articles>? = null | 33 | private var artAcargar2: List<Articles>? = null |
34 | private var listArticulos2: List<Articles>? = null | 34 | private var listArticulos2: List<Articles>? = null |
35 | lateinit var viewAdapter2: RecyclerView.Adapter<*> | 35 | lateinit var viewAdapter2: RecyclerView.Adapter<*> |
36 | private lateinit var viewManager2: RecyclerView.LayoutManager | 36 | private lateinit var viewManager2: RecyclerView.LayoutManager |
37 | private lateinit var rcDescripcion: RecyclerView | 37 | private lateinit var rcDescripcion: RecyclerView |
38 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) | 38 | private var swipeBackground: ColorDrawable = ColorDrawable(Color.YELLOW) |
39 | private var cantidad = 0F | 39 | private var cantidad = 0F |
40 | private var numeroInventario = 0 | 40 | private var numeroInventario = 0 |
41 | lateinit var navController: NavController | 41 | lateinit var navController: NavController |
42 | lateinit var sharedPreferences: SharedPreferences | 42 | lateinit var sharedPreferences: SharedPreferences |
43 | private var indice=0 | 43 | private var indice=0 |
44 | 44 | ||
45 | override fun onCreate(savedInstanceState: Bundle?) { | 45 | override fun onCreate(savedInstanceState: Bundle?) { |
46 | super.onCreate(savedInstanceState) | 46 | super.onCreate(savedInstanceState) |
47 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 47 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
48 | arguments.apply { | 48 | arguments.apply { |
49 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> | 49 | artAcargar2 = requireArguments().getSerializable("ArrayDesc") as List<Articles> |
50 | numeroInventario = requireArguments().getInt("numeroInv") | 50 | numeroInventario = requireArguments().getInt("numeroInv") |
51 | } | 51 | } |
52 | } | 52 | } |
53 | 53 | ||
54 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 54 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
55 | super.onViewCreated(view, savedInstanceState) | 55 | super.onViewCreated(view, savedInstanceState) |
56 | navController = Navigation.findNavController(view) | 56 | navController = Navigation.findNavController(view) |
57 | } | 57 | } |
58 | 58 | ||
59 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 59 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
60 | val v = inflater.inflate(R.layout.fragment_descripcion, container, false) | 60 | val v = inflater.inflate(R.layout.fragment_descripcion, container, false) |
61 | rcDescripcion = v.findViewById(R.id.rcDescripcion) | 61 | rcDescripcion = v.findViewById(R.id.rcDescripcion) |
62 | val btnSalir = v.findViewById<Button>(R.id.btnSalir) | 62 | val btnSalir = v.findViewById<Button>(R.id.btnSalir) |
63 | 63 | ||
64 | IngresarRecicler(artAcargar2) | 64 | IngresarRecicler(artAcargar2) |
65 | 65 | ||
66 | btnSalir.setOnClickListener { | 66 | btnSalir.setOnClickListener { |
67 | VolverAinventario() | 67 | VolverAinventario() |
68 | } | 68 | } |
69 | return v | 69 | return v |
70 | } | 70 | } |
71 | 71 | ||
72 | fun IngresarRecicler(articulos: List<Articles>?) { | 72 | fun IngresarRecicler(articulos: List<Articles>?) { |
73 | 73 | ||
74 | viewAdapter2 = DescripcionListAdapter(articulos) | 74 | viewAdapter2 = DescripcionListAdapter(articulos) |
75 | viewManager2 = LinearLayoutManager(requireContext()) | 75 | viewManager2 = LinearLayoutManager(requireContext()) |
76 | 76 | ||
77 | rcDescripcion.apply { | 77 | rcDescripcion.apply { |
78 | adapter = viewAdapter2 | 78 | adapter = viewAdapter2 |
79 | layoutManager = viewManager2 | 79 | layoutManager = viewManager2 |
80 | } | 80 | } |
81 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT) { | 81 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT) { |
82 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | 82 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { |
83 | return false | 83 | return false |
84 | } | 84 | } |
85 | 85 | ||
86 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { | 86 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { |
87 | val type = InputType.TYPE_CLASS_PHONE | 87 | val type = InputType.TYPE_CLASS_NUMBER |
88 | MaterialDialog(requireContext()).show { | 88 | MaterialDialog(requireContext()).show { |
89 | title(text = "Producto: ${(viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion}") | 89 | title(text = "Producto: ${(viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion}") |
90 | message(R.string.sMensajeEncontrado) | 90 | message(R.string.sMensajeEncontrado) |
91 | input (waitForPositiveButton = false ,hint = "99.99", inputType = type){ materialDialog, charSequence -> | 91 | input (waitForPositiveButton = false ,hint = "99.99", inputType = type){ materialDialog, charSequence -> |
92 | cantidad = 0F | 92 | cantidad = 0F |
93 | cantidad = charSequence.toString().toFloat() | 93 | cantidad = charSequence.toString().toFloat() |
94 | } | 94 | } |
95 | // .input("Cantidad",1,,1,0,InputType.TYPE_CLASS_NUMBER,0,waitForPositiveButton = true,false,positiveButton ()) | 95 | // .input("Cantidad",1,,1,0,InputType.TYPE_CLASS_NUMBER,0,waitForPositiveButton = true,false,positiveButton ()) |
96 | positiveButton(R.string.btnOk) { | 96 | positiveButton(R.string.btnOk) { |
97 | dismiss() | 97 | dismiss() |
98 | var indice = 0 | 98 | var indice = 0 |
99 | indice=viewHolder.layoutPosition | 99 | indice=viewHolder.layoutPosition |
100 | 100 | ||
101 | val body = InvBody(numeroInventario, | 101 | val body = InvBody(numeroInventario, |
102 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector, | 102 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.sector, |
103 | // TODO PREPARO PARA MANDAR A CARGAR EN LA BD | 103 | // TODO PREPARO PARA MANDAR A CARGAR EN LA BD |
104 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo, | 104 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codigo, |
105 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion, | 105 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion, |
106 | cantidad.toString(), | 106 | cantidad.toString(), |
107 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codBar, | 107 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codBar, |
108 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codOrigen, | 108 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.codOrigen, |
109 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, | 109 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, |
110 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, | 110 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.precio, |
111 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza, | 111 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.balanza, |
112 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.depSn, | 112 | (viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.depSn, |
113 | InventarioFragment().ObtenerFechaActual(), | 113 | InventarioFragment().ObtenerFechaActual(), |
114 | InventarioFragment().ObtenerFechaActual()) | 114 | InventarioFragment().ObtenerFechaActual()) |
115 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS | 115 | InsertarArtEnDB(body)// TODO: MANDO A CARGAR A LA BASE DE DATOS |
116 | VolverAinventario() | 116 | VolverAinventario() |
117 | } | 117 | } |
118 | }.cancelOnTouchOutside(false).cornerRadius(10F) | 118 | }.cancelOnTouchOutside(false).cornerRadius(10F) |
119 | } | 119 | } |
120 | 120 | ||
121 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | 121 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
122 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 122 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
123 | val itemView = viewHolder.itemView | 123 | val itemView = viewHolder.itemView |
124 | 124 | ||
125 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | 125 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) |
126 | 126 | ||
127 | if (dX > 0) { | 127 | if (dX > 0) { |
128 | 128 | ||
129 | c.drawColor(Color.RED) | 129 | c.drawColor(Color.RED) |
130 | } else if (dX < 0) { | 130 | } else if (dX < 0) { |
131 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) | 131 | // swipeBackground.setBounds(itemView.right+dX.toInt(),itemView.top,itemView.right,itemView.bottom) |
132 | c.drawColor(Color.YELLOW) | 132 | c.drawColor(Color.YELLOW) |
133 | } | 133 | } |
134 | swipeBackground.draw(c) | 134 | swipeBackground.draw(c) |
135 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 135 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
136 | } | 136 | } |
137 | } | 137 | } |
138 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) | 138 | val itemTouchHelper2 = ItemTouchHelper(itemTouchHelperCallback) |
139 | itemTouchHelper2.attachToRecyclerView(rcDescripcion) | 139 | itemTouchHelper2.attachToRecyclerView(rcDescripcion) |
140 | 140 | ||
141 | } | 141 | } |
142 | 142 | ||
143 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { | 143 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { |
144 | lifecycleScope.launch { | 144 | lifecycleScope.launch { |
145 | withContext(Dispatchers.IO) { | 145 | withContext(Dispatchers.IO) { |
146 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) | 146 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) |
147 | } | 147 | } |
148 | } | 148 | } |
149 | } | 149 | } |
150 | fun VolverAinventario(){ | 150 | fun VolverAinventario(){ |
151 | 151 | ||
152 | val editor = sharedPreferences.edit() | 152 | val editor = sharedPreferences.edit() |
153 | editor?.putString("Inventario", numeroInventario.toString()) | 153 | editor?.putString("Inventario", numeroInventario.toString()) |
154 | editor?.apply() | 154 | editor?.apply() |
155 | editor.commit() | 155 | editor.commit() |
156 | navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) | 156 | navController.navigate(R.id.action_descripcionFragment_to_inventarioFragment) |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/inventario/InventarioFragment.kt
1 | package com.focasoftware.deboinventariov20.ui.inventario | 1 | package com.focasoftware.deboinventariov20.ui.inventario |
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.graphics.Canvas | 5 | import android.graphics.Canvas |
6 | import android.graphics.Color | 6 | import android.graphics.Color |
7 | import android.graphics.drawable.Drawable | 7 | import android.graphics.drawable.Drawable |
8 | import android.os.Bundle | 8 | import android.os.Bundle |
9 | import android.text.InputType | 9 | import android.text.InputType |
10 | import android.view.KeyEvent | 10 | import android.view.KeyEvent |
11 | import android.view.LayoutInflater | 11 | import android.view.LayoutInflater |
12 | import android.view.View | 12 | import android.view.View |
13 | import android.view.ViewGroup | 13 | import android.view.ViewGroup |
14 | import android.widget.EditText | 14 | import android.widget.EditText |
15 | import android.widget.TextView | 15 | import android.widget.TextView |
16 | import android.widget.Toast | 16 | import android.widget.Toast |
17 | import androidx.core.content.ContextCompat | 17 | import androidx.core.content.ContextCompat |
18 | import androidx.core.os.bundleOf | 18 | import androidx.core.os.bundleOf |
19 | import androidx.fragment.app.Fragment | 19 | import androidx.fragment.app.Fragment |
20 | import androidx.lifecycle.lifecycleScope | 20 | import androidx.lifecycle.lifecycleScope |
21 | import androidx.navigation.NavController | 21 | import androidx.navigation.NavController |
22 | import androidx.navigation.Navigation | 22 | import androidx.navigation.Navigation |
23 | import androidx.recyclerview.widget.ItemTouchHelper | 23 | import androidx.recyclerview.widget.ItemTouchHelper |
24 | import androidx.recyclerview.widget.LinearLayoutManager | 24 | import androidx.recyclerview.widget.LinearLayoutManager |
25 | import androidx.recyclerview.widget.RecyclerView | 25 | import androidx.recyclerview.widget.RecyclerView |
26 | import com.afollestad.materialdialogs.MaterialDialog | 26 | import com.afollestad.materialdialogs.MaterialDialog |
27 | import com.afollestad.materialdialogs.input.input | 27 | import com.afollestad.materialdialogs.input.input |
28 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 28 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
29 | import com.focasoftware.deboinventariov20.Model.Articles | 29 | import com.focasoftware.deboinventariov20.Model.Articles |
30 | import com.focasoftware.deboinventariov20.Model.InvBody | 30 | import com.focasoftware.deboinventariov20.Model.InvBody |
31 | import com.focasoftware.deboinventariov20.Model.InvHead | 31 | import com.focasoftware.deboinventariov20.Model.InvHead |
32 | import com.focasoftware.deboinventariov20.R | 32 | import com.focasoftware.deboinventariov20.R |
33 | import kotlinx.android.synthetic.main.fragment_inventario.* | 33 | import kotlinx.android.synthetic.main.fragment_inventario.* |
34 | import kotlinx.coroutines.* | 34 | import kotlinx.coroutines.* |
35 | import java.time.LocalDateTime | 35 | import java.time.LocalDateTime |
36 | import java.time.format.DateTimeFormatter | 36 | import java.time.format.DateTimeFormatter |
37 | import java.util.* | 37 | import java.util.* |
38 | 38 | ||
39 | 39 | ||
40 | class InventarioFragment : Fragment() { | 40 | class InventarioFragment : Fragment() { |
41 | 41 | ||
42 | private lateinit var sharedPreferences: SharedPreferences | 42 | private lateinit var sharedPreferences: SharedPreferences |
43 | private var iArea: Int = 0 | 43 | private var iArea: Int = 0 |
44 | private lateinit var invHead: InvHead | 44 | private lateinit var invHead: InvHead |
45 | private lateinit var rcInventarios: RecyclerView | 45 | private lateinit var rcInventarios: RecyclerView |
46 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | 46 | private lateinit var viewAdapter: RecyclerView.Adapter<*> |
47 | private lateinit var viewManager: RecyclerView.LayoutManager | 47 | private lateinit var viewManager: RecyclerView.LayoutManager |
48 | private lateinit var sChangeUpper: String | 48 | private lateinit var sChangeUpper: String |
49 | private var listArticulos = ArrayList<ItemsRecycler>() | 49 | private var listArticulos = ArrayList<ItemsRecycler>() |
50 | private lateinit var navController: NavController | 50 | private lateinit var navController: NavController |
51 | private var InventarioNuevo: Int = 0 | 51 | private var InventarioNuevo: Int = 0 |
52 | private var iEstado = 0 | 52 | private var iEstado = 0 |
53 | private var iBusquedaPor=0 | ||
53 | private var fCant = 0F | 54 | private var fCant = 0F |
54 | private var bFirst = false | 55 | private var bFirst = false |
55 | private lateinit var deleteIcon: Drawable | 56 | private lateinit var deleteIcon: Drawable |
56 | // private var editTT: EditText? = null | 57 | // private var editTT: EditText? = null |
57 | // private var dialogoModificacion: DialogPersoComplexCantidadModificacion? = null | 58 | // private var dialogoModificacion: DialogPersoComplexCantidadModificacion? = null |
58 | 59 | ||
59 | override fun onCreate(savedInstanceState: Bundle?) { | 60 | override fun onCreate(savedInstanceState: Bundle?) { |
60 | super.onCreate(savedInstanceState) | 61 | super.onCreate(savedInstanceState) |
61 | 62 | ||
62 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 63 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
63 | if (sharedPreferences.contains("Inventario")) if (sharedPreferences.getString("Inventario", "").toString() != "-1") { | 64 | if (sharedPreferences.contains("Inventario")) if (sharedPreferences.getString("Inventario", "").toString() != "-1") { |
64 | InventarioNuevo = sharedPreferences.getString("Inventario", "").toString().toInt() | 65 | InventarioNuevo = sharedPreferences.getString("Inventario", "").toString().toInt() |
65 | val editor = sharedPreferences.edit() | 66 | val editor = sharedPreferences.edit() |
66 | editor?.putString("Inventario", "-1") | 67 | editor?.putString("Inventario", "-1") |
67 | editor?.apply() | 68 | editor?.apply() |
68 | editor.commit() | 69 | editor.commit() |
69 | } | 70 | } |
70 | } | 71 | } |
71 | 72 | ||
72 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 73 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
73 | val v = inflater.inflate(R.layout.fragment_inventario, container, false) | 74 | val v = inflater.inflate(R.layout.fragment_inventario, container, false) |
74 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 75 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
75 | val tCodigoBarras = v.findViewById<EditText>(R.id.etCodigoBarras) | 76 | val tCodigoBarras = v.findViewById<EditText>(R.id.etCodigoBarras) |
76 | rcInventarios = v.findViewById(R.id.rcInventarios) | 77 | rcInventarios = v.findViewById(R.id.rcInventarios) |
77 | val tvTitulo = v.findViewById<TextView>(R.id.tvTitulo) | 78 | val tvTitulo = v.findViewById<TextView>(R.id.tvTitulo) |
78 | 79 | ||
79 | 80 | ||
80 | if (InventarioNuevo == 0) {// TODO: SI INVETNARIO NUEVO | 81 | if (InventarioNuevo == 0) {// TODO: SI INVETNARIO NUEVO |
81 | GlobalScope.launch(Dispatchers.Main) { | 82 | GlobalScope.launch(Dispatchers.Main) { |
82 | //TODO: BUSCO EL ULTIMO INVENTARIO EN LA BD PARA PODER CREAR EL PROXIMO | 83 | //TODO: BUSCO EL ULTIMO INVENTARIO EN LA BD PARA PODER CREAR EL PROXIMO |
83 | InventarioNuevo = AppDb.getAppDb(requireActivity())?.InvHeadDAO()?.findLastInv()?.plus(1) ?: 1 | 84 | InventarioNuevo = AppDb.getAppDb(requireActivity())?.InvHeadDAO()?.findLastInv()?.plus(1) ?: 1 |
84 | SerchArea() | 85 | SerchArea() |
85 | val descripInv: String = if (iArea == 0) "Ventas" else "Deposito" | 86 | val descripInv: String = if (iArea == 0) "Ventas" else "Deposito" |
86 | //TODO: CREAMOS EL INVENTARIO EN LA CABECERA DEL INVENTARIO | 87 | //TODO: CREAMOS EL INVENTARIO EN LA CABECERA DEL INVENTARIO |
87 | invHead = InvHead(InventarioNuevo, descripInv, 1, ObtenerFechaActual(), ObtenerFechaActual(), 0L, iArea, AjusteProductos(), ProdNoCont()) | 88 | invHead = InvHead(InventarioNuevo, descripInv, 1, ObtenerFechaActual(), ObtenerFechaActual(), 0L, iArea, AjusteProductos(), ProdNoCont()) |
88 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.insertInvHead(invHead) | 89 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.insertInvHead(invHead) |
89 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" | 90 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" |
90 | } | 91 | } |
91 | } else {// TODO: SI VENGO DE FRAGMENT DESCRIPCION | 92 | } else {// TODO: SI VENGO DE FRAGMENT DESCRIPCION |
92 | CargarDeBdInventario(InventarioNuevo) | 93 | CargarDeBdInventario(InventarioNuevo) |
93 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" | 94 | tvTitulo.text = "Inventario Dinamico" + " N° $InventarioNuevo" |
94 | } | 95 | } |
95 | 96 | ||
96 | tCodigoBarras.setOnKeyListener { _, keyCode, keyEvent -> | 97 | tCodigoBarras.setOnKeyListener { _, keyCode, keyEvent -> |
97 | if (keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_UP) { | 98 | if (keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_UP) { |
98 | sChangeUpper = tCodigoBarras.text.toString() | 99 | sChangeUpper = tCodigoBarras.text.toString() |
99 | 100 | ||
100 | var indiceDelArtEncontrado = 0 | 101 | var indiceDelArtEncontrado = 0 |
101 | 102 | ||
102 | //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS | 103 | //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS |
103 | when (iEstado) { | 104 | when (iBusquedaPor) { |
104 | 0 -> { | 105 | 0 -> { |
105 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice | 106 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice |
106 | //TODO Si no lo encuentra devuelve -1 | 107 | //TODO Si no lo encuentra devuelve -1 |
107 | if (indiceDelArtEncontrado != -1) { | 108 | if (indiceDelArtEncontrado != -1) { |
108 | if (swSumaUno!!.isChecked) { | 109 | if (swSumaUno!!.isChecked) { |
109 | fCant = 0F | 110 | fCant = 0F |
110 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 111 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
111 | fCant += 1F | 112 | fCant += 1F |
112 | //TODO ACTUALIZO LA CANTIDAD EN LA BD | 113 | //TODO ACTUALIZO LA CANTIDAD EN LA BD |
113 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 114 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
114 | //TODO ACTUALIZO LA CANTIDAD EN EL RV | 115 | //TODO ACTUALIZO LA CANTIDAD EN EL RV |
115 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 116 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
116 | viewAdapter.notifyDataSetChanged() | 117 | viewAdapter.notifyDataSetChanged() |
117 | } else { | 118 | } else { |
118 | // val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | 119 | // val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) |
119 | // val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Login Form").setCancelable(false) | 120 | // val mBuilder = AlertDialog.Builder(context).setView(mDialogView).setTitle("Login Form").setCancelable(false) |
120 | // val mAlertDialog = mBuilder.show() | 121 | // val mAlertDialog = mBuilder.show() |
121 | // mDialogView.dialogLoginBtn.setOnClickListener { | 122 | // mDialogView.dialogLoginBtn.setOnClickListener { |
122 | // mAlertDialog.dismiss() | 123 | // mAlertDialog.dismiss() |
123 | // //get text from EditTexts of custom layout | 124 | // //get text from EditTexts of custom layout |
124 | // val name = mDialogView.dialogNameEt.text.toString() | 125 | // val name = mDialogView.dialogNameEt.text.toString() |
125 | // val email = mDialogView.dialogEmailEt.text.toString() | 126 | // val email = mDialogView.dialogEmailEt.text.toString() |
126 | // val password = mDialogView.dialogPasswEt.text.toString() | 127 | // val password = mDialogView.dialogPasswEt.text.toString() |
127 | // fCant = 0F | 128 | // fCant = 0F |
128 | // fCant = name.toFloat() | 129 | // fCant = name.toFloat() |
129 | // } | 130 | // } |
130 | // mDialogView.dialogCancelBtn.setOnClickListener { | 131 | // mDialogView.dialogCancelBtn.setOnClickListener { |
131 | // mAlertDialog.dismiss() | 132 | // mAlertDialog.dismiss() |
132 | // } | 133 | // } |
133 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 134 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
134 | 135 | ||
135 | val type = InputType.TYPE_CLASS_PHONE | 136 | val type = InputType.TYPE_CLASS_NUMBER |
136 | MaterialDialog(requireContext()).show { | 137 | MaterialDialog(requireContext()).show { |
137 | 138 | ||
138 | title(text = "Producto '$sChangeUpper', se encuentra cargado.") | 139 | title(text = "Producto '$sChangeUpper', se encuentra cargado.") |
139 | message(R.string.sMensajeEncontrado) | 140 | message(R.string.sMensajeEncontrado) |
140 | input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | 141 | input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> |
141 | // val inputField = materialDialog.getInputField() | 142 | // val inputField = materialDialog.getInputField() |
142 | // val isValid = charSequence.isEmpty() | 143 | // val isValid = charSequence.isEmpty() |
143 | // | 144 | // |
144 | // inputField.error = if (isValid) null else "El campo no puede quedar vacio" | 145 | // inputField.error = if (isValid) null else "El campo no puede quedar vacio" |
145 | // materialDialog.setActionButtonEnabled(WhichButton.POSITIVE, isValid) | 146 | // materialDialog.setActionButtonEnabled(WhichButton.POSITIVE, isValid) |
146 | fCant = 0F | 147 | fCant = 0F |
147 | fCant = charSequence.toString().toFloat() | 148 | fCant = charSequence.toString().toFloat() |
148 | } | 149 | } |
149 | positiveButton(R.string.btnOk) { | 150 | positiveButton(R.string.btnOk) { |
150 | //TODO ACTUALIZO CANTIADAD EN BD | 151 | //TODO ACTUALIZO CANTIADAD EN BD |
151 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 152 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
152 | //TODO ACTUALIZO CANTIDAD EN RV | 153 | //TODO ACTUALIZO CANTIDAD EN RV |
153 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 154 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
154 | viewAdapter.notifyDataSetChanged() | 155 | viewAdapter.notifyDataSetChanged() |
155 | dismiss() | 156 | dismiss() |
156 | } | 157 | } |
157 | }.cancelOnTouchOutside(false).cornerRadius(10F) | 158 | }.cancelOnTouchOutside(false).cornerRadius(10F) |
158 | } | 159 | } |
159 | 160 | ||
160 | } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD | 161 | } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD |
161 | 162 | ||
162 | GlobalScope.launch(Dispatchers.Main) { | 163 | GlobalScope.launch(Dispatchers.Main) { |
163 | //TODO BUSCO EN BASE DE DATOS | 164 | //TODO BUSCO EN BASE DE DATOS |
164 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | 165 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) |
165 | ContinuarCargaCB(artEncontrado) | 166 | ContinuarCargaCB(artEncontrado) |
166 | } | 167 | } |
167 | } | 168 | } |
168 | 169 | ||
169 | tCodigoBarras.focusable = View.FOCUSABLE | 170 | tCodigoBarras.focusable = View.FOCUSABLE |
170 | tCodigoBarras.setText("") | 171 | tCodigoBarras.setText("") |
171 | tCodigoBarras.selectAll() | 172 | tCodigoBarras.selectAll() |
172 | return@setOnKeyListener true | 173 | return@setOnKeyListener true |
173 | 174 | ||
174 | 175 | ||
175 | } | 176 | } |
176 | 1 -> {//TODO: BUSQUEDA POR DESCRIPCION************************************************************************** | 177 | 1 -> {//TODO: BUSQUEDA POR DESCRIPCION************************************************************************** |
177 | // | 178 | // |
178 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 1) //TODO :Si encuentra el articulo en el RV devuelve el indice | 179 | // indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 1) //TODO :Si encuentra el articulo en el RV devuelve el indice |
179 | // //TODO Si no lo encuentra devuelve -1 | 180 | // //TODO Si no lo encuentra devuelve -1 |
180 | // if (indiceDelArtEncontrado != -1) { | 181 | // if (indiceDelArtEncontrado != -1) { |
181 | //// if (swSumaUno!!.isChecked) { | 182 | //// if (swSumaUno!!.isChecked) { |
182 | //// fCant = 0F | 183 | //// fCant = 0F |
183 | //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 184 | //// fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
184 | //// fCant += 1F | 185 | //// fCant += 1F |
185 | //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 186 | //// listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
186 | //// viewAdapter.notifyDataSetChanged() | 187 | //// viewAdapter.notifyDataSetChanged() |
187 | //// } else { | 188 | //// } else { |
188 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 189 | // fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
189 | // MaterialDialog(requireContext()).show { | 190 | // MaterialDialog(requireContext()).show { |
190 | // title(R.string.sTituloNueva) | 191 | // title(R.string.sTituloNueva) |
191 | // message(R.string.sCantidadNueva) | 192 | // message(R.string.sCantidadNueva) |
192 | // input { materialDialog, charSequence -> | 193 | // input { materialDialog, charSequence -> |
193 | // fCant = 0F | 194 | // fCant = 0F |
194 | // fCant = charSequence.toString().toFloat() | 195 | // fCant = charSequence.toString().toFloat() |
195 | // } | 196 | // } |
196 | // positiveButton(R.string.btnOk) { | 197 | // positiveButton(R.string.btnOk) { |
197 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 198 | // listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
198 | // viewAdapter.notifyDataSetChanged() | 199 | // viewAdapter.notifyDataSetChanged() |
199 | // dismiss() | 200 | // dismiss() |
200 | // } | 201 | // } |
201 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 202 | // }.cancelOnTouchOutside(false).cornerRadius(10F) |
202 | //// } | 203 | //// } |
203 | // | 204 | // |
204 | // } else if | 205 | // } else if |
205 | // (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD | 206 | // (indiceDelArtEncontrado == -1) {// TODO: no lo encontro en el RV, lo va a buscar en al BD |
206 | GlobalScope.launch(Dispatchers.Main) { | 207 | GlobalScope.launch(Dispatchers.Main) { |
207 | val artEncontrado = buscarDescEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | 208 | val artEncontrado = buscarDescEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) |
208 | ContinuarCargaDesc(artEncontrado as ArrayList<Articles>) | 209 | ContinuarCargaDesc(artEncontrado as ArrayList<Articles>) |
209 | } | 210 | } |
210 | // } | 211 | // } |
211 | tCodigoBarras.focusable = View.FOCUSABLE | 212 | tCodigoBarras.focusable = View.FOCUSABLE |
212 | tCodigoBarras.setText("") | 213 | tCodigoBarras.setText("") |
213 | tCodigoBarras.selectAll() | 214 | tCodigoBarras.selectAll() |
214 | return@setOnKeyListener true | 215 | return@setOnKeyListener true |
215 | } | 216 | } |
216 | 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN************************************************************************** | 217 | 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN************************************************************************** |
217 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 3)//TODO Si encuentra el articulo en el RV devuelve el indice | 218 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 3)//TODO Si encuentra el articulo en el RV devuelve el indice |
218 | //TODO Si no lo encuentra devuelve -1 | 219 | //TODO Si no lo encuentra devuelve -1 |
219 | if (indiceDelArtEncontrado != -1) { | 220 | if (indiceDelArtEncontrado != -1) { |
220 | if (swSumaUno!!.isChecked) { | 221 | if (swSumaUno!!.isChecked) { |
221 | fCant = 0F | 222 | fCant = 0F |
222 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 223 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
223 | fCant += 1F | 224 | fCant += 1F |
224 | //TODO ACTUALIZO LA CANTIDAD EN LA BD | 225 | //TODO ACTUALIZO LA CANTIDAD EN LA BD |
225 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 226 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
226 | //TODO ACTUALIZO LA CANTIDAD EN EL RV | 227 | //TODO ACTUALIZO LA CANTIDAD EN EL RV |
227 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 228 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
228 | viewAdapter.notifyDataSetChanged() | 229 | viewAdapter.notifyDataSetChanged() |
229 | } else { | 230 | } else { |
230 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada | 231 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
231 | val type = InputType.TYPE_CLASS_PHONE | 232 | val type = InputType.TYPE_CLASS_NUMBER |
232 | MaterialDialog(requireContext()).show { | 233 | MaterialDialog(requireContext()).show { |
233 | 234 | ||
234 | title(text = "Producto '$sChangeUpper', se encuentra cargado.") | 235 | title(text = "Producto '$sChangeUpper', se encuentra cargado.") |
235 | message(R.string.sCantidadNueva) | 236 | message(R.string.sCantidadNueva) |
236 | input (waitForPositiveButton = false ,hint = "99.99", inputType = type){ materialDialog, charSequence -> | 237 | input (waitForPositiveButton = false ,hint = "99.99", inputType = type){ materialDialog, charSequence -> |
237 | fCant = 0F | 238 | fCant = 0F |
238 | fCant = charSequence.toString().toFloat() | 239 | fCant = charSequence.toString().toFloat() |
239 | } | 240 | } |
240 | positiveButton(R.string.btnOk) { | 241 | positiveButton(R.string.btnOk) { |
241 | //TODO ACTUALIZO CANTIADAD EN BD | 242 | //TODO ACTUALIZO CANTIADAD EN BD |
242 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) | 243 | updateCantidad(listArticulos[indiceDelArtEncontrado].sector.toString(), listArticulos[indiceDelArtEncontrado].codigo.toString(), fCant) |
243 | //TODO ACTUALIZO CANTIDAD EN RV | 244 | //TODO ACTUALIZO CANTIDAD EN RV |
244 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant | 245 | listArticulos[indiceDelArtEncontrado].cantTomada = fCant |
245 | viewAdapter.notifyDataSetChanged() | 246 | viewAdapter.notifyDataSetChanged() |
246 | dismiss() | 247 | dismiss() |
247 | } | 248 | } |
248 | }.cancelOnTouchOutside(false).cornerRadius(10F) | 249 | }.cancelOnTouchOutside(false).cornerRadius(10F) |
249 | } | 250 | } |
250 | 251 | ||
251 | } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD | 252 | } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD |
252 | 253 | ||
253 | GlobalScope.launch(Dispatchers.Main) { | 254 | GlobalScope.launch(Dispatchers.Main) { |
254 | //TODO BUSCO EN BASE DE DATOS | 255 | //TODO BUSCO EN BASE DE DATOS |
255 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) | 256 | val artEncontrado = buscarCBEnBD(sChangeUpper.toUpperCase(Locale.ROOT)) |
256 | ContinuarCargaCB(artEncontrado) | 257 | ContinuarCargaCB(artEncontrado) |
257 | } | 258 | } |
258 | } | 259 | } |
259 | 260 | ||
260 | tCodigoBarras.focusable = View.FOCUSABLE | 261 | tCodigoBarras.focusable = View.FOCUSABLE |
261 | tCodigoBarras.setText("") | 262 | tCodigoBarras.setText("") |
262 | tCodigoBarras.selectAll() | 263 | tCodigoBarras.selectAll() |
263 | return@setOnKeyListener true | 264 | return@setOnKeyListener true |
264 | 265 | ||
265 | 266 | ||
266 | } | 267 | } |
267 | } | 268 | } |
268 | } | 269 | } |
269 | return@setOnKeyListener false | 270 | return@setOnKeyListener false |
270 | } | 271 | } |
271 | return v | 272 | return v |
272 | } | 273 | } |
273 | 274 | ||
274 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 275 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
275 | super.onViewCreated(view, savedInstanceState) | 276 | super.onViewCreated(view, savedInstanceState) |
276 | navController = Navigation.findNavController(view) | 277 | navController = Navigation.findNavController(view) |
277 | etCodigoBarras.requestFocus() | 278 | etCodigoBarras.requestFocus() |
278 | 279 | ||
279 | btnBorrarInv.setOnClickListener { | 280 | btnBorrarInv.setOnClickListener { |
280 | MaterialDialog(requireContext()).show { | 281 | MaterialDialog(requireContext()).show { |
281 | title(R.string.sTituloBorrarInv) | 282 | title(R.string.sTituloBorrarInv) |
282 | message(R.string.sMensajeBorrarInv) | 283 | message(R.string.sMensajeBorrarInv) |
283 | positiveButton(R.string.btnOk) { | 284 | positiveButton(R.string.btnOk) { |
284 | BorrarInvActual() | 285 | BorrarInvActual() |
285 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show() | 286 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Borrado", Toast.LENGTH_LONG).show() |
286 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | 287 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) |
287 | InventarioNuevo = 0 | 288 | InventarioNuevo = 0 |
288 | dismiss() | 289 | dismiss() |
289 | } | 290 | } |
290 | negativeButton { | 291 | negativeButton { |
291 | dismiss() | 292 | dismiss() |
292 | } | 293 | } |
293 | }.cancelOnTouchOutside(false).cornerRadius(10F) | 294 | }.cancelOnTouchOutside(false).cornerRadius(10F) |
294 | } | 295 | } |
295 | 296 | ||
296 | btnExportarInv.setOnClickListener { | 297 | btnExportarInv.setOnClickListener { |
297 | MaterialDialog(requireContext()).show { | 298 | MaterialDialog(requireContext()).show { |
298 | title(R.string.sTituloExportar) | 299 | title(R.string.sTituloExportar) |
299 | message(R.string.sMensajeExportar) | 300 | message(R.string.sMensajeExportar) |
300 | positiveButton(R.string.btnOk) { | 301 | positiveButton(R.string.btnOk) { |
301 | BorrarInvActual() | 302 | BorrarInvActual() |
302 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() | 303 | Toast.makeText(requireContext(), "El inventario $InventarioNuevo fue Exportado al Servidor", Toast.LENGTH_LONG).show() |
303 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) | 304 | navController.navigate(R.id.action_inventarioFragment_to_mainFragment2) |
304 | InventarioNuevo = 0 | 305 | InventarioNuevo = 0 |
305 | dismiss() | 306 | dismiss() |
306 | } | 307 | } |
307 | negativeButton { | 308 | negativeButton { |
308 | dismiss() | 309 | dismiss() |
309 | } | 310 | } |
310 | }.cancelOnTouchOutside(false).cornerRadius(10F) | 311 | }.cancelOnTouchOutside(false).cornerRadius(10F) |
311 | } | 312 | } |
312 | ivCamara.setOnClickListener { | 313 | ivCamara.setOnClickListener { |
313 | if (!bFirst) { | 314 | if (!bFirst) { |
314 | iEstado = 1 | 315 | iEstado = 1 |
315 | bFirst = true | 316 | bFirst = true |
316 | } | 317 | } |
317 | 318 | ||
318 | when (iEstado) { | 319 | when (iEstado) { |
319 | 0 -> { | 320 | 0 -> { |
320 | ivCamara.setImageResource(R.drawable.codbar) | 321 | ivCamara.setImageResource(R.drawable.codbar) |
321 | etCodigoBarras.hint = "Busqueda por C. Barras" | 322 | etCodigoBarras.hint = "Busqueda por C. Barras" |
322 | swSumaUno.visibility = View.VISIBLE | 323 | swSumaUno.visibility = View.VISIBLE |
323 | iEstado = 0 | 324 | iBusquedaPor=0 |
325 | iEstado = 1 | ||
324 | } | 326 | } |
325 | 1 -> { | 327 | 1 -> { |
326 | ivCamara.setImageResource(R.drawable.desc) | 328 | ivCamara.setImageResource(R.drawable.desc) |
327 | etCodigoBarras.hint = "Busqueda por Descripción" | 329 | etCodigoBarras.hint = "Busqueda por Descripción" |
328 | swSumaUno.visibility = View.GONE | 330 | swSumaUno.visibility = View.GONE |
329 | iEstado = 1 | 331 | iBusquedaPor=1 |
332 | iEstado = 2 | ||
330 | } | 333 | } |
331 | 2 -> { | 334 | 2 -> { |
332 | ivCamara.setImageResource(R.drawable.cod_origen) | 335 | ivCamara.setImageResource(R.drawable.cod_origen) |
333 | etCodigoBarras.hint = "Busqueda por C. Origen" | 336 | etCodigoBarras.hint = "Busqueda por C. Origen" |
334 | swSumaUno.visibility = View.GONE | 337 | swSumaUno.visibility = View.GONE |
335 | iEstado = 2 | 338 | iBusquedaPor=2 |
339 | iEstado = 0 | ||
336 | } | 340 | } |
337 | } | 341 | } |
338 | } | 342 | } |
339 | } | 343 | } |
340 | 344 | ||
341 | private fun BorrarInvActual() { | 345 | private fun BorrarInvActual() { |
342 | lifecycleScope.launch { | 346 | lifecycleScope.launch { |
343 | withContext(Dispatchers.IO) { | 347 | withContext(Dispatchers.IO) { |
344 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.deleteinvHead(InventarioNuevo) | 348 | AppDb.getAppDb(requireActivity())!!.InvHeadDAO()!!.deleteinvHead(InventarioNuevo) |
345 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.deleteInvBody(InventarioNuevo) | 349 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.deleteInvBody(InventarioNuevo) |
346 | } | 350 | } |
347 | } | 351 | } |
348 | } | 352 | } |
349 | 353 | ||
350 | private fun CargarDeBdInventario(ultimoInv: Int) { | 354 | private fun CargarDeBdInventario(ultimoInv: Int) { |
351 | GlobalScope.launch(Dispatchers.Main) { | 355 | GlobalScope.launch(Dispatchers.Main) { |
352 | val invbody = cargarInventario(ultimoInv) | 356 | val invbody = cargarInventario(ultimoInv) |
353 | for ((i, item) in invbody!!.withIndex()) { | 357 | for ((i, item) in invbody!!.withIndex()) { |
354 | val art = Articles(invbody[i].sector, | 358 | val art = Articles(invbody[i].sector, |
355 | invbody[i].codigo, | 359 | invbody[i].codigo, |
356 | invbody[i].descripcion, | 360 | invbody[i].descripcion, |
357 | invbody[i].codBar, | 361 | invbody[i].codBar, |
358 | invbody[i].codOrigen, | 362 | invbody[i].codOrigen, |
359 | invbody[i].precio, | 363 | invbody[i].precio, |
360 | invbody[i].costo, | 364 | invbody[i].costo, |
361 | invbody[i].balanza, | 365 | invbody[i].balanza, |
362 | invbody[i].depSn, | 366 | invbody[i].depSn, |
363 | invbody[i].costo) | 367 | invbody[i].costo) |
364 | cargarRecicler(art, invbody[i].cantTomada!!.toFloat()) | 368 | cargarRecicler(art, invbody[i].cantTomada!!.toFloat()) |
365 | } | 369 | } |
366 | } | 370 | } |
367 | 371 | ||
368 | } | 372 | } |
369 | 373 | ||
370 | private fun ContinuarCargaDesc(artAcargar: ArrayList<Articles>) { | 374 | private fun ContinuarCargaDesc(artAcargar: ArrayList<Articles>) { |
371 | //TODO DESPUES DE INGRESAR LA DESCRIPCION Y DE BUSCAR LOS CAINCIDENCIAS EN LA BASE SE VA A MOSTRAR LAS MISMAS | 375 | //TODO DESPUES DE INGRESAR LA DESCRIPCION Y DE BUSCAR LOS CAINCIDENCIAS EN LA BASE SE VA A MOSTRAR LAS MISMAS |
372 | //TODO SI LA CANTIDAD ENCONTRADA ES UNO, LO CARGO DIRECTAMENTE EN EL RV | 376 | //TODO SI LA CANTIDAD ENCONTRADA ES UNO, LO CARGO DIRECTAMENTE EN EL RV |
373 | 377 | ||
374 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD | 378 | if (artAcargar.isNotEmpty() || !artAcargar.isNullOrEmpty()) {// TODO: Si lo encuentra en la BD |
375 | // if (swSumaUno!!.isChecked) {// TODO: SI ESTA +1, PONE CANTIDAD 1 | 379 | // if (swSumaUno!!.isChecked) {// TODO: SI ESTA +1, PONE CANTIDAD 1 |
376 | if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV | 380 | if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV |
377 | fCant = 0F | 381 | fCant = 0F |
378 | fCant += 1F | 382 | fCant += 1F |
379 | // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV | 383 | // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV |
380 | val acargarPorDesc = Articles(artAcargar[0].sector, | 384 | val acargarPorDesc = Articles(artAcargar[0].sector, |
381 | artAcargar[0].codigo, | 385 | artAcargar[0].codigo, |
382 | artAcargar[0].descripcion, | 386 | artAcargar[0].descripcion, |
383 | artAcargar[0].codBar, | 387 | artAcargar[0].codBar, |
384 | artAcargar[0].codOrigen, | 388 | artAcargar[0].codOrigen, |
385 | artAcargar[0].precio, | 389 | artAcargar[0].precio, |
386 | artAcargar[0].costo, | 390 | artAcargar[0].costo, |
387 | artAcargar[0].balanza, | 391 | artAcargar[0].balanza, |
388 | artAcargar[0].depSn, | 392 | artAcargar[0].depSn, |
389 | "") | 393 | "") |
390 | // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD | 394 | // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD |
391 | cargarArtEnBd(acargarPorDesc, fCant) | 395 | cargarArtEnBd(acargarPorDesc, fCant) |
392 | cargarRecicler(acargarPorDesc, fCant) | 396 | cargarRecicler(acargarPorDesc, fCant) |
393 | } else { | 397 | } else { |
394 | var bundle = Bundle() | 398 | var bundle = Bundle() |
395 | bundle = bundleOf("ArrayDesc" to artAcargar) | 399 | bundle = bundleOf("ArrayDesc" to artAcargar) |
396 | bundle.putInt("numeroInv", InventarioNuevo) | 400 | bundle.putInt("numeroInv", InventarioNuevo) |
397 | navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) | 401 | navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) |
398 | } | 402 | } |
399 | // } else {//SI NO ESTA +1 | 403 | // } else {//SI NO ESTA +1 |
400 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV | 404 | // if (artAcargar.size == 1) { // TODO: SI EN EL ARRAY SOLO HAY UN ITEM LO METE DIRECTAMENTE AL RV |
401 | // fCant = listArticulos[0].cantTomada | 405 | // fCant = listArticulos[0].cantTomada |
402 | // MaterialDialog(requireContext()).show { | 406 | // MaterialDialog(requireContext()).show { |
403 | // title(R.string.sTituloNueva) | 407 | // title(R.string.sTituloNueva) |
404 | // message(R.string.sCantidadNueva) | 408 | // message(R.string.sCantidadNueva) |
405 | // input { materialDialog, charSequence -> | 409 | // input { materialDialog, charSequence -> |
406 | // fCant = 0F | 410 | // fCant = 0F |
407 | // fCant = charSequence.toString().toFloat() | 411 | // fCant = charSequence.toString().toFloat() |
408 | // } | 412 | // } |
409 | // positiveButton(R.string.btnOk) { | 413 | // positiveButton(R.string.btnOk) { |
410 | // listArticulos[0].cantTomada = fCant | 414 | // listArticulos[0].cantTomada = fCant |
411 | // viewAdapter.notifyDataSetChanged() | 415 | // viewAdapter.notifyDataSetChanged() |
412 | // dismiss() | 416 | // dismiss() |
413 | // } | 417 | // } |
414 | // }.cancelOnTouchOutside(false).cornerRadius(10F) | 418 | // }.cancelOnTouchOutside(false).cornerRadius(10F) |
415 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV | 419 | // // TODO PASO DEL ARRAY A UN ITEM PARA QUE LO CARGUE EN EL RV |
416 | // val acargarPorDesc = Articles(artAcargar[0].sector, | 420 | // val acargarPorDesc = Articles(artAcargar[0].sector, |
417 | // artAcargar[0].codigo, | 421 | // artAcargar[0].codigo, |
418 | // artAcargar[0].descripcion, | 422 | // artAcargar[0].descripcion, |
419 | // artAcargar[0].codBar, | 423 | // artAcargar[0].codBar, |
420 | // artAcargar[0].cod_origen, | 424 | // artAcargar[0].cod_origen, |
421 | // artAcargar[0].precio, | 425 | // artAcargar[0].precio, |
422 | // artAcargar[0].costo, | 426 | // artAcargar[0].costo, |
423 | // artAcargar[0].balanza, | 427 | // artAcargar[0].balanza, |
424 | // artAcargar[0].depSn, | 428 | // artAcargar[0].depSn, |
425 | // "") | 429 | // "") |
426 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD | 430 | // // TODO LO ENVIO A CARGAR EN EL RV Y EN LA BD |
427 | // cargarArtEnBd(acargarPorDesc, fCant) | 431 | // cargarArtEnBd(acargarPorDesc, fCant) |
428 | // cargarRecicler(acargarPorDesc, fCant) | 432 | // cargarRecicler(acargarPorDesc, fCant) |
429 | // } else { | 433 | // } else { |
430 | // var bundle = Bundle() | 434 | // var bundle = Bundle() |
431 | // bundle = bundleOf("ArrayDesc" to artAcargar) | 435 | // bundle = bundleOf("ArrayDesc" to artAcargar) |
432 | // bundle.putInt("numeroInv", InventarioNuevo) | 436 | // bundle.putInt("numeroInv", InventarioNuevo) |
433 | // navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) | 437 | // navController.navigate(R.id.action_inventarioFragment_to_descripcionFragment, bundle) |
434 | // } | 438 | // } |
435 | // } | 439 | // } |
436 | } else {//TODO si no lo encuentra en la BD | 440 | } else {//TODO si no lo encuentra en la BD |
437 | // MaterialDialog(requireContext()).show { | 441 | MaterialDialog(requireContext()).show { |
438 | // title(R.string.sTitulo) | 442 | title(text = "El articulo ${etCodigoBarras.text}") |
439 | // message(R.string.sMensaje) | 443 | message(R.string.sMensaje) |
440 | // positiveButton(R.string.btnOk) { | 444 | positiveButton(R.string.btnOk) { |
441 | // dismiss() | 445 | dismiss() |
442 | // } | 446 | } |
443 | // }.cornerRadius(10F) | 447 | }.cornerRadius(10F) |
444 | |||
445 | // val modalDialog = DialogNoEncontrado() | ||
446 | // modalDialog.isCancelable=false | ||
447 | // modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | ||
448 | // | ||
449 | // | ||
450 | // val modalDialog = DialogNoEncontrado().newInstance( | ||
451 | // "El producto $etCodigoBarras.text.toString()", | ||
452 | // "No se encotro en la Base de Datos." | ||
453 | // ) | ||
454 | // modalDialog?.show(requireActivity().supportFragmentManager, "DialogFragment") | ||
455 | |||
456 | // val mDialogView = LayoutInflater.from(context).inflate(R.layout.login_dialog, null) | ||
457 | // val mBuilder = AlertDialog.Builder(requireContext()).setView(mDialogView).setTitle("Login Form").setCancelable(false) | ||
458 | // val mAlertDialog = mBuilder.show() | ||
459 | // mDialogView.dialogLoginBtn.setOnClickListener { | ||
460 | // mAlertDialog.dismiss() | ||
461 | // //get text from EditTexts of custom layout | ||
462 | // val name = mDialogView.tvgenerico4.text.toString() | ||
463 | // | ||
464 | //// fCant = 0F | ||
465 | //// fCant = name.toFloat() | ||
466 | // } | ||
467 | // mDialogView.dialogCancelBtn.setOnClickListener { | ||
468 | // mAlertDialog.dismiss() | ||
469 | // } | ||
470 | } | 448 | } |
471 | |||
472 | } | 449 | } |
473 | 450 | ||
474 | private fun ContinuarCargaCB(artAcargar: Articles?) { | 451 | private fun ContinuarCargaCB(artAcargar: Articles?) { |
475 | 452 | ||
476 | if (artAcargar != null) {//Si lo encuentra en la BD | 453 | if (artAcargar != null) {//Si lo encuentra en la BD |
477 | |||
478 | if (swSumaUno!!.isChecked) {// SI ESTA +1, PONE CANTIDAD 1 | 454 | if (swSumaUno!!.isChecked) {// SI ESTA +1, PONE CANTIDAD 1 |
479 | fCant = 0F | 455 | fCant = 0F |
480 | fCant += 1F | 456 | fCant += 1F |
481 | cargarArtEnBd(artAcargar, fCant) | 457 | cargarArtEnBd(artAcargar, fCant) |
482 | cargarRecicler(artAcargar, fCant) | 458 | cargarRecicler(artAcargar, fCant) |
483 | } else {//SI NO ESTA +1 PREGUNTA CANTIDAD | 459 | } else {//SI NO ESTA +1 PREGUNTA CANTIDAD |
484 | val type = InputType.TYPE_CLASS_PHONE | 460 | val type = InputType.TYPE_CLASS_PHONE |
485 | MaterialDialog(requireContext()).show { | 461 | MaterialDialog(requireContext()).show { |
486 | 462 | ||
487 | title(text = "Producto: $sChangeUpper") | 463 | title(text = "Producto: $sChangeUpper") |
488 | message(R.string.sMensajeEncontrado) | 464 | message(R.string.sMensajeEncontrado) |
489 | input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> | 465 | input(waitForPositiveButton = false, hint = "99.99", inputType = type) { materialDialog, charSequence -> |
490 | // val inputField = materialDialog.getInputField() | 466 | // val inputField = materialDialog.getInputField() |
491 | // val isValid = charSequence.isEmpty() | 467 | // val isValid = charSequence.isEmpty() |
492 | // | 468 | // |
493 | // inputField.error = if (isValid) null else "El campo no puede quedar vacio" | 469 | // inputField.error = if (isValid) null else "El campo no puede quedar vacio" |
494 | // materialDialog.setActionButtonEnabled(WhichButton.POSITIVE, isValid) | 470 | // materialDialog.setActionButtonEnabled(WhichButton.POSITIVE, isValid) |
495 | fCant = 0F | 471 | fCant = 0F |
496 | fCant = charSequence.toString().toFloat() | 472 | fCant = charSequence.toString().toFloat() |
497 | } | 473 | } |
498 | positiveButton(R.string.btnOk) { | 474 | positiveButton(R.string.btnOk) { |
499 | dismiss() | 475 | dismiss() |
500 | cargarArtEnBd(artAcargar, fCant) | 476 | cargarArtEnBd(artAcargar, fCant) |
501 | cargarRecicler(artAcargar, fCant) | 477 | cargarRecicler(artAcargar, fCant) |
502 | 478 | ||
503 | } | 479 | } |
504 | }.cancelOnTouchOutside(false).cornerRadius(10F) | 480 | }.cancelOnTouchOutside(false).cornerRadius(10F) |
505 | } | 481 | } |
506 | } else {// TODO si no lo encuentra en la BD | 482 | } else {// TODO si no lo encuentra en la BD |
507 | 483 | ||
508 | MaterialDialog(requireContext()).show { | 484 | MaterialDialog(requireContext()).show { |
509 | title(text = "El producto: $sChangeUpper") | 485 | title(text = "El producto: $sChangeUpper") |
510 | message(text = "¡No fue encontrado!") | 486 | message(text = "¡No fue encontrado!") |
511 | positiveButton(R.string.btnOk) {} | 487 | positiveButton(R.string.btnOk) {} |
512 | dismiss() | 488 | dismiss() |
513 | } | 489 | } |
514 | } | 490 | } |
515 | } | 491 | } |
516 | 492 | ||
517 | suspend fun buscarCBEnBD(CodigoBarras: String): Articles? { | 493 | suspend fun buscarCBEnBD(CodigoBarras: String): Articles? { |
518 | //TODO BUSQUEDA POR CODIGO DE BARRAS | 494 | //TODO BUSQUEDA POR CODIGO DE BARRAS |
519 | var busqueda: Articles? = null | 495 | var busqueda: Articles? = null |
520 | return GlobalScope.async(Dispatchers.IO) { | 496 | return GlobalScope.async(Dispatchers.IO) { |
521 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(CodigoBarras, iArea) | 497 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByCodBar(CodigoBarras, iArea) |
522 | return@async busqueda | 498 | return@async busqueda |
523 | }.await() | 499 | }.await() |
524 | } | 500 | } |
525 | 501 | ||
526 | suspend fun buscarDescEnBD(descripcion: String): List<Articles>? { | 502 | suspend fun buscarDescEnBD(descripcion: String): List<Articles>? { |
527 | //TODO BUSQUEDA POR DESCRIPCION | 503 | //TODO BUSQUEDA POR DESCRIPCION |
528 | var busqueda: List<Articles>? = null | 504 | var busqueda: List<Articles>? = null |
529 | return GlobalScope.async(Dispatchers.IO) { | 505 | return GlobalScope.async(Dispatchers.IO) { |
530 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByDesc(descripcion, iArea) | 506 | busqueda = AppDb.getAppDb(requireContext())!!.ArticulosDAO()!!.findArticuloByDesc(descripcion, iArea) |
531 | return@async busqueda | 507 | return@async busqueda |
532 | }.await() | 508 | }.await() |
533 | } | 509 | } |
534 | 510 | ||
535 | private fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int { | 511 | private fun buscoArtEnRv(codigoBarras: String, sTipoBusqueda: Int): Int { |
536 | var indice = 0 | 512 | var indice = 0 |
537 | var bEncontrado = false | 513 | var bEncontrado = false |
538 | if (sTipoBusqueda == 0) {//TODO BUSQUEDA POR CODIGO DE BARRAS | 514 | if (sTipoBusqueda == 0) {//TODO BUSQUEDA POR CODIGO DE BARRAS |
539 | for (item in listArticulos) { | 515 | for (item in listArticulos) { |
540 | if (item.codigoBarras!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | 516 | if (item.codigoBarras!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { |
541 | bEncontrado = true | 517 | bEncontrado = true |
542 | break | 518 | break |
543 | } | 519 | } |
544 | indice += 1 | 520 | indice += 1 |
545 | } | 521 | } |
546 | } else if (sTipoBusqueda == 1) {//TODO BUSQUEDA POR DESCRIPCION | 522 | } else if (sTipoBusqueda == 1) {//TODO BUSQUEDA POR DESCRIPCION |
547 | for (item in listArticulos) { | 523 | for (item in listArticulos) { |
548 | if (item.descripcion!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | 524 | if (item.descripcion!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { |
549 | bEncontrado = true | 525 | bEncontrado = true |
550 | break | 526 | break |
551 | } | 527 | } |
552 | indice += 1 | 528 | indice += 1 |
553 | } | 529 | } |
554 | } else if (sTipoBusqueda == 2) {//TODO BUSQUEDA POR CODIGO DE ORIGEN | 530 | } else if (sTipoBusqueda == 2) {//TODO BUSQUEDA POR CODIGO DE ORIGEN |
555 | for (item in listArticulos) { | 531 | for (item in listArticulos) { |
556 | if (item.codigoOrigen!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { | 532 | if (item.codigoOrigen!!.toUpperCase(Locale.ROOT).contains(codigoBarras)) { |
557 | bEncontrado = true | 533 | bEncontrado = true |
558 | break | 534 | break |
559 | } | 535 | } |
560 | indice += 1 | 536 | indice += 1 |
561 | } | 537 | } |
562 | } | 538 | } |
563 | return if (bEncontrado) indice | 539 | return if (bEncontrado) indice |
564 | else -1 | 540 | else -1 |
565 | } | 541 | } |
566 | 542 | ||
567 | private fun cargarArtEnBd(articulos: Articles, cant: Float) { | 543 | private fun cargarArtEnBd(articulos: Articles, cant: Float) { |
568 | val body = InvBody(InventarioNuevo,// TODO PREPARO PARA MANDAR A CARGAR EN LA BD | 544 | val body = InvBody(InventarioNuevo,// TODO PREPARO PARA MANDAR A CARGAR EN LA BD |
569 | articulos.sector, | 545 | articulos.sector, |
570 | articulos.codigo, | 546 | articulos.codigo, |
571 | articulos.descripcion, | 547 | articulos.descripcion, |
572 | cant.toString(), | 548 | cant.toString(), |
573 | articulos.codBar, | 549 | articulos.codBar, |
574 | articulos.codOrigen, | 550 | articulos.codOrigen, |
575 | articulos.precio, | 551 | articulos.precio, |
576 | articulos.precio, | 552 | articulos.precio, |
577 | articulos.balanza, | 553 | articulos.balanza, |
578 | articulos.depSn, | 554 | articulos.depSn, |
579 | ObtenerFechaActual(), | 555 | ObtenerFechaActual(), |
580 | ObtenerFechaActual()) | 556 | ObtenerFechaActual()) |
581 | InsertarArtEnDB(body)// TODO MANDO A CARGAR A LA BASE DE DATOS | 557 | InsertarArtEnDB(body)// TODO MANDO A CARGAR A LA BASE DE DATOS |
582 | } | 558 | } |
583 | 559 | ||
584 | fun cargarRecicler(articulos: Articles, cant: Float) { | 560 | fun cargarRecicler(articulos: Articles, cant: Float) { |
585 | 561 | ||
586 | //TODO CARGO EN LE RV | 562 | //TODO CARGO EN LE RV |
587 | val item = ItemsRecycler(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar, articulos.codOrigen) | 563 | val item = ItemsRecycler(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar, articulos.codOrigen) |
588 | listArticulos.add(item) | 564 | listArticulos.add(item) |
589 | 565 | ||
590 | viewAdapter = ProductosListAdapter(listArticulos) | 566 | viewAdapter = ProductosListAdapter(listArticulos) |
591 | viewManager = LinearLayoutManager(requireContext()) | 567 | viewManager = LinearLayoutManager(requireContext()) |
592 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! | 568 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! |
593 | rcInventarios.apply { | 569 | rcInventarios.apply { |
594 | adapter = viewAdapter | 570 | adapter = viewAdapter |
595 | layoutManager = viewManager | 571 | layoutManager = viewManager |
596 | } | 572 | } |
597 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { | 573 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { |
598 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | 574 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { |
599 | return false | 575 | return false |
600 | } | 576 | } |
601 | 577 | ||
602 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { | 578 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { |
603 | (viewAdapter as ProductosListAdapter).removeItem(viewHolder) | 579 | (viewAdapter as ProductosListAdapter).removeItem(viewHolder) |
604 | viewAdapter.notifyDataSetChanged() | 580 | viewAdapter.notifyDataSetChanged() |
605 | } | 581 | } |
606 | 582 | ||
607 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | 583 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
608 | val itemView = viewHolder.itemView | 584 | val itemView = viewHolder.itemView |
609 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 | 585 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 |
610 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | 586 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) |
611 | 587 | ||
612 | if (dX > 0) { | 588 | if (dX > 0) { |
613 | 589 | ||
614 | if (dX < c.width / 2) c.drawColor(Color.GREEN) | 590 | if (dX < c.width / 2) c.drawColor(Color.GREEN) |
615 | else c.drawColor(Color.RED) | 591 | else c.drawColor(Color.RED) |
616 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) | 592 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) |
617 | } else { | 593 | } else { |
618 | 594 | ||
619 | } | 595 | } |
620 | 596 | ||
621 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 597 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
622 | deleteIcon.draw(c) | 598 | deleteIcon.draw(c) |
623 | } | 599 | } |
624 | } | 600 | } |
625 | 601 | ||
626 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) | 602 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) |
627 | itemTouchHelper.attachToRecyclerView(rcInventarios) | 603 | itemTouchHelper.attachToRecyclerView(rcInventarios) |
628 | } | 604 | } |
629 | 605 | ||
630 | private fun ProdNoCont(): Int? { | 606 | private fun ProdNoCont(): Int? { |
631 | var mostrarStock = 0 | 607 | var mostrarStock = 0 |
632 | if (sharedPreferences.contains("cbMostrarStock")) if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") mostrarStock = 1 | 608 | if (sharedPreferences.contains("cbMostrarStock")) if (sharedPreferences.getString("cbMostrarStock", "").toString() == "1") mostrarStock = 1 |
633 | return mostrarStock | 609 | return mostrarStock |
634 | } | 610 | } |
635 | 611 | ||
636 | private fun AjusteProductos(): Int? { | 612 | private fun AjusteProductos(): Int? { |
637 | var prodInclu = 0 | 613 | var prodInclu = 0 |
638 | if (sharedPreferences.contains("rbProInclu")) if (sharedPreferences.getString("rbProInclu", "").toString() == "1") prodInclu = 1 | 614 | if (sharedPreferences.contains("rbProInclu")) if (sharedPreferences.getString("rbProInclu", "").toString() == "1") prodInclu = 1 |
639 | 615 | ||
640 | if (sharedPreferences.contains("rbProNoInclu")) if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") prodInclu = 0 | 616 | if (sharedPreferences.contains("rbProNoInclu")) if (sharedPreferences.getString("rbProNoInclu", "").toString() == "0") prodInclu = 0 |
641 | return prodInclu | 617 | return prodInclu |
642 | } | 618 | } |
643 | 619 | ||
644 | private fun SerchArea() { | 620 | private fun SerchArea() { |
645 | 621 | ||
646 | if (sharedPreferences.contains("rbVentas")) if (sharedPreferences.getString("rbVentas", "").toString() == "1") iArea = 0 | 622 | if (sharedPreferences.contains("rbVentas")) if (sharedPreferences.getString("rbVentas", "").toString() == "1") iArea = 0 |
647 | if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = 1 | 623 | if (sharedPreferences.contains("rbDeposito")) if (sharedPreferences.getString("rbDeposito", "").toString() == "1") iArea = 1 |
648 | } | 624 | } |
649 | 625 | ||
650 | fun ObtenerFechaActual(): String? { | 626 | fun ObtenerFechaActual(): String? { |
651 | //TODO OBTENGO FECHA Y HORA ACTUAL PARA LA CABECERA DEL INVENTARIO Y PARA CADA ITEM QUE SE INSERTA EN LA BD | 627 | //TODO OBTENGO FECHA Y HORA ACTUAL PARA LA CABECERA DEL INVENTARIO Y PARA CADA ITEM QUE SE INSERTA EN LA BD |
652 | val current = LocalDateTime.now() | 628 | val current = LocalDateTime.now() |
653 | val formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy hh:mm:ss") | 629 | val formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy hh:mm:ss") |
654 | val dFechaHora = current.format(formatter) | 630 | val dFechaHora = current.format(formatter) |
655 | return dFechaHora.toString() | 631 | return dFechaHora.toString() |
656 | } | 632 | } |
657 | 633 | ||
658 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { | 634 | fun InsertarArtEnDB(cuarpoInventario: InvBody) { |
659 | lifecycleScope.launch { | 635 | lifecycleScope.launch { |
660 | withContext(Dispatchers.IO) { | 636 | withContext(Dispatchers.IO) { |
661 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) | 637 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.insertInvBody(cuarpoInventario) |
662 | } | 638 | } |
663 | } | 639 | } |
664 | } | 640 | } |
665 | 641 | ||
666 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { | 642 | fun updateCantidad(sector: String, codigo: String, cantidad: Float) { |
667 | lifecycleScope.launch { | 643 | lifecycleScope.launch { |
668 | withContext(Dispatchers.IO) { | 644 | withContext(Dispatchers.IO) { |
669 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) | 645 | AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.UpdateInvBody(cantidad, sector, codigo) |
670 | } | 646 | } |
671 | } | 647 | } |
672 | } | 648 | } |
673 | 649 | ||
674 | suspend fun cargarInventario(inventario: Int): List<InvBody>? { | 650 | suspend fun cargarInventario(inventario: Int): List<InvBody>? { |
675 | // var inventarios: List<InvBody>? = null | 651 | // var inventarios: List<InvBody>? = null |
676 | return GlobalScope.async(Dispatchers.IO) { | 652 | return GlobalScope.async(Dispatchers.IO) { |
677 | return@async AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.fetchAllInvBody(inventario) | 653 | return@async AppDb.getAppDb(requireActivity())!!.InvBodyDAO()!!.fetchAllInvBody(inventario) |
678 | }.await() | 654 | }.await() |
679 | } | 655 | } |
680 | } | 656 | } |
681 | 657 | ||
682 | 658 | ||
683 | 659 | ||
684 | 660 | ||
685 | 661 | ||
686 | 662 | ||
687 | 663 | ||
688 | 664 | ||
689 | 665 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/Base/BaseViewHolder.kt
File was created | 1 | package com.focasoftware.deboinventariov20.ui.main.Base | |
2 | |||
3 | import android.view.View | ||
4 | import androidx.recyclerview.widget.RecyclerView | ||
5 | |||
6 | abstract class BaseViewHolder<T>(itemView:View):RecyclerView.ViewHolder(itemView) { | ||
7 | abstract fun bind(item:T, position:Int) | ||
8 | } |
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/InventarioListAdapter.kt
1 | package com.focasoftware.deboinventariov20.ui.main | 1 | package com.focasoftware.deboinventariov20.ui.main |
2 | 2 | ||
3 | import android.content.Context | ||
3 | import android.view.LayoutInflater | 4 | import android.view.LayoutInflater |
4 | import android.view.View | 5 | import android.view.View |
5 | import android.view.ViewGroup | 6 | import android.view.ViewGroup |
7 | import android.widget.AdapterView | ||
6 | import androidx.recyclerview.widget.RecyclerView | 8 | import androidx.recyclerview.widget.RecyclerView |
7 | import com.focasoftware.deboinventariov20.R | 9 | import com.focasoftware.deboinventariov20.R |
8 | import com.google.android.material.snackbar.Snackbar | 10 | import com.focasoftware.deboinventariov20.ui.main.Base.BaseViewHolder |
9 | import kotlinx.android.synthetic.main.item.view.* | ||
10 | import kotlinx.android.synthetic.main.item_principal.view.* | 11 | import kotlinx.android.synthetic.main.item_principal.view.* |
11 | import javax.sql.ConnectionEventListener | ||
12 | 12 | ||
13 | class InventarioListAdapter(private val context: Context, private val inv: ArrayList<ItemInventario>, private val itemClickListener: OnInventarioClickListener) : | ||
14 | RecyclerView.Adapter<BaseViewHolder<*>>() { | ||
13 | 15 | ||
14 | class InventarioListAdapter(private val productos: ArrayList<ItemInventario>, private val listener: OnItemClickListener) : RecyclerView.Adapter<InventarioListAdapter.ItemsViewHolder>() { | 16 | interface OnInventarioClickListener { |
17 | fun onItemClick(inventario: String?) | ||
18 | } | ||
15 | 19 | ||
16 | internal var items2: ArrayList<ItemInventario>? = null | 20 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(context).inflate(R.layout.item_principal, parent, false)) |
17 | 21 | ||
18 | init { | 22 | override fun getItemCount() = inv.size |
19 | this.items2 = productos | ||
20 | } | ||
21 | 23 | ||
22 | override fun onCreateViewHolder(parent: ViewGroup, p1: Int) = ItemsViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.item_principal, parent, false)) | ||
23 | 24 | ||
24 | override fun getItemCount() = productos.size | 25 | inner class ItemsViewHolder(itemview: View) : BaseViewHolder<ItemInventario>(itemview) { |
26 | override fun bind(item: ItemInventario, position: Int) { | ||
27 | itemView.setOnClickListener {itemClickListener.onItemClick(item.inventario)} | ||
28 | itemView.tvPrincipalinventario.text = item.inventario | ||
29 | } | ||
25 | 30 | ||
26 | override fun onBindViewHolder(holder: ItemsViewHolder, position: Int) { | ||
27 | val currentItem=productos[position] | ||
28 | holder.inventario.text=currentItem.inventario | ||
29 | } | 31 | } |
30 | 32 | ||
31 | inner class ItemsViewHolder constructor(view: View) : RecyclerView.ViewHolder(view),View.OnClickListener { | 33 | override fun onBindViewHolder(holder: BaseViewHolder<*>, position: Int) { |
32 | 34 | when (holder) { | |
33 | val inventario = view.inventario | 35 | is ItemsViewHolder -> holder.bind(inv[position], position) |
34 | init { | 36 | else -> IllegalArgumentException("No se pudo pasar el ViewHolder") |
35 | itemView.setOnClickListener(this) | ||
36 | } | ||
37 | override fun onClick(p0: View?) { | ||
38 | val position=adapterPosition | ||
39 | if (position!=RecyclerView.NO_POSITION) { | ||
40 | listener.OnItemClick(position) |
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 androidx.fragment.app.Fragment | 9 | import androidx.fragment.app.Fragment |
10 | import androidx.navigation.NavController | 10 | import androidx.navigation.NavController |
11 | import androidx.navigation.Navigation | 11 | import androidx.navigation.Navigation |
12 | import androidx.recyclerview.widget.LinearLayoutManager | 12 | import androidx.recyclerview.widget.LinearLayoutManager |
13 | import androidx.recyclerview.widget.RecyclerView | 13 | import androidx.recyclerview.widget.RecyclerView |
14 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb | 14 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
15 | import com.focasoftware.deboinventariov20.Model.InvHead | 15 | import com.focasoftware.deboinventariov20.Model.InvHead |
16 | import com.focasoftware.deboinventariov20.R | 16 | import com.focasoftware.deboinventariov20.R |
17 | import kotlinx.coroutines.Dispatchers | 17 | import kotlinx.coroutines.Dispatchers |
18 | import kotlinx.coroutines.GlobalScope | 18 | import kotlinx.coroutines.GlobalScope |
19 | import kotlinx.coroutines.async | 19 | import kotlinx.coroutines.async |
20 | import kotlinx.coroutines.launch | 20 | import kotlinx.coroutines.launch |
21 | import java.util.* | 21 | import java.util.* |
22 | 22 | ||
23 | class MainFragment : Fragment(), InventarioListAdapter.OnItemClickListener { | 23 | class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener { |
24 | private lateinit var inventarios: List<InvHead> | 24 | private lateinit var inventarios: List<InvHead> |
25 | private lateinit var rcInventario: RecyclerView | 25 | private lateinit var rcInventario: 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 = ArrayList<ItemInventario>() | 28 | private var listIvn = ArrayList<ItemInventario>() |
29 | private lateinit var navController: NavController | 29 | private lateinit var navController: NavController |
30 | private lateinit var sharedPreferences: SharedPreferences | 30 | private lateinit var sharedPreferences: SharedPreferences |
31 | 31 | ||
32 | override fun onCreate(savedInstanceState: Bundle?) { | 32 | override fun onCreate(savedInstanceState: Bundle?) { |
33 | super.onCreate(savedInstanceState) | 33 | super.onCreate(savedInstanceState) |
34 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) | 34 | sharedPreferences = requireActivity().getSharedPreferences("SP_INFO", Context.MODE_PRIVATE) |
35 | 35 | ||
36 | 36 | ||
37 | } | 37 | } |
38 | 38 | ||
39 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 39 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
40 | val v = inflater.inflate(R.layout.fragment_main, container, false) | 40 | val v = inflater.inflate(R.layout.fragment_main, container, false) |
41 | 41 | ||
42 | GlobalScope.launch(Dispatchers.Main) { | 42 | GlobalScope.launch(Dispatchers.Main) { |
43 | inventarios = buscarEnBDInvHead() | 43 | inventarios = buscarEnBDInvHead() |
44 | for ((i, item) in inventarios.withIndex()) { | 44 | for ((i, item) in inventarios.withIndex()) { |
45 | val inv = InvHead(inventarios[i].invNum, | 45 | val inv = InvHead(inventarios[i].invNum, |
46 | inventarios[i].descripcion, | 46 | inventarios[i].descripcion, |
47 | inventarios[i].estado, | 47 | inventarios[i].estado, |
48 | inventarios[i].fechaInicio, | 48 | inventarios[i].fechaInicio, |
49 | inventarios[i].fechaFinal, | 49 | inventarios[i].fechaFinal, |
50 | inventarios[i].prodContados, | 50 | inventarios[i].prodContados, |
51 | inventarios[i].lugar, | 51 | inventarios[i].lugar, |
52 | inventarios[i].stDesc, | 52 | inventarios[i].stDesc, |
53 | inventarios[i].proNoCont) | 53 | inventarios[i].proNoCont) |
54 | cargarRecicler(inv) | 54 | cargarRecicler(inv) |
55 | } | 55 | } |
56 | } | 56 | } |
57 | rcInventario = v.findViewById(R.id.rcInventario) | 57 | rcInventario = v.findViewById(R.id.rcInventario) |
58 | return v | 58 | return v |
59 | } | 59 | } |
60 | 60 | ||
61 | suspend fun buscarEnBDInvHead(): List<InvHead> { | 61 | suspend fun buscarEnBDInvHead(): List<InvHead> { |
62 | //TODO BUSQUEDA POR DESCRIPCION | 62 | //TODO BUSQUEDA POR DESCRIPCION |
63 | var busqueda: List<InvHead> | 63 | var busqueda: List<InvHead> |
64 | return GlobalScope.async(Dispatchers.IO) { | 64 | return GlobalScope.async(Dispatchers.IO) { |
65 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.fetchAllInvHead() | 65 | busqueda = AppDb.getAppDb(requireContext())!!.InvHeadDAO()!!.fetchAllInvHead() |
66 | return@async busqueda | 66 | return@async busqueda |
67 | }.await() | 67 | }.await() |
68 | } | 68 | } |
69 | 69 | ||
70 | fun cargarRecicler(inv: InvHead) { | 70 | fun cargarRecicler(inv: InvHead) { |
71 | //TODO CARGO EN LE RV | 71 | //TODO CARGO EN LE RV |
72 | 72 | ||
73 | val number = if (inv.invNum.toLong()<10) "0${inv.invNum.toLong()}" else inv.invNum.toString() | 73 | val number = if (inv.invNum.toLong()<10) "0${inv.invNum.toLong()}" else inv.invNum.toString() |
74 | val item = ItemInventario("N° $number ${inv.descripcion}. Fecha: ${inv.fechaFinal}") | 74 | val item = ItemInventario("N° $number ${inv.descripcion}. Fecha: ${inv.fechaFinal}") |
75 | //(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar) | 75 | //(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar) |
76 | listIvn.add(item) | 76 | listIvn.add(item) |
77 | 77 | ||
78 | viewAdapter = InventarioListAdapter(listIvn, this) | 78 | viewAdapter = InventarioListAdapter(requireContext(),listIvn,this) |
79 | viewManager = LinearLayoutManager(requireContext()) | 79 | viewManager = LinearLayoutManager(requireContext()) |
80 | 80 | ||
81 | rcInventario.apply { | 81 | rcInventario.apply { |
82 | adapter = viewAdapter | 82 | adapter = viewAdapter |
83 | layoutManager = viewManager | 83 | layoutManager = viewManager |
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 87 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
88 | super.onViewCreated(view, savedInstanceState) | 88 | super.onViewCreated(view, savedInstanceState) |
89 | navController = Navigation.findNavController(view) | 89 | navController = Navigation.findNavController(view) |
90 | listIvn.clear() | 90 | listIvn.clear() |
91 | } | 91 | } |
92 | 92 | ||
93 | override fun OnItemClick(position: Int) { | 93 | override fun onItemClick(inventario: String?) { |
94 | val editor = sharedPreferences.edit() | ||
95 | var invSel:String = listIvn[position].inventario.toString() | ||
96 | invSel=invSel.substring(3, 5) | ||
97 | editor?.putString("Inventario", invSel) | ||
98 | editor?.apply() | ||
99 | editor.commit() | ||
100 | navController.navigate(R.id.action_mainFragment2_to_inventarioFragment) | ||
101 | 94 | ||
95 | val editor = sharedPreferences.edit() | ||
96 | var invSel:String =inventario.toString() | ||
97 | invSel=invSel.substring(3, 5) | ||
98 | editor?.putString("Inventario", invSel) | ||
99 | editor?.apply() | ||
100 | editor.commit() |
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 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 androidx.core.content.ContextCompat | 11 | import androidx.core.content.ContextCompat |
11 | import androidx.fragment.app.Fragment | 12 | import androidx.fragment.app.Fragment |
12 | import androidx.lifecycle.lifecycleScope | 13 | import androidx.lifecycle.lifecycleScope |
13 | import androidx.recyclerview.widget.DefaultItemAnimator | ||
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 com.focasoftware.deboinventariov20.ui.inventario.ProductosListAdapter | ||
21 | import kotlinx.android.synthetic.main.fragment_servidores.* | 20 | import kotlinx.android.synthetic.main.fragment_servidores.* |
22 | import kotlinx.coroutines.* | 21 | import kotlinx.coroutines.* |
23 | import java.text.FieldPosition | ||
24 | 22 | ||
25 | class ServidoresFragment : Fragment() { | 23 | class ServidoresFragment : Fragment() { |
26 | private val servidorNuevo = ArrayList<ItemsServidores>() | 24 | |
27 | private var index = 0 | ||
28 | private lateinit var rvServidores: RecyclerView | 25 | private lateinit var rvServidores: RecyclerView |
29 | private lateinit var viewAdapter: RecyclerView.Adapter<*> | 26 | private lateinit var viewAdapter: RecyclerView.Adapter<*> |
30 | private lateinit var viewManager: RecyclerView.LayoutManager | 27 | private lateinit var viewManager: RecyclerView.LayoutManager |
31 | private var listIvn = java.util.ArrayList<ItemsServidores>() | 28 | private var listIvn = java.util.ArrayList<ItemsServidores>() |
32 | private lateinit var servidores: List<ServeInv> | 29 | private lateinit var servidores: List<ServeInv> |
33 | private lateinit var deleteIcon: Drawable | 30 | private lateinit var deleteIcon: Drawable |
34 | 31 | ||
35 | override fun onCreate(savedInstanceState: Bundle?) { | 32 | override fun onCreate(savedInstanceState: Bundle?) { |
36 | super.onCreate(savedInstanceState) | 33 | super.onCreate(savedInstanceState) |
37 | buscaEnBD() | 34 | CargarRV() |
38 | } | 35 | } |
39 | 36 | ||
40 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 37 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
41 | super.onViewCreated(view, savedInstanceState) | 38 | super.onViewCreated(view, savedInstanceState) |
42 | 39 | ||
43 | rvServidores.layoutManager = LinearLayoutManager(context) | 40 | // rvServidores.layoutManager = LinearLayoutManager(context) |
44 | rvServidores.itemAnimator = DefaultItemAnimator() | 41 | // rvServidores.itemAnimator = DefaultItemAnimator() |
45 | 42 | ||
46 | btnGuardarServidores.setOnClickListener { | 43 | btnGuardarServidores.setOnClickListener { |
47 | if (etNombreServidor.text.isNullOrBlank()){ | 44 | if (etNombreServidor.text.isNullOrBlank()) { |
48 | etNombreServidor.error="Nombre no valido" | 45 | etNombreServidor.error = "Nombre no valido" |
49 | etNombreServidor.requestFocus() | 46 | etNombreServidor.requestFocus() |
50 | etNombreServidor.hint="Nombre no valido" | 47 | etNombreServidor.hint = "Nombre no valido" |
51 | } | 48 | } |
52 | if (etDireccionServidor.text.isNullOrBlank()){ | 49 | if (etDireccionServidor.text.isNullOrBlank()) { |
53 | etDireccionServidor.error="Dirección no valida" | 50 | etDireccionServidor.error = "Dirección no valida" |
54 | etDireccionServidor.requestFocus() | 51 | etDireccionServidor.requestFocus() |
55 | etDireccionServidor.hint="Dirección no valida" | 52 | etDireccionServidor.hint = "Dirección no valida" |
56 | } | 53 | } |
57 | if (!etDireccionServidor.text.isNullOrBlank() || !etNombreServidor.text.isNullOrBlank()){ | 54 | if (!etDireccionServidor.text.isNullOrBlank() || !etNombreServidor.text.isNullOrBlank()) { |
58 | btnGuardarServidores.isEnabled=true | 55 | Toast.makeText(requireContext(), "Servidor ${etNombreServidor.text} Guardado", Toast.LENGTH_LONG).show() |
59 | buscaEnBD() | 56 | GlobalScope.launch(Dispatchers.Main) { |
60 | rvServidores.adapter = AdapterServidores(ingresarDatos(), requireContext()) | 57 | val num: Long = buscaUltimoNroEnBD() |
61 | btnGuardarServidores.isEnabled=false | 58 | val servidor = ServeInv(num, etNombreServidor.text.toString(), "http://${etDireccionServidor.text}/", "0") |
59 | ingresarDatos(servidor) | ||
60 | cargarRecicler(servidor) | ||
61 | } | ||
62 | etNombreServidor.text.clear() | ||
63 | etDireccionServidor.text.clear() | ||
62 | } | 64 | } |
63 | } | 65 | } |
64 | } | 66 | } |
67 | |||
65 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | 68 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
66 | val v = inflater.inflate(R.layout.fragment_servidores, container, false) | 69 | val v = inflater.inflate(R.layout.fragment_servidores, container, false) |
67 | rvServidores = v.findViewById(R.id.rvServidores) | 70 | rvServidores = v.findViewById(R.id.rvServidores) |
68 | |||
69 | return v | 71 | return v |
70 | } | 72 | } |
71 | 73 | ||
72 | fun ingresarDatos(): ArrayList<ItemsServidores> { | ||
73 | 74 | ||
74 | val item = ItemsServidores(etNombreServidor.text.toString(), etDireccionServidor.text.toString(), "0") | 75 | suspend fun buscaUltimoNroEnBD(): Long { |
75 | val servidor = ServeInv(etNombreServidor.text.toString(), etDireccionServidor.text.toString(), "0") | 76 | |
76 | index += index | 77 | var busqueda: Long |
77 | servidorNuevo.add(item) | 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) { | ||
78 | val Job = GlobalScope.launch { | 85 | val Job = GlobalScope.launch { |
79 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.insertServer(servidor) | 86 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.insertServer(servidor) |
80 | } | 87 | } |
81 | |||
82 | return servidorNuevo | ||
83 | } | 88 | } |
84 | 89 | ||
85 | suspend fun buscarEnBD(): List<ServeInv> { | 90 | suspend fun buscarEnBD(): List<ServeInv> { |
86 | //TODO BUSQUEDA POR DESCRIPCION | 91 | //TODO BUSQUEDA POR DESCRIPCION |
87 | var busqueda: List<ServeInv> | 92 | var busqueda: List<ServeInv> |
88 | return GlobalScope.async(Dispatchers.IO) { | 93 | return GlobalScope.async(Dispatchers.IO) { |
89 | busqueda = AppDb.getAppDb(requireContext())!!.ServeInvDao()!!.fetchAllServers() | 94 | busqueda = AppDb.getAppDb(requireContext())!!.ServeInvDao()!!.fetchAllServers() |
90 | return@async busqueda | 95 | return@async busqueda |
91 | }.await() | 96 | }.await() |
92 | } | 97 | } |
93 | 98 | ||
94 | fun buscaEnBD() { | 99 | fun CargarRV() { |
95 | GlobalScope.launch(Dispatchers.Main) { | 100 | GlobalScope.launch(Dispatchers.Main) { |
96 | servidores = buscarEnBD() | 101 | servidores = buscarEnBD() |
97 | for ((i, item) in servidores.withIndex()) { | 102 | for ((i, item) in servidores.withIndex()) { |
98 | val ser = ServeInv(servidores[i].descripcion, servidores[i].direccion, servidores[i].predeterminado) | 103 | val ser = ServeInv(servidores[i].SER_NUM, servidores[i].descripcion, servidores[i].direccion, servidores[i].predeterminado) |
99 | cargarRecicler(ser) | 104 | cargarRecicler(ser) |
100 | } | 105 | } |
101 | } | 106 | } |
102 | } | 107 | } |
103 | 108 | ||
104 | fun cargarRecicler(ser: ServeInv) { | 109 | fun cargarRecicler(ser: ServeInv) { |
105 | //TODO CARGO EN LE RV | 110 | //TODO CARGO EN LE RV |
106 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! | 111 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! |
107 | val item = ItemsServidores(ser.descripcion, ser.direccion, ser.predeterminado) | 112 | val item = ItemsServidores(ser.SER_NUM, ser.descripcion, ser.direccion, ser.predeterminado) |
108 | index += index | 113 | |
109 | listIvn.add(item) | 114 | listIvn.add(item) |
110 | 115 | ||
111 | viewAdapter = AdapterServidores(listIvn, requireContext()) | 116 | viewAdapter = AdapterServidores(listIvn, requireContext()) |
112 | viewManager = LinearLayoutManager(requireContext()) | 117 | viewManager = LinearLayoutManager(requireContext()) |
113 | 118 | ||
114 | rvServidores.apply { | 119 | rvServidores.apply { |
115 | adapter = viewAdapter | 120 | adapter = viewAdapter |
116 | layoutManager = viewManager | 121 | layoutManager = viewManager |
117 | } | 122 | } |
118 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { | 123 | val itemTouchHelperCallback = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.RIGHT) { |
119 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { | 124 | override fun onMove(p0: RecyclerView, p1: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { |
120 | return false | 125 | return false |
121 | } | 126 | } |
122 | 127 | ||
123 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { | 128 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { |
124 | BorrarInvActual(viewHolder.adapterPosition.toLong()) | 129 | // viewManager[ |
130 | // BorrarInvActual(viewHolder.adapterPosition.toInt()) | ||
125 | 131 | ||
126 | (viewAdapter as AdapterServidores).removeItem(viewHolder) | 132 | (viewAdapter as AdapterServidores).removeItem(viewHolder) |
127 | viewAdapter.notifyDataSetChanged() | 133 | viewAdapter.notifyDataSetChanged() |
128 | } | 134 | } |
129 | 135 | ||
130 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { | 136 | override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) { |
131 | val itemView = viewHolder.itemView | 137 | val itemView = viewHolder.itemView |
132 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 | 138 | val iconMargin = (itemView.height - deleteIcon.intrinsicHeight) / 2 |
133 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) | 139 | c.clipRect(0f, itemView.top.toFloat(), dX, itemView.bottom.toFloat()) |
134 | 140 | ||
135 | if (dX > 0) { | 141 | if (dX > 0) { |
136 | 142 | ||
137 | if (dX < c.width / 2) c.drawColor(Color.GREEN) | 143 | if (dX < c.width / 2) c.drawColor(Color.GREEN) |
138 | else c.drawColor(Color.RED) | 144 | else c.drawColor(Color.RED) |
139 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) | 145 | deleteIcon.setBounds(itemView.left + iconMargin, itemView.top + iconMargin, itemView.left + iconMargin + deleteIcon.intrinsicWidth, itemView.bottom - iconMargin) |
140 | } else { } | 146 | } else { |
147 | } | ||
141 | 148 | ||
142 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) | 149 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
143 | deleteIcon.draw(c) | 150 | deleteIcon.draw(c) |
144 | 151 | ||
145 | } | 152 | } |
146 | } | 153 | } |
147 | 154 | ||
148 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) | 155 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) |
149 | itemTouchHelper.attachToRecyclerView(rvServidores) | 156 | itemTouchHelper.attachToRecyclerView(rvServidores) |
150 | } | 157 | } |
158 | |||
151 | private fun BorrarInvActual(idServer: Long) { | 159 | private fun BorrarInvActual(idServer: Long) { |
app/src/main/res/drawable/suitedebo.png
6.74 KB
app/src/main/res/layout/activity_splash.xml
File was created | 1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | ||
4 | xmlns:tools="http://schemas.android.com/tools" | ||
5 | android:layout_width="match_parent" | ||
6 | android:layout_height="match_parent" | ||
7 | tools:context=".ui.SplashActivity"> | ||
8 | |||
9 | |||
10 | <androidx.appcompat.widget.AppCompatTextView | ||
11 | android:id="@+id/textView2" | ||
12 | android:layout_width="match_parent" | ||
13 | android:layout_height="100dp" | ||
14 | android:layout_margin="20dp" | ||
15 | android:autoSizeMaxTextSize="1000sp" | ||
16 | android:autoSizeMinTextSize="30sp" | ||
17 | android:autoSizeStepGranularity="5sp" | ||
18 | android:autoSizeTextType="uniform" | ||
19 | android:gravity="center" | ||
20 | android:lines="1" | ||
21 | android:text="@string/bien" | ||
22 | android:textColor="@color/colorAccent" | ||
23 | app:fontFamily="sans-serif-condensed" | ||
24 | app:layout_constraintBottom_toTopOf="@+id/imageView" | ||
25 | app:layout_constraintEnd_toEndOf="parent" | ||
26 | app:layout_constraintStart_toStartOf="parent" | ||
27 | app:layout_constraintTop_toTopOf="parent" /> | ||
28 | |||
29 | <ImageView | ||
30 | android:id="@+id/imageView" | ||
31 | android:layout_width="wrap_content" | ||
32 | android:layout_height="wrap_content" | ||
33 | android:contentDescription="@string/todo" | ||
34 | android:src="@drawable/ic_launcher_background" | ||
35 | app:layout_constraintBottom_toTopOf="@id/textView3" | ||
36 | app:layout_constraintEnd_toEndOf="parent" | ||
37 | app:layout_constraintStart_toStartOf="parent" | ||
38 | app:layout_constraintTop_toBottomOf="@+id/textView2" | ||
39 | app:srcCompat="@drawable/suitedebo" /> | ||
40 | |||
41 | |||
42 | <TextView | ||
43 | android:id="@+id/textView3" | ||
44 | android:layout_width="match_parent" | ||
45 | android:layout_height="100dp" | ||
46 | android:layout_margin="20dp" | ||
47 | android:autoSizeMaxTextSize="1000sp" | ||
48 | android:autoSizeMinTextSize="30sp" | ||
49 | android:autoSizeStepGranularity="5sp" | ||
50 | android:autoSizeTextType="uniform" | ||
51 | android:gravity="center" | ||
52 | android:lines="1" | ||
53 | android:text="@string/debo" | ||
54 | android:textColor="@color/colorAccent" | ||
55 | app:fontFamily="sans-serif-condensed" | ||
56 | app:layout_constraintBottom_toTopOf="@+id/textView4" | ||
57 | app:layout_constraintEnd_toEndOf="parent" | ||
58 | app:layout_constraintStart_toStartOf="parent" | ||
59 | app:layout_constraintTop_toBottomOf="@+id/imageView" /> | ||
60 | |||
61 | <androidx.appcompat.widget.AppCompatTextView | ||
62 | android:id="@+id/textView4" | ||
63 | android:layout_width="match_parent" | ||
64 | android:layout_height="110dp" | ||
65 | android:layout_margin="20dp" | ||
66 | android:autoSizeMaxTextSize="1000sp" | ||
67 | android:autoSizeMinTextSize="30sp" | ||
68 | android:autoSizeStepGranularity="5sp" | ||
69 | android:autoSizeTextType="uniform" | ||
70 | android:gravity="center" | ||
71 | android:lines="1" | ||
72 | android:text="@string/inventario" | ||
73 | android:textColor="@color/colorAccent" | ||
74 | app:fontFamily="sans-serif-condensed" | ||
75 | app:layout_constraintBottom_toBottomOf="parent" | ||
76 | app:layout_constraintEnd_toEndOf="parent" | ||
77 | app:layout_constraintEnd_toStartOf="parent" | ||
78 | app:layout_constraintTop_toBottomOf="@id/textView3" /> | ||
79 | </androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/layout/app_bar_main.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.coordinatorlayout.widget.CoordinatorLayout 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 | tools:context=".MainActivity"> | 7 | tools:context=".ui.MainActivity"> |
8 | 8 | ||
9 | <com.google.android.material.appbar.AppBarLayout | 9 | <com.google.android.material.appbar.AppBarLayout |
10 | android:layout_width="match_parent" | 10 | android:layout_width="match_parent" |
11 | android:layout_height="wrap_content" | 11 | android:layout_height="wrap_content" |
12 | android:theme="@style/AppTheme.AppBarOverlay"> | 12 | android:theme="@style/AppTheme.AppBarOverlay"> |
13 | 13 | ||
14 | <androidx.appcompat.widget.Toolbar | 14 | <androidx.appcompat.widget.Toolbar |
15 | android:id="@+id/toolbar" | 15 | android:id="@+id/toolbar" |
16 | android:layout_width="match_parent" | 16 | android:layout_width="match_parent" |
17 | android:layout_height="?attr/actionBarSize" | 17 | android:layout_height="?attr/actionBarSize" |
18 | android:background="?attr/colorPrimary" | 18 | android:background="?attr/colorPrimary" |
19 | app:popupTheme="@style/AppTheme.PopupOverlay" /> | 19 | app:popupTheme="@style/AppTheme.PopupOverlay" /> |
20 | 20 | ||
21 | </com.google.android.material.appbar.AppBarLayout> | 21 | </com.google.android.material.appbar.AppBarLayout> |
22 | 22 | ||
23 | <include layout="@layout/content_main" /> | 23 | <include layout="@layout/content_main" /> |
24 | 24 | ||
25 | 25 | ||
26 | </androidx.coordinatorlayout.widget.CoordinatorLayout> | 26 | </androidx.coordinatorlayout.widget.CoordinatorLayout> |
app/src/main/res/layout/fragment_inventario.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:id="@+id/frameLayout" | 5 | android:id="@+id/frameLayout" |
6 | android:layout_width="match_parent" | 6 | android:layout_width="match_parent" |
7 | android:layout_height="match_parent" | 7 | android:layout_height="match_parent" |
8 | tools:context=".ui.inventario.InventarioFragment"> | 8 | tools:context=".ui.inventario.InventarioFragment"> |
9 | 9 | ||
10 | 10 | ||
11 | <androidx.appcompat.widget.AppCompatTextView | 11 | <androidx.appcompat.widget.AppCompatTextView |
12 | android:id="@+id/tvTitulo" | 12 | android:id="@+id/tvTitulo" |
13 | android:layout_width="match_parent" | 13 | android:layout_width="match_parent" |
14 | android:layout_height="90dp" | 14 | android:layout_height="90dp" |
15 | android:layout_marginStart="8dp" | 15 | android:layout_marginStart="8dp" |
16 | android:layout_marginTop="15dp" | 16 | android:layout_marginTop="15dp" |
17 | android:layout_marginEnd="8dp" | 17 | android:layout_marginEnd="8dp" |
18 | android:autoSizeMaxTextSize="100sp" | 18 | android:autoSizeMaxTextSize="100sp" |
19 | android:autoSizeMinTextSize="20sp" | 19 | android:autoSizeMinTextSize="20sp" |
20 | android:autoSizeStepGranularity="5sp" | 20 | android:autoSizeStepGranularity="5sp" |
21 | android:autoSizeTextType="uniform" | 21 | android:autoSizeTextType="uniform" |
22 | android:gravity="center" | 22 | android:gravity="center" |
23 | android:lines="1" | 23 | android:lines="1" |
24 | android:text="@string/invTitulo" | 24 | android:text="@string/invTitulo" |
25 | android:textColor="@color/colorAccent" | 25 | android:textColor="@color/colorAccent" |
26 | app:fontFamily="sans-serif-condensed" | 26 | app:fontFamily="sans-serif-condensed" |
27 | app:layout_constraintBottom_toTopOf="@id/guideline2" | 27 | app:layout_constraintBottom_toTopOf="@id/guideline2" |
28 | app:layout_constraintEnd_toEndOf="parent" | 28 | app:layout_constraintEnd_toEndOf="parent" |
29 | app:layout_constraintStart_toStartOf="parent" | 29 | app:layout_constraintStart_toStartOf="parent" |
30 | app:layout_constraintTop_toTopOf="@id/guideline" /> | 30 | app:layout_constraintTop_toTopOf="@id/guideline" /> |
31 | 31 | ||
32 | 32 | ||
33 | <ImageButton | 33 | <ImageButton |
34 | android:id="@+id/ivCamara" | 34 | android:id="@+id/ivCamara" |
35 | android:layout_width="80dp" | 35 | android:layout_width="80dp" |
36 | android:layout_height="80dp" | 36 | android:layout_height="80dp" |
37 | 37 | android:layout_marginTop="15dp" | |
38 | android:clickable="true" | 38 | android:clickable="true" |
39 | android:contentDescription="@string/ibBusCB" | 39 | android:contentDescription="@string/ibBusCB" |
40 | android:elevation="5dp" | 40 | android:elevation="5dp" |
41 | android:background="@drawable/boton_redondo" | 41 | android:background="@drawable/boton_redondo" |
42 | android:layout_margin="10dp" | 42 | android:layout_margin="10dp" |
43 | android:focusable="false" | 43 | android:focusable="false" |
44 | android:scaleType="fitEnd" | 44 | android:scaleType="fitEnd" |
45 | app:layout_constraintCircleRadius="40dp" | 45 | app:layout_constraintCircleRadius="40dp" |
46 | android:src="@drawable/codbar" | 46 | android:src="@drawable/codbar" |
47 | app:layout_constraintBottom_toTopOf="@id/guideline3" | 47 | app:layout_constraintBottom_toTopOf="@id/guideline3" |
48 | app:layout_constraintEnd_toStartOf="@+id/etCodigoBarras" | 48 | app:layout_constraintEnd_toStartOf="@+id/etCodigoBarras" |
49 | app:layout_constraintHorizontal_bias="0.0" | 49 | app:layout_constraintHorizontal_bias="0.0" |
50 | app:layout_constraintStart_toStartOf="parent" | 50 | app:layout_constraintStart_toStartOf="parent" |
51 | app:layout_constraintTop_toBottomOf="@+id/guideline2" /> | 51 | app:layout_constraintTop_toBottomOf="@+id/guideline2" /> |
52 | 52 | ||
53 | <EditText | 53 | <EditText |
54 | android:id="@+id/etCodigoBarras" | 54 | android:id="@+id/etCodigoBarras" |
55 | android:layout_width="0dp" | 55 | android:layout_width="0dp" |
56 | android:layout_height="wrap_content" | 56 | android:layout_height="wrap_content" |
57 | android:autofillHints="" | 57 | android:autofillHints="" |
58 | android:clickable="true" | 58 | android:clickable="true" |
59 | android:ems="10" | 59 | android:ems="10" |
60 | android:focusable="true" | 60 | android:focusable="true" |
61 | android:hint="@string/ibBusCB" | 61 | android:hint="@string/ibBusCB" |
62 | android:inputType="textPersonName" | 62 | android:inputType="textPersonName" |
63 | android:lines="1" | 63 | android:lines="1" |
64 | android:textAllCaps="true" | 64 | android:textAllCaps="true" |
65 | android:textSize="20sp" | 65 | android:textSize="20sp" |
66 | app:layout_constraintBottom_toTopOf="@+id/guideline3" | 66 | app:layout_constraintBottom_toTopOf="@+id/guideline3" |
67 | app:layout_constraintEnd_toStartOf="@+id/swSumaUno" | 67 | app:layout_constraintEnd_toStartOf="@+id/swSumaUno" |
68 | app:layout_constraintHorizontal_bias="0.49" | 68 | app:layout_constraintHorizontal_bias="0.49" |
69 | app:layout_constraintHorizontal_chainStyle="packed" | 69 | app:layout_constraintHorizontal_chainStyle="packed" |
70 | app:layout_constraintStart_toEndOf="@+id/ivCamara" | 70 | app:layout_constraintStart_toEndOf="@+id/ivCamara" |
71 | app:layout_constraintTop_toBottomOf="@+id/guideline2" /> | 71 | app:layout_constraintTop_toBottomOf="@+id/guideline2" /> |
72 | 72 | ||
73 | 73 | ||
74 | <Switch | 74 | <Switch |
75 | android:id="@+id/swSumaUno" | 75 | android:id="@+id/swSumaUno" |
76 | android:layout_width="wrap_content" | 76 | android:layout_width="wrap_content" |
77 | android:layout_height="wrap_content" | 77 | android:layout_height="wrap_content" |
78 | android:text="@string/switch_1" | 78 | android:text="@string/switch_1" |
79 | app:layout_constraintBottom_toTopOf="@+id/guideline3" | 79 | app:layout_constraintBaseline_toBaselineOf="@+id/etCodigoBarras" |
80 | app:layout_constraintEnd_toEndOf="parent" | 80 | app:layout_constraintEnd_toEndOf="parent" |
81 | app:layout_constraintStart_toEndOf="@id/etCodigoBarras" | 81 | app:layout_constraintStart_toEndOf="@id/etCodigoBarras" |
82 | app:layout_constraintTop_toTopOf="@id/guideline2" | ||
83 | app:layout_constraintVertical_bias="1.0" | ||
84 | tools:ignore="UseSwitchCompatOrMaterialXml" /> | 82 | tools:ignore="UseSwitchCompatOrMaterialXml" /> |
85 | 83 | ||
86 | <androidx.recyclerview.widget.RecyclerView | 84 | <androidx.recyclerview.widget.RecyclerView |
87 | android:id="@+id/rcInventarios" | 85 | android:id="@+id/rcInventarios" |
88 | android:layout_width="match_parent" | 86 | android:layout_width="match_parent" |
89 | android:layout_height="0dp" | 87 | android:layout_height="0dp" |
90 | android:background="@android:color/darker_gray" | 88 | android:background="@android:color/darker_gray" |
91 | app:layout_constraintBottom_toBottomOf="@+id/guideline5" | 89 | app:layout_constraintBottom_toBottomOf="@+id/guideline5" |
92 | app:layout_constraintEnd_toEndOf="parent" | 90 | app:layout_constraintEnd_toEndOf="parent" |
93 | app:layout_constraintStart_toStartOf="parent" | 91 | app:layout_constraintStart_toStartOf="parent" |
94 | app:layout_constraintTop_toBottomOf="@+id/guideline4" | 92 | app:layout_constraintTop_toBottomOf="@+id/guideline4" |
95 | tools:listitem="@layout/item" /> | 93 | tools:listitem="@layout/item" /> |
96 | 94 | ||
97 | 95 | ||
98 | <Button | 96 | <Button |
99 | android:id="@+id/btnExportarInv" | 97 | android:id="@+id/btnExportarInv" |
100 | android:layout_width="wrap_content" | 98 | android:layout_width="wrap_content" |
101 | android:layout_height="wrap_content" | 99 | android:layout_height="wrap_content" |
102 | android:text="@string/btnExportarInv" | 100 | android:text="@string/btnExportarInv" |
103 | android:textColor="@android:color/white" | 101 | android:textColor="@android:color/white" |
104 | android:padding="10dp" | 102 | android:padding="10dp" |
105 | android:background="@drawable/boton_borde_redondeado" | 103 | android:background="@drawable/boton_borde_redondeado" |
106 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" | 104 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" |
107 | app:layout_constraintEnd_toEndOf="parent" | 105 | app:layout_constraintEnd_toEndOf="parent" |
108 | app:layout_constraintHorizontal_chainStyle="spread" | 106 | app:layout_constraintHorizontal_chainStyle="spread" |
109 | app:layout_constraintStart_toEndOf="@+id/btnBorrarInv" | 107 | app:layout_constraintStart_toEndOf="@+id/btnBorrarInv" |
110 | app:layout_constraintTop_toBottomOf="@+id/guideline5" /> | 108 | app:layout_constraintTop_toBottomOf="@+id/guideline5" /> |
111 | 109 | ||
112 | <Button | 110 | <Button |
113 | android:id="@+id/btnBorrarInv" | 111 | android:id="@+id/btnBorrarInv" |
114 | android:layout_width="wrap_content" | 112 | android:layout_width="wrap_content" |
115 | android:layout_height="wrap_content" | 113 | android:layout_height="wrap_content" |
116 | android:text="@string/btnBorrarInv" | 114 | android:text="@string/btnBorrarInv" |
117 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" | 115 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" |
118 | app:layout_constraintEnd_toStartOf="@id/btnExportarInv" | 116 | app:layout_constraintEnd_toStartOf="@id/btnExportarInv" |
119 | app:layout_constraintHorizontal_chainStyle="spread" | 117 | app:layout_constraintHorizontal_chainStyle="spread" |
120 | app:layout_constraintStart_toStartOf="parent" | 118 | app:layout_constraintStart_toStartOf="parent" |
121 | android:textColor="@android:color/white" | 119 | android:textColor="@android:color/white" |
122 | android:padding="10dp" | 120 | android:padding="10dp" |
123 | android:background="@drawable/boton_borde_redondeado" | 121 | android:background="@drawable/boton_borde_redondeado" |
124 | app:layout_constraintTop_toBottomOf="@+id/guideline5" /> | 122 | app:layout_constraintTop_toBottomOf="@+id/guideline5" /> |
125 | 123 | ||
126 | <androidx.constraintlayout.widget.Guideline | 124 | <androidx.constraintlayout.widget.Guideline |
127 | android:id="@+id/guideline" | 125 | android:id="@+id/guideline" |
128 | android:layout_width="wrap_content" | 126 | android:layout_width="wrap_content" |
129 | android:layout_height="wrap_content" | 127 | android:layout_height="wrap_content" |
130 | android:orientation="horizontal" | 128 | android:orientation="horizontal" |
131 | app:layout_constraintGuide_percent="0.02" /> | 129 | app:layout_constraintGuide_percent="0.02" /> |
132 | 130 | ||
133 | <androidx.constraintlayout.widget.Guideline | 131 | <androidx.constraintlayout.widget.Guideline |
134 | android:id="@+id/guideline2" | 132 | android:id="@+id/guideline2" |
135 | android:layout_width="wrap_content" | 133 | android:layout_width="wrap_content" |
136 | android:layout_height="wrap_content" | 134 | android:layout_height="wrap_content" |
137 | android:orientation="horizontal" | 135 | android:orientation="horizontal" |
138 | app:layout_constraintGuide_percent="0.12" /> | 136 | app:layout_constraintGuide_percent="0.12" /> |
139 | 137 | ||
140 | <androidx.constraintlayout.widget.Guideline | 138 | <androidx.constraintlayout.widget.Guideline |
141 | android:id="@+id/guideline3" | 139 | android:id="@+id/guideline3" |
142 | android:layout_width="wrap_content" | 140 | android:layout_width="wrap_content" |
143 | android:layout_height="wrap_content" | 141 | android:layout_height="wrap_content" |
144 | android:orientation="horizontal" | 142 | android:orientation="horizontal" |
145 | app:layout_constraintGuide_percent="0.25" /> | 143 | app:layout_constraintGuide_percent="0.29" /> |
146 | 144 | ||
147 | <androidx.constraintlayout.widget.Guideline | 145 | <androidx.constraintlayout.widget.Guideline |
148 | android:id="@+id/guideline4" | 146 | android:id="@+id/guideline4" |
149 | android:layout_width="wrap_content" | 147 | android:layout_width="wrap_content" |
150 | android:layout_height="wrap_content" | 148 | android:layout_height="wrap_content" |
151 | android:orientation="horizontal" | 149 | android:orientation="horizontal" |
152 | app:layout_constraintGuide_percent="0.35" /> | 150 | app:layout_constraintGuide_percent="0.35" /> |
153 | 151 | ||
154 | <androidx.constraintlayout.widget.Guideline | 152 | <androidx.constraintlayout.widget.Guideline |
155 | android:id="@+id/guideline5" | 153 | android:id="@+id/guideline5" |
156 | android:layout_width="wrap_content" | 154 | android:layout_width="wrap_content" |
157 | android:layout_height="wrap_content" | 155 | android:layout_height="wrap_content" |
158 | android:orientation="horizontal" | 156 | android:orientation="horizontal" |
159 | app:layout_constraintGuide_percent="0.88" /> | 157 | app:layout_constraintGuide_percent="0.88" /> |
160 | 158 | ||
161 | <androidx.constraintlayout.widget.Guideline | 159 | <androidx.constraintlayout.widget.Guideline |
162 | android:id="@+id/guideline6" | 160 | android:id="@+id/guideline6" |
163 | android:layout_width="wrap_content" | 161 | android:layout_width="wrap_content" |
164 | android:layout_height="wrap_content" | 162 | android:layout_height="wrap_content" |
165 | android:orientation="horizontal" | 163 | android:orientation="horizontal" |
166 | app:layout_constraintGuide_percent="0.97" /> | 164 | app:layout_constraintGuide_percent="0.97" /> |
167 | 165 | ||
168 | 166 | ||
169 | </androidx.constraintlayout.widget.ConstraintLayout> | 167 | </androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/layout/fragment_servidores.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 |
3 | xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 4 | xmlns:app="http://schemas.android.com/apk/res-auto" |
4 | xmlns:tools="http://schemas.android.com/tools" | 5 | xmlns:tools="http://schemas.android.com/tools" |
5 | android:layout_width="match_parent" | 6 | android:layout_width="match_parent" |
6 | android:layout_height="match_parent" | 7 | android:layout_height="match_parent" |
7 | tools:context=".ui.servidores.ServidoresFragment"> | 8 | tools:context=".ui.servidores.ServidoresFragment"> |
8 | 9 | ||
9 | |||
10 | <androidx.appcompat.widget.AppCompatTextView | 10 | <androidx.appcompat.widget.AppCompatTextView |
11 | android:id="@+id/tvTitutloServer" | 11 | android:id="@+id/tvTitutloServer" |
12 | android:layout_width="match_parent" | 12 | android:layout_width="match_parent" |
13 | android:layout_height="90dp" | 13 | android:layout_height="90dp" |
14 | android:layout_marginStart="8dp" | 14 | android:layout_marginStart="8dp" |
15 | android:layout_marginTop="15dp" | 15 | android:layout_marginTop="15dp" |
16 | android:layout_marginEnd="8dp" | 16 | android:layout_marginEnd="8dp" |
17 | android:autoSizeMaxTextSize="100sp" | 17 | android:autoSizeMaxTextSize="100sp" |
18 | android:autoSizeMinTextSize="20sp" | 18 | android:autoSizeMinTextSize="20sp" |
19 | android:autoSizeStepGranularity="5sp" | 19 | android:autoSizeStepGranularity="5sp" |
20 | android:autoSizeTextType="uniform" | 20 | android:autoSizeTextType="uniform" |
21 | android:gravity="center" | 21 | android:gravity="center" |
22 | android:lines="1" | 22 | android:lines="1" |
23 | android:text="@string/tvTitutloServer" | 23 | android:text="@string/tvTitutloServer" |
24 | android:textColor="@color/colorAccent" | 24 | android:textColor="@color/colorAccent" |
25 | app:fontFamily="sans-serif-condensed" | 25 | app:fontFamily="sans-serif-condensed" |
26 | app:layout_constraintBottom_toTopOf="@id/guideline2" | ||
27 | app:layout_constraintEnd_toEndOf="parent" | 26 | app:layout_constraintEnd_toEndOf="parent" |
28 | app:layout_constraintStart_toStartOf="parent" | 27 | app:layout_constraintStart_toStartOf="parent" |
29 | app:layout_constraintTop_toTopOf="parent" /> | 28 | app:layout_constraintTop_toTopOf="parent" /> |
30 | 29 | ||
31 | <TextView | 30 | <TextView |
32 | android:id="@+id/tvDirServer" | 31 | android:id="@+id/tvDirServer" |
33 | android:layout_width="match_parent" | 32 | android:layout_width="match_parent" |
34 | android:layout_height="wrap_content" | 33 | android:layout_height="wrap_content" |
35 | android:layout_marginStart="8dp" | 34 | android:layout_margin="10dp" |
36 | android:layout_marginEnd="8dp" | 35 | android:gravity="start" |
37 | android:gravity="center" | ||
38 | android:lines="1" | 36 | android:lines="1" |
39 | android:text="@string/tvDirServer" | 37 | android:text="@string/tvDirServer" |
40 | android:textColor="@android:color/black" | 38 | android:textColor="@android:color/black" |
41 | android:textSize="@dimen/TitulosMedios" | 39 | android:textSize="@dimen/TitulosMedios" |
42 | android:textStyle="bold|italic" | 40 | android:textStyle="bold|italic" |
43 | app:fontFamily="sans-serif-condensed" | 41 | app:fontFamily="sans-serif-condensed" |
44 | app:layout_constraintBottom_toTopOf="@+id/etDireccionServidor" | 42 | app:layout_constraintBottom_toTopOf="@+id/etDireccionServidor" |
45 | app:layout_constraintEnd_toEndOf="parent" | 43 | app:layout_constraintEnd_toEndOf="parent" |
46 | app:layout_constraintStart_toStartOf="parent" | 44 | app:layout_constraintStart_toStartOf="parent" |
47 | app:layout_constraintTop_toBottomOf="@id/guideline3" | 45 | app:layout_constraintTop_toBottomOf="@id/tvTitutloServer" /> |
48 | app:layout_constraintVertical_bias="0.451" /> | ||
49 | |||
50 | <TextView | ||
51 | android:id="@+id/tvNomServer" | ||
52 | android:layout_width="match_parent" | ||
53 | android:layout_height="wrap_content" | ||
54 | android:layout_marginStart="8dp" | ||
55 | android:layout_marginEnd="8dp" | ||
56 | android:layout_marginTop="15dp" | ||
57 | android:gravity="center" | ||
58 | android:lines="2" | ||
59 | android:text="@string/tvNomServer" | ||
60 | android:textColor="@android:color/black" | ||
61 | android:textSize="@dimen/TitulosMedios" | ||
62 | android:textStyle="bold|italic" | ||
63 | app:fontFamily="sans-serif-condensed" | ||
64 | app:layout_constraintBottom_toTopOf="@+id/etNombreServidor" | ||
65 | app:layout_constraintEnd_toEndOf="parent" | ||
66 | app:layout_constraintStart_toStartOf="parent" | ||
67 | app:layout_constraintTop_toBottomOf="@id/guideline2" /> | ||
68 | 46 | ||
69 | <EditText | 47 | <EditText |
70 | android:id="@+id/etNombreServidor" | 48 | android:id="@+id/etDireccionServidor" |
71 | android:layout_width="match_parent" | 49 | android:layout_width="0dp" |
72 | android:layout_height="wrap_content" | 50 | android:layout_height="wrap_content" |
73 | android:autofillHints="" | 51 | android:layout_margin="10dp" |
74 | android:clickable="true" | 52 | android:clickable="true" |
75 | android:ems="10" | 53 | android:ems="10" |
76 | android:focusable="true" | 54 | android:focusable="true" |
55 | android:hint="192.168.10.1:9090" | ||
77 | android:inputType="text" | 56 | android:inputType="text" |
78 | android:lines="1" | 57 | android:lines="1" |
79 | android:hint="Servidor Local" | ||
80 | android:textSize="15sp" | 58 | android:textSize="15sp" |
81 | app:layout_constraintBottom_toTopOf="@id/guideline3" | ||
82 | app:layout_constraintEnd_toEndOf="parent" | 59 | app:layout_constraintEnd_toEndOf="parent" |
83 | app:layout_constraintHorizontal_bias="0.0" | ||
84 | app:layout_constraintStart_toStartOf="parent" | 60 | app:layout_constraintStart_toStartOf="parent" |
85 | app:layout_constraintTop_toBottomOf="@+id/tvNomServer" /> | 61 | app:layout_constraintTop_toBottomOf="@id/tvDirServer" /> |
86 | 62 | ||
87 | <EditText | 63 | <TextView |
88 | android:id="@+id/etDireccionServidor" | 64 | android:id="@+id/tvNomServer" |
89 | android:layout_width="0dp" | 65 | android:layout_width="match_parent" |
90 | android:layout_height="wrap_content" | 66 | android:layout_height="wrap_content" |
91 | android:layout_marginStart="8dp" | 67 | android:layout_margin="10dp" |
92 | android:layout_marginEnd="8dp" | 68 | android:gravity="center" |
93 | android:clickable="true" | ||
94 | android:ems="10" | ||
95 | android:focusable="true" | ||
96 | android:inputType="text" | ||
97 | android:lines="1" | 69 | android:lines="1" |
98 | 70 | android:text="@string/tvNomServer" | |
99 | android:hint="192.168.10.1:9090" | 71 | android:textColor="@android:color/black" |
100 | android:textSize="15sp" | 72 | android:textSize="@dimen/TitulosMedios" |
101 | app:layout_constraintBottom_toTopOf="@id/guideline4" | 73 | android:textStyle="bold|italic" |
74 | app:fontFamily="sans-serif-condensed" | ||
102 | app:layout_constraintEnd_toEndOf="parent" | 75 | app:layout_constraintEnd_toEndOf="parent" |
103 | app:layout_constraintStart_toStartOf="parent" | 76 | app:layout_constraintStart_toStartOf="parent" |
104 | app:layout_constraintTop_toTopOf="@+id/tvDirServer" /> | 77 | app:layout_constraintTop_toBottomOf="@id/etDireccionServidor" /> |
78 | |||
79 | <EditText | ||
80 | android:id="@+id/etNombreServidor" | ||
81 | android:layout_width="match_parent" | ||
82 | android:layout_height="wrap_content" | ||
83 | android:layout_margin="10dp" | ||
84 | android:autofillHints="" | ||
85 | android:clickable="true" | ||
86 | android:ems="10" | ||
87 | android:focusable="true" | ||
88 | android:inputType="text" | ||
89 | android:lines="1" | ||
90 | android:hint="Servidor Local" | ||
91 | android:textSize="15sp" | ||
92 | app:layout_constraintEnd_toEndOf="parent" | ||
93 | app:layout_constraintStart_toStartOf="parent" | ||
94 | app:layout_constraintTop_toBottomOf="@+id/tvNomServer" /> | ||
95 | |||
105 | 96 | ||
106 | <androidx.recyclerview.widget.RecyclerView | 97 | <androidx.recyclerview.widget.RecyclerView |
107 | android:id="@+id/rvServidores" | 98 | android:id="@+id/rvServidores" |
108 | android:layout_width="match_parent" | 99 | android:layout_width="0dp" |
109 | android:layout_height="0dp" | 100 | android:layout_height="0dp" |
101 | android:layout_marginTop="10dp" | ||
102 | app:layout_goneMarginEnd="10dp" | ||
110 | android:background="@android:color/darker_gray" | 103 | android:background="@android:color/darker_gray" |
111 | app:layout_constraintBottom_toBottomOf="@+id/guideline5" | 104 | app:layout_constraintBottom_toTopOf="@+id/btnGuardarServidores" |
112 | app:layout_constraintEnd_toEndOf="parent" | 105 | app:layout_constraintEnd_toEndOf="parent" |
113 | app:layout_constraintStart_toStartOf="parent" | 106 | app:layout_constraintStart_toStartOf="parent" |
114 | app:layout_constraintTop_toBottomOf="@+id/guideline4" | 107 | app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" |
115 | tools:listitem="@layout/item_servidores" /> | 108 | tools:listitem="@layout/item_servidores" /> |
116 | 109 | ||
117 | <Button | 110 | <Button |
118 | android:id="@+id/btnGuardarServidores" | 111 | android:id="@+id/btnGuardarServidores" |
119 | android:layout_width="0dp" | 112 | android:layout_width="0dp" |
120 | android:layout_height="wrap_content" | 113 | android:layout_height="wrap_content" |
121 | android:text="@string/btnGuardarServidores" | 114 | android:layout_marginTop="10dp" |
122 | android:textColor="@android:color/white" | 115 | android:layout_marginEnd="10dp" |
123 | android:padding="10dp" | 116 | android:text="@string/btnGuardarServidores" |
124 | android:background="@drawable/boton_borde_redondeado" | 117 | android:textColor="@android:color/white" |
125 | app:layout_constraintBottom_toBottomOf="@+id/guideline6" | 118 | android:padding="10dp" |
126 | app:layout_constraintEnd_toEndOf="parent" | 119 | android:background="@drawable/boton_borde_redondeado" |
127 | app:layout_constraintStart_toStartOf="parent" /> | 120 | app:layout_constraintTop_toBottomOf="@+id/rvServidores" |
128 | 121 | app:layout_constraintEnd_toEndOf="parent" | |
129 | 122 | app:layout_constraintStart_toStartOf="parent" | |
130 | <androidx.constraintlayout.widget.Guideline | 123 | app:layout_constraintBottom_toBottomOf="parent"/> |
131 | android:id="@+id/guideline2" | ||
132 | android:layout_width="wrap_content" | ||
133 | android:layout_height="wrap_content" | ||
134 | android:orientation="horizontal" | ||
135 | app:layout_constraintGuide_percent="0.15" /> | ||
136 | 124 | ||
137 | <androidx.constraintlayout.widget.Guideline | ||
138 | android:id="@+id/guideline3" | ||
139 | android:layout_width="wrap_content" | ||
140 | android:layout_height="wrap_content" | ||
141 | android:orientation="horizontal" | ||
142 | app:layout_constraintGuide_percent="0.25" /> |
app/src/main/res/layout/item_principal.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <androidx.cardview.widget.CardView | 2 | <androidx.cardview.widget.CardView |
3 | xmlns:android="http://schemas.android.com/apk/res/android" | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
4 | xmlns:app="http://schemas.android.com/apk/res-auto" | 4 | xmlns:app="http://schemas.android.com/apk/res-auto" |
5 | xmlns:tools="http://schemas.android.com/tools" | 5 | xmlns:tools="http://schemas.android.com/tools" |
6 | android:id="@+id/cvInventario" | ||
7 | android:layout_width="match_parent" | 6 | android:layout_width="match_parent" |
8 | android:layout_height="wrap_content" | 7 | android:layout_height="wrap_content" |
9 | android:layout_rowWeight="1" | 8 | android:layout_margin="5dp" |
10 | android:layout_columnWeight="1" | 9 | app:cardCornerRadius="2dp" |
11 | android:layout_margin="15dp" | 10 | app:cardElevation="10dp" |
12 | android:clickable="true" | 11 | app:contentPadding="5dp" |
13 | app:cardCornerRadius="8dp" | 12 | app:cardPreventCornerOverlap="false"> |
14 | app:cardElevation="8dp" | ||
15 | app:layout_constraintBottom_toBottomOf="parent" | ||
16 | app:layout_constraintEnd_toEndOf="parent" | ||
17 | app:layout_constraintStart_toStartOf="parent" | ||
18 | app:layout_constraintTop_toTopOf="parent"> | ||
19 | 13 | ||
20 | <LinearLayout | 14 | <LinearLayout |
21 | android:layout_width="wrap_content" | 15 | android:layout_width="wrap_content" |
22 | android:layout_height="wrap_content" | 16 | android:layout_height="wrap_content" |
23 | android:layout_gravity="center_horizontal|center_vertical" | 17 | android:layout_gravity="center_horizontal|center_vertical" |
24 | android:orientation="vertical"> | 18 | android:orientation="vertical"> |
25 | 19 | ||
26 | <androidx.appcompat.widget.AppCompatImageView | 20 | <androidx.appcompat.widget.AppCompatImageView |
27 | android:layout_width="wrap_content" | 21 | android:layout_width="wrap_content" |
28 | android:layout_height="wrap_content" | 22 | android:layout_height="wrap_content" |
29 | android:layout_gravity="center_horizontal" | 23 | android:layout_gravity="center_horizontal" |
30 | android:src="@drawable/inventario" /> | 24 | android:src="@drawable/inventario" /> |
31 | 25 | ||
32 | <TextView | 26 | <TextView |
33 | android:id="@+id/inventario" | 27 | android:id="@+id/tvPrincipalinventario" |
34 | android:layout_width="wrap_content" | 28 | android:layout_width="wrap_content" |
35 | android:layout_height="wrap_content" | 29 | android:layout_height="wrap_content" |
36 | android:clickable="true" | ||
37 | android:gravity="center" | 30 | android:gravity="center" |
38 | android:lines="2" | 31 | android:lines="2" |
39 | tools:text="Demo text" | 32 | tools:text="Demo text" |
40 | android:textColor="@android:color/black" | 33 | android:textColor="@android:color/black" |
41 | android:textStyle="bold" /> | 34 | android:textStyle="bold" /> |
42 | </LinearLayout> | 35 | </LinearLayout> |
43 | </androidx.cardview.widget.CardView> | 36 | </androidx.cardview.widget.CardView> |
44 | 37 |
app/src/main/res/navigation/mobile_navigation.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <navigation xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <navigation xmlns:android="http://schemas.android.com/apk/res/android" |
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | android:id="@+id/mobile_navigation" | 5 | android:id="@+id/mobile_navigation" |
6 | app:startDestination="@id/mainFragment2"> | 6 | app:startDestination="@id/mainFragment2"> |
7 | 7 | ||
8 | <activity | 8 | <activity |
9 | android:id="@+id/mainActivity" | 9 | android:id="@+id/mainActivity" |
10 | android:name="com.focasoftware.deboinventariov20.MainActivity" | 10 | android:name="com.focasoftware.deboinventariov20.ui.MainActivity" |
11 | android:label="app_bar_main" | 11 | android:label="app_bar_main" |
12 | tools:layout="@layout/app_bar_main" /> | 12 | tools:layout="@layout/app_bar_main" /> |
13 | <fragment | 13 | <fragment |
14 | android:id="@+id/mainFragment2" | 14 | android:id="@+id/mainFragment2" |
15 | android:name="com.focasoftware.deboinventariov20.ui.main.MainFragment" | 15 | android:name="com.focasoftware.deboinventariov20.ui.main.MainFragment" |
16 | android:label="Principal" | 16 | android:label="Principal" |
17 | tools:layout="@layout/fragment_main" > | 17 | tools:layout="@layout/fragment_main" > |
18 | <action | 18 | <action |
19 | android:id="@+id/action_mainFragment2_to_configuracionFragment" | 19 | android:id="@+id/action_mainFragment2_to_configuracionFragment" |
20 | app:destination="@id/configuracionFragment" | 20 | app:destination="@id/configuracionFragment" |
21 | app:popEnterAnim="@anim/slide_in_left" | 21 | app:popEnterAnim="@anim/slide_in_left" |
22 | app:popExitAnim="@anim/slide_out_right" | 22 | app:popExitAnim="@anim/slide_out_right" |
23 | app:enterAnim="@anim/slide_in_right" | 23 | app:enterAnim="@anim/slide_in_right" |
24 | app:exitAnim="@anim/slide_out_left" /> | 24 | app:exitAnim="@anim/slide_out_left" /> |
25 | <action | 25 | <action |
26 | android:id="@+id/action_mainFragment2_to_actuaMaestrosFragment" | 26 | android:id="@+id/action_mainFragment2_to_actuaMaestrosFragment" |
27 | app:destination="@id/actuaMaestrosFragment" | 27 | app:destination="@id/actuaMaestrosFragment" |
28 | app:popEnterAnim="@anim/slide_in_left" | 28 | app:popEnterAnim="@anim/slide_in_left" |
29 | app:popExitAnim="@anim/slide_out_right" | 29 | app:popExitAnim="@anim/slide_out_right" |
30 | app:enterAnim="@anim/slide_in_right" | 30 | app:enterAnim="@anim/slide_in_right" |
31 | app:exitAnim="@anim/slide_out_left" /> | 31 | app:exitAnim="@anim/slide_out_left" /> |
32 | <action | 32 | <action |
33 | android:id="@+id/action_mainFragment2_to_inventarioFragment" | 33 | android:id="@+id/action_mainFragment2_to_inventarioFragment" |
34 | app:destination="@id/inventarioFragment" | 34 | app:destination="@id/inventarioFragment" |
35 | app:popEnterAnim="@anim/slide_in_left" | 35 | app:popEnterAnim="@anim/slide_in_left" |
36 | app:popExitAnim="@anim/slide_out_right" | 36 | app:popExitAnim="@anim/slide_out_right" |
37 | app:enterAnim="@anim/slide_in_right" | 37 | app:enterAnim="@anim/slide_in_right" |
38 | app:exitAnim="@anim/slide_out_left" /> | 38 | app:exitAnim="@anim/slide_out_left" /> |
39 | </fragment> | 39 | </fragment> |
40 | <fragment | 40 | <fragment |
41 | android:id="@+id/actuaMaestrosFragment" | 41 | android:id="@+id/actuaMaestrosFragment" |
42 | android:name="com.focasoftware.deboinventariov20.ui.actualizacionMaestros.ActuaMaestrosFragment" | 42 | android:name="com.focasoftware.deboinventariov20.ui.actualizacionMaestros.ActuaMaestrosFragment" |
43 | android:label="Actualización de Maestros" | 43 | android:label="Actualización de Maestros" |
44 | tools:layout="@layout/fragment_actua_maestros" /> | 44 | tools:layout="@layout/fragment_actua_maestros" /> |
45 | <fragment | 45 | <fragment |
46 | android:id="@+id/servidoresFragment" | 46 | android:id="@+id/servidoresFragment" |
47 | android:name="com.focasoftware.deboinventariov20.ui.servidores.ServidoresFragment" | 47 | android:name="com.focasoftware.deboinventariov20.ui.servidores.ServidoresFragment" |
48 | android:label="Alta Servidores" | 48 | android:label="Alta Servidores" |
49 | tools:layout="@layout/fragment_servidores"> | 49 | tools:layout="@layout/fragment_servidores"> |
50 | <action | 50 | <action |
51 | android:id="@+id/action_servidoresFragment_to_configuracionFragment" | 51 | android:id="@+id/action_servidoresFragment_to_configuracionFragment" |
52 | app:destination="@id/configuracionFragment" | 52 | app:destination="@id/configuracionFragment" |
53 | app:enterAnim="@anim/slide_in_right" | 53 | app:enterAnim="@anim/slide_in_right" |
54 | app:exitAnim="@anim/slide_out_left" | 54 | app:exitAnim="@anim/slide_out_left" |
55 | app:popEnterAnim="@anim/slide_in_left" | 55 | app:popEnterAnim="@anim/slide_in_left" |
56 | app:popExitAnim="@anim/slide_out_right" /> | 56 | app:popExitAnim="@anim/slide_out_right" /> |
57 | </fragment> | 57 | </fragment> |
58 | <fragment | 58 | <fragment |
59 | android:id="@+id/inventarioFragment" | 59 | android:id="@+id/inventarioFragment" |
60 | android:name="com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment" | 60 | android:name="com.focasoftware.deboinventariov20.ui.inventario.InventarioFragment" |
61 | android:label="Inventario Dinamico" | 61 | android:label="Inventario Dinamico" |
62 | tools:layout="@layout/fragment_inventario" > | 62 | tools:layout="@layout/fragment_inventario" > |
63 | <action | 63 | <action |
64 | android:id="@+id/action_inventarioFragment_to_descripcionFragment" | 64 | android:id="@+id/action_inventarioFragment_to_descripcionFragment" |
65 | app:destination="@id/descripcionFragment" | 65 | app:destination="@id/descripcionFragment" |
66 | app:popEnterAnim="@anim/slide_in_left" | 66 | app:popEnterAnim="@anim/slide_in_left" |
67 | app:popExitAnim="@anim/slide_out_right" | 67 | app:popExitAnim="@anim/slide_out_right" |
68 | app:enterAnim="@anim/slide_in_right" | 68 | app:enterAnim="@anim/slide_in_right" |
69 | app:exitAnim="@anim/slide_out_left" /> | 69 | app:exitAnim="@anim/slide_out_left" /> |
70 | <action | 70 | <action |
71 | android:id="@+id/action_inventarioFragment_to_mainFragment2" | 71 | android:id="@+id/action_inventarioFragment_to_mainFragment2" |
72 | app:destination="@id/mainFragment2" | 72 | app:destination="@id/mainFragment2" |
73 | app:popEnterAnim="@anim/slide_in_left" | 73 | app:popEnterAnim="@anim/slide_in_left" |
74 | app:popExitAnim="@anim/slide_out_right" | 74 | app:popExitAnim="@anim/slide_out_right" |
75 | app:enterAnim="@anim/slide_in_right" | 75 | app:enterAnim="@anim/slide_in_right" |
76 | app:exitAnim="@anim/slide_out_left"/> | 76 | app:exitAnim="@anim/slide_out_left"/> |
77 | 77 | ||
78 | </fragment> | 78 | </fragment> |
79 | <fragment | 79 | <fragment |
80 | android:id="@+id/configuracionFragment" | 80 | android:id="@+id/configuracionFragment" |
81 | android:name="com.focasoftware.deboinventariov20.ui.configuracion.ConfiguracionFragment" | 81 | android:name="com.focasoftware.deboinventariov20.ui.configuracion.ConfiguracionFragment" |
82 | android:label="Configuraciones" | 82 | android:label="Configuraciones" |
83 | tools:layout="@layout/fragment_configuracion" > | 83 | tools:layout="@layout/fragment_configuracion" > |
84 | <action | 84 | <action |
85 | android:id="@+id/action_configuracionFragment_to_servidoresFragment" | 85 | android:id="@+id/action_configuracionFragment_to_servidoresFragment" |
86 | app:destination="@id/servidoresFragment" | 86 | app:destination="@id/servidoresFragment" |
87 | app:popEnterAnim="@anim/slide_in_left" | 87 | app:popEnterAnim="@anim/slide_in_left" |
88 | app:popExitAnim="@anim/slide_out_right" | 88 | app:popExitAnim="@anim/slide_out_right" |
89 | app:enterAnim="@anim/slide_in_right" | 89 | app:enterAnim="@anim/slide_in_right" |
90 | app:exitAnim="@anim/slide_out_left" /> | 90 | app:exitAnim="@anim/slide_out_left" /> |
91 | </fragment> | 91 | </fragment> |
92 | <fragment | 92 | <fragment |
93 | android:id="@+id/descripcionFragment" | 93 | android:id="@+id/descripcionFragment" |
94 | android:name="com.focasoftware.deboinventariov20.ui.descripcionFragment.DescripcionFragment" | 94 | android:name="com.focasoftware.deboinventariov20.ui.descripcionFragment.DescripcionFragment" |
95 | android:label="Productos Encontrados"> | 95 | android:label="Productos Encontrados"> |
96 | 96 | ||
97 | <action | 97 | <action |
98 | android:id="@+id/action_descripcionFragment_to_inventarioFragment" | 98 | android:id="@+id/action_descripcionFragment_to_inventarioFragment" |
99 | app:destination="@id/inventarioFragment" | 99 | app:destination="@id/inventarioFragment" |
100 | app:popEnterAnim="@anim/slide_in_left" | 100 | app:popEnterAnim="@anim/slide_in_left" |
101 | app:popExitAnim="@anim/slide_out_right" | 101 | app:popExitAnim="@anim/slide_out_right" |
102 | app:enterAnim="@anim/slide_in_right" | 102 | app:enterAnim="@anim/slide_in_right" |
103 | app:exitAnim="@anim/slide_out_left" | 103 | app:exitAnim="@anim/slide_out_left" |
104 | app:popUpTo="@+id/descripcionFragment" | 104 | app:popUpTo="@+id/descripcionFragment" |
105 | app:popUpToInclusive="true"/> | 105 | app:popUpToInclusive="true"/> |
106 | </fragment> | 106 | </fragment> |
107 | <dialog | 107 | <dialog |
108 | android:id="@+id/dialogNoEncontrado" | 108 | android:id="@+id/dialogNoEncontrado" |
109 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.DialogNoEncontrado" | 109 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.DialogNoEncontrado" |
110 | android:label="DialogNoEncontrado" /> | 110 | android:label="DialogNoEncontrado" /> |
111 | <fragment | 111 | <fragment |
112 | android:id="@+id/dialogoLogin" | 112 | android:id="@+id/dialogoLogin" |
113 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.dialogoLogin" | 113 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.dialogoLogin" |
114 | android:label="dialogoLogin" /> | 114 | android:label="dialogoLogin" /> |
115 | <fragment | 115 | <fragment |
116 | android:id="@+id/singleChoiceAlertDialog" | 116 | android:id="@+id/singleChoiceAlertDialog" |
117 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.SingleChoiceAlertDialog" | 117 | android:name="com.focasoftware.deboinventariov20.ui.dialogos.SingleChoiceAlertDialog" |
118 | android:label="SingleChoiceAlertDialog" /> | 118 | android:label="SingleChoiceAlertDialog" /> |
119 | </navigation> | 119 | </navigation> |