use of com.lingtuan.firefly.vo.UserBaseVo in project SmartMesh_Android by SmartMeshFoundation.
the class MainContactFragmentUI method onActivityResult.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 0 && resultCode == getActivity().RESULT_OK) {
// Select the contact to return
ArrayList<UserBaseVo> selectList = (ArrayList<UserBaseVo>) data.getSerializableExtra("selectList");
if (selectList != null && selectList.size() == 1) {
UserBaseVo vo = selectList.get(0);
Utils.intentChattingUI(getActivity(), vo.getLocalId(), vo.getThumb(), vo.getShowName(), vo.getGender(), vo.getFriendLog(), false, false, false, 0, false);
} else if (selectList != null && selectList.size() > 1) {
StringBuilder touids = new StringBuilder();
for (UserBaseVo vo : selectList) {
touids.append(vo.getLocalId()).append(",");
}
touids.deleteCharAt(touids.lastIndexOf(","));
createDiscussionGroups(touids.toString(), selectList);
}
}
}
use of com.lingtuan.firefly.vo.UserBaseVo in project SmartMesh_Android by SmartMeshFoundation.
the class MainContactFragmentUI method deleteFriends.
/**
* Remove buddy
*/
private void deleteFriends(final String uid, final boolean isFriendOffline) {
if (isFriendOffline) {
FinalUserDataBase.getInstance().deleteFriendByUid(uid);
int i = 0;
for (UserBaseVo info : mFriendInfoList) {
if (uid.equals(info.getLocalId())) {
mFriendInfoList.remove(i);
break;
}
i++;
}
mContactList.clear();
for (UserBaseVo voT : mFriendInfoList) {
NewContactVO info = new NewContactVO();
info.setAge(voT.getAge());
info.setDistance(voT.getDistance());
info.setFriendLog(voT.getFriendLog());
info.setGender(voT.getGender());
info.setSightml(voT.getSightml());
info.setThumb(voT.getThumb());
info.setLocalId(voT.getLocalId());
info.setUsername(voT.getUserName());
info.setNote(voT.getNote());
info.setLogintime(voT.getLogintime());
info.setFullName(PinYin.getPinYin(voT.getShowName()));
info.setMid(voT.getMid());
info.setOffLine(voT.isOffLine());
mContactList.add(info);
}
mNewListView.setFastScrollEnabled(true);
Collections.sort(mContactList, new ContactItemComparator());
mNewContactListAdapter.updateList(mContactList);
contactNum.setText(getString(R.string.contact_num, mContactList.size()));
} else {
NetRequestImpl.getInstance().deleteFriends(uid, new RequestListener() {
@Override
public void start() {
}
@Override
public void success(JSONObject response) {
showToast(response.optString("msg"));
FinalUserDataBase.getInstance().deleteFriendByUid(uid);
int i = 0;
for (UserBaseVo info : mFriendInfoList) {
if (uid.equals(info.getLocalId())) {
mFriendInfoList.remove(i);
break;
}
i++;
}
mContactList.clear();
for (UserBaseVo voT : mFriendInfoList) {
NewContactVO info = new NewContactVO();
info.setAge(voT.getAge());
info.setDistance(voT.getDistance());
info.setFriendLog(voT.getFriendLog());
info.setGender(voT.getGender());
info.setSightml(voT.getSightml());
info.setThumb(voT.getThumb());
info.setLocalId(voT.getLocalId());
info.setUsername(voT.getUserName());
info.setNote(voT.getNote());
info.setLogintime(voT.getLogintime());
info.setFullName(PinYin.getPinYin(voT.getShowName()));
info.setMid(voT.getMid());
info.setOffLine(voT.isOffLine());
mContactList.add(info);
}
mNewListView.setFastScrollEnabled(true);
Collections.sort(mContactList, new ContactItemComparator());
mNewContactListAdapter.updateList(mContactList);
contactNum.setText(getString(R.string.contact_num, mContactList.size()));
}
@Override
public void error(int errorCode, String errorMsg) {
showToast(errorMsg);
}
});
}
}
use of com.lingtuan.firefly.vo.UserBaseVo in project SmartMesh_Android by SmartMeshFoundation.
the class MainFoundFragmentUI method onRadarItemClick.
@Override
public void onRadarItemClick(int position) {
WifiPeopleVO wifiPeopleVO = mDatas.get(position);
UserBaseVo info = new UserBaseVo();
info.setLocalId(wifiPeopleVO.getLocalId());
info.setMid(wifiPeopleVO.getMid());
info.setUsername(wifiPeopleVO.getUserName());
info.setNote(wifiPeopleVO.getNote());
info.setThumb(wifiPeopleVO.getThumb());
info.setGender(wifiPeopleVO.getGender());
info.setSightml(wifiPeopleVO.getSightml());
info.setAge(wifiPeopleVO.getAge());
info.setFriendLog(wifiPeopleVO.getFriendLog());
info.setOffLineFound(true);
Utils.intentFriendUserInfo(getActivity(), info, false);
}
use of com.lingtuan.firefly.vo.UserBaseVo in project SmartMesh_Android by SmartMeshFoundation.
the class FinalUserDataBase method getOffLineInfoByUid.
/**
* Get offline user information
*
* @param uid The user id
*/
public WifiPeopleVO getOffLineInfoByUid(String uid) {
if (TextUtils.isEmpty(uid)) {
return null;
}
String sql = "select * from " + TableField.TABLE_FRIEND + " where " + TableField.FIELD_FRIEND_UID + "=? and " + TableField.FIELD_RESERVED_DATA3 + "=1";
Cursor cursor = db.rawQuery(sql, new String[] { uid });
WifiPeopleVO vo = null;
if (cursor.moveToNext()) {
vo = new WifiPeopleVO();
vo.setAge(cursor.getString(cursor.getColumnIndex(TableField.FIELD_FRIEND_AGE)));
vo.setDistance(cursor.getString(cursor.getColumnIndex(TableField.FIELD_FRIEND_DISTANCE)));
vo.setGender(cursor.getString(cursor.getColumnIndex(TableField.FIELD_FRIEND_GENDER)));
vo.setLogintime(cursor.getLong(cursor.getColumnIndex(TableField.FIELD_FRIEND_LOGINTIME)));
vo.setNote(cursor.getString(cursor.getColumnIndex(TableField.FIELD_FRIEND_NOTE)));
vo.setPic(cursor.getString(cursor.getColumnIndex(TableField.FIELD_FRIEND_PIC)));
vo.setSightml(cursor.getString(cursor.getColumnIndex(TableField.FIELD_FRIEND_SIGHTML)));
vo.setThumb(cursor.getString(cursor.getColumnIndex(TableField.FIELD_FRIEND_THUMB)));
vo.setLocalId(cursor.getString(cursor.getColumnIndex(TableField.FIELD_FRIEND_UID)));
vo.setUsername(cursor.getString(cursor.getColumnIndex(TableField.FIELD_FRIEND_UNAME)));
vo.setOffLine(true);
vo.setMeetNum(cursor.getInt(cursor.getColumnIndex(TableField.FIELD_RESERVED_DATA4)));
vo.setAddress(cursor.getString(cursor.getColumnIndex(TableField.FIELD_RESERVED_DATA7)));
UserBaseVo baseVo = getUserBaseVoByUid(uid);
if (baseVo != null) {
vo.setFriendLog(1);
}
}
cursor.close();
return vo;
}
use of com.lingtuan.firefly.vo.UserBaseVo in project SmartMesh_Android by SmartMeshFoundation.
the class FinalUserDataBase method clearFriends.
public void clearFriends(List<UserBaseVo> mFriendInfoList) {
String sql = "select * from " + TableField.TABLE_FRIEND + " order by " + TableField.FIELD_FRIEND_UID;
Cursor cursor = db.rawQuery(sql, null);
UserBaseVo vo;
while (cursor.moveToNext()) {
vo = new UserBaseVo();
vo.setLocalId(cursor.getString(cursor.getColumnIndex(TableField.FIELD_FRIEND_UID)));
vo.setOffLine(cursor.getInt(cursor.getColumnIndex(TableField.FIELD_RESERVED_DATA3)) == 1 ? true : false);
if (vo.isOffLine()) {
boolean hasSynced = false;
for (int i = 0; i < mFriendInfoList.size(); i++) {
if (mFriendInfoList.get(i).getLocalId().equals(vo.getLocalId())) {
hasSynced = true;
}
}
if (hasSynced) {
db.delete(TableField.TABLE_FRIEND, TableField.FIELD_FRIEND_UID + "=?", new String[] { vo.getLocalId() });
}
} else {
db.delete(TableField.TABLE_FRIEND, TableField.FIELD_FRIEND_UID + "=?", new String[] { vo.getLocalId() });
}
}
cursor.close();
// db.delete(TableField.TABLE_FRIEND, null, null);
}
Aggregations