| | |
| | | import android.content.Intent; |
| | | import android.view.View; |
| | | import android.widget.EditText; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.runt.open.mvvm.R; |
| | | import com.runt.open.mvvm.base.activities.BaseActivity; |
| | | import com.runt.open.mvvm.config.Configuration; |
| | |
| | | import com.runt.open.mvvm.listener.CustomClickListener; |
| | | import com.runt.open.mvvm.ui.web.WebViewActivity; |
| | | import com.runt.open.mvvm.util.AlgorithmUtils; |
| | | import com.runt.open.mvvm.util.MyLog; |
| | | import com.runt.open.mvvm.util.PhoneUtil; |
| | | |
| | | import java.util.Date; |
| | |
| | | /** |
| | | * My father is Object, ites purpose of |
| | | * |
| | | * @purpose Created by Runt (qingingrunt2010@qq.com) on 2022/1/29. |
| | | * @purpose Created by Runt (qingingrunt2010@qq.com) on 2020-9-17. |
| | | */ |
| | | public class RegisterLoginActivity extends BaseActivity<ActivityLoginBinding,LoginViewModel> { |
| | | final String VERIFY_CODE = "verify_code"; |
| | |
| | | mBinding.txtLogin.setOnClickListener(onclick); |
| | | mBinding.txtRegister.setOnClickListener(onclick); |
| | | mBinding.txtPrivacy.setOnClickListener(onclick); |
| | | mBinding.button.setOnClickListener(onclick); |
| | | mBinding.editPhone.setText(getStringProjectPrefrence(Configuration.KEY_USERNAME)); |
| | | mViewModel.getVerifyResult().observe(this, result -> { |
| | | if(result == 0){ |
| | |
| | | }else{ |
| | | |
| | | } |
| | | }); |
| | | mViewModel.getLoginResult().observe(this, loggedInUser -> { |
| | | if(loggedInUser.code == 200){ |
| | | putBooleanProjectPrefrence(Configuration.IS_LOGIN,true); |
| | | putStringProjectPrefrence(Configuration.KEY_USERNAME, mBinding.editPhone.getText().toString()); |
| | | |
| | | UserBean user = new Gson().fromJson(new Gson().toJson(loggedInUser.data) ,UserBean.class); |
| | | UserBean.setUser(user); |
| | | putStringProjectPrefrence(Configuration.KEY_TOKEN, user.getToken()); |
| | | MyLog.i("registerlogin",user.toString()); |
| | | showToast(R.string.login_success); |
| | | setResult(RESULT_CODE_SUCESS); |
| | | finish(); |
| | | }else{ |
| | | showToast(loggedInUser.msg); |
| | | } |
| | | }); |
| | | } |
| | | |