Commit 10d0868ed80f1628f49d64b9cf674dc9f6285387
1 parent
8f56b4b215
Exists in
master
27022020 0031
Showing
3 changed files
with
26 additions
and
45 deletions
Show diff stats
app/build.gradle
... | ... | @@ -67,7 +67,6 @@ dependencies { |
67 | 67 | annotationProcessor 'androidx.room:room-compiler:2.2.5' |
68 | 68 | |
69 | 69 | |
70 | - implementation 'com.afollestad.material-dialogs:bottomsheets:3.2.1' | |
71 | 70 | implementation 'com.afollestad.material-dialogs:core:3.3.0' |
72 | 71 | implementation 'com.afollestad.material-dialogs:input:3.3.0' |
73 | 72 | } |
74 | 73 | \ No newline at end of file |
app/src/main/java/com/focasoftware/deboinventariov20/ui/dialogos/DialogNoEncontrado.kt
... | ... | @@ -2,40 +2,19 @@ package com.focasoftware.deboinventariov20.ui.dialogos |
2 | 2 | |
3 | 3 | import android.app.AlertDialog |
4 | 4 | import android.app.Dialog |
5 | -import android.content.DialogInterface | |
6 | 5 | import android.os.Bundle |
7 | -import android.view.LayoutInflater | |
8 | 6 | import androidx.fragment.app.DialogFragment |
9 | -import com.focasoftware.deboinventariov20.R | |
10 | -import kotlinx.android.synthetic.main.ingresar_cantidad.* | |
11 | -import kotlinx.android.synthetic.main.ingresar_cantidad.view.* | |
12 | 7 | |
13 | 8 | class DialogNoEncontrado : DialogFragment() { |
14 | - | |
15 | - fun newInstance(title: String, s: String): DialogNoEncontrado? { | |
16 | - val dialog = DialogNoEncontrado() | |
17 | - | |
18 | - val args = Bundle() | |
19 | - args.putString("title", title) | |
20 | - args.putString("s", s) | |
21 | - dialog.arguments = args | |
22 | - return dialog | |
23 | - } | |
24 | 9 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { |
25 | 10 | return activity?.let { |
26 | - val args = requireArguments() | |
27 | - | |
28 | - | |
11 | + val title = "Busqueda de Productos" | |
12 | + val content = "Producto no encotrado." | |
29 | 13 | val builder: AlertDialog.Builder = AlertDialog.Builder(requireActivity()) |
30 | - val inflater = requireActivity().layoutInflater; | |
31 | - | |
32 | - builder.setView(inflater.inflate(R.layout.ingresar_cantidad, null)) | |
33 | - .setPositiveButton(R.string.btnOk, DialogInterface.OnClickListener { dialog, id ->}) | |
34 | - | |
35 | - | |
36 | - builder.create() | |
14 | + builder.setTitle(title).setMessage(content).setPositiveButton(android.R.string.ok) { _, _ -> | |
15 | + //Todo OK click | |
16 | + } | |
17 | + return builder.create() | |
37 | 18 | } ?: throw IllegalStateException("Activity cannot be null") |
38 | 19 | } |
39 | - | |
40 | 20 | } |
41 | - |
app/src/main/java/com/focasoftware/deboinventariov20/ui/inventario/InventarioFragment.kt
... | ... | @@ -29,6 +29,7 @@ import com.focasoftware.deboinventariov20.Model.Articles |
29 | 29 | import com.focasoftware.deboinventariov20.Model.InvBody |
30 | 30 | import com.focasoftware.deboinventariov20.Model.InvHead |
31 | 31 | import com.focasoftware.deboinventariov20.R |
32 | +import com.focasoftware.deboinventariov20.ui.dialogos.DialogNoEncontrado | |
32 | 33 | import kotlinx.android.synthetic.main.fragment_inventario.* |
33 | 34 | import kotlinx.android.synthetic.main.ingresar_cantidad.view.* |
34 | 35 | import kotlinx.android.synthetic.main.login_dialog.view.* |
... | ... | @@ -205,9 +206,7 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
205 | 206 | ContinuarCargaDesc(artEncontrado as ArrayList<Articles>) |
206 | 207 | } |
207 | 208 | // } |
208 | - tCodigoBarras.focusable = View.FOCUSABLE | |
209 | - tCodigoBarras.setText("") | |
210 | - tCodigoBarras.selectAll() | |
209 | + | |
211 | 210 | return@setOnKeyListener true |
212 | 211 | } |
213 | 212 | 2 -> {//TODO: BUSQUEDA POR CODIGO DE ORIGEN************************************************************************** |
... | ... | @@ -278,7 +277,6 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
278 | 277 | // } |
279 | 278 | // }.cancelOnTouchOutside(false).cornerRadius(10F) |
280 | 279 | } |
281 | - | |
282 | 280 | } else if (indiceDelArtEncontrado == -1) {// no lo encontro en el RV, lo va a buscar en al BD |
283 | 281 | |
284 | 282 | GlobalScope.launch(Dispatchers.Main) { |
... | ... | @@ -288,13 +286,7 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
288 | 286 | ContinuarCargaCB(artEncontrado) |
289 | 287 | } |
290 | 288 | } |
291 | - | |
292 | - tCodigoBarras.focusable = View.FOCUSABLE | |
293 | - tCodigoBarras.setText("") | |
294 | - tCodigoBarras.selectAll() | |
295 | 289 | return@setOnKeyListener true |
296 | - | |
297 | - | |
298 | 290 | } |
299 | 291 | } |
300 | 292 | } |
... | ... | @@ -475,14 +467,22 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
475 | 467 | // } |
476 | 468 | // } |
477 | 469 | } else {//TODO si no lo encuentra en la BD |
478 | - MaterialDialog(requireContext()).show { | |
479 | - title(text = "El articulo ${etCodigoBarras.text}") | |
480 | - message(R.string.sMensaje) | |
481 | - positiveButton(R.string.btnOk) { | |
482 | - dismiss() | |
483 | - } | |
484 | - }.cornerRadius(10F) | |
470 | + val modalDialog = DialogNoEncontrado() | |
471 | + | |
472 | + modalDialog.show(requireActivity().supportFragmentManager, "confirmDialog") | |
473 | + | |
474 | +// MaterialDialog(requireContext()).show { | |
475 | +// val t=etCodigoBarras.text | |
476 | +// title(text = "El articulo ${etCodigoBarras.text.toString()}") | |
477 | +// message(R.string.sMensaje) | |
478 | +// positiveButton(R.string.btnOk) { | |
479 | +// dismiss() | |
480 | +// } | |
481 | +// }.cornerRadius(10F) | |
485 | 482 | } |
483 | + etCodigoBarras.focusable = View.FOCUSABLE | |
484 | + etCodigoBarras.setText("") | |
485 | + etCodigoBarras.selectAll() | |
486 | 486 | } |
487 | 487 | |
488 | 488 | private fun ContinuarCargaCB(artAcargar: Articles?) { |
... | ... | @@ -516,6 +516,9 @@ class InventarioFragment : Fragment(), ProductosListAdapter.OnImageDotsClickList |
516 | 516 | dismiss() |
517 | 517 | } |
518 | 518 | } |
519 | + etCodigoBarras.focusable = View.FOCUSABLE | |
520 | + etCodigoBarras.setText("") | |
521 | + etCodigoBarras.selectAll() | |
519 | 522 | } |
520 | 523 | |
521 | 524 | suspend fun buscarCBEnBD(CodigoBarras: String): Articles? { |