[88eadd6] | 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; |
---|
[95d372e] | 9 | import android.util.Log; |
---|
[88eadd6] | 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 |
---|
[4528953] | 37 | LinearLayout shareButton = (LinearLayout) this.findViewById(R.id.button_remove_certificate_zone); |
---|
[88eadd6] | 38 | shareButton.setVisibility(LinearLayout.GONE); |
---|
[4528953] | 39 | ImageView backImage = (ImageView) this.findViewById(R.id.button_add_certificate); |
---|
[88eadd6] | 40 | backImage.setVisibility(ImageView.GONE); |
---|
[4528953] | 41 | TextView buttonFinishText = (TextView) this.findViewById(R.id.button_add_certificate_text); |
---|
[88eadd6] | 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(); |
---|
[8860b8f] | 53 | String test = bundle.getString("numeroObjetoError"); |
---|
| 54 | //Log.d("ActivitySignatureErrors.onCreate", "numero de objetos de error: "+test); |
---|
[88eadd6] | 55 | |
---|
| 56 | ArrayList<SignatureErrorDetail> errorList = (ArrayList<SignatureErrorDetail>) bundle.getSerializable("SignatureErrorDetailList"); |
---|
[8860b8f] | 57 | //Log.d("ActivitySignatureErrors:", "obteniendo ArrayList<SignatureErrorDetail> errorList"); |
---|
| 58 | //Log.d("ActivitySignatureErrors: numero de objetos de error:", Integer.toString(errorList.size())); |
---|
[88eadd6] | 59 | |
---|
[8860b8f] | 60 | //Log.d("ActivitySignatureErrors: firmante del objeto 0", errorList.get(0).getSigner()); |
---|
| 61 | //Log.d("ActivitySignatureErrors: numero de errores del objeto 0", Integer.toString(errorList.get(0).getListError().size())); |
---|
| 62 | //Log.d("ActivitySignatureErrors: firmante del objeto 1", errorList.get(1).getSigner()); |
---|
| 63 | //Log.d("ActivitySignatureErrors: numero de errores del objeto 1", Integer.toString(errorList.get(1).getListError().size())); |
---|
| 64 | |
---|
| 65 | // asignacion del adaptador |
---|
[88eadd6] | 66 | SignatureErrorDetailAdapter errorsAdapter = new SignatureErrorDetailAdapter(ActivitySignatureErrors.this, errorList); |
---|
| 67 | errorsListView.setAdapter(errorsAdapter); |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | |
---|
| 71 | /* |
---|
| 72 | // clase que abstrae un objeto de tipo detalle de error de firma |
---|
| 73 | public class SignatureErrorDetail implements Serializable { |
---|
| 74 | private String mSigner; |
---|
| 75 | private String mError; |
---|
| 76 | |
---|
| 77 | public SignatureErrorDetail(String signer, String error){ |
---|
| 78 | mSigner = signer; |
---|
| 79 | mError = error; |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | public void setName(String signer) { |
---|
| 83 | this.mSigner = signer; |
---|
| 84 | } |
---|
| 85 | |
---|
| 86 | public String getSigner() { |
---|
| 87 | return mSigner; |
---|
| 88 | } |
---|
| 89 | |
---|
| 90 | public void setError(String error) { |
---|
| 91 | this.mError = error; |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | public String getError() { |
---|
| 95 | return mError; |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | } // fin de clase SignatureErrorDetail |
---|
| 99 | */ |
---|
| 100 | |
---|
| 101 | // clase que abstrae el adaptador para llenar el ListView de objetos |
---|
| 102 | // de detalle de error de firma |
---|
| 103 | private class SignatureErrorDetailAdapter extends BaseAdapter { |
---|
| 104 | |
---|
| 105 | private ArrayList<SignatureErrorDetail> mSignatureErrorDetailList; |
---|
| 106 | private LayoutInflater lInflater; |
---|
| 107 | |
---|
| 108 | private SignatureErrorDetailAdapter(Context context, ArrayList<SignatureErrorDetail> errorList) { |
---|
| 109 | this.lInflater = LayoutInflater.from(context); |
---|
| 110 | this.mSignatureErrorDetailList = errorList; |
---|
| 111 | |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | |
---|
| 115 | @Override |
---|
| 116 | public int getCount() { |
---|
| 117 | return mSignatureErrorDetailList.size(); |
---|
| 118 | } |
---|
| 119 | |
---|
| 120 | @Override |
---|
| 121 | public Object getItem(int position) { |
---|
| 122 | return mSignatureErrorDetailList.get(position); |
---|
| 123 | } |
---|
| 124 | |
---|
| 125 | @Override |
---|
| 126 | public long getItemId(int position) { |
---|
| 127 | return position; |
---|
| 128 | } |
---|
| 129 | |
---|
| 130 | @Override |
---|
| 131 | public View getView(int position, View convertView, ViewGroup parent) { |
---|
| 132 | ViewHolder container = null; |
---|
| 133 | |
---|
| 134 | if (convertView == null){ |
---|
| 135 | container = new ViewHolder(); |
---|
| 136 | convertView = lInflater.inflate(R.layout.error_inside_signature_item, null); |
---|
| 137 | |
---|
| 138 | container.signer_info = (TextView) convertView.findViewById(R.id.signer_info); |
---|
| 139 | container.signature_errors = (TextView) convertView.findViewById(R.id.signature_errors); |
---|
| 140 | container.signature_icon = (ImageView) convertView.findViewById(R.id.signature_icon); |
---|
| 141 | convertView.setTag(container); |
---|
[8860b8f] | 142 | }//else{ |
---|
[88eadd6] | 143 | container = (ViewHolder) convertView.getTag(); |
---|
[8860b8f] | 144 | //} |
---|
[88eadd6] | 145 | |
---|
| 146 | SignatureErrorDetail detailError = (SignatureErrorDetail) getItem(position); |
---|
| 147 | container.signer_info.setText(detailError.getSigner()); |
---|
[95d372e] | 148 | |
---|
| 149 | //container.signature_errors.setText(detailError.getError()); |
---|
| 150 | container.signature_errors.setText(detailError.getTransalatedStringError()); |
---|
[8860b8f] | 151 | Log.d("SignatureErrorDetailAdapter: position: "+Integer.toString(position), "Integer.toString(position)"); |
---|
| 152 | Log.d("SignatureErrorDetailAdapter: signer: ", detailError.getSigner()); |
---|
| 153 | Log.d("SignatureErrorDetailAdapter: lista de errores:", detailError.getTransalatedStringError()); |
---|
[95d372e] | 154 | |
---|
| 155 | |
---|
[88eadd6] | 156 | container.signature_icon.setImageResource(R.drawable.ic_pluma); |
---|
| 157 | |
---|
| 158 | return convertView; |
---|
| 159 | } |
---|
| 160 | |
---|
| 161 | |
---|
| 162 | class ViewHolder{ |
---|
| 163 | TextView signer_info; |
---|
| 164 | TextView signature_errors; |
---|
| 165 | ImageView signature_icon; |
---|
| 166 | } |
---|
| 167 | |
---|
| 168 | } |
---|
| 169 | |
---|
| 170 | |
---|
| 171 | } |
---|