package com.casic.dcms.ui;

import android.content.Context;
import android.content.Intent;

import androidx.recyclerview.widget.GridLayoutManager;

import com.casic.dcms.adapter.AnalysisRecycleAdapter;
import com.casic.dcms.base.AndroidxBaseActivity;
import com.casic.dcms.databinding.ActivityCaseAnalysisBinding;
import com.casic.dcms.utils.ToastHelper;

/**
 * @author : Pengxh
 * @time : 2021/4/15 16:03
 * @email : 290677893@qq.com
 */
public class DataAnalysisActivity extends AndroidxBaseActivity<ActivityCaseAnalysisBinding> {

    private final Context context = DataAnalysisActivity.this;

    @Override
    protected void setupTopBarLayout() {
        viewBinding.titleBarLayout.titleView.setText("统计分析");
        viewBinding.titleBarLayout.leftBackView.setOnClickListener(v -> finish());
    }

    @Override
    protected void initData() {
        AnalysisRecycleAdapter adapter = new AnalysisRecycleAdapter(this);
        viewBinding.analysisRecyclerView.setLayoutManager(new GridLayoutManager(this, 2));
        viewBinding.analysisRecyclerView.setAdapter(adapter);
        adapter.setOnGridItemClickListener(new AnalysisRecycleAdapter.OnGridItemClickListener() {
            @Override
            public void onClick(int position) {
                Intent intent = new Intent();
                switch (position) {
                    case 0:
                        intent.setClass(context, EventSourceActivity.class);
                        startActivity(intent);
                        break;
                    case 1:
                        ToastHelper.showToast("案卷状态", ToastHelper.INFO);
                        break;
                    case 2:
                        intent.setClass(context, HighEventListActivity.class);
                        startActivity(intent);
                        break;
                    case 3:
                        intent.setClass(context, StreetStatisticsActivity.class);
                        startActivity(intent);
                        break;
                    case 4:
                        ToastHelper.showToast("处理统计", ToastHelper.INFO);
                        break;
                    case 5:
                        intent.setClass(context, TrendAnalysisActivity.class);
                        startActivity(intent);
                        break;
                }
            }
        });
    }

    @Override
    protected void initEvent() {

    }
}