DialogPersoComplexExport.java
3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package com.focasoftware.deboinventario;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
/**
* Dialgo personalizado que permite al usuario elegir el medio de exportacion y si
* borrar los datos o no posteriormente
* @author GuillermoR
*
*/
public class DialogPersoComplexExport extends Dialog{
/**
* Quien lo llamo
*/
@SuppressWarnings("unused")
private Activity owner;
/**
* Hay que borrar despues los datos exportados?
*/
private boolean borrar_luego = false;
/**
* Constructor completo que incializa la UI y carga los handlers correspondientes
* <p>1� Construcci�n del t�tulo
* <p>2� Cargamos el layout y main layout
* <p>3� Construcci�n de la imagen
* <p>4� Mensaje
* <p>5� Check Box de supresion
* <p>6� Botones
*
* @param context
* @param titulo
* @param mensaje
* @param activar_borrar
* @param listenerRedWifi
* @param listenerUsb
* @param listenerNegativo
*/
public DialogPersoComplexExport (@NonNull Context context,
@NonNull String titulo, String mensaje, boolean activar_borrar,
View.OnClickListener listenerRedWifi,
View.OnClickListener listenerUsb,
View.OnClickListener listenerNegativo) {
super(context);
final Activity owner = (Activity) context;
//1� Construcci�n del t�tulo:
if (titulo.length() > 0) {
super.setTitle(titulo);
}
//2� Cargamos el layout y main layout:
super.setContentView(R.layout.z_dialogpersocomplex_export);
//3� Construcci�n de la imagen:
ImageView imagen = (ImageView) super.findViewById(R.id.DIALOG_imagen);
imagen.setImageDrawable(owner.getResources().getDrawable(R.drawable.boton_export));
//4� Mensaje:
TextView texto = (TextView) super.findViewById(R.id.DIALOG_texto);
texto.setText(mensaje);
//5� Check Box de supresion:
CheckBox chkbox = (CheckBox) super.findViewById(R.id.DIaLOG_chkbox);
if (activar_borrar) {
chkbox.setVisibility(View.VISIBLE);
}
else {
chkbox.setVisibility(View.INVISIBLE);
}
chkbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { borrar_luego = isChecked; }
});
//6� Botones:
Button boton_wifi = (Button) super.findViewById(R.id.DIALOG_boton_wifi);
Button boton_usb = (Button) super.findViewById(R.id.DIALOG_boton_usb);
Button boton_cancelar = (Button) super.findViewById(R.id.DIALOG_boton_cancelar);
boton_wifi.setOnClickListener(listenerRedWifi);
boton_usb.setOnClickListener(listenerUsb);
boton_cancelar.setOnClickListener(listenerNegativo);
}
public boolean isBorrar_luego() {
return borrar_luego;
}
}