use of com.juns.health.net.loopj.android.http.RequestParams in project wechat by motianhuo.
the class UserUtils method initUserInfo.
public static void initUserInfo(final Context context, final String telphone, final ImageView img_avar, final TextView txt_name) {
NetClient netClient = new NetClient(context);
RequestParams params = new RequestParams();
params.put("telphone", telphone);
netClient.post(Constants.getUserInfoURL, params, new BaseJsonRes() {
@Override
public void onMySuccess(String data) {
User user = JSON.parseObject(data, User.class);
if (user != null) {
if (user.getUserName() != null) {
txt_name.setText(user.getUserName());
}
if (user.getHeadUrl() != null) {
NetClient.getIconBitmap(img_avar, user.getHeadUrl());
}
FinalDb db = FinalDb.create(context, Constants.DB_NAME, false);
if (db.findById(user.getId(), User.class) != null)
db.deleteById(User.class, user.getId());
db.save(user);
GloableParams.UserInfos.add(user);
GloableParams.Users.put(user.getTelephone(), user);
}
}
@Override
public void onMyFailure() {
}
});
}
use of com.juns.health.net.loopj.android.http.RequestParams in project wechat by motianhuo.
the class ChatActivity method initGroupInfo.
private void initGroupInfo() {
RequestParams params = new RequestParams();
String userid = UserUtils.getUserID(this);
params.put("user_id", userid);
params.put("group_id", toChatUsername);
netClient.post(Constants.getUserInfoURL, params, new BaseJsonRes() {
@Override
public void onMySuccess(String data) {
GroupInfo group = JSON.parseObject(data, GroupInfo.class);
// NetClient.getIconBitmap(img_avar, group.getGroup_name());
if (group != null && group.getGroup_name() != null)
txt_title.setText(group.getGroup_name());
}
@Override
public void onMyFailure() {
}
});
}
use of com.juns.health.net.loopj.android.http.RequestParams in project wechat by motianhuo.
the class AddFromContactActivity method initView.
@Override
protected void initView() {
getLoadingDialog("正在获取联系人").show();
String str_contact = Utils.getValue(this, Constants.ContactMsg);
RequestParams params = new RequestParams();
params.put("userlist", str_contact);
netClient.post(Constants.getContactFriendURL, params, new BaseJsonRes() {
@Override
public void onMySuccess(String data) {
List<User> UserInfos = JSON.parseArray(data, User.class);
mlistview.setAdapter(new FromContactAdapter(AddFromContactActivity.this, UserInfos));
getLoadingDialog("正在获取联系人").dismiss();
}
@Override
public void onMyFailure() {
// TODO Auto-generated method stub
getLoadingDialog("正在获取联系人").dismiss();
}
});
}
Aggregations