package cn.yyxx.commsdk.platform.hnyy.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageButton;

import cn.yyxx.commsdk.core.utils.ResourceUtil;
import cn.yyxx.commsdk.platform.hnyy.HNYYLoginActivity;
import cn.yyxx.commsdk.platform.hnyy.dialog.WvPageListDialog;
import cn.yyxx.commsdk.platform.hnyy.impl.SdkPlatformImpl;

public class BaseFragment extends android.support.v4.app.Fragment implements View.OnClickListener {
    private ImageButton btn_kefu;
    public HNYYLoginActivity loginImpl;


    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        btn_kefu = view.findViewById(ResourceUtil.getId(getActivity(),"btn_kefu"));
        if (btn_kefu != null){
            btn_kefu.setOnClickListener(this);
            if (!SdkPlatformImpl.initConfig.isShowKf){
                btn_kefu.setVisibility(View.GONE);
            }
        }


        if (getActivity() instanceof HNYYLoginActivity) {
            loginImpl = (HNYYLoginActivity) getActivity();
        }

    }



    @Override
    public void onClick(View v) {
        if (v.getId() == ResourceUtil.getId(getActivity(), "btn_kefu")){

            if (!TextUtils.isEmpty(SdkPlatformImpl.initConfig.service_center)){

                new WvPageListDialog(getActivity(),ResourceUtil.getStyleId(getActivity(),"hnyy_base_dialog"), SdkPlatformImpl.initConfig.service_center).show();

            }



        }
    }
}
