package cn.net.caoyao.cpzshandset.service.presenter.impl.upload.kia;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;

import cn.net.caoyao.cpzshandset.common.config.HandsetOperation;
import cn.net.caoyao.cpzshandset.service.bll.UploadStatusBll;
import cn.net.caoyao.cpzshandset.service.presenter.UploadStatusConstact;
import cn.net.caoyao.cpzshandset.service.presenter.base.impl.UploadStatusConstactImpl;
import cn.net.caoyao.cpzshandset.ui.adapter.UploadStatusAdapter;

public class KIAUploadStatusPresenter extends UploadStatusConstactImpl{

	private final UploadStatusConstact.View uView;
	private Context context;
	private List<String> dates = new ArrayList<>();
//	private List<HomeBean> homeBeans = new ArrayList<>();
	private List<HandsetOperation> options = new ArrayList<>();
	private UploadStatusBll uploadStatusBll;
	public KIAUploadStatusPresenter(UploadStatusConstact.View uView,Context context) {
		this.uView = uView;
		this.context = context;
		start();
	}
	
	@Override
	public void start() {
		if (!checkViewAvailable()) return;
		init();
		uView.setPageTitle("提交状态");
		uView.setAdapter(new UploadStatusAdapter(dates, options, uploadStatusBll));
	}

	private void init() {
		uploadStatusBll = new UploadStatusBll(context);
		
		options.add(HandsetOperation.OPERATION_PI_ACTIVATE_CONSTANT);
		options.add(HandsetOperation.OPERATION_DAN_ACTIVATE_CONSTANT);
		
		
		dates = uploadStatusBll.queryUploadDateFor7Days();
//		LogUtil.d(TConfig.Echo, "提交状态：" + dates.toString());
	}

	@Override
	public boolean checkViewAvailable() {
		boolean b = false;
        if (uView != null && context != null) {
            b = true;
        }
        return b;
	}

	


}
