Search in sources :

Example 1 with UserInfo

use of com.rideread.rideread.data.result.UserInfo in project ride-read-android by Ride-Read.

the class UserMomentsActivity method followUser.

private void followUser() {
    if (isFollow) {
        ConfirmDialogFragment unFollowDialog = ConfirmDialogFragment.newInstance(R.string.sure2unfollow);
        unFollowDialog.show(getSupportFragmentManager(), "dialog");
    } else {
        ApiUtils.follow(mSelectedUid, new BaseCallback<BaseModel<DefJsonResult>>() {

            @Override
            protected void onSuccess(BaseModel<DefJsonResult> model) throws Exception {
                isFollow = true;
                refreshFollowAction(isFollow);
                UserInfo myInfo = UserUtils.getCurUser();
                int curFollowing = myInfo.getFollowing() + 1;
                myInfo.setFollowing(curFollowing);
                UserUtils.saveUserInfo(myInfo);
            }
        });
    }
}
Also used : DefJsonResult(com.rideread.rideread.data.result.DefJsonResult) BaseModel(com.rideread.rideread.function.net.retrofit.BaseModel) UserInfo(com.rideread.rideread.data.result.UserInfo) DetailUserInfo(com.rideread.rideread.data.result.DetailUserInfo) ConfirmDialogFragment(com.rideread.rideread.common.dialog.ConfirmDialogFragment)

Example 2 with UserInfo

use of com.rideread.rideread.data.result.UserInfo in project ride-read-android by Ride-Read.

the class UserInfoActivity method saveCurInfo.

private void saveCurInfo() {
    UserInfo curInfo = new UserInfo(mFaceUrl, mNick, mCurSexIndex + 1, mLabels, mSignature, mSchool, mLocation, mHomeTown, mCareer);
    ApiUtils.update(curInfo, mBirthday, new BaseCallback<BaseModel<UserInfo>>() {

        @Override
        protected void onSuccess(BaseModel<UserInfo> model) throws Exception {
            UserInfo userInfo = model.getData();
            if (null != userInfo) {
                UserUtils.saveUserInfo(userInfo);
                finish();
                EventBus.getDefault().postSticky(new RefreshProfileEvent());
            }
        }
    });
}
Also used : BaseModel(com.rideread.rideread.function.net.retrofit.BaseModel) UserInfo(com.rideread.rideread.data.result.UserInfo) JSONException(org.json.JSONException) IOException(java.io.IOException) RefreshProfileEvent(com.rideread.rideread.common.event.RefreshProfileEvent)

Aggregations

UserInfo (com.rideread.rideread.data.result.UserInfo)2 BaseModel (com.rideread.rideread.function.net.retrofit.BaseModel)2 ConfirmDialogFragment (com.rideread.rideread.common.dialog.ConfirmDialogFragment)1 RefreshProfileEvent (com.rideread.rideread.common.event.RefreshProfileEvent)1 DefJsonResult (com.rideread.rideread.data.result.DefJsonResult)1 DetailUserInfo (com.rideread.rideread.data.result.DetailUserInfo)1 IOException (java.io.IOException)1 JSONException (org.json.JSONException)1