Android Open Source - Note Notes List Item






From Project

Back to project page Note.

License

The source code is released under:

MIT License

If you think the Android project Note 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.bq.note;
/* w  ww . j a  va  2 s.  c  om*/
import org.bq.db.Note;
import org.bq.tool.ResourceParser.NoteItemBgResources;

import android.content.Context;
import android.text.format.DateUtils;
import android.view.View;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.TextView;

public class NotesListItem extends LinearLayout {
  private TextView mTitle;
  private TextView mTime;
  private CheckBox mCheckBox;
  private Note data = null;

  public NotesListItem(Context context) {
    super(context);
    inflate(context, R.layout.note_item, this);
    mTitle = (TextView) findViewById(R.id.tv_title);
    mTime = (TextView) findViewById(R.id.tv_time);
    mCheckBox = (CheckBox) findViewById(android.R.id.checkbox);
  }

  public void bind(Context context, Note data, boolean choiceMode,
      boolean checked) {
    this.data = data;
    if (choiceMode) {
      mCheckBox.setVisibility(View.VISIBLE);
      mCheckBox.setChecked(checked);
    } else {
      mCheckBox.setVisibility(View.GONE);
    }

    mTitle.setTextAppearance(context, R.style.TextAppearancePrimaryItem);

    mTitle.setText(data.getText());

    mTime.setText(DateUtils.getRelativeTimeSpanString(data.getDate()
        .getTime()));
    setBackgroundResource(NoteItemBgResources.getNoteBgNormalRes(data
        .getType()));
  }

  public Note getItemData() {
    return data;
  }

}




Java Source Code List

com.bq.note.NoteActivity.java
com.bq.note.NoteAdapter.java
com.bq.note.NoteEditActivity.java
com.bq.note.NotesListItem.java
com.bq.widget.NoteWidgetProvider_4x.java
com.bq.widget.NoteWidgetProvider.java
org.bq.app.NoteApplication.java
org.bq.db.DaoMaster.java
org.bq.db.DaoSession.java
org.bq.db.NoteDao.java
org.bq.db.Note.java
org.bq.tool.ResourceParser.java