[8379cd8] | 1 | /* |
---|
| 2 | Tibisay Movil |
---|
| 3 | |
---|
| 4 | Copyright (C) 2013 Antonio Araujo (aaraujo@cenditel.gob.ve), Jose Ruiz |
---|
| 5 | (jruiz@cenditel.gob.ve), Fundacion Centro Nacional de Desarrollo e |
---|
| 6 | Investigacion en Tecnologias Libres - CENDITEL. |
---|
| 7 | |
---|
| 8 | La Fundación CENDITEL concede permiso para usar, copiar, distribuir y/o |
---|
| 9 | modificar este programa, reconociendo el derecho que la humanidad posee al |
---|
| 10 | libre acceso al conocimiento, bajo los términos de la licencia de software |
---|
| 11 | GPL versión 2.0 de la Free Software Foundation. |
---|
| 12 | |
---|
| 13 | Este programa se distribuye con la esperanza de que sea util, pero SIN |
---|
| 14 | NINGUNA GARANTIA; tampoco las implicitas garantias de MERCANTILIDAD o |
---|
| 15 | ADECUACION A UN PROPOSITO PARTICULAR. |
---|
| 16 | |
---|
| 17 | Para mayor información sobre los términos de la licencia ver el archivo |
---|
| 18 | llamado "gpl-2.0.txt" en ingles. |
---|
| 19 | */ |
---|
| 20 | |
---|
[88eadd6] | 21 | package ve.gob.cenditel.tibisaymovil; |
---|
| 22 | |
---|
| 23 | import java.io.Serializable; |
---|
| 24 | import java.util.ArrayList; |
---|
| 25 | |
---|
| 26 | import android.os.Bundle; |
---|
| 27 | import android.app.Activity; |
---|
| 28 | import android.content.Context; |
---|
[95d372e] | 29 | import android.util.Log; |
---|
[88eadd6] | 30 | import android.view.LayoutInflater; |
---|
| 31 | import android.view.Menu; |
---|
| 32 | import android.view.View; |
---|
| 33 | import android.view.ViewGroup; |
---|
| 34 | import android.view.Window; |
---|
| 35 | import android.widget.BaseAdapter; |
---|
| 36 | import android.widget.ImageView; |
---|
| 37 | import android.widget.LinearLayout; |
---|
| 38 | import android.widget.ListView; |
---|
| 39 | import android.widget.TextView; |
---|
| 40 | |
---|
| 41 | public class ActivitySignatureErrors extends Activity { |
---|
| 42 | |
---|
| 43 | @Override |
---|
| 44 | protected void onCreate(Bundle savedInstanceState) { |
---|
| 45 | |
---|
| 46 | //Estilando la barra de titulo |
---|
| 47 | final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); |
---|
| 48 | |
---|
| 49 | super.onCreate(savedInstanceState); |
---|
| 50 | setContentView(R.layout.activity_signature_errors); |
---|
| 51 | |
---|
| 52 | //Estilando Barra de titulo |
---|
| 53 | if(customTitleSupported) |
---|
| 54 | getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_bar); |
---|
| 55 | |
---|
| 56 | // deshabilitar los botones de finalizar y compartir |
---|
[4528953] | 57 | LinearLayout shareButton = (LinearLayout) this.findViewById(R.id.button_remove_certificate_zone); |
---|
[88eadd6] | 58 | shareButton.setVisibility(LinearLayout.GONE); |
---|
[4528953] | 59 | ImageView backImage = (ImageView) this.findViewById(R.id.button_add_certificate); |
---|
[88eadd6] | 60 | backImage.setVisibility(ImageView.GONE); |
---|
[4528953] | 61 | TextView buttonFinishText = (TextView) this.findViewById(R.id.button_add_certificate_text); |
---|
[88eadd6] | 62 | buttonFinishText.setVisibility(TextView.GONE); |
---|
| 63 | |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | // se crea el adaptador para mostrar los objetos detalle de error de firma |
---|
| 67 | ListView errorsListView = (ListView) findViewById(R.id.listViewErrors); |
---|
| 68 | final ArrayList<SignatureErrorDetail> errors = new ArrayList<SignatureErrorDetail>(); |
---|
| 69 | //errors.add(new SignatureErrorDetail("Antonio Araujo Brett", "El certificado expiro.")); |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | Bundle bundle = getIntent().getExtras(); |
---|
[8860b8f] | 73 | String test = bundle.getString("numeroObjetoError"); |
---|
| 74 | //Log.d("ActivitySignatureErrors.onCreate", "numero de objetos de error: "+test); |
---|
[88eadd6] | 75 | |
---|
| 76 | ArrayList<SignatureErrorDetail> errorList = (ArrayList<SignatureErrorDetail>) bundle.getSerializable("SignatureErrorDetailList"); |
---|
[8860b8f] | 77 | //Log.d("ActivitySignatureErrors:", "obteniendo ArrayList<SignatureErrorDetail> errorList"); |
---|
| 78 | //Log.d("ActivitySignatureErrors: numero de objetos de error:", Integer.toString(errorList.size())); |
---|
[88eadd6] | 79 | |
---|
[8860b8f] | 80 | //Log.d("ActivitySignatureErrors: firmante del objeto 0", errorList.get(0).getSigner()); |
---|
| 81 | //Log.d("ActivitySignatureErrors: numero de errores del objeto 0", Integer.toString(errorList.get(0).getListError().size())); |
---|
| 82 | //Log.d("ActivitySignatureErrors: firmante del objeto 1", errorList.get(1).getSigner()); |
---|
| 83 | //Log.d("ActivitySignatureErrors: numero de errores del objeto 1", Integer.toString(errorList.get(1).getListError().size())); |
---|
| 84 | |
---|
| 85 | // asignacion del adaptador |
---|
[88eadd6] | 86 | SignatureErrorDetailAdapter errorsAdapter = new SignatureErrorDetailAdapter(ActivitySignatureErrors.this, errorList); |
---|
| 87 | errorsListView.setAdapter(errorsAdapter); |
---|
| 88 | } |
---|
| 89 | |
---|
| 90 | |
---|
| 91 | /* |
---|
| 92 | // clase que abstrae un objeto de tipo detalle de error de firma |
---|
| 93 | public class SignatureErrorDetail implements Serializable { |
---|
| 94 | private String mSigner; |
---|
| 95 | private String mError; |
---|
| 96 | |
---|
| 97 | public SignatureErrorDetail(String signer, String error){ |
---|
| 98 | mSigner = signer; |
---|
| 99 | mError = error; |
---|
| 100 | } |
---|
| 101 | |
---|
| 102 | public void setName(String signer) { |
---|
| 103 | this.mSigner = signer; |
---|
| 104 | } |
---|
| 105 | |
---|
| 106 | public String getSigner() { |
---|
| 107 | return mSigner; |
---|
| 108 | } |
---|
| 109 | |
---|
| 110 | public void setError(String error) { |
---|
| 111 | this.mError = error; |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | public String getError() { |
---|
| 115 | return mError; |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | } // fin de clase SignatureErrorDetail |
---|
| 119 | */ |
---|
| 120 | |
---|
| 121 | // clase que abstrae el adaptador para llenar el ListView de objetos |
---|
| 122 | // de detalle de error de firma |
---|
| 123 | private class SignatureErrorDetailAdapter extends BaseAdapter { |
---|
| 124 | |
---|
| 125 | private ArrayList<SignatureErrorDetail> mSignatureErrorDetailList; |
---|
| 126 | private LayoutInflater lInflater; |
---|
| 127 | |
---|
| 128 | private SignatureErrorDetailAdapter(Context context, ArrayList<SignatureErrorDetail> errorList) { |
---|
| 129 | this.lInflater = LayoutInflater.from(context); |
---|
| 130 | this.mSignatureErrorDetailList = errorList; |
---|
| 131 | |
---|
| 132 | } |
---|
| 133 | |
---|
| 134 | |
---|
| 135 | @Override |
---|
| 136 | public int getCount() { |
---|
| 137 | return mSignatureErrorDetailList.size(); |
---|
| 138 | } |
---|
| 139 | |
---|
| 140 | @Override |
---|
| 141 | public Object getItem(int position) { |
---|
| 142 | return mSignatureErrorDetailList.get(position); |
---|
| 143 | } |
---|
| 144 | |
---|
| 145 | @Override |
---|
| 146 | public long getItemId(int position) { |
---|
| 147 | return position; |
---|
| 148 | } |
---|
| 149 | |
---|
| 150 | @Override |
---|
| 151 | public View getView(int position, View convertView, ViewGroup parent) { |
---|
| 152 | ViewHolder container = null; |
---|
| 153 | |
---|
| 154 | if (convertView == null){ |
---|
| 155 | container = new ViewHolder(); |
---|
| 156 | convertView = lInflater.inflate(R.layout.error_inside_signature_item, null); |
---|
| 157 | |
---|
| 158 | container.signer_info = (TextView) convertView.findViewById(R.id.signer_info); |
---|
| 159 | container.signature_errors = (TextView) convertView.findViewById(R.id.signature_errors); |
---|
| 160 | container.signature_icon = (ImageView) convertView.findViewById(R.id.signature_icon); |
---|
| 161 | convertView.setTag(container); |
---|
[8860b8f] | 162 | }//else{ |
---|
[88eadd6] | 163 | container = (ViewHolder) convertView.getTag(); |
---|
[8860b8f] | 164 | //} |
---|
[88eadd6] | 165 | |
---|
| 166 | SignatureErrorDetail detailError = (SignatureErrorDetail) getItem(position); |
---|
| 167 | container.signer_info.setText(detailError.getSigner()); |
---|
[95d372e] | 168 | |
---|
| 169 | //container.signature_errors.setText(detailError.getError()); |
---|
| 170 | container.signature_errors.setText(detailError.getTransalatedStringError()); |
---|
[8860b8f] | 171 | Log.d("SignatureErrorDetailAdapter: position: "+Integer.toString(position), "Integer.toString(position)"); |
---|
| 172 | Log.d("SignatureErrorDetailAdapter: signer: ", detailError.getSigner()); |
---|
| 173 | Log.d("SignatureErrorDetailAdapter: lista de errores:", detailError.getTransalatedStringError()); |
---|
[95d372e] | 174 | |
---|
| 175 | |
---|
[58c7f6a] | 176 | container.signature_icon.setImageResource(R.drawable.ic_firmar_verde); |
---|
[88eadd6] | 177 | |
---|
| 178 | return convertView; |
---|
| 179 | } |
---|
| 180 | |
---|
| 181 | |
---|
| 182 | class ViewHolder{ |
---|
| 183 | TextView signer_info; |
---|
| 184 | TextView signature_errors; |
---|
| 185 | ImageView signature_icon; |
---|
| 186 | } |
---|
| 187 | |
---|
| 188 | } |
---|
| 189 | |
---|
| 190 | |
---|
| 191 | } |
---|