package com.test.smartnotes;

import android.content.Context;
import android.database.Cursor;
import android.support.v4.widget.CursorAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

/**
 * Created by saff on 18.06.17.
 */

public class ListNotesAdapter extends CursorAdapter {
    public ListNotesAdapter(Context context, Cursor cursor) {
        super(context, cursor, 0);
    }

    @Override
    public View newView(Context context, Cursor cursor, ViewGroup parent) {
        return LayoutInflater.from(context).inflate(R.layout.notes_list_item, parent, false);
    }

    @Override
    public void bindView(View view, Context context, Cursor cursor) {

        LinearLayout noteBackground = (LinearLayout) view.findViewById(R.id.noteBackground);
        ImageView noteImage = (ImageView) view.findViewById(R.id.noteImage);
        TextView noteTitle = (TextView) view.findViewById(R.id.noteTitle);
        ImageButton editNoteButton = (ImageButton) view.findViewById(R.id.editNote);
        ImageButton removeNoteButton = (ImageButton) view.findViewById(R.id.removeNote);

        String note_title = cursor.getString(cursor.getColumnIndexOrThrow("note_title"));
        int priority = cursor.getInt(cursor.getColumnIndexOrThrow("importance"));

        noteTitle.setText(note_title);
//        tvPriority.setText(String.valueOf(priority));
    }
}

@@ -842,102 +842,8 @@
 r) %7B
-%0A%0A        LinearLayout noteBackground = (LinearLayout) view.findViewById(R.id.noteBackground);
 %0A   
@@ -920,83 +920,8 @@
 e);%0A
-        TextView noteTitle = (TextView) view.findViewById(R.id.noteTitle);%0A
     
@@ -1103,24 +1103,114 @@
     
-String note_titl
+LinearLayout noteBackground = (LinearLayout) view.findViewById(R.id.noteBackground);%0A        int importanc
 e = 
@@ -1219,22 +1219,19 @@
 rsor.get
-String
+Int
 (cursor.
@@ -1253,25 +1253,25 @@
 rThrow(%22
-note_titl
+importanc
 e%22));%0A  
@@ -1281,131 +1281,393 @@
    i
-nt priority = cursor.getInt(cursor.getColumnIndexOrThrow(%22importance%22));%0A%0A        noteTitle.setText(
+f (importance == 1) %7B%0A            noteBackground.setBackgroundColor(0xffff0000);%0A        %7D%0A        else if (importance == 2) %7B%0A            noteBackground.setBackgroundColor(0xffffff00);%0A        %7D%0A        else if (importance == 3) %7B%0A            noteBackground.setBackgroundColor(0xff00ff00);%0A        %7D%0A%0A        TextView noteTitle = (TextView) view.findViewById(R.id.
 note
-_t
+T
 itle);%0A
-//
         
 tvPr
@@ -1666,51 +1666,126 @@
     
-tvPriority.setText(String.valueOf(priority)
+String note_title = cursor.getString(cursor.getColumnIndexOrThrow(%22note_title%22));%0A        noteTitle.setText(note_title
 );%0A 

Add importance coloring