/** * 注册补全完成(用户信息) * * @param userName 用户昵称 * @param sex 性别 * @param faceUri 头像 */ @Override public void CompUserInfoOK(String userName, int sex, String faceUri) { if (isRegistering) { return; } isRegistering = true; AppStaticValue.setUserToken(AppStaticValue.getUserID()); RetrofitNetwork.retrofit .create(RetrofitAPI.UserAccount.class) .register( phoneNumber, userName, GetPassword.fullHash(password), String.valueOf(sex), faceUri, "2", String.valueOf(Build.VERSION.SDK_INT) + " GMS:" + GetGMSStatue.haveGMS(this), Build.MODEL + " " + Build.DEVICE) .enqueue( new Callback<Login>() { @Override public void onResponse(Call<Login> call, Response<Login> response) { isRegistering = false; if (response.isSuccessful() && response.body().success) { Login login = response.body(); LoginAndUserAccount.setUserInfo( AppStaticValue.getUserPhone(), login.getUser().getId(), login.getUser().getToken()); MyUserInfo.getInstance().setUserInfo(login.getUser()); PrivateMessPairList.getInstance().getGroupsFromDataBase(); List<Login.GroupEntity> groups = new ArrayList<>(); groups.addAll(login.group); ((GroupList) GroupList.getInstance()).setGroupListByLoginGroup(groups); // start intent Intent intent = new Intent(context, MainActivity.class); intent.addFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); context.startActivity(intent); } else { String mess = response.isSuccessful() ? response.body().msg : response.message(); Log.w(TAG, mess); Snackbar.make(view, mess, Snackbar.LENGTH_LONG).show(); } } @Override public void onFailure(Call<Login> call, Throwable t) { isRegistering = false; Log.w(TAG, t.getMessage()); Snackbar.make(view, t.getMessage(), Snackbar.LENGTH_LONG).show(); } }); }
/** * 注册第一步完成(手机验证) 跳转信息补全 * * @param phoneNumber 用户手机号 */ @Override public void register1stepOK(String phoneNumber, String password) { this.phoneNumber = phoneNumber; this.password = password; AppStaticValue.setUserID(phoneNumber); completeUesrInfo = new CompleteUesrInfo(); completeUesrInfo.setAllDone(this); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment, completeUesrInfo) .commit(); }