/* Tibisay Movil Copyright (C) 2013 Antonio Araujo (aaraujo@cenditel.gob.ve), Jose Ruiz (jruiz@cenditel.gob.ve), Fundacion Centro Nacional de Desarrollo e Investigacion en Tecnologias Libres - CENDITEL. La Fundación CENDITEL concede permiso para usar, copiar, distribuir y/o modificar este programa, reconociendo el derecho que la humanidad posee al libre acceso al conocimiento, bajo los términos de la licencia de software GPL versión 2.0 de la Free Software Foundation. Este programa se distribuye con la esperanza de que sea util, pero SIN NINGUNA GARANTIA; tampoco las implicitas garantias de MERCANTILIDAD o ADECUACION A UN PROPOSITO PARTICULAR. Para mayor información sobre los términos de la licencia ver el archivo llamado "gpl-2.0.txt" en ingles. */ package ve.gob.cenditel.tibisaymovil; import android.annotation.SuppressLint; import android.content.Context; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; /** * Adaptador para mostrar la lista de funciones disponibles al inicio * de la aplicación. * */ public class FunctionListAdapter extends ArrayAdapter { private final Context context; private final String[] values; public FunctionListAdapter(Context context, String[] values) { super(context, R.layout.list_item, values); this.context = context; this.values = values; } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.list_item, parent, false); TextView textView1 = (TextView) rowView.findViewById(R.id.textListMainMenu); textView1.setText(values[position]); ImageView imageView = (ImageView) rowView.findViewById(R.id.imageListMainMenu); // Change icon based on name String s = values[position]; System.out.println(s); if (s.equals(context.getString(R.string.firmar))) { imageView.setImageResource(R.drawable.ic_pluma); } else if (s.equals(context.getString(R.string.verificar))) { imageView.setImageResource(R.drawable.ic_verify); } else if (s.equals(context.getString(R.string.cifrar))) { imageView.setImageResource(R.drawable.ic_secure); } else if (s.equals(context.getString(R.string.descifrar))) { imageView.setImageResource(R.drawable.ic_not_secure); } else if (s.equals(context.getString(R.string.compartir))) { imageView.setImageResource(R.drawable.ic_share); } else if (s.equals(context.getString(R.string.certificados))) { imageView.setImageResource(R.drawable.ic_management); } else if (s.equals(context.getString(R.string.preferencias))) { imageView.setImageResource(R.drawable.ic_preferences); } return rowView; } }