package com.ewei.demo.otherui.adapter;

import android.view.View;
import android.widget.TextView;

import com.baidu.mapapi.search.core.PoiInfo;
import com.ewei.demo.R;
import com.ewei.sdk.base.BaseActivity;
import com.ewei.sdk.base.adapter.BaseMySelectListAdapter;

import java.util.List;

/**
 * Created by Administrator on 2016/5/31.
 */
public class LocationPoiInfoListAdapter extends BaseMySelectListAdapter<PoiInfo> {

    public LocationPoiInfoListAdapter(BaseActivity context, List<PoiInfo> poiInfos) {
        super(context, poiInfos);
    }

    @Override
    protected void setLayoutParams(View convertView) {

    }

    @Override
    protected int getLayout() {
        return R.layout.activity_location_search_result;
    }

    @Override
    protected AbstractViewHolder getViewHolder(View convertView) {
        CustomPoiInfoItemViewHolder cpiivh = new CustomPoiInfoItemViewHolder();
        cpiivh.mName = (TextView) convertView.findViewById(R.id.tv_poiinfo_name);
        cpiivh.mAddress = (TextView) convertView.findViewById(R.id.tv_poiinfo_addr);
        return cpiivh;
    }

    @Override
    protected void bindView(View convertView, AbstractViewHolder holder, PoiInfo poiInfo, int position) {
        CustomPoiInfoItemViewHolder cpiivh = (CustomPoiInfoItemViewHolder) holder;
        cpiivh.mName.setText(poiInfo.name);
        cpiivh.mAddress.setText(poiInfo.address);
    }

    private class CustomPoiInfoItemViewHolder extends AbstractViewHolder {
        TextView mName;
        TextView mAddress;
    }
}
