package com.airson.alive.adapter;

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

import com.airson.alive.R;
import com.airson.alive.utils.AppConstants;

public class SlideMenueAdapter extends BaseAdapter{

    private Context context;
    private LayoutInflater mInflater;


    public SlideMenueAdapter(Context context){
        this.context = context;
        mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    @Override
    public int getCount() {
        return AppConstants.menu_title.length;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

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

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        convertView = null;

        if (convertView == null) {
            holder = new ViewHolder();

            convertView = mInflater.inflate(R.layout.layout_menu_item_row, null);
            holder.textViewTitle = (TextView) convertView.findViewById(R.id.textView);
            holder.icons = (ImageView) convertView.findViewById(R.id.imageView);

            holder.icons.setImageResource(AppConstants.menu_icon[position]);
            holder.textViewTitle.setText(AppConstants.menu_title[position]);

            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        return convertView;
    }

    public static class ViewHolder {
        public TextView textViewTitle;
        public ImageView icons;

    }




}
