Android Open Source - myToDo Memo Adapter






From Project

Back to project page myToDo.

License

The source code is released under:

Apache License

If you think the Android project myToDo 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.gutspot.apps.android.mytodo.adapter;
//from  ww  w  . j  a v  a 2 s  . com
import java.util.List;

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

import com.gutspot.apps.android.mytodo.R;
import com.gutspot.apps.android.mytodo.model.Memo;

public class MemoAdapter extends BaseAdapter {

    private Context context;
    private List<Memo> memos;

    public MemoAdapter(Context context, List<Memo> memos) {
        this.context = context;
        this.memos = memos;
    }

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

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

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

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if (convertView == null) {
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
            convertView = inflater.inflate(R.layout.item_row_memo, parent, false);
            holder = new ViewHolder();
            holder.memoTextView = (TextView) convertView.findViewById(R.id.text_memo);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        Memo memo = memos.get(position);
        TextView memoTextView = holder.memoTextView;
        memoTextView.setText(memo.getContent());
        memoTextView.setTextColor(memo.getTextColor());
        memoTextView.setBackgroundColor(memo.getBackgroundColor());

        return convertView;
    }

    static class ViewHolder {
        public TextView memoTextView;
    }
}




Java Source Code List

com.gutspot.apps.android.mytodo.MainActivity.java
com.gutspot.apps.android.mytodo.MemoActivity.java
com.gutspot.apps.android.mytodo.ToDoActivity.java
com.gutspot.apps.android.mytodo.adapter.MemoAdapter.java
com.gutspot.apps.android.mytodo.adapter.ToDoAdapter.java
com.gutspot.apps.android.mytodo.dao.AbstractDAO.java
com.gutspot.apps.android.mytodo.dao.MemoDAO.java
com.gutspot.apps.android.mytodo.dao.NoticeDAO.java
com.gutspot.apps.android.mytodo.dao.ToDoDAO.java
com.gutspot.apps.android.mytodo.dialog.DateTimeDialog.java
com.gutspot.apps.android.mytodo.dialog.MemoOptionsDialog.java
com.gutspot.apps.android.mytodo.dialog.ToDoOptionsDialog.java
com.gutspot.apps.android.mytodo.model.AbstractEntity.java
com.gutspot.apps.android.mytodo.model.Memo.java
com.gutspot.apps.android.mytodo.model.Notice.java
com.gutspot.apps.android.mytodo.model.ToDo.java
com.gutspot.apps.android.mytodo.utils.AlertUtil.java
com.gutspot.apps.android.mytodo.utils.DBOpenHelper.java
com.gutspot.apps.android.mytodo.utils.DateTimeUtil.java