Search in sources :

Example 1 with TodoItem

use of com.example.sqlbrite.todo.db.TodoItem in project sqlbrite by square.

the class ItemsAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = inflater.inflate(android.R.layout.simple_list_item_multiple_choice, parent, false);
    }
    TodoItem item = getItem(position);
    CheckedTextView textView = (CheckedTextView) convertView;
    textView.setChecked(item.complete());
    CharSequence description = item.description();
    if (item.complete()) {
        SpannableString spannable = new SpannableString(description);
        spannable.setSpan(new StrikethroughSpan(), 0, description.length(), 0);
        description = spannable;
    }
    textView.setText(description);
    return convertView;
}
Also used : SpannableString(android.text.SpannableString) TodoItem(com.example.sqlbrite.todo.db.TodoItem) CheckedTextView(android.widget.CheckedTextView) StrikethroughSpan(android.text.style.StrikethroughSpan)

Aggregations

SpannableString (android.text.SpannableString)1 StrikethroughSpan (android.text.style.StrikethroughSpan)1 CheckedTextView (android.widget.CheckedTextView)1 TodoItem (com.example.sqlbrite.todo.db.TodoItem)1