1 | package ve.gob.cenditel.tibisaymovil; |
---|
2 | |
---|
3 | import java.io.Serializable; |
---|
4 | import java.util.ArrayList; |
---|
5 | |
---|
6 | import android.os.Bundle; |
---|
7 | import android.app.Activity; |
---|
8 | import android.content.Context; |
---|
9 | import android.view.LayoutInflater; |
---|
10 | import android.view.Menu; |
---|
11 | import android.view.View; |
---|
12 | import android.view.ViewGroup; |
---|
13 | import android.view.Window; |
---|
14 | import android.widget.BaseAdapter; |
---|
15 | import android.widget.ImageView; |
---|
16 | import android.widget.LinearLayout; |
---|
17 | import android.widget.ListView; |
---|
18 | import android.widget.TextView; |
---|
19 | |
---|
20 | public class ActivitySignatureErrors extends Activity { |
---|
21 | |
---|
22 | @Override |
---|
23 | protected void onCreate(Bundle savedInstanceState) { |
---|
24 | |
---|
25 | //Estilando la barra de titulo |
---|
26 | final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); |
---|
27 | |
---|
28 | super.onCreate(savedInstanceState); |
---|
29 | setContentView(R.layout.activity_signature_errors); |
---|
30 | |
---|
31 | //Estilando Barra de titulo |
---|
32 | if(customTitleSupported) |
---|
33 | getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_bar); |
---|
34 | |
---|
35 | // deshabilitar los botones de finalizar y compartir |
---|
36 | LinearLayout shareButton = (LinearLayout) this.findViewById(R.id.button_share_zone); |
---|
37 | shareButton.setVisibility(LinearLayout.GONE); |
---|
38 | ImageView backImage = (ImageView) this.findViewById(R.id.button_finish); |
---|
39 | backImage.setVisibility(ImageView.GONE); |
---|
40 | TextView buttonFinishText = (TextView) this.findViewById(R.id.button_finish_text); |
---|
41 | buttonFinishText.setVisibility(TextView.GONE); |
---|
42 | |
---|
43 | |
---|
44 | |
---|
45 | // se crea el adaptador para mostrar los objetos detalle de error de firma |
---|
46 | ListView errorsListView = (ListView) findViewById(R.id.listViewErrors); |
---|
47 | final ArrayList<SignatureErrorDetail> errors = new ArrayList<SignatureErrorDetail>(); |
---|
48 | //errors.add(new SignatureErrorDetail("Antonio Araujo Brett", "El certificado expiro.")); |
---|
49 | |
---|
50 | |
---|
51 | Bundle bundle = getIntent().getExtras(); |
---|
52 | String test = bundle.getString("string"); |
---|
53 | |
---|
54 | ArrayList<SignatureErrorDetail> errorList = (ArrayList<SignatureErrorDetail>) bundle.getSerializable("SignatureErrorDetailList"); |
---|
55 | |
---|
56 | |
---|
57 | SignatureErrorDetailAdapter errorsAdapter = new SignatureErrorDetailAdapter(ActivitySignatureErrors.this, errorList); |
---|
58 | errorsListView.setAdapter(errorsAdapter); |
---|
59 | } |
---|
60 | |
---|
61 | |
---|
62 | /* |
---|
63 | // clase que abstrae un objeto de tipo detalle de error de firma |
---|
64 | public class SignatureErrorDetail implements Serializable { |
---|
65 | private String mSigner; |
---|
66 | private String mError; |
---|
67 | |
---|
68 | public SignatureErrorDetail(String signer, String error){ |
---|
69 | mSigner = signer; |
---|
70 | mError = error; |
---|
71 | } |
---|
72 | |
---|
73 | public void setName(String signer) { |
---|
74 | this.mSigner = signer; |
---|
75 | } |
---|
76 | |
---|
77 | public String getSigner() { |
---|
78 | return mSigner; |
---|
79 | } |
---|
80 | |
---|
81 | public void setError(String error) { |
---|
82 | this.mError = error; |
---|
83 | } |
---|
84 | |
---|
85 | public String getError() { |
---|
86 | return mError; |
---|
87 | } |
---|
88 | |
---|
89 | } // fin de clase SignatureErrorDetail |
---|
90 | */ |
---|
91 | |
---|
92 | // clase que abstrae el adaptador para llenar el ListView de objetos |
---|
93 | // de detalle de error de firma |
---|
94 | private class SignatureErrorDetailAdapter extends BaseAdapter { |
---|
95 | |
---|
96 | private ArrayList<SignatureErrorDetail> mSignatureErrorDetailList; |
---|
97 | private LayoutInflater lInflater; |
---|
98 | |
---|
99 | private SignatureErrorDetailAdapter(Context context, ArrayList<SignatureErrorDetail> errorList) { |
---|
100 | this.lInflater = LayoutInflater.from(context); |
---|
101 | this.mSignatureErrorDetailList = errorList; |
---|
102 | |
---|
103 | } |
---|
104 | |
---|
105 | |
---|
106 | @Override |
---|
107 | public int getCount() { |
---|
108 | return mSignatureErrorDetailList.size(); |
---|
109 | } |
---|
110 | |
---|
111 | @Override |
---|
112 | public Object getItem(int position) { |
---|
113 | return mSignatureErrorDetailList.get(position); |
---|
114 | } |
---|
115 | |
---|
116 | @Override |
---|
117 | public long getItemId(int position) { |
---|
118 | return position; |
---|
119 | } |
---|
120 | |
---|
121 | @Override |
---|
122 | public View getView(int position, View convertView, ViewGroup parent) { |
---|
123 | ViewHolder container = null; |
---|
124 | |
---|
125 | if (convertView == null){ |
---|
126 | container = new ViewHolder(); |
---|
127 | convertView = lInflater.inflate(R.layout.error_inside_signature_item, null); |
---|
128 | |
---|
129 | container.signer_info = (TextView) convertView.findViewById(R.id.signer_info); |
---|
130 | container.signature_errors = (TextView) convertView.findViewById(R.id.signature_errors); |
---|
131 | container.signature_icon = (ImageView) convertView.findViewById(R.id.signature_icon); |
---|
132 | convertView.setTag(container); |
---|
133 | }else{ |
---|
134 | container = (ViewHolder) convertView.getTag(); |
---|
135 | } |
---|
136 | |
---|
137 | SignatureErrorDetail detailError = (SignatureErrorDetail) getItem(position); |
---|
138 | container.signer_info.setText(detailError.getSigner()); |
---|
139 | container.signature_errors.setText(detailError.getError()); |
---|
140 | container.signature_icon.setImageResource(R.drawable.ic_pluma); |
---|
141 | |
---|
142 | return convertView; |
---|
143 | } |
---|
144 | |
---|
145 | |
---|
146 | class ViewHolder{ |
---|
147 | TextView signer_info; |
---|
148 | TextView signature_errors; |
---|
149 | ImageView signature_icon; |
---|
150 | } |
---|
151 | |
---|
152 | } |
---|
153 | |
---|
154 | |
---|
155 | } |
---|