Android Open Source - ItopMobile Task Adapter






From Project

Back to project page ItopMobile.

License

The source code is released under:

GNU General Public License

If you think the Android project ItopMobile 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

// Copyright (C) 2011-2013 ITOMIG GmbH
///* www .j  a v a 2s .  c o  m*/
//   This file is part of iTopMobile.
//
//   iTopMobile is free software; you can redistribute it and/or modify  
//   it under the terms of the GNU General Public License as published by
//   the Free Software Foundation, either version 3 of the License, or
//   (at your option) any later version.
//
//   iTopMobile is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//   along with iTopMobile. If not, see <http://www.gnu.org/licenses/>

package de.itomig.itoplib;

import java.util.List; 
import de.itomig.itoplib.cmdb.InternalTask;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
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 static de.itomig.itoplib.ItopConfig.*;

public class TaskAdapter extends BaseAdapter  {
  private Context context;
  private List<InternalTask> listTasks;

  public TaskAdapter(Context context, List<InternalTask> listTasks) {
    this.context = context;
    this.listTasks = listTasks;
  }

  public int getCount() {
    return listTasks.size();
  }

  public Object getItem(int position) {
    return listTasks.get(position);
  }

  public long getItemId(int position) {
    return position;
  }

  public View getView(int position, View convertView, ViewGroup viewGroup) {
    InternalTask entry = listTasks.get(position);
    if (convertView == null) {    // (re-)using the "convertView" is important for performance
      LayoutInflater inflater = (LayoutInflater) context
          .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      convertView = inflater.inflate(R.layout.itop_task_row, null);
    }
    if (position % 2 == 0) {
      convertView.setBackgroundColor(Color.rgb(255, 255, 255));
    } else {
      convertView.setBackgroundColor(Color.rgb(235, 235, 235));
    } 
    
    TextView tvName = (TextView) convertView.findViewById(R.id.tv_name);
    TextView tvDesc = (TextView) convertView.findViewById(R.id.tv_desc);
    tvName.setText(entry.name);
    tvDesc.setText("("+entry.person_id_friendlyname+")   "+entry.description);
    
    ImageView prImage = (ImageView) convertView.findViewById(R.id.imagev);
        prImage.setImageResource(entry.prioImageResource(prioStrings));
    prImage.setFocusableInTouchMode(false);
    prImage.setFocusable(false);
  
    return convertView;
  }
}




Java Source Code List

de.itomig.itoplib.AboutActivity.java
de.itomig.itoplib.AddTaskActivity.java
de.itomig.itoplib.AlarmReceiver.java
de.itomig.itoplib.BackgroundCheck.java
de.itomig.itoplib.BootReceiver.java
de.itomig.itoplib.Cache.java
de.itomig.itoplib.DataConnection.java
de.itomig.itoplib.GetItopData.java
de.itomig.itoplib.GetItopJSON.java
de.itomig.itoplib.HelpdeskActivity.java
de.itomig.itoplib.IncidentActivity.java
de.itomig.itoplib.InternalTaskActivity.java
de.itomig.itoplib.ItopConfig.java
de.itomig.itoplib.ItopUtils.java
de.itomig.itoplib.MainActivity.java
de.itomig.itoplib.MyActivity.java
de.itomig.itoplib.PersonAndOrgsLookup.java
de.itomig.itoplib.Preferences.java
de.itomig.itoplib.SearchActivity.java
de.itomig.itoplib.TaskAdapter.java
de.itomig.itoplib.TaskDetailActivity.java
de.itomig.itoplib.TicketAdapter.java
de.itomig.itoplib.TicketDetailActivity.java
de.itomig.itoplib.cmdb.CMDBObject.java
de.itomig.itoplib.cmdb.InternalTask.java
de.itomig.itoplib.cmdb.ItopTicket.java
de.itomig.itoplib.cmdb.Organization.java
de.itomig.itoplib.cmdb.Person.java
de.itomig.itoplib.cmdb.XmlResult.java
de.itomig.itopmobile.ItopApplication.java
de.itomig.itopmobile.ItopMobileActivity.java