Search in sources :

Example 1 with WifiPeopleVO

use of com.lingtuan.firefly.offline.vo.WifiPeopleVO 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);
}
Also used : WifiPeopleVO(com.lingtuan.firefly.offline.vo.WifiPeopleVO) UserBaseVo(com.lingtuan.firefly.vo.UserBaseVo)

Example 2 with WifiPeopleVO

use of com.lingtuan.firefly.offline.vo.WifiPeopleVO 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;
}
Also used : WifiPeopleVO(com.lingtuan.firefly.offline.vo.WifiPeopleVO) Cursor(android.database.Cursor) UserBaseVo(com.lingtuan.firefly.vo.UserBaseVo)

Example 3 with WifiPeopleVO

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

the class MainFoundAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    BlackHolder holder;
    if (convertView == null) {
        holder = new BlackHolder();
        convertView = View.inflate(c, R.layout.black_list_item, null);
        holder.avatar = (CharAvatarView) convertView.findViewById(R.id.invite_avatar);
        holder.nickName = (TextView) convertView.findViewById(R.id.name);
        convertView.setTag(holder);
    } else {
        holder = (BlackHolder) convertView.getTag();
    }
    WifiPeopleVO vo = source.get(position);
    holder.avatar.setText(vo.getUsername(), holder.avatar, "file://".concat(vo.getThumb()));
    holder.nickName.setText(vo.getShowName());
    return convertView;
}
Also used : WifiPeopleVO(com.lingtuan.firefly.offline.vo.WifiPeopleVO)

Example 4 with WifiPeopleVO

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

the class ChattingManager method setVoiceInfo.

public void setVoiceInfo(int second) {
    boolean successed = true;
    if (uid.equals(Constants.APP_EVERYONE)) {
        ChatMsg msg = createAudioChatMsg(uid, SDCardCtrl.getAudioPath() + File.separator + audioName, userName, avatarUrl, second + "", isSend);
        if (appNetService != null) {
            successed = appNetService.handleSendVoice(second, SDCardCtrl.getAudioPath() + File.separator + audioName, true, uid, msg.getMessageId());
        }
        if (msg.getSend() == 0 && !successed) {
            msg.setSend(0);
        }
        mAdapter.addChatMsg(msg, true);
    } else if (isGroup) {
        ChatMsg msg = createAudioChatMsg(uid, SDCardCtrl.getAudioPath() + File.separator + audioName, userName, avatarUrl, second + "", isSend);
        mAdapter.addChatMsg(msg, true);
    } else {
        boolean foundPeople = false;
        if (appNetService != null && appNetService.getwifiPeopleList() != null) {
            for (// All users need to traverse, find out the corresponding touid users
            WifiPeopleVO vo : // All users need to traverse, find out the corresponding touid users
            appNetService.getwifiPeopleList()) {
                if (uid.equals(vo.getLocalId())) {
                    foundPeople = true;
                    break;
                }
            }
        }
        if (// With no net with no net send messages
        foundPeople) {
            ChatMsg msg = new ChatMsg();
            msg.setType(2);
            msg.setContent(SDCardCtrl.getAudioPath() + File.separator + audioName);
            msg.setLocalUrl(SDCardCtrl.getAudioPath() + File.separator + audioName);
            msg.setSecond(second + "");
            msg.parseUserBaseVo(NextApplication.myInfo.getUserBaseVo());
            msg.setChatId(uid);
            msg.setOffLineMsg(true);
            msg.setSend(1);
            msg.setMessageId(UUID.randomUUID().toString());
            msg.setMsgTime(System.currentTimeMillis() / 1000);
            msg.setShowTime(FinalUserDataBase.getInstance().isOffLineShowTime(uid, msg.getMsgTime()));
            if (appNetService != null) {
                successed = appNetService.handleSendVoice(second, SDCardCtrl.getAudioPath() + File.separator + audioName, false, uid, msg.getMessageId());
            }
            if (!successed) {
                msg.setSend(0);
            }
            mAdapter.addChatMsg(msg, true);
            FinalUserDataBase.getInstance().saveChatMsg(msg, uid, userName, avatarUrl);
        } else {
            ChatMsg msg = createAudioChatMsg(uid, SDCardCtrl.getAudioPath() + File.separator + audioName, userName, avatarUrl, second + "", isSend);
            mAdapter.addChatMsg(msg, true);
        }
    }
    listView.setSelection(mAdapter.getCount());
}
Also used : WifiPeopleVO(com.lingtuan.firefly.offline.vo.WifiPeopleVO) ChatMsg(com.lingtuan.firefly.vo.ChatMsg)

Example 5 with WifiPeopleVO

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

the class ContactSelectedUI method forwardImgMethod.

/**
 * Sending pictures method
 * @param picturePath Image path
 */
private void forwardImgMethod(String uid, String picturePath, String userName, String avatarUrl, boolean isGroup, boolean isSend) {
    float density = getResources().getDisplayMetrics().density;
    // mContext.getResources().getDisplayMetrics().widthPixels;
    int screenWidth = Constants.MAX_IMAGE_WIDTH;
    // mContext.getResources().getDisplayMetrics().heightPixels;
    int screenHeight = Constants.MAX_IMAGE_HEIGHT;
    int width = (int) (120 * density);
    Bitmap bmp = BitmapUtils.getimage(picturePath, width, width, 10);
    Bitmap bmpUpload = BitmapUtils.getimage(picturePath, screenWidth, screenHeight, Constants.MAX_KB);
    BitmapUtils.saveBitmap2SD(bmp, 10, false);
    String uploadPath = BitmapUtils.saveBitmap2SD(bmpUpload, screenWidth, true).getPath();
    String url = uploadPath;
    boolean successed = true;
    if (uid.equals("everyone")) {
        XmppMessageUtil.getInstance().sendEnterLeaveEveryOne(0, false);
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        ChatMsg msg = createImageChatMsg(uid, url, userName, avatarUrl, BitmapUtils.BitmapToBase64String(bmp), isGroup, isSend);
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        XmppMessageUtil.getInstance().sendEnterLeaveEveryOne(0, true);
        if (appNetService != null) {
            successed = appNetService.handleSendPicutre(url, true, uid, msg.getMessageId());
        }
        if (msg.getSend() == 0 && !successed) {
            msg.setSend(0);
        }
    } else if (isGroup) {
        createImageChatMsg(uid, url, userName, avatarUrl, BitmapUtils.BitmapToBase64String(bmp), isGroup, isSend);
    } else {
        boolean foundPeople = false;
        if (appNetService != null && appNetService.getwifiPeopleList() != null) {
            for (// All users need to traverse, find out the corresponding touid users
            WifiPeopleVO vo : // All users need to traverse, find out the corresponding touid users
            appNetService.getwifiPeopleList()) {
                if (uid.equals(vo.getLocalId())) {
                    foundPeople = true;
                    break;
                }
            }
        }
        if (// With no net with no net send messages
        foundPeople) {
            ChatMsg msg = new ChatMsg();
            msg.setType(1);
            msg.setContent(url);
            msg.setLocalUrl(url);
            msg.setCover(BitmapUtils.BitmapToBase64String(bmp));
            msg.parseUserBaseVo(NextApplication.myInfo.getUserBaseVo());
            msg.setChatId(uid);
            msg.setOffLineMsg(true);
            msg.setSend(1);
            msg.setMessageId(UUID.randomUUID().toString());
            msg.setMsgTime(System.currentTimeMillis() / 1000);
            msg.setShowTime(FinalUserDataBase.getInstance().isOffLineShowTime(uid, msg.getMsgTime()));
            successed = appNetService.handleSendPicutre(url, false, uid, msg.getMessageId());
            if (!successed) {
                msg.setSend(0);
            }
            FinalUserDataBase.getInstance().saveChatMsg(msg, uid, userName, avatarUrl);
        } else {
            createImageChatMsg(uid, url, userName, avatarUrl, BitmapUtils.BitmapToBase64String(bmp), isGroup, isSend);
        }
    }
    if (bmp != null && !bmp.isRecycled()) {
        bmp.recycle();
    }
    if (bmpUpload != null && !bmpUpload.isRecycled()) {
        bmpUpload.recycle();
    }
}
Also used : Bitmap(android.graphics.Bitmap) WifiPeopleVO(com.lingtuan.firefly.offline.vo.WifiPeopleVO) ChatMsg(com.lingtuan.firefly.vo.ChatMsg)

Aggregations

WifiPeopleVO (com.lingtuan.firefly.offline.vo.WifiPeopleVO)11 ChatMsg (com.lingtuan.firefly.vo.ChatMsg)5 UserBaseVo (com.lingtuan.firefly.vo.UserBaseVo)3 Intent (android.content.Intent)2 Bitmap (android.graphics.Bitmap)2 Activity (android.app.Activity)1 Cursor (android.database.Cursor)1 Editable (android.text.Editable)1 File (java.io.File)1