[a8ff2b6] | 1 | package ve.gob.cenditel.tibisaymovil; |
---|
| 2 | |
---|
| 3 | |
---|
[a8bb2bb] | 4 | import android.annotation.SuppressLint; |
---|
[a8ff2b6] | 5 | import android.content.Context; |
---|
| 6 | import android.view.LayoutInflater; |
---|
| 7 | import android.view.View; |
---|
| 8 | import android.view.ViewGroup; |
---|
| 9 | import android.widget.ArrayAdapter; |
---|
[08c45bd] | 10 | import android.widget.ImageView; |
---|
[a8ff2b6] | 11 | import android.widget.TextView; |
---|
| 12 | |
---|
| 13 | /** |
---|
| 14 | * Adaptador para mostrar la lista de funciones disponibles al inicio |
---|
| 15 | * de la aplicación. |
---|
| 16 | * |
---|
| 17 | */ |
---|
| 18 | public class FunctionListAdapter extends ArrayAdapter<String> { |
---|
| 19 | private final Context context; |
---|
| 20 | private final String[] values; |
---|
| 21 | |
---|
| 22 | public FunctionListAdapter(Context context, String[] values) { |
---|
| 23 | super(context, R.layout.list_item, values); |
---|
| 24 | this.context = context; |
---|
| 25 | this.values = values; |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | @Override |
---|
| 29 | public View getView(int position, View convertView, ViewGroup parent) { |
---|
| 30 | LayoutInflater inflater = (LayoutInflater) context |
---|
| 31 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
---|
| 32 | |
---|
| 33 | View rowView = inflater.inflate(R.layout.list_item, parent, false); |
---|
[08c45bd] | 34 | TextView textView1 = (TextView) rowView.findViewById(R.id.textListMainMenu); |
---|
[a8ff2b6] | 35 | textView1.setText(values[position]); |
---|
[08c45bd] | 36 | ImageView imageView = (ImageView) rowView.findViewById(R.id.imageListMainMenu); |
---|
[a8ff2b6] | 37 | |
---|
| 38 | // Change icon based on name |
---|
| 39 | String s = values[position]; |
---|
| 40 | |
---|
| 41 | System.out.println(s); |
---|
| 42 | |
---|
[37467be] | 43 | if (s.equals(context.getString(R.string.firmar))) { |
---|
[08c45bd] | 44 | imageView.setImageResource(R.drawable.ic_pluma); |
---|
[37467be] | 45 | } else if (s.equals(context.getString(R.string.verificar))) { |
---|
[08c45bd] | 46 | imageView.setImageResource(R.drawable.ic_verify); |
---|
[37467be] | 47 | } else if (s.equals(context.getString(R.string.cifrar))) { |
---|
[08c45bd] | 48 | imageView.setImageResource(R.drawable.ic_secure); |
---|
[37467be] | 49 | } else if (s.equals(context.getString(R.string.descifrar))) { |
---|
[08c45bd] | 50 | imageView.setImageResource(R.drawable.ic_not_secure); |
---|
[37467be] | 51 | } else if (s.equals(context.getString(R.string.compartir))) { |
---|
[08c45bd] | 52 | imageView.setImageResource(R.drawable.ic_share); |
---|
[37467be] | 53 | } else if (s.equals(context.getString(R.string.certificados))) { |
---|
[08c45bd] | 54 | imageView.setImageResource(R.drawable.ic_management); |
---|
| 55 | } |
---|
[a8ff2b6] | 56 | return rowView; |
---|
| 57 | } |
---|
| 58 | } |
---|