package com.example.todocloud.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.todocloud.R;
import com.example.todocloud.data.PredefinedList;

import java.util.ArrayList;
import java.util.List;

public class PredefinedListAdapter extends BaseAdapter {

  private final List<PredefinedList> predefinedLists;

  public PredefinedListAdapter(final ArrayList<PredefinedList> predefinedLists) {
    this.predefinedLists = predefinedLists;
  }

  @Override
  public int getCount() {
    return predefinedLists.size();
  }

  @Override
  public Object getItem(int position) {
    return predefinedLists.get(position);
  }

  @Override
  public long getItemId(int position) {
    return 0;
  }

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    final PredefinedList predefinedList = predefinedLists.get(position);

    LayoutInflater inflater = (LayoutInflater) parent.getContext().getSystemService(
        Context.LAYOUT_INFLATER_SERVICE);
    View itemView = inflater.inflate(R.layout.predefined_list_item, null);

    TextView textViewTitle = (TextView) itemView.findViewById(R.id.tvTitle);
    ImageView ivPredefinedList = (ImageView) itemView.findViewById(R.id.ivPredefinedList);

    String title = predefinedList.getTitle();
    switch (title) {
      case "0":
        ivPredefinedList.setImageResource(R.drawable.calendar_1_24);
        textViewTitle.setText(R.string.itemMainListToday);
        break;
      case "1":
        ivPredefinedList.setImageResource(R.drawable.week_view_24);
        textViewTitle.setText(R.string.itemMainListNext7Days);
        break;
      case "2":
        ivPredefinedList.setImageResource(R.drawable.infinity_24);
        textViewTitle.setText(R.string.itemMainListAll);
        break;
      case "3":
        ivPredefinedList.setImageResource(R.drawable.today_24);
        textViewTitle.setText(R.string.itemMainListCompleted);
        break;
    }

    return itemView;
  }

  /**
   * Hozzáadja az adapterhez a megadott elemet.
   * @param predefinedList Az adapterhez adandó elem.
   */
  public void addItem(PredefinedList predefinedList) {
    predefinedLists.add(predefinedList);
  }

}

@@ -976,19 +976,12 @@
 ) %7B%0A
-%0A
     
-final 
 Pred
@@ -1039,17 +1039,16 @@
 ition);%0A
-%0A
     Layo
@@ -1058,17 +1058,23 @@
 nflater 
-i
+layoutI
 nflater 
@@ -1169,16 +1169,21 @@
 _SERVICE
+%0A    
 );%0A    V
@@ -1197,17 +1197,23 @@
 mView = 
-i
+layoutI
 nflater.
@@ -1258,17 +1258,16 @@
  null);%0A
-%0A
     Text
@@ -1272,23 +1272,17 @@
 xtView t
-extView
+v
 Title = 
@@ -1574,39 +1574,33 @@
 1_24);%0A        t
-extView
+v
 Title.setText(R.
@@ -1726,39 +1726,33 @@
 w_24);%0A        t
-extView
+v
 Title.setText(R.
@@ -1881,39 +1881,33 @@
 y_24);%0A        t
-extView
+v
 Title.setText(R.
@@ -2035,23 +2035,17 @@
        t
-extView
+v
 Title.se
@@ -2135,122 +2135,8 @@
  %7D%0A%0A
-  /**%0A   * Hozz%C3%A1adja az adapterhez a megadott elemet.%0A   * @param predefinedList Az adapterhez adand%C3%B3 elem.%0A   */%0A
   pu

Simplify PredefinedListAdapter class