package com.xwkj.jcjcgz.mvp.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.xwkj.jcjcgz.R;
import com.xwkj.jcjcgz.di.component.DaggerFzQzFkComponent;
import com.xwkj.jcjcgz.mvp.contract.FzQzFkContract;
import com.xwkj.jcjcgz.mvp.presenter.FzQzFkPresenter;
import com.zkjc.common.base.ZkjcBaseActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

import static com.jess.arms.utils.Preconditions.checkNotNull;


/**
 * ================================================
 * Description:
 * <p>
 * Created by MVPArmsTemplate on 07/18/2024 16:09
 * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
 * <a href="https://github.com/JessYanCoding">Follow me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
 * <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
 * ================================================
 */
public class FzQzFkActivity extends ZkjcBaseActivity<FzQzFkPresenter> implements FzQzFkContract.View {

    @BindView(R.id.bt_back)
    Button btBack;
    @BindView(R.id.view_wdhlx)
    View viewWdhlx;
    @BindView(R.id.rl_wdhlx)
    RelativeLayout rlWdhlx;
    @BindView(R.id.view_ydhlx)
    View viewYdhlx;
    @BindView(R.id.rl_ydhlx)
    RelativeLayout rlYdhlx;
    @BindView(R.id.rb_wdh_jj)
    RadioButton rbWdhJj;
    @BindView(R.id.rb_wdh_kh)
    RadioButton rbWdhKh;
    @BindView(R.id.rb_wdh_bzxq)
    RadioButton rbWdhBzxq;
    @BindView(R.id.rg_wdhlx)
    RadioGroup rgWdhlx;
    @BindView(R.id.rb_ydh_sddx)
    RadioButton rbYdhSddx;
    @BindView(R.id.rb_ydh_wsddx)
    RadioButton rbYdhWsddx;
    @BindView(R.id.rb_ydh_tdmh)
    RadioButton rbYdhTdmh;
    @BindView(R.id.rb_ydh_wfkxx)
    RadioButton rbYdhWfkxx;
    @BindView(R.id.rb_ydh_tdmh_jm)
    RadioButton rbYdhTdmhJm;
    @BindView(R.id.rb_ydh_wfk_jm)
    RadioButton rbYdhWfkJm;
    @BindView(R.id.rb_ydh_yba)
    RadioButton rbYdhYba;
    @BindView(R.id.rb_ydh_sjyhkhbf)
    RadioButton rbYdhSjyhkhbf;
    @BindView(R.id.rb_ydh_ydhqz_jm)
    RadioButton rbYdhYdhqzJm;
    @BindView(R.id.rg_ydhlx)
    RadioGroup rgYdhlx;
    @BindView(R.id.tv_bt)
    TextView tvBt;
    @BindView(R.id.tv_fk)
    TextView tvFk;
    @BindView(R.id.rg_fk)
    RadioGroup rgFk;
    @BindView(R.id.tv_xtts)
    TextView tvXtts;
    @BindView(R.id.rl_xtzs)
    RelativeLayout rlXtzs;
    @BindView(R.id.ll_yjdh)
    LinearLayout llYjdh;
    @BindView(R.id.tv)
    TextView tv;
    @BindView(R.id.tv_mj)
    TextView tvMj;

    @Override
    public void setupActivityComponent(@NonNull AppComponent appComponent) {
        DaggerFzQzFkComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .view(this)
                .build()
                .inject(this);
    }

    @Override
    public int initView(@Nullable Bundle savedInstanceState) {
        return R.layout.activity_fz_qz_fk; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {

    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void showMessage(@NonNull String message) {
        checkNotNull(message);
        ArmsUtils.snackbarText(message);
    }

    @Override
    public void launchActivity(@NonNull Intent intent) {
        checkNotNull(intent);
        ArmsUtils.startActivity(intent);
    }

    @Override
    public void killMyself() {
        finish();
    }

    @OnClick({R.id.rl_wdhlx, R.id.rl_ydhlx})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.rl_wdhlx:
                changeUI(R.id.rl_wdhlx);
                break;
            case R.id.rl_ydhlx:
                changeUI(R.id.rl_ydhlx);
                break;
        }
    }

    private void changeUI(int id) {
        switch (id) {
            case R.id.rl_wdhlx:
                rlWdhlx.setBackground(getDrawable(R.drawable.shape_select));
                rlYdhlx.setBackground(getDrawable(R.drawable.shape_unselect));
                rgWdhlx.setVisibility(View.VISIBLE);
                rgYdhlx.setVisibility(View.GONE);
                llYjdh.setVisibility(View.GONE);
                viewWdhlx.setVisibility(View.VISIBLE);
                viewYdhlx.setVisibility(View.GONE);
                break;
            case R.id.rl_ydhlx:
                rlYdhlx.setBackground(getDrawable(R.drawable.shape_select));
                rlWdhlx.setBackground(getDrawable(R.drawable.shape_unselect));
                rgYdhlx.setVisibility(View.VISIBLE);
                rgWdhlx.setVisibility(View.GONE);
                llYjdh.setVisibility(View.VISIBLE);
                viewWdhlx.setVisibility(View.GONE);
                viewYdhlx.setVisibility(View.VISIBLE);
                break;
        }
    }
}
