package com.sheep.gamegroup.view.activity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.sheep.gamegroup.absBase.BaseActivity;
import com.sheep.gamegroup.event.BindWXResultEvent;
import com.sheep.gamegroup.util.GlideImageLoader;
import com.sheep.gamegroup.util.Jump2View;
import com.sheep.gamegroup.util.UMConfigUtils;
import com.sheep.jiuyan.samllsheep.R;
import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by ljy on 2018/3/26.
 */

public class ChangeWxOrTelAct extends BaseActivity {
    public static final int TYPE_RECHARGE = 1;//提现
    public static final int TYPE_NORMAL = 0;//正常情况下
    @BindView(R.id.change_sure_tv)
    TextView sureTv;
    @BindView(R.id.no_bind_img)
    ImageView no_bind_img;

    @Override
    public void onCreate(Bundle savedIntent){
        super.onCreate(savedIntent);
        EventBus.getDefault().register(this);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.change_wx_tel_layout;
    }
    private int from;
    @Override
    public void initView() {
        TitleBarUtils.getInstance()
                .setShowOrHide(this, true)
                .setTitle(this,"绑定微信号")
                .setTitleFinish(this);
        from = getIntent().getIntExtra("from", TYPE_NORMAL);
        GlideImageLoader.setImage(no_bind_img, "http://cdngame.kuaifazs.com/no_bind_img.png");
    }

    @Override
    public void initListener() {

    }

    @Override
    public void initData() {

    }
    @OnClick(R.id.change_sure_tv)
    public void onViewClicked() {
        Jump2View.getInstance().goBindOrChangeWeixinView(ChangeWxOrTelAct.this, true, from);
        UMConfigUtils.onEvent(UMConfigUtils.Event.USER_BIND_WEIXIN);
    }

    @Subscribe
    public void busBindWxResult(BindWXResultEvent ev){
        finish();
    }

    @Override
    public void onDestroy(){
        EventBus.getDefault().unregister(this);
        super.onDestroy();
    }
}
