Android Open Source - iEtueri Schedule Today Adapter






From Project

Back to project page iEtueri.

License

The source code is released under:

GNU General Public License

If you think the Android project iEtueri listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package schedule;
//from   w  w w  .  j a  v a 2  s  .  co  m
import java.util.ArrayList;
import java.util.List;

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

import com.javils.ietueri.R;

/**
 * Adapter for the the ListView of the Schedule
 * 
 * @author Javier Luque Sanabria
 * 
 */
public class ScheduleTodayAdapter extends ArrayAdapter<Event> {

  /** List of the events */
  private List<Event> events = new ArrayList<Event>();
  /** Id of the item's ListView of Schedule */
  private int resource;
  /** Context of the application */
  private Context context;
  /** Auxiliar TextView */
  private TextView text;

  public ScheduleTodayAdapter(Context context, int resource, List<Event> objects) {
    super(context, resource, objects);
    this.resource = resource;
    this.context = context;
    this.events = objects;
  }

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

  @Override
  public Event getItem(int i) {
    return events.get(i);
  }

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

  public void setItems(ArrayList<Event> items) {
    this.events = items;
  }

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

    // If don't have view, take it!
    if (view == null) {
      LayoutInflater layout = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      view = layout.inflate(resource, null);
    }

    Event event = getItem(position);

    // Fill the structure of the item
    text = (TextView) view.findViewById(R.id.schedule_list_item_nameevent);
    text.setText(" " + event.getName());
    text = (TextView) view.findViewById(R.id.schedule_list_item_place);
    text.setText(event.getPlace());
    text = (TextView) view.findViewById(R.id.schedule_list_item_date);
    text.setText(event.getDiff());

    return view;
  }
}




Java Source Code List

courses.CourseDetailFragment.java
courses.Course.java
courses.CoursesAdapter.java
courses.CoursesFragment.java
courses.NewCourseFragment.java
exams.Exam.java
exams.ExamsAdapter.java
exams.ExamsFragment.java
exams.NewExamFragment.java
homework.HomeworkAdapter.java
homework.HomeworkFragment.java
homework.Homework.java
homework.NewHomeworkFragment.java
navigationdrawer.DrawerListAdapter.java
navigationdrawer.DrawerList.java
navigationdrawer.MainActivity.java
navigationdrawer.NavigationDrawerCallbacks.java
navigationdrawer.NavigationDrawerController.java
navigationdrawer.NavigationDrawerFragment.java
navigationdrawer.OpenBrowser.java
schedule.CalendarManager.java
schedule.Event.java
schedule.EventsManager.java
schedule.FindEvents.java
schedule.RefreshScheduleEventsData.java
schedule.ScheduleFragment.java
schedule.ScheduleTodayAdapter.java
subject.DetailSubjectFragment.java
subject.NewSubjectFragment.java
subject.SubjectFragment.java
subject.SubjectListAdapter.java
subject.Subject.java
today.NewEventRepetitionDialogFragment.java
today.NewEventTodayFragment.java
today.TodayFragment.java
utility.DatabaseContract.java
utility.DatabaseHelper.java
utility.DatePickerDialogFragment.java
utility.OnBackPressed.java
utility.OnClickButtonXml.java
utility.PriorityDialogFragment.java
utility.TimePickerDialogFragment.java