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