package com.taikor.investment.adapter;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.taikor.investment.R;
import com.taikor.investment.base.BaseAdapter;
import com.taikor.investment.bean.Market;
import com.taikor.investment.modules.find.MarketDescActivity;

/**
 * 市场波动解析列表适配器
 * Created by Any on 2017/3/31.
 */

public class MarketAdapter extends BaseAdapter<Market>{
    
    private Context mContext;
    public MarketAdapter(Activity context) {
        super(context);
        mContext=context;
    }

    @Override
    protected int getItemLayoutId(int itemViewType) {
        return R.layout.item_find_market;
    }

    @Override
    protected void handleItem(int itemViewType, int position, final Market item, ViewHolder holder, boolean reused) {
        holder.get(R.id.tv_item_market_title, TextView.class).setText(item.getTitle());
        holder.get(R.id.tv_market_des, TextView.class).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent marketIntent = new Intent(mContext, MarketDescActivity.class);
                marketIntent.putExtra("fluctuationID",item.getArticleID());
                mContext.startActivity(marketIntent);
            }
        });
    }
}