package com.fxy.mine;

import android.os.Bundle;
import android.text.TextUtils;
import android.widget.EditText;
import android.widget.TextView;

import com.fxy.baselibrary.base.BaseActivity;
import com.fxy.baselibrary.util.AnimShakeUtil;
import com.fxy.BuildConfig;
import com.fxy.R;

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


/**
 * 修改密码
 */
public class ModifyPassWordActivity extends BaseActivity {

    @BindView(R.id.et_oldPassword)
    EditText etOldPassword;
    @BindView(R.id.et_NewPassword)
    EditText etNewPassword;
    @BindView(R.id.et_verifyPassword)
    EditText etVerifyPassword;
    @BindView(R.id.tv_tip)
    TextView tvTip;
    private Unbinder unbinder;

    @Override
    public int getContentViewResId() {
        return R.layout.activity_modifypwd;
    }

    @Override
    public boolean showToolBar() {
        return true;
    }

    @Override
    public boolean openEventBus() {
        return false;
    }

    @Override
    protected void getBundleExtras(Bundle extras) {

    }

    @Override
    public boolean isPlayMusic() {
        return true;
    }

    @Override
    protected void initView() {
        unbinder = ButterKnife.bind(this);
        setTitleName(getString(R.string.str_mdy_pwd));
    }

    /**
     * 修改用户密码
     */
    private void updatePassword() {

    }

    @OnClick(R.id.ll_submit)
    public void onViewClicked() {
        if (TextUtils.isEmpty(etOldPassword.getText().toString())
                || TextUtils.isEmpty(etNewPassword.getText().toString())
                || TextUtils.isEmpty(etVerifyPassword.getText().toString())) {
            tvTip.setText(R.string.str_pwd_nonull);
            AnimShakeUtil.shake(tvTip);
        } else if (!etNewPassword.getText().toString().equals(etVerifyPassword.getText().toString())) {
            tvTip.setText(R.string.str_pwd_err);
            AnimShakeUtil.shake(tvTip);
        } else {
            updatePassword();
        }
    }

    @Override
    protected void onDestroy() {
        unbinder.unbind();
        super.onDestroy();
    }
}
