use of com.lingtuan.firefly.vo.UserBaseVo in project SmartMesh_Android by SmartMeshFoundation.
the class ContactAddAdapter method requestAgree.
/**
* Agree to add buddy
*/
private void requestAgree(final Holder h, final ChatMsg msg) {
if (msg.isOffLineMsg()) {
if (listener != null) {
boolean successed = listener.addFriendConfim(msg.getUserId());
if (successed) {
FinalUserDataBase.getInstance().updateChatEventAgree(msg.getUserId(), true, msg.getType());
UserBaseVo vo = new UserBaseVo();
vo.setFriendLog(1);
vo.setThumb(msg.getUserImage());
vo.setLocalId(msg.getUserId());
vo.setUsername(msg.getUsername());
vo.setGender(msg.getGender() + "");
vo.setOffLine(true);
FinalUserDataBase.getInstance().saveFriendUserBase(vo);
msg.setAgree(true);
notifyDataSetChanged();
} else {
h.agreeBtn.setEnabled(true);
if (Utils.isConnectNet(mContext)) {
NetRequestImpl.getInstance().addFriendAgree(msg.getUserId(), new RequestListener() {
@Override
public void start() {
}
@Override
public void success(JSONObject response) {
try {
MyToast.showToast(mContext, response.optString("msg"));
FinalUserDataBase.getInstance().updateChatEventAgree(msg.getUserId(), true, msg.getType());
msg.setAgree(true);
Constants.isRefresh = true;
notifyDataSetChanged();
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void error(int errorCode, String errorMsg) {
try {
if (1211122 == errorCode) {
FinalUserDataBase.getInstance().updateChatEventAgree(msg.getUserId(), true, msg.getType());
msg.setAgree(true);
} else {
MyToast.showToast(mContext, errorMsg);
}
} catch (Exception e) {
e.printStackTrace();
}
notifyDataSetChanged();
}
});
}
}
}
} else {
NetRequestImpl.getInstance().addFriendAgree(msg.getUserId(), new RequestListener() {
@Override
public void start() {
}
@Override
public void success(JSONObject response) {
try {
MyToast.showToast(mContext, response.optString("msg"));
FinalUserDataBase.getInstance().updateChatEventAgree(msg.getUserId(), true, msg.getType());
msg.setAgree(true);
Constants.isRefresh = true;
notifyDataSetChanged();
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void error(int errorCode, String errorMsg) {
try {
if (1211121 == errorCode) {
FinalUserDataBase.getInstance().updateChatEventAgree(msg.getUserId(), true, msg.getType());
msg.setAgree(true);
} else {
MyToast.showToast(mContext, errorMsg);
}
} catch (Exception e) {
e.printStackTrace();
}
notifyDataSetChanged();
}
});
}
}
use of com.lingtuan.firefly.vo.UserBaseVo in project SmartMesh_Android by SmartMeshFoundation.
the class ContactSearchNickAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Holder h;
if (convertView == null) {
h = new Holder();
convertView = View.inflate(mContext, R.layout.contact_search_nick_item, null);
h.mAvatar = (ImageView) convertView.findViewById(R.id.invite_avatar);
h.nickName = (TextView) convertView.findViewById(R.id.nearby_nickname);
convertView.setTag(h);
} else {
h = (Holder) convertView.getTag();
}
UserBaseVo vo = friendList.get(position);
h.nickName.setText(vo.getShowName());
NextApplication.displayCircleImage(h.mAvatar, vo.getThumb());
return convertView;
}
use of com.lingtuan.firefly.vo.UserBaseVo in project SmartMesh_Android by SmartMeshFoundation.
the class ChatAdapter method showCardMsg.
/**
* Display and operation business card message
* @param h ViewHolder
* @param msg message
*/
private void showCardMsg(Holder h, final ChatMsg msg) {
h.shopImage.setText(msg.getThirdName(), h.shopImage, msg.getThirdImage());
// h.shopAddress.setText(msg.getCardSign());
h.shopAddress.setText(mContext.getString(R.string.chatting_card_hint));
h.shopName.setText(msg.getThirdName());
h.leftLinear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
UserBaseVo vo = new UserBaseVo();
vo.setUsername(msg.getThirdName());
vo.setLocalId(msg.getThirdId());
vo.setThumb(msg.getThirdImage());
vo.setGender(msg.getThirdGender());
vo.setFriendLog(msg.getFriendLog());
intentPeopleDetailUI(vo);
}
});
}
use of com.lingtuan.firefly.vo.UserBaseVo in project SmartMesh_Android by SmartMeshFoundation.
the class SelectGroupMemberListAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Holder h = null;
if (convertView == null) {
h = new Holder();
convertView = View.inflate(mContext, R.layout.contact_child_item, null);
h.mAvatar = (ImageView) convertView.findViewById(R.id.invite_avatar);
h.mNickname = (TextView) convertView.findViewById(R.id.nearby_nickname);
h.mLinear = (LinearLayout) convertView.findViewById(R.id.linear);
convertView.setTag(h);
} else {
h = (Holder) convertView.getTag();
}
UserBaseVo vo = mList.get(position);
NextApplication.displayCircleImage(h.mAvatar, vo.getThumb());
h.mNickname.setText(vo.getShowName());
h.mLinear.setVisibility(View.GONE);
return convertView;
}
use of com.lingtuan.firefly.vo.UserBaseVo in project SmartMesh_Android by SmartMeshFoundation.
the class DiscussionGroupsVo method parse.
public DiscussionGroupsVo parse(JSONObject obj, boolean withOutMe) {
if (obj == null) {
return null;
}
setCid(obj.optInt("cid"));
setName(obj.optString("name"));
setMask(obj.optInt("mask"));
setMaxNum(obj.optInt("max_num"));
List<UserBaseVo> mList = new ArrayList<UserBaseVo>();
UserBaseVo vo;
JSONArray array = obj.optJSONArray("members");
for (int i = 0; i < array.length(); i++) {
vo = new UserBaseVo().parse(array.optJSONObject(i));
if (vo != null) {
if (withOutMe) {
// Is your own
if (vo.getLocalId().equals(NextApplication.myInfo.getLocalId())) {
withOutMe = false;
continue;
}
}
mList.add(vo);
}
}
setMembers(mList);
return this;
}
Aggregations