package com.oo.eye.activity;

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

import com.app.baselibrary.base.common.BaseActivity;
import com.app.baselibrary.commonUtil.LogUtil;
import com.app.baselibrary.commonUtil.ToastUtil;
import com.oo.eye.EyeConfig;
import com.oo.eye.R;
import com.oo.eye.bean.StudentBean;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 视力测试
 */

public class EyeTestMainActivity extends BaseActivity {

    @BindView(R.id.test_setting)
    LinearLayout mTestSetting;
    @BindView(R.id.lin_eye_test)
    LinearLayout mLinEyeTest;
    @BindView(R.id.tv_eye_test_histroy)
    TextView mTvEyeTestHistroy;
    @BindView(R.id.lin_eye_test_histroy)
    LinearLayout mLinEyeTestHistroy;
    @BindView(R.id.lin_eye_test_statistics)
    LinearLayout mLinEyeTestStatistics;
    @BindView(R.id.lin_eye_test_setting)
    LinearLayout mLinEyeTestSetting;

    private boolean isRequestFinish = false;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_eye_test_main;
    }

    @Override
    protected void init() {
    }

    protected void onResume() {
        super.onResume();
    }


    @Override
    protected void onPause() {
        super.onPause();
    }


    public void getEyeSuccee() {
        isRequestFinish = true;
    }

    public void getEyeFail(String msg) {
        isRequestFinish = false;
        ToastUtil.showLongMessage(msg);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        LogUtil.e("dispatchTouchEvent:" + ev.getAction());
        return super.dispatchTouchEvent(ev);
    }

    @OnClick({R.id.test_setting, R.id.lin_eye_test, R.id.lin_eye_test_histroy, R.id.lin_eye_test_statistics, R.id.lin_eye_test_setting})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.test_setting:
                startActivity(EyeSettingActivity.class);
                break;
            case R.id.lin_eye_test://单人测试
                startActivity(SinglePeopleTestActivity.class);
                break;
            case R.id.lin_eye_test_histroy://多人测试
                startActivity(MorePeopleTestActivity.class);
                break;
            case R.id.lin_eye_test_statistics:
                ArrayList<StudentBean> list = new ArrayList<>();
                StudentBean student = new StudentBean();
                student.setRealname("游客");
                list.add(student);
                EyeConfig.getInstance().setStudents(list);
                startActivity(BeforeEyeTestActivity.class);
                break;
            case R.id.lin_eye_test_setting://测试报表
                startActivity(TestResurtListActivity.class);
                break;
        }
    }
}
