Search in sources :

Example 51 with UserBaseVo

use of com.lingtuan.firefly.vo.UserBaseVo in project SmartMesh_Android by SmartMeshFoundation.

the class FinalUserDataBase method getFriendsRecomment.

/**
 * For reference information
 *
 * @return
 */
public List<FriendRecommentVo> getFriendsRecomment() {
    List<FriendRecommentVo> mList = new ArrayList<FriendRecommentVo>();
    if (null == db) {
        return mList;
    }
    String sql = "select * from " + TableField.TABLE_FRIENDS_RECOMMENT + " order by " + TableField._ID + " desc ";
    Cursor cursor = db.rawQuery(sql, null);
    FriendRecommentVo msg;
    while (cursor.moveToNext()) {
        msg = new FriendRecommentVo();
        msg.setMsgId(cursor.getString(cursor.getColumnIndex(TableField._MSGID)));
        msg.setFriendId(cursor.getString(cursor.getColumnIndex(TableField.FIELD_CHAT_THIRDID)));
        msg.setUid(cursor.getString(cursor.getColumnIndex(TableField.FIELD_FRIEND_UID)));
        msg.setUsername(cursor.getString(cursor.getColumnIndex(TableField.FIELD_FRIEND_UNAME)));
        msg.setPic(cursor.getString(cursor.getColumnIndex(TableField.FIELD_FRIEND_PIC)));
        msg.setThumb(cursor.getString(cursor.getColumnIndex(TableField.FIELD_FRIEND_THUMB)));
        msg.setType(cursor.getInt(cursor.getColumnIndex(TableField.FIELD_CHAT_TYPE)));
        msg.setTime(cursor.getLong(cursor.getColumnIndex(TableField.FIELD_CHAT_MSGTIME)));
        msg.setUnread(cursor.getInt(cursor.getColumnIndex(TableField.FIELD_CHAT_UNREAD)));
        msg.setThirdName(cursor.getString(cursor.getColumnIndex(TableField.FIELD_CHAT_THIRDNAME)));
        UserBaseVo baseVo = FinalUserDataBase.getInstance().getUserBaseVoByUid(msg.getUid());
        if (baseVo == null) {
            // 不是好友
            msg.setAgree(false);
        } else {
            msg.setAgree(true);
        }
        try {
            if (!TextUtils.isEmpty(msg.getThirdName())) {
                if (msg.getThirdName().endsWith(")") && msg.getThirdName().contains("(")) {
                    msg.setThirdName(msg.getThirdName().substring(0, msg.getThirdName().lastIndexOf("(")));
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        mList.add(msg);
    }
    cursor.close();
    return mList;
}
Also used : FriendRecommentVo(com.lingtuan.firefly.contact.vo.FriendRecommentVo) ArrayList(java.util.ArrayList) Cursor(android.database.Cursor) UserBaseVo(com.lingtuan.firefly.vo.UserBaseVo)

Example 52 with UserBaseVo

use of com.lingtuan.firefly.vo.UserBaseVo in project SmartMesh_Android by SmartMeshFoundation.

the class MainFoundFragmentUI method onItemClick.

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    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);
}
Also used : WifiPeopleVO(com.lingtuan.firefly.offline.vo.WifiPeopleVO) UserBaseVo(com.lingtuan.firefly.vo.UserBaseVo)

Example 53 with UserBaseVo

use of com.lingtuan.firefly.vo.UserBaseVo in project SmartMesh_Android by SmartMeshFoundation.

the class MainMessageFragmentUI method onActivityResult.

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == 0 && resultCode == Activity.RESULT_OK) {
        // 选择联系人返回
        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);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) UserBaseVo(com.lingtuan.firefly.vo.UserBaseVo)

Aggregations

UserBaseVo (com.lingtuan.firefly.vo.UserBaseVo)53 ArrayList (java.util.ArrayList)13 ChatMsg (com.lingtuan.firefly.vo.ChatMsg)9 Cursor (android.database.Cursor)7 View (android.view.View)7 ListView (android.widget.ListView)7 TextView (android.widget.TextView)7 Intent (android.content.Intent)6 ImageView (android.widget.ImageView)6 JSONObject (org.json.JSONObject)6 Bundle (android.os.Bundle)5 AdapterView (android.widget.AdapterView)5 OnClickListener (android.view.View.OnClickListener)4 HorizontalScrollView (android.widget.HorizontalScrollView)4 DiscussionGroupsVo (com.lingtuan.firefly.contact.vo.DiscussionGroupsVo)4 NewContactVO (com.lingtuan.firefly.contact.vo.NewContactVO)4 RequestListener (com.lingtuan.firefly.listener.RequestListener)4 Handler (android.os.Handler)3 Editable (android.text.Editable)3 LinearLayout (android.widget.LinearLayout)3