<commit_before>package example.com.mpdlcamera.TaskManager;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.activeandroid.query.Delete;
import com.activeandroid.query.Select;

import java.util.Date;
import java.util.List;
import java.util.UUID;

import example.com.mpdlcamera.AutoRun.ManualUploadService;
import example.com.mpdlcamera.AutoRun.TaskUploadService;
import example.com.mpdlcamera.Model.LocalModel.Image;
import example.com.mpdlcamera.Model.LocalModel.Task;
import example.com.mpdlcamera.R;
import example.com.mpdlcamera.Utils.DeviceStatus;

/**
 * Created by yingli on 1/22/16.
 */
public class TaskManagerAdapter extends BaseAdapter {

    private static String TAG = TaskManagerAdapter.class.getSimpleName();
    private LayoutInflater inflater;

    private Activity activity;
    private List<Task> taskList;

    private RemoveTaskInterface removeTaskInterface;

    static final int  AU_WAITING = 1001;
    static final int AU_UPLOADING = 1002;
    static final int AU_FINISH = 1003;

    static final int MU_UPLOADING = 2002;
    static final int MU_FINISH = 2003;

    // interrupt (collectionID not exist)
    static final int AU_INTERRUPT = 3001;
    static final int MU_INTERRUPT = 3002;

    public TaskManagerAdapter() {
    }

    public TaskManagerAdapter(Activity activity, List<Task> taskList, RemoveTaskInterface removeTaskInterface) {
        this.activity = activity;
        this.taskList = taskList;
        this.removeTaskInterface = removeTaskInterface;
    }

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

    @Override
    public Object getItem(int i) {
        return taskList.get(i);
    }

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

    @Override
    public View getView(final int position, View view, ViewGroup viewGroup) {


        if (inflater == null)
            inflater = (LayoutInflater) activity
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        if (view == null)
            view = inflater.inflate(R.layout.task_list_cell, null);

        // set task info according to mode
        TextView taskNameTextView = (TextView) view.findViewById(R.id.tv_task_name);
        if(taskList.get(position).getUploadMode().equalsIgnoreCase("AU")){
            // AU
            taskNameTextView.setText("Captured Fotos upload to");
        }else {
            // MU
            taskNameTextView.setText(taskList.get(position).getTotalItems()+" selected Fotos upload to");
        }
        // set collection name
        TextView taskCollectionTextView = (TextView) view.findViewById(R.id.tv_task_collection);
        taskCollectionTextView.setText(taskList.get(position).getCollectionName());

        //ProgressBar
        ProgressBar firstBar = (ProgressBar) view.findViewById(R.id.firstBar);

        //get task<commit_msg>Foto to photo<commit_after>package example.com.mpdlcamera.TaskManager;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.activeandroid.query.Delete;
import com.activeandroid.query.Select;

import java.util.Date;
import java.util.List;
import java.util.UUID;

import example.com.mpdlcamera.AutoRun.ManualUploadService;
import example.com.mpdlcamera.AutoRun.TaskUploadService;
import example.com.mpdlcamera.Model.LocalModel.Image;
import example.com.mpdlcamera.Model.LocalModel.Task;
import example.com.mpdlcamera.R;
import example.com.mpdlcamera.Utils.DeviceStatus;

/**
 * Created by yingli on 1/22/16.
 */
public class TaskManagerAdapter extends BaseAdapter {

    private static String TAG = TaskManagerAdapter.class.getSimpleName();
    private LayoutInflater inflater;

    private Activity activity;
    private List<Task> taskList;

    private RemoveTaskInterface removeTaskInterface;

    static final int  AU_WAITING = 1001;
    static final int AU_UPLOADING = 1002;
    static final int AU_FINISH = 1003;

    static final int MU_UPLOADING = 2002;
    static final int MU_FINISH = 2003;

    // interrupt (collectionID not exist)
    static final int AU_INTERRUPT = 3001;
    static final int MU_INTERRUPT = 3002;

    public TaskManagerAdapter() {
    }

    public TaskManagerAdapter(Activity activity, List<Task> taskList, RemoveTaskInterface removeTaskInterface) {
        this.activity = activity;
        this.taskList = taskList;
        this.removeTaskInterface = removeTaskInterface;
    }

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

    @Override
    public Object getItem(int i) {
        return taskList.get(i);
    }

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

    @Override
    public View getView(final int position, View view, ViewGroup viewGroup) {


        if (inflater == null)
            inflater = (LayoutInflater) activity
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        if (view == null)
            view = inflater.inflate(R.layout.task_list_cell, null);

        // set task info according to mode
        TextView taskNameTextView = (TextView) view.findViewById(R.id.tv_task_name);
        if(taskList.get(position).getUploadMode().equalsIgnoreCase("AU")){
            // AU
            taskNameTextView.setText("Captured photos upload to");
        }else {
            // MU
            taskNameTextView.setText(taskList.get(position).getTotalItems()+" selected photos upload to");
        }
        // set collection name
        TextView taskCollectionTextView = (TextView) view.findViewById(R.id.tv_task_collection);
        taskCollectionTextView.setText(taskList.get(position).getCollectionName());

        //ProgressBar
        ProgressBar firstBar = (ProgressBar) view.findViewById(R.id.firstBar);

        //get task
{'fraction_non_alphanumeric': 0.09077512525788388, 'fraction_numerical': 0.010020630710285883, 'mean_word_length': 3.4214983713355047, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6002404', 'n_tokens_mistral': 1988, 'n_tokens_neox': 1869, 'n_words': 441}