Search in sources :

Example 1 with UserBean

use of org.qii.weiciyuan.bean.UserBean in project weiciyuan by qii.

the class OAuthDao method getOAuthUserInfo.

public UserBean getOAuthUserInfo() throws WeiboException {
    String uidJson = getOAuthUserUIDJsonData();
    String uid = "";
    try {
        JSONObject jsonObject = new JSONObject(uidJson);
        uid = jsonObject.optString("uid");
    } catch (JSONException e) {
        AppLogger.e(e.getMessage());
    }
    Map<String, String> map = new HashMap<String, String>();
    map.put("uid", uid);
    map.put("access_token", access_token);
    String url = URLHelper.USER_SHOW;
    String result = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map);
    Gson gson = new Gson();
    UserBean user = new UserBean();
    try {
        user = gson.fromJson(result, UserBean.class);
    } catch (JsonSyntaxException e) {
        AppLogger.e(result);
    }
    return user;
}
Also used : JsonSyntaxException(com.google.gson.JsonSyntaxException) JSONObject(org.json.JSONObject) UserBean(org.qii.weiciyuan.bean.UserBean) HashMap(java.util.HashMap) JSONException(org.json.JSONException) Gson(com.google.gson.Gson)

Example 2 with UserBean

use of org.qii.weiciyuan.bean.UserBean in project weiciyuan by qii.

the class FriendshipsDao method executeTask.

private UserBean executeTask(String url) throws WeiboException {
    if (TextUtils.isEmpty(uid) && TextUtils.isEmpty(screen_name)) {
        AppLogger.e("uid or screen name can't be empty");
        return null;
    }
    Map<String, String> map = new HashMap<String, String>();
    map.put("access_token", access_token);
    if (!TextUtils.isEmpty(uid)) {
        map.put("uid", uid);
    } else {
        map.put("screen_name", screen_name);
    }
    String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map);
    try {
        UserBean value = new Gson().fromJson(jsonData, UserBean.class);
        if (value != null) {
            return value;
        }
    } catch (JsonSyntaxException e) {
        AppLogger.e(e.getMessage());
    }
    return null;
}
Also used : JsonSyntaxException(com.google.gson.JsonSyntaxException) UserBean(org.qii.weiciyuan.bean.UserBean) HashMap(java.util.HashMap) Gson(com.google.gson.Gson)

Example 3 with UserBean

use of org.qii.weiciyuan.bean.UserBean in project weiciyuan by qii.

the class EditMyProfileDao method update.

public UserBean update() throws WeiboException {
    String apiUrl = URLHelper.MYPROFILE_EDIT;
    Map<String, String> map = new HashMap<String, String>();
    map.put("access_token", access_token);
    map.put("screen_name", screen_name);
    map.put("url", url);
    map.put("description", description);
    String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, apiUrl, map);
    Gson gson = new Gson();
    UserBean value = null;
    try {
        value = gson.fromJson(jsonData, UserBean.class);
    } catch (JsonSyntaxException e) {
        AppLogger.e(e.getMessage());
    }
    if (this.avatar != null) {
        UploadAvatarDao uploadAvatarDao = new UploadAvatarDao(access_token, avatar);
        uploadAvatarDao.upload();
    }
    return value;
}
Also used : JsonSyntaxException(com.google.gson.JsonSyntaxException) UserBean(org.qii.weiciyuan.bean.UserBean) HashMap(java.util.HashMap) Gson(com.google.gson.Gson)

Example 4 with UserBean

use of org.qii.weiciyuan.bean.UserBean in project weiciyuan by qii.

the class RemarkDao method updateRemark.

public UserBean updateRemark() throws WeiboException {
    String url = URLHelper.REMARK_UPDATE;
    Map<String, String> map = new HashMap<String, String>();
    map.put("access_token", access_token);
    map.put("uid", uid);
    map.put("remark", remark);
    String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map);
    Gson gson = new Gson();
    UserBean value = null;
    try {
        value = gson.fromJson(jsonData, UserBean.class);
    } catch (JsonSyntaxException e) {
        AppLogger.e(e.getMessage());
    }
    return value;
}
Also used : JsonSyntaxException(com.google.gson.JsonSyntaxException) UserBean(org.qii.weiciyuan.bean.UserBean) HashMap(java.util.HashMap) Gson(com.google.gson.Gson)

Example 5 with UserBean

use of org.qii.weiciyuan.bean.UserBean in project weiciyuan by qii.

the class ShowUserDao method getUserInfo.

public UserBean getUserInfo() throws WeiboException {
    String url = (!TextUtils.isEmpty(domain) ? URLHelper.USER_DOMAIN_SHOW : URLHelper.USER_SHOW);
    Map<String, String> map = new HashMap<String, String>();
    map.put("access_token", access_token);
    map.put("uid", uid);
    map.put("screen_name", screen_name);
    map.put("domain", domain);
    String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map);
    Gson gson = new Gson();
    UserBean value = null;
    try {
        value = gson.fromJson(jsonData, UserBean.class);
    } catch (JsonSyntaxException e) {
        AppLogger.e(e.getMessage());
    }
    return value;
}
Also used : JsonSyntaxException(com.google.gson.JsonSyntaxException) UserBean(org.qii.weiciyuan.bean.UserBean) HashMap(java.util.HashMap) Gson(com.google.gson.Gson)

Aggregations

UserBean (org.qii.weiciyuan.bean.UserBean)31 Gson (com.google.gson.Gson)9 JsonSyntaxException (com.google.gson.JsonSyntaxException)9 DMUserBean (org.qii.weiciyuan.bean.DMUserBean)8 HashMap (java.util.HashMap)7 MessageBean (org.qii.weiciyuan.bean.MessageBean)6 Drawable (android.graphics.drawable.Drawable)4 RelativeLayout (android.widget.RelativeLayout)4 AtUserBean (org.qii.weiciyuan.bean.AtUserBean)4 SearchUserBean (org.qii.weiciyuan.bean.SearchUserBean)4 Intent (android.content.Intent)3 SpannableString (android.text.SpannableString)3 CommentBean (org.qii.weiciyuan.bean.CommentBean)3 Cursor (android.database.Cursor)2 View (android.view.View)2 ListView (android.widget.ListView)2 ArrayList (java.util.ArrayList)2 AccountBean (org.qii.weiciyuan.bean.AccountBean)2 WriteReplyToCommentActivity (org.qii.weiciyuan.ui.send.WriteReplyToCommentActivity)2 PendingIntent (android.app.PendingIntent)1