package com.sheep.gamegroup.module.login.fragments;


import android.support.v4.app.Fragment;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.sheep.gamegroup.module.login.controller.LoginController;
import com.sheep.gamegroup.util.StringUtils;
import com.sheep.jiuyan.samllsheep.R;
import com.sheep.jiuyan.samllsheep.base.BaseFragment;
import com.sheep.jiuyan.samllsheep.utils.G;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * A simple {@link Fragment} subclass.
 */
public class WelcomeFgt extends AbsLoginFgt {

    @BindView(R.id.login_type_toggle_icon)
    ImageView loginToggleIconBtn;
    @BindView(R.id.login_type_toggle_text)
    TextView loginToggleTextBtn;

    public WelcomeFgt() {
        // Required empty public constructor
    }

    public static WelcomeFgt newInstance(LoginController controller) {
        WelcomeFgt fragment = new WelcomeFgt();
        fragment.mController = controller;
        return fragment;
    }

    @Override
    public int getLayoutId() {
        return R.layout.fragment_login_welcome;
    }

    @Override
    public void onViewCreated() {
        loginToggleIconBtn.setImageResource(R.mipmap.login_phone);
        loginToggleTextBtn.setText("一键登录");
    }

    @OnClick({R.id.login_btn, R.id.login_type_toggle})
    public void doToLogin(View v) {
        if(v.getId()==R.id.login_btn) {
            mController.whenToLogin(LoginController.PLATFORM_ACCOUNT);
        } else {
            mController.whenToLogin(LoginController.PLATFORM_PHONE);
        }
    }

    @OnClick(R.id.register_btn)
    public void doToRegister(View v) {
        mController.whenToRegister();
    }

}
