Search in sources :

Example 1 with Item

use of com.clear.helpers.Item in project AndroidCleaner by ReguloSarmiento.

the class AdapterHistory method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View v = convertView;
    final Item i = items.get(position);
    if (i != null) {
        if (i.isSection()) {
            SectionItem si = (SectionItem) i;
            v = vi.inflate(R.layout.divisor, null);
            v.setBackgroundColor(Color.parseColor("#142241"));
            v.setOnClickListener(null);
            v.setOnLongClickListener(null);
            v.setLongClickable(false);
            final TextView sectionView = (TextView) v.findViewById(R.id.list_item_section_text);
            sectionView.setTextColor(Color.parseColor("#FFFFFF"));
            sectionView.setText(si.getTitle());
        } else {
            final EntryItem ei = (EntryItem) i;
            v = vi.inflate(R.layout.list_items_history, null);
            final ImageView icono = (ImageView) v.findViewById(R.id.list_item_entry_drawable);
            final TextView title = (TextView) v.findViewById(R.id.list_item_entry_title);
            final TextView cantidad = (TextView) v.findViewById(R.id.list_item_entry_summary);
            final CheckBox check = (CheckBox) v.findViewById(R.id.checkBox1);
            check.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    Log.d("Metodo ApplicationAdapter------>", ei.title);
                    ei.setSelected(buttonView.isChecked());
                }
            });
            title.setText(ei.title);
            cantidad.setText(ei.cantidad);
            icono.setImageResource(ei.icono);
            check.setChecked(ei.isSelected());
        }
    }
    return v;
}
Also used : SectionItem(com.clear.helpers.SectionItem) SectionItem(com.clear.helpers.SectionItem) EntryItem(com.clear.helpers.EntryItem) Item(com.clear.helpers.Item) CheckBox(android.widget.CheckBox) TextView(android.widget.TextView) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) CompoundButton(android.widget.CompoundButton) EntryItem(com.clear.helpers.EntryItem)

Example 2 with Item

use of com.clear.helpers.Item in project AndroidCleaner by ReguloSarmiento.

the class AdapterLlamadasMensajes method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View v = convertView;
    final Item i = items.get(position);
    if (i != null) {
        if (i.isSection()) {
            SectionItem si = (SectionItem) i;
            v = vi.inflate(R.layout.divisor, null);
            v.setBackgroundColor(Color.parseColor("#142241"));
            v.setOnClickListener(null);
            v.setOnLongClickListener(null);
            v.setLongClickable(false);
            final TextView sectionView = (TextView) v.findViewById(R.id.list_item_section_text);
            sectionView.setTextColor(Color.parseColor("#FFFFFF"));
            sectionView.setText(si.getTitle());
        } else {
            final EntryItem ei = (EntryItem) i;
            v = vi.inflate(R.layout.items_call_msj, null);
            final ImageView icono = (ImageView) v.findViewById(R.id.list_item_entry_drawable);
            final TextView title = (TextView) v.findViewById(R.id.list_item_entry_title);
            final TextView cantidad = (TextView) v.findViewById(R.id.list_item_entry_summary);
            final CheckBox check = (CheckBox) v.findViewById(R.id.checkBox1);
            check.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    ei.setSelected(buttonView.isChecked());
                    Log.d("Metodo ApplicationAdapter------>", ei.title);
                }
            });
            title.setText(ei.title);
            cantidad.setText(ei.cantidad);
            icono.setImageResource(ei.icono);
            check.setChecked(ei.isSelected());
        }
    }
    return v;
}
Also used : SectionItem(com.clear.helpers.SectionItem) SectionItem(com.clear.helpers.SectionItem) EntryItem(com.clear.helpers.EntryItem) Item(com.clear.helpers.Item) CheckBox(android.widget.CheckBox) TextView(android.widget.TextView) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) CompoundButton(android.widget.CompoundButton) EntryItem(com.clear.helpers.EntryItem)

Aggregations

View (android.view.View)2 CheckBox (android.widget.CheckBox)2 CompoundButton (android.widget.CompoundButton)2 ImageView (android.widget.ImageView)2 TextView (android.widget.TextView)2 EntryItem (com.clear.helpers.EntryItem)2 Item (com.clear.helpers.Item)2 SectionItem (com.clear.helpers.SectionItem)2