Android Open Source - android-unittesting To Do Adapter






From Project

Back to project page android-unittesting.

License

The source code is released under:

Apache License

If you think the Android project android-unittesting 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 com.hp.mvp;
/*from w ww  . ja  va2s  . c  o  m*/
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.hp.mvp.data.ToDo;

import java.util.List;

public class ToDoAdapter extends ArrayAdapter<ToDo> {

    private final Context mContext;
    private final List<ToDo> mValues;

    public ToDoAdapter(Context context, List<ToDo> values) {
        super(context, android.R.layout.simple_list_item_1, values);
        this.mContext = context;
        this.mValues = values;
    }

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

    /*
     * Creates the row in the ListView
     */
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        final LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        //Generate the row from a layout
        final View rowView = inflater.inflate(android.R.layout.simple_list_item_1, parent, false);

        final TextView textView = (TextView) rowView.findViewById(android.R.id.text1);

        //Get the data
        final ToDo s = mValues.get(position);

        //Store the Id in the tag
        rowView.setTag(s.getId());

        //Place the data in the view
        textView.setText(s.getTitle());

        return rowView;
    }
}




Java Source Code List

com.devfest.dagger.app.DataModule.java
com.devfest.dagger.app.MainActivity.java
com.devfest.dagger.app.MainApplication.java
com.devfest.dagger.app.ToDoAdapter.java
com.devfest.dagger.data.DataProvider.java
com.devfest.dagger.data.SqlLiteProvider.java
com.devfest.dagger.data.ToDo.java
com.hp.mvp.DataModule.java
com.hp.mvp.MainActivity.java
com.hp.mvp.MainApplication.java
com.hp.mvp.MainPresenter.java
com.hp.mvp.ToDoAdapter.java
com.hp.mvp.ToDoPresenter.java
com.hp.mvp.ToDoView.java
com.hp.mvp.data.DataProvider.java
com.hp.mvp.data.SqlLiteProvider.java
com.hp.mvp.data.ToDo.java