package com.example.waoperations.Inventory;


import com.example.waoperations.R;
import com.example.waoperations.R.id;
import com.example.waoperations.R.layout;

import android.app.Activity;
import android.content.Context;
import android.database.Cursor;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.ImageView;
import android.widget.TextView;

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

        @Override
        public void bindView(View view, Context context, Cursor cursor) {
    		if (view == null) {
                LayoutInflater mInflater = (LayoutInflater)
                        context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
                view = mInflater.inflate(R.layout.drawer_list_item, null);
            }
            Typeface font = Typeface.createFromAsset(context.getAssets(), "fonts/opensans-light.ttf");  
            Typeface fontbold = Typeface.createFromAsset(context.getAssets(), "fonts/opensans-semibold.ttf");  

            TextView clientTextView = (TextView) view.findViewById(R.id.cliente);
            clientTextView.setText("Posición: "+cursor.getString(1));
            clientTextView.setTextColor(Color.BLACK);
            clientTextView.setTypeface(fontbold); 
            clientTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
  
            TextView qtyTextView = (TextView) view.findViewById(R.id.nombre);
            qtyTextView.setText("ítem: "+cursor.getString(2));
            qtyTextView.setTextColor(Color.GRAY);
            qtyTextView.setTypeface(fontbold); 
            qtyTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12);
            
            TextView profile = (TextView) view.findViewById(R.id.puesto);
            profile.setText("Cantidad: "+cursor.getString(4)+" "+cursor.getString(5));
            profile.setTextColor(Color.BLACK);
            profile.setTypeface(fontbold); 
            profile.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12);
            
            TextView email = (TextView) view.findViewById(R.id.email);
            email.setText("País: "+cursor.getString(6));
            email.setTextColor(Color.LTGRAY);
            email.setTypeface(fontbold); 
            email.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
            
       
           
        }

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

}