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
... | ... | @@ -14,7 +14,7 @@ |
14 | 14 | android:theme="@style/AppTheme" |
15 | 15 | android:usesCleartextTraffic="true"> |
16 | 16 | <activity |
17 | - android:name=".MainActivity" | |
17 | + android:name=".ui.SplashActivity" | |
18 | 18 | android:label="@string/app_name" |
19 | 19 | android:theme="@style/AppTheme.NoActionBar"> |
20 | 20 | <intent-filter> |
... | ... | @@ -23,6 +23,12 @@ |
23 | 23 | <category android:name="android.intent.category.LAUNCHER" /> |
24 | 24 | </intent-filter> |
25 | 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 | 32 | </application> |
27 | 33 | |
28 | 34 | </manifest> |
29 | 35 | \ No newline at end of file |
app/src/main/java/com/focasoftware/deboinventariov20/DB/DAO/ArticulosDAO.kt
... | ... | @@ -67,9 +67,12 @@ interface ServeInvDao { |
67 | 67 | @Insert(onConflict = OnConflictStrategy.REPLACE) |
68 | 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 | 71 | suspend fun fetchAllServers(): List<ServeInv> |
72 | 72 | |
73 | 73 | @Query("DELETE FROM ServeInv WHERE SER_NUM = :number") |
74 | 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 | } |
76 | 79 | \ No newline at end of file |
app/src/main/java/com/focasoftware/deboinventariov20/MainActivity.kt
... | ... | @@ -1,48 +0,0 @@ |
1 | -package com.focasoftware.deboinventariov20 | |
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 | -} | |
49 | 0 | \ No newline at end of file |
app/src/main/java/com/focasoftware/deboinventariov20/Model/ProductosService.kt
... | ... | @@ -4,8 +4,8 @@ import retrofit2.Retrofit |
4 | 4 | import retrofit2.converter.gson.GsonConverterFactory |
5 | 5 | |
6 | 6 | object ProductosService { |
7 | - private val BASE_URL ="http://10.0.2.2:3000/" | |
8 | - //"http://10.231.45.83:3000/" | |
7 | + private val BASE_URL ="http://192.168.0.8:3000/" | |
8 | + //"http://10.0.2.2:3000/" | |
9 | 9 | |
10 | 10 | |
11 | 11 | fun getProductosService(): ProductosApi { |
app/src/main/java/com/focasoftware/deboinventariov20/Model/Tablas.kt
... | ... | @@ -10,8 +10,7 @@ import com.focasoftware.deboinventario.ui.actualizacionMaestros.Constans.Compani |
10 | 10 | import com.google.gson.annotations.SerializedName |
11 | 11 | import java.io.Serializable |
12 | 12 | |
13 | -data class Productos( | |
14 | - @SerializedName("SEC")var sector: String?, | |
13 | +data class Productos(@SerializedName("SEC") var sector: String?, | |
15 | 14 | @SerializedName("COD") var codigo: String?, |
16 | 15 | @SerializedName("DESC") var descripcion: String?, |
17 | 16 | @SerializedName("CB") var codBar: String?, |
... | ... | @@ -23,8 +22,7 @@ data class Productos( |
23 | 22 | @SerializedName("FOTO") var imagen: String?) |
24 | 23 | |
25 | 24 | @Entity(tableName = TABLA_ART) |
26 | -data class Articles( | |
27 | - @ColumnInfo(name = "SEC") var sector: String?, | |
25 | +data class Articles(@ColumnInfo(name = "SEC") var sector: String?, | |
28 | 26 | @ColumnInfo(name = "COD") var codigo: String?, |
29 | 27 | @ColumnInfo(name = "DES") var descripcion: String?, |
30 | 28 | @ColumnInfo(name = "CB") var codBar: String?, |
... | ... | @@ -35,7 +33,8 @@ data class Articles( |
35 | 33 | @ColumnInfo(name = "DEPSN") var depSn: Int?, |
36 | 34 | @ColumnInfo(name = "FOTO") var imagen: String?) : Serializable { |
37 | 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 | |
... | ... | @@ -56,8 +55,7 @@ data class InvHead(@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "INV_NUM" |
56 | 55 | |
57 | 56 | |
58 | 57 | @Entity(tableName = TABLA_INV_B) |
59 | -data class InvBody( | |
60 | - @ColumnInfo(name = "INV_NUM") var invNum: Int, | |
58 | +data class InvBody(@ColumnInfo(name = "INV_NUM") var invNum: Int, | |
61 | 59 | @ColumnInfo(name = "SEC") var sector: String?, |
62 | 60 | @ColumnInfo(name = "COD") var codigo: String?, |
63 | 61 | @ColumnInfo(name = "DES") var descripcion: String?, |
... | ... | @@ -69,15 +67,18 @@ data class InvBody( |
69 | 67 | @ColumnInfo(name = "BAL") var balanza: Int?, |
70 | 68 | @ColumnInfo(name = "DSN") var depSn: Int?, |
71 | 69 | @ColumnInfo(name = "INV_FEI") var fechaInicio: String?, |
72 | - @ColumnInfo(name = "INV_FEF") var fechaFinal: String?):Serializable{ | |
73 | - @PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") var id: Long = 0 | |
70 | + @ColumnInfo(name = "INV_FEF") var fechaFinal: String?) : Serializable { | |
71 | + @PrimaryKey(autoGenerate = true) | |
72 | + @ColumnInfo(name = "id") | |
73 | + var id: Long = 0 | |
74 | 74 | } |
75 | 75 | |
76 | 76 | @Entity(tableName = TABLA_SERV_INV) |
77 | 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 { | |
80 | - @PrimaryKey(autoGenerate = true) | |
81 | - @ColumnInfo(name = "SER_NUM") | |
82 | - var ID: Int = 0 | |
83 | -} | |
79 | + @PrimaryKey(autoGenerate = true) @ColumnInfo(name = "SER_NUM") var SER_NUM: Long, | |
80 | + @ColumnInfo(name = "SER_DESC") var descripcion: String?, | |
81 | + @ColumnInfo(name = "SER_DIR") var direccion: String?, | |
82 | + @ColumnInfo(name = "SER_PRE") var predeterminado: String?) | |
83 | + | |
84 | + |
app/src/main/java/com/focasoftware/deboinventariov20/ui/MainActivity.kt
... | ... | @@ -0,0 +1,46 @@ |
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 | +} | |
0 | 47 | \ No newline at end of file |
app/src/main/java/com/focasoftware/deboinventariov20/ui/SplashActivity.kt
... | ... | @@ -0,0 +1,29 @@ |
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 | +} |
app/src/main/java/com/focasoftware/deboinventariov20/ui/descripcionFragment/DescripcionFragment.kt
... | ... | @@ -84,7 +84,7 @@ class DescripcionFragment : Fragment() { |
84 | 84 | } |
85 | 85 | |
86 | 86 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { |
87 | - val type = InputType.TYPE_CLASS_PHONE | |
87 | + val type = InputType.TYPE_CLASS_NUMBER | |
88 | 88 | MaterialDialog(requireContext()).show { |
89 | 89 | title(text = "Producto: ${(viewAdapter2 as DescripcionListAdapter).items2?.get(indice)!!.descripcion}") |
90 | 90 | message(R.string.sMensajeEncontrado) |
app/src/main/java/com/focasoftware/deboinventariov20/ui/inventario/InventarioFragment.kt
... | ... | @@ -50,6 +50,7 @@ class InventarioFragment : Fragment() { |
50 | 50 | private lateinit var navController: NavController |
51 | 51 | private var InventarioNuevo: Int = 0 |
52 | 52 | private var iEstado = 0 |
53 | + private var iBusquedaPor=0 | |
53 | 54 | private var fCant = 0F |
54 | 55 | private var bFirst = false |
55 | 56 | private lateinit var deleteIcon: Drawable |
... | ... | @@ -100,7 +101,7 @@ class InventarioFragment : Fragment() { |
100 | 101 | var indiceDelArtEncontrado = 0 |
101 | 102 | |
102 | 103 | //TODO COMIENZA LA BUSQUEDA POR CODIGO DE BARRAS |
103 | - when (iEstado) { | |
104 | + when (iBusquedaPor) { | |
104 | 105 | 0 -> { |
105 | 106 | indiceDelArtEncontrado = buscoArtEnRv(sChangeUpper.toUpperCase(Locale.ROOT), 0)//TODO Si encuentra el articulo en el RV devuelve el indice |
106 | 107 | //TODO Si no lo encuentra devuelve -1 |
... | ... | @@ -132,7 +133,7 @@ class InventarioFragment : Fragment() { |
132 | 133 | // } |
133 | 134 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
134 | 135 | |
135 | - val type = InputType.TYPE_CLASS_PHONE | |
136 | + val type = InputType.TYPE_CLASS_NUMBER | |
136 | 137 | MaterialDialog(requireContext()).show { |
137 | 138 | |
138 | 139 | title(text = "Producto '$sChangeUpper', se encuentra cargado.") |
... | ... | @@ -228,7 +229,7 @@ class InventarioFragment : Fragment() { |
228 | 229 | viewAdapter.notifyDataSetChanged() |
229 | 230 | } else { |
230 | 231 | fCant = listArticulos[indiceDelArtEncontrado].cantTomada |
231 | - val type = InputType.TYPE_CLASS_PHONE | |
232 | + val type = InputType.TYPE_CLASS_NUMBER | |
232 | 233 | MaterialDialog(requireContext()).show { |
233 | 234 | |
234 | 235 | title(text = "Producto '$sChangeUpper', se encuentra cargado.") |
... | ... | @@ -320,19 +321,22 @@ class InventarioFragment : Fragment() { |
320 | 321 | ivCamara.setImageResource(R.drawable.codbar) |
321 | 322 | etCodigoBarras.hint = "Busqueda por C. Barras" |
322 | 323 | swSumaUno.visibility = View.VISIBLE |
323 | - iEstado = 0 | |
324 | + iBusquedaPor=0 | |
325 | + iEstado = 1 | |
324 | 326 | } |
325 | 327 | 1 -> { |
326 | 328 | ivCamara.setImageResource(R.drawable.desc) |
327 | 329 | etCodigoBarras.hint = "Busqueda por Descripciรณn" |
328 | 330 | swSumaUno.visibility = View.GONE |
329 | - iEstado = 1 | |
331 | + iBusquedaPor=1 | |
332 | + iEstado = 2 | |
330 | 333 | } |
331 | 334 | 2 -> { |
332 | 335 | ivCamara.setImageResource(R.drawable.cod_origen) |
333 | 336 | etCodigoBarras.hint = "Busqueda por C. Origen" |
334 | 337 | swSumaUno.visibility = View.GONE |
335 | - iEstado = 2 | |
338 | + iBusquedaPor=2 | |
339 | + iEstado = 0 | |
336 | 340 | } |
337 | 341 | } |
338 | 342 | } |
... | ... | @@ -434,47 +438,19 @@ class InventarioFragment : Fragment() { |
434 | 438 | // } |
435 | 439 | // } |
436 | 440 | } else {//TODO si no lo encuentra en la BD |
437 | -// MaterialDialog(requireContext()).show { | |
438 | -// title(R.string.sTitulo) | |
439 | -// message(R.string.sMensaje) | |
440 | -// positiveButton(R.string.btnOk) { | |
441 | -// dismiss() | |
442 | -// } | |
443 | -// }.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 | -// } | |
441 | + MaterialDialog(requireContext()).show { | |
442 | + title(text = "El articulo ${etCodigoBarras.text}") | |
443 | + message(R.string.sMensaje) | |
444 | + positiveButton(R.string.btnOk) { | |
445 | + dismiss() | |
446 | + } | |
447 | + }.cornerRadius(10F) | |
470 | 448 | } |
471 | - | |
472 | 449 | } |
473 | 450 | |
474 | 451 | private fun ContinuarCargaCB(artAcargar: Articles?) { |
475 | 452 | |
476 | 453 | if (artAcargar != null) {//Si lo encuentra en la BD |
477 | - | |
478 | 454 | if (swSumaUno!!.isChecked) {// SI ESTA +1, PONE CANTIDAD 1 |
479 | 455 | fCant = 0F |
480 | 456 | fCant += 1F |
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/Base/BaseViewHolder.kt
... | ... | @@ -0,0 +1,8 @@ |
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 | +} | |
0 | 9 | \ No newline at end of file |
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/InventarioListAdapter.kt
1 | 1 | package com.focasoftware.deboinventariov20.ui.main |
2 | 2 | |
3 | +import android.content.Context | |
3 | 4 | import android.view.LayoutInflater |
4 | 5 | import android.view.View |
5 | 6 | import android.view.ViewGroup |
7 | +import android.widget.AdapterView | |
6 | 8 | import androidx.recyclerview.widget.RecyclerView |
7 | 9 | import com.focasoftware.deboinventariov20.R |
8 | -import com.google.android.material.snackbar.Snackbar | |
9 | -import kotlinx.android.synthetic.main.item.view.* | |
10 | +import com.focasoftware.deboinventariov20.ui.main.Base.BaseViewHolder | |
10 | 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 { | |
19 | - this.items2 = productos | |
20 | - } | |
22 | + override fun getItemCount() = inv.size | |
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 { | |
32 | - | |
33 | - val inventario = view.inventario | |
34 | - init { | |
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) | |
41 | - } | |
33 | + override fun onBindViewHolder(holder: BaseViewHolder<*>, position: Int) { | |
34 | + when (holder) { | |
35 | + is ItemsViewHolder -> holder.bind(inv[position], position) | |
36 | + else -> IllegalArgumentException("No se pudo pasar el ViewHolder") | |
42 | 37 | } |
43 | 38 | } |
44 | 39 | |
45 | - interface OnItemClickListener{ | |
46 | - fun OnItemClick(position: Int) | |
47 | - } | |
40 | + | |
48 | 41 | } |
49 | 42 | |
43 | + | |
44 | + |
app/src/main/java/com/focasoftware/deboinventariov20/ui/main/MainFragment.kt
... | ... | @@ -20,7 +20,7 @@ import kotlinx.coroutines.async |
20 | 20 | import kotlinx.coroutines.launch |
21 | 21 | import java.util.* |
22 | 22 | |
23 | -class MainFragment : Fragment(), InventarioListAdapter.OnItemClickListener { | |
23 | +class MainFragment : Fragment(), InventarioListAdapter.OnInventarioClickListener { | |
24 | 24 | private lateinit var inventarios: List<InvHead> |
25 | 25 | private lateinit var rcInventario: RecyclerView |
26 | 26 | private lateinit var viewAdapter: RecyclerView.Adapter<*> |
... | ... | @@ -75,7 +75,7 @@ class MainFragment : Fragment(), InventarioListAdapter.OnItemClickListener { |
75 | 75 | //(articulos.sector, articulos.codigo, articulos.descripcion, cant, articulos.codBar) |
76 | 76 | listIvn.add(item) |
77 | 77 | |
78 | - viewAdapter = InventarioListAdapter(listIvn, this) | |
78 | + viewAdapter = InventarioListAdapter(requireContext(),listIvn,this) | |
79 | 79 | viewManager = LinearLayoutManager(requireContext()) |
80 | 80 | |
81 | 81 | rcInventario.apply { |
... | ... | @@ -90,15 +90,17 @@ class MainFragment : Fragment(), InventarioListAdapter.OnItemClickListener { |
90 | 90 | listIvn.clear() |
91 | 91 | } |
92 | 92 | |
93 | - override fun OnItemClick(position: Int) { | |
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) | |
93 | + override fun onItemClick(inventario: String?) { | |
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() | |
101 | + navController.navigate(R.id.action_mainFragment2_to_inventarioFragment) | |
102 | 102 | } |
103 | + | |
104 | + | |
103 | 105 | } |
104 | 106 |
app/src/main/java/com/focasoftware/deboinventariov20/ui/servidores/ItemsServidores.kt
1 | 1 | package com.focasoftware.deboinventariov20.ui.servidores |
2 | 2 | |
3 | -data class ItemsServidores (val descripcion: String?, var direccion: String?, var predeterminado: String?) | |
4 | 3 | \ No newline at end of file |
4 | +data class ItemsServidores(val ID: Long?, val descripcion: String?, var direccion: String?, var predeterminado: String?) | |
5 | 5 | \ No newline at end of file |
app/src/main/java/com/focasoftware/deboinventariov20/ui/servidores/ServidoresFragment.kt
... | ... | @@ -7,24 +7,21 @@ import android.os.Bundle |
7 | 7 | import android.view.LayoutInflater |
8 | 8 | import android.view.View |
9 | 9 | import android.view.ViewGroup |
10 | +import android.widget.Toast | |
10 | 11 | import androidx.core.content.ContextCompat |
11 | 12 | import androidx.fragment.app.Fragment |
12 | 13 | import androidx.lifecycle.lifecycleScope |
13 | -import androidx.recyclerview.widget.DefaultItemAnimator | |
14 | 14 | import androidx.recyclerview.widget.ItemTouchHelper |
15 | 15 | import androidx.recyclerview.widget.LinearLayoutManager |
16 | 16 | import androidx.recyclerview.widget.RecyclerView |
17 | 17 | import com.focasoftware.deboinventariov20.DB.DataBase.AppDb |
18 | 18 | import com.focasoftware.deboinventariov20.Model.ServeInv |
19 | 19 | import com.focasoftware.deboinventariov20.R |
20 | -import com.focasoftware.deboinventariov20.ui.inventario.ProductosListAdapter | |
21 | 20 | import kotlinx.android.synthetic.main.fragment_servidores.* |
22 | 21 | import kotlinx.coroutines.* |
23 | -import java.text.FieldPosition | |
24 | 22 | |
25 | 23 | class ServidoresFragment : Fragment() { |
26 | - private val servidorNuevo = ArrayList<ItemsServidores>() | |
27 | - private var index = 0 | |
24 | + | |
28 | 25 | private lateinit var rvServidores: RecyclerView |
29 | 26 | private lateinit var viewAdapter: RecyclerView.Adapter<*> |
30 | 27 | private lateinit var viewManager: RecyclerView.LayoutManager |
... | ... | @@ -34,52 +31,60 @@ class ServidoresFragment : Fragment() { |
34 | 31 | |
35 | 32 | override fun onCreate(savedInstanceState: Bundle?) { |
36 | 33 | super.onCreate(savedInstanceState) |
37 | - buscaEnBD() | |
34 | + CargarRV() | |
38 | 35 | } |
39 | 36 | |
40 | 37 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
41 | 38 | super.onViewCreated(view, savedInstanceState) |
42 | 39 | |
43 | - rvServidores.layoutManager = LinearLayoutManager(context) | |
44 | - rvServidores.itemAnimator = DefaultItemAnimator() | |
40 | +// rvServidores.layoutManager = LinearLayoutManager(context) | |
41 | +// rvServidores.itemAnimator = DefaultItemAnimator() | |
45 | 42 | |
46 | 43 | btnGuardarServidores.setOnClickListener { |
47 | - if (etNombreServidor.text.isNullOrBlank()){ | |
48 | - etNombreServidor.error="Nombre no valido" | |
44 | + if (etNombreServidor.text.isNullOrBlank()) { | |
45 | + etNombreServidor.error = "Nombre no valido" | |
49 | 46 | etNombreServidor.requestFocus() |
50 | - etNombreServidor.hint="Nombre no valido" | |
47 | + etNombreServidor.hint = "Nombre no valido" | |
51 | 48 | } |
52 | - if (etDireccionServidor.text.isNullOrBlank()){ | |
53 | - etDireccionServidor.error="Direcciรณn no valida" | |
49 | + if (etDireccionServidor.text.isNullOrBlank()) { | |
50 | + etDireccionServidor.error = "Direcciรณn no valida" | |
54 | 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()){ | |
58 | - btnGuardarServidores.isEnabled=true | |
59 | - buscaEnBD() | |
60 | - rvServidores.adapter = AdapterServidores(ingresarDatos(), requireContext()) | |
61 | - btnGuardarServidores.isEnabled=false | |
54 | + if (!etDireccionServidor.text.isNullOrBlank() || !etNombreServidor.text.isNullOrBlank()) { | |
55 | + Toast.makeText(requireContext(), "Servidor ${etNombreServidor.text} Guardado", Toast.LENGTH_LONG).show() | |
56 | + GlobalScope.launch(Dispatchers.Main) { | |
57 | + val num: Long = buscaUltimoNroEnBD() | |
58 | + val servidor = ServeInv(num, etNombreServidor.text.toString(), "http://${etDireccionServidor.text}/", "0") | |
59 | + ingresarDatos(servidor) | |
60 | + cargarRecicler(servidor) | |
61 | + } | |
62 | + etNombreServidor.text.clear() | |
63 | + etDireccionServidor.text.clear() | |
62 | 64 | } |
63 | 65 | } |
64 | 66 | } |
67 | + | |
65 | 68 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
66 | 69 | val v = inflater.inflate(R.layout.fragment_servidores, container, false) |
67 | 70 | rvServidores = v.findViewById(R.id.rvServidores) |
68 | - | |
69 | 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 | - val servidor = ServeInv(etNombreServidor.text.toString(), etDireccionServidor.text.toString(), "0") | |
76 | - index += index | |
77 | - servidorNuevo.add(item) | |
75 | + suspend fun buscaUltimoNroEnBD(): Long { | |
76 | + | |
77 | + var busqueda: Long | |
78 | + return GlobalScope.async(Dispatchers.IO) { | |
79 | + busqueda = AppDb.getAppDb(requireContext())!!.ServeInvDao()!!.findLastSer() | |
80 | + return@async busqueda | |
81 | + }.await() | |
82 | + } | |
83 | + | |
84 | + fun ingresarDatos(servidor:ServeInv) { | |
78 | 85 | val Job = GlobalScope.launch { |
79 | 86 | AppDb.getAppDb(requireActivity())!!.ServeInvDao()!!.insertServer(servidor) |
80 | 87 | } |
81 | - | |
82 | - return servidorNuevo | |
83 | 88 | } |
84 | 89 | |
85 | 90 | suspend fun buscarEnBD(): List<ServeInv> { |
... | ... | @@ -91,11 +96,11 @@ class ServidoresFragment : Fragment() { |
91 | 96 | }.await() |
92 | 97 | } |
93 | 98 | |
94 | - fun buscaEnBD() { | |
99 | + fun CargarRV() { | |
95 | 100 | GlobalScope.launch(Dispatchers.Main) { |
96 | 101 | servidores = buscarEnBD() |
97 | 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 | 104 | cargarRecicler(ser) |
100 | 105 | } |
101 | 106 | } |
... | ... | @@ -104,8 +109,8 @@ class ServidoresFragment : Fragment() { |
104 | 109 | fun cargarRecicler(ser: ServeInv) { |
105 | 110 | //TODO CARGO EN LE RV |
106 | 111 | deleteIcon = ContextCompat.getDrawable(requireContext(), R.drawable.borrar)!! |
107 | - val item = ItemsServidores(ser.descripcion, ser.direccion, ser.predeterminado) | |
108 | - index += index | |
112 | + val item = ItemsServidores(ser.SER_NUM, ser.descripcion, ser.direccion, ser.predeterminado) | |
113 | + | |
109 | 114 | listIvn.add(item) |
110 | 115 | |
111 | 116 | viewAdapter = AdapterServidores(listIvn, requireContext()) |
... | ... | @@ -121,7 +126,8 @@ class ServidoresFragment : Fragment() { |
121 | 126 | } |
122 | 127 | |
123 | 128 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, position: Int) { |
124 | - BorrarInvActual(viewHolder.adapterPosition.toLong()) | |
129 | +// viewManager[ | |
130 | +// BorrarInvActual(viewHolder.adapterPosition.toInt()) | |
125 | 131 | |
126 | 132 | (viewAdapter as AdapterServidores).removeItem(viewHolder) |
127 | 133 | viewAdapter.notifyDataSetChanged() |
... | ... | @@ -137,7 +143,8 @@ class ServidoresFragment : Fragment() { |
137 | 143 | if (dX < c.width / 2) c.drawColor(Color.GREEN) |
138 | 144 | else c.drawColor(Color.RED) |
139 | 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 | 149 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) |
143 | 150 | deleteIcon.draw(c) |
... | ... | @@ -148,6 +155,7 @@ class ServidoresFragment : Fragment() { |
148 | 155 | val itemTouchHelper = ItemTouchHelper(itemTouchHelperCallback) |
149 | 156 | itemTouchHelper.attachToRecyclerView(rvServidores) |
150 | 157 | } |
158 | + | |
151 | 159 | private fun BorrarInvActual(idServer: Long) { |
152 | 160 | lifecycleScope.launch { |
153 | 161 | withContext(Dispatchers.IO) { |
app/src/main/res/drawable/suitedebo.png
6.74 KB
app/src/main/res/layout/activity_splash.xml
... | ... | @@ -0,0 +1,79 @@ |
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> | |
0 | 80 | \ No newline at end of file |
app/src/main/res/layout/app_bar_main.xml
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | 5 | android:layout_width="match_parent" |
6 | 6 | android:layout_height="match_parent" |
7 | - tools:context=".MainActivity"> | |
7 | + tools:context=".ui.MainActivity"> | |
8 | 8 | |
9 | 9 | <com.google.android.material.appbar.AppBarLayout |
10 | 10 | android:layout_width="match_parent" |
app/src/main/res/layout/fragment_inventario.xml
... | ... | @@ -34,7 +34,7 @@ |
34 | 34 | android:id="@+id/ivCamara" |
35 | 35 | android:layout_width="80dp" |
36 | 36 | android:layout_height="80dp" |
37 | - | |
37 | + android:layout_marginTop="15dp" | |
38 | 38 | android:clickable="true" |
39 | 39 | android:contentDescription="@string/ibBusCB" |
40 | 40 | android:elevation="5dp" |
... | ... | @@ -76,11 +76,9 @@ |
76 | 76 | android:layout_width="wrap_content" |
77 | 77 | android:layout_height="wrap_content" |
78 | 78 | android:text="@string/switch_1" |
79 | - app:layout_constraintBottom_toTopOf="@+id/guideline3" | |
79 | + app:layout_constraintBaseline_toBaselineOf="@+id/etCodigoBarras" | |
80 | 80 | app:layout_constraintEnd_toEndOf="parent" |
81 | 81 | app:layout_constraintStart_toEndOf="@id/etCodigoBarras" |
82 | - app:layout_constraintTop_toTopOf="@id/guideline2" | |
83 | - app:layout_constraintVertical_bias="1.0" | |
84 | 82 | tools:ignore="UseSwitchCompatOrMaterialXml" /> |
85 | 83 | |
86 | 84 | <androidx.recyclerview.widget.RecyclerView |
... | ... | @@ -142,7 +140,7 @@ |
142 | 140 | android:layout_width="wrap_content" |
143 | 141 | android:layout_height="wrap_content" |
144 | 142 | android:orientation="horizontal" |
145 | - app:layout_constraintGuide_percent="0.25" /> | |
143 | + app:layout_constraintGuide_percent="0.29" /> | |
146 | 144 | |
147 | 145 | <androidx.constraintlayout.widget.Guideline |
148 | 146 | android:id="@+id/guideline4" |
app/src/main/res/layout/fragment_servidores.xml
1 | 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 | 4 | xmlns:app="http://schemas.android.com/apk/res-auto" |
4 | 5 | xmlns:tools="http://schemas.android.com/tools" |
5 | 6 | android:layout_width="match_parent" |
6 | 7 | android:layout_height="match_parent" |
7 | 8 | tools:context=".ui.servidores.ServidoresFragment"> |
8 | 9 | |
9 | - | |
10 | 10 | <androidx.appcompat.widget.AppCompatTextView |
11 | 11 | android:id="@+id/tvTitutloServer" |
12 | 12 | android:layout_width="match_parent" |
... | ... | @@ -23,7 +23,6 @@ |
23 | 23 | android:text="@string/tvTitutloServer" |
24 | 24 | android:textColor="@color/colorAccent" |
25 | 25 | app:fontFamily="sans-serif-condensed" |
26 | - app:layout_constraintBottom_toTopOf="@id/guideline2" | |
27 | 26 | app:layout_constraintEnd_toEndOf="parent" |
28 | 27 | app:layout_constraintStart_toStartOf="parent" |
29 | 28 | app:layout_constraintTop_toTopOf="parent" /> |
... | ... | @@ -32,9 +31,8 @@ |
32 | 31 | android:id="@+id/tvDirServer" |
33 | 32 | android:layout_width="match_parent" |
34 | 33 | android:layout_height="wrap_content" |
35 | - android:layout_marginStart="8dp" | |
36 | - android:layout_marginEnd="8dp" | |
37 | - android:gravity="center" | |
34 | + android:layout_margin="10dp" | |
35 | + android:gravity="start" | |
38 | 36 | android:lines="1" |
39 | 37 | android:text="@string/tvDirServer" |
40 | 38 | android:textColor="@android:color/black" |
... | ... | @@ -44,121 +42,84 @@ |
44 | 42 | app:layout_constraintBottom_toTopOf="@+id/etDireccionServidor" |
45 | 43 | app:layout_constraintEnd_toEndOf="parent" |
46 | 44 | app:layout_constraintStart_toStartOf="parent" |
47 | - app:layout_constraintTop_toBottomOf="@id/guideline3" | |
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" /> | |
45 | + app:layout_constraintTop_toBottomOf="@id/tvTitutloServer" /> | |
68 | 46 | |
69 | 47 | <EditText |
70 | - android:id="@+id/etNombreServidor" | |
71 | - android:layout_width="match_parent" | |
48 | + android:id="@+id/etDireccionServidor" | |
49 | + android:layout_width="0dp" | |
72 | 50 | android:layout_height="wrap_content" |
73 | - android:autofillHints="" | |
51 | + android:layout_margin="10dp" | |
74 | 52 | android:clickable="true" |
75 | 53 | android:ems="10" |
76 | 54 | android:focusable="true" |
55 | + android:hint="192.168.10.1:9090" | |
77 | 56 | android:inputType="text" |
78 | 57 | android:lines="1" |
79 | - android:hint="Servidor Local" | |
80 | 58 | android:textSize="15sp" |
81 | - app:layout_constraintBottom_toTopOf="@id/guideline3" | |
82 | 59 | app:layout_constraintEnd_toEndOf="parent" |
83 | - app:layout_constraintHorizontal_bias="0.0" | |
84 | 60 | app:layout_constraintStart_toStartOf="parent" |
85 | - app:layout_constraintTop_toBottomOf="@+id/tvNomServer" /> | |
61 | + app:layout_constraintTop_toBottomOf="@id/tvDirServer" /> | |
86 | 62 | |
87 | - <EditText | |
88 | - android:id="@+id/etDireccionServidor" | |
89 | - android:layout_width="0dp" | |
63 | + <TextView | |
64 | + android:id="@+id/tvNomServer" | |
65 | + android:layout_width="match_parent" | |
90 | 66 | android:layout_height="wrap_content" |
91 | - android:layout_marginStart="8dp" | |
92 | - android:layout_marginEnd="8dp" | |
93 | - android:clickable="true" | |
94 | - android:ems="10" | |
95 | - android:focusable="true" | |
96 | - android:inputType="text" | |
67 | + android:layout_margin="10dp" | |
68 | + android:gravity="center" | |
97 | 69 | android:lines="1" |
98 | - | |
99 | - android:hint="192.168.10.1:9090" | |
100 | - android:textSize="15sp" | |
101 | - app:layout_constraintBottom_toTopOf="@id/guideline4" | |
70 | + android:text="@string/tvNomServer" | |
71 | + android:textColor="@android:color/black" | |
72 | + android:textSize="@dimen/TitulosMedios" | |
73 | + android:textStyle="bold|italic" | |
74 | + app:fontFamily="sans-serif-condensed" | |
102 | 75 | app:layout_constraintEnd_toEndOf="parent" |
103 | 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 | 97 | <androidx.recyclerview.widget.RecyclerView |
107 | 98 | android:id="@+id/rvServidores" |
108 | - android:layout_width="match_parent" | |
99 | + android:layout_width="0dp" | |
109 | 100 | android:layout_height="0dp" |
101 | + android:layout_marginTop="10dp" | |
102 | + app:layout_goneMarginEnd="10dp" | |
110 | 103 | android:background="@android:color/darker_gray" |
111 | - app:layout_constraintBottom_toBottomOf="@+id/guideline5" | |
104 | + app:layout_constraintBottom_toTopOf="@+id/btnGuardarServidores" | |
112 | 105 | app:layout_constraintEnd_toEndOf="parent" |
113 | 106 | app:layout_constraintStart_toStartOf="parent" |
114 | - app:layout_constraintTop_toBottomOf="@+id/guideline4" | |
107 | + app:layout_constraintTop_toBottomOf="@+id/etNombreServidor" | |
115 | 108 | tools:listitem="@layout/item_servidores" /> |
116 | 109 | |
117 | - <Button | |
118 | - android:id="@+id/btnGuardarServidores" | |
119 | - android:layout_width="0dp" | |
120 | - android:layout_height="wrap_content" | |
121 | - android:text="@string/btnGuardarServidores" | |
122 | - android:textColor="@android:color/white" | |
123 | - android:padding="10dp" | |
124 | - android:background="@drawable/boton_borde_redondeado" | |
125 | - app:layout_constraintBottom_toBottomOf="@+id/guideline6" | |
126 | - app:layout_constraintEnd_toEndOf="parent" | |
127 | - app:layout_constraintStart_toStartOf="parent" /> | |
128 | - | |
129 | - | |
130 | - <androidx.constraintlayout.widget.Guideline | |
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" /> | |
110 | + <Button | |
111 | + android:id="@+id/btnGuardarServidores" | |
112 | + android:layout_width="0dp" | |
113 | + android:layout_height="wrap_content" | |
114 | + android:layout_marginTop="10dp" | |
115 | + android:layout_marginEnd="10dp" | |
116 | + android:text="@string/btnGuardarServidores" | |
117 | + android:textColor="@android:color/white" | |
118 | + android:padding="10dp" | |
119 | + android:background="@drawable/boton_borde_redondeado" | |
120 | + app:layout_constraintTop_toBottomOf="@+id/rvServidores" | |
121 | + app:layout_constraintEnd_toEndOf="parent" | |
122 | + app:layout_constraintStart_toStartOf="parent" | |
123 | + app:layout_constraintBottom_toBottomOf="parent"/> | |
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" /> | |
143 | - | |
144 | - <androidx.constraintlayout.widget.Guideline | |
145 | - android:id="@+id/guideline4" | |
146 | - android:layout_width="wrap_content" | |
147 | - android:layout_height="wrap_content" | |
148 | - android:orientation="horizontal" | |
149 | - app:layout_constraintGuide_percent="0.5" /> | |
150 | - | |
151 | - <androidx.constraintlayout.widget.Guideline | |
152 | - android:id="@+id/guideline5" | |
153 | - android:layout_width="wrap_content" | |
154 | - android:layout_height="wrap_content" | |
155 | - android:orientation="horizontal" | |
156 | - app:layout_constraintGuide_percent="0.80" /> | |
157 | - | |
158 | - <androidx.constraintlayout.widget.Guideline | |
159 | - android:id="@+id/guideline6" | |
160 | - android:layout_width="wrap_content" | |
161 | - android:layout_height="wrap_content" | |
162 | - android:orientation="horizontal" | |
163 | - app:layout_constraintGuide_percent="0.88" /> | |
164 | 125 | </androidx.constraintlayout.widget.ConstraintLayout> |
app/src/main/res/layout/item_principal.xml
... | ... | @@ -3,19 +3,13 @@ |
3 | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
4 | 4 | xmlns:app="http://schemas.android.com/apk/res-auto" |
5 | 5 | xmlns:tools="http://schemas.android.com/tools" |
6 | - android:id="@+id/cvInventario" | |
7 | 6 | android:layout_width="match_parent" |
8 | 7 | android:layout_height="wrap_content" |
9 | - android:layout_rowWeight="1" | |
10 | - android:layout_columnWeight="1" | |
11 | - android:layout_margin="15dp" | |
12 | - android:clickable="true" | |
13 | - app:cardCornerRadius="8dp" | |
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"> | |
8 | + android:layout_margin="5dp" | |
9 | + app:cardCornerRadius="2dp" | |
10 | + app:cardElevation="10dp" | |
11 | + app:contentPadding="5dp" | |
12 | + app:cardPreventCornerOverlap="false"> | |
19 | 13 | |
20 | 14 | <LinearLayout |
21 | 15 | android:layout_width="wrap_content" |
... | ... | @@ -30,10 +24,9 @@ |
30 | 24 | android:src="@drawable/inventario" /> |
31 | 25 | |
32 | 26 | <TextView |
33 | - android:id="@+id/inventario" | |
27 | + android:id="@+id/tvPrincipalinventario" | |
34 | 28 | android:layout_width="wrap_content" |
35 | 29 | android:layout_height="wrap_content" |
36 | - android:clickable="true" | |
37 | 30 | android:gravity="center" |
38 | 31 | android:lines="2" |
39 | 32 | tools:text="Demo text" |
app/src/main/res/navigation/mobile_navigation.xml
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | |
8 | 8 | <activity |
9 | 9 | android:id="@+id/mainActivity" |
10 | - android:name="com.focasoftware.deboinventariov20.MainActivity" | |
10 | + android:name="com.focasoftware.deboinventariov20.ui.MainActivity" | |
11 | 11 | android:label="app_bar_main" |
12 | 12 | tools:layout="@layout/app_bar_main" /> |
13 | 13 | <fragment |