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 | |
---|
21 | |
---|
22 | package ve.gob.cenditel.tibisaymovil; |
---|
23 | |
---|
24 | |
---|
25 | import android.annotation.SuppressLint; |
---|
26 | import android.content.Context; |
---|
27 | import android.util.Log; |
---|
28 | import android.view.LayoutInflater; |
---|
29 | import android.view.View; |
---|
30 | import android.view.ViewGroup; |
---|
31 | import android.widget.ArrayAdapter; |
---|
32 | import android.widget.ImageView; |
---|
33 | import android.widget.TextView; |
---|
34 | |
---|
35 | /** |
---|
36 | * Adaptador para mostrar la lista de funciones disponibles al inicio |
---|
37 | * de la aplicación. |
---|
38 | * |
---|
39 | */ |
---|
40 | public class FunctionListAdapter extends ArrayAdapter<String> { |
---|
41 | private final Context context; |
---|
42 | private final String[] values; |
---|
43 | |
---|
44 | public FunctionListAdapter(Context context, String[] values) { |
---|
45 | super(context, R.layout.list_item, values); |
---|
46 | this.context = context; |
---|
47 | this.values = values; |
---|
48 | } |
---|
49 | |
---|
50 | @Override |
---|
51 | public View getView(int position, View convertView, ViewGroup parent) { |
---|
52 | LayoutInflater inflater = (LayoutInflater) context |
---|
53 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
---|
54 | |
---|
55 | View rowView = inflater.inflate(R.layout.list_item, parent, false); |
---|
56 | TextView textView1 = (TextView) rowView.findViewById(R.id.textListMainMenu); |
---|
57 | textView1.setText(values[position]); |
---|
58 | ImageView imageView = (ImageView) rowView.findViewById(R.id.imageListMainMenu); |
---|
59 | |
---|
60 | // Change icon based on name |
---|
61 | String s = values[position]; |
---|
62 | |
---|
63 | System.out.println(s); |
---|
64 | |
---|
65 | if (s.equals(context.getString(R.string.firmar))) { |
---|
66 | imageView.setImageResource(R.drawable.ic_pluma); |
---|
67 | } else if (s.equals(context.getString(R.string.verificar))) { |
---|
68 | imageView.setImageResource(R.drawable.ic_verify); |
---|
69 | } else if (s.equals(context.getString(R.string.cifrar))) { |
---|
70 | imageView.setImageResource(R.drawable.ic_secure); |
---|
71 | } else if (s.equals(context.getString(R.string.descifrar))) { |
---|
72 | imageView.setImageResource(R.drawable.ic_not_secure); |
---|
73 | } else if (s.equals(context.getString(R.string.compartir))) { |
---|
74 | imageView.setImageResource(R.drawable.ic_share); |
---|
75 | } else if (s.equals(context.getString(R.string.certificados))) { |
---|
76 | imageView.setImageResource(R.drawable.ic_management); |
---|
77 | } else if (s.equals(context.getString(R.string.preferencias))) { |
---|
78 | imageView.setImageResource(R.drawable.ic_preferences); |
---|
79 | } |
---|
80 | return rowView; |
---|
81 | } |
---|
82 | } |
---|