Search in sources :

Example 36 with ChatMsg

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

the class XmppMessageUtil method sendAudio.

/**
 * Send a voice message
 */
public ChatMsg sendAudio(String uid, String content, String uName, String avatarUrl, String second, boolean isGroup, boolean isSend) {
    ChatMsg chatMsg = new ChatMsg();
    chatMsg.setType(2);
    final String body = chatMsg.getContent();
    chatMsg.setContent(content);
    chatMsg.setSecond(second);
    chatMsg = send(uid, uName, avatarUrl, chatMsg, false, isGroup, isSend);
    // Using a local url
    chatMsg.setContent(body);
    return chatMsg;
}
Also used : ChatMsg(com.lingtuan.firefly.vo.ChatMsg)

Example 37 with ChatMsg

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

the class XmppMessageUtil method sendShare.

/**
 * Send to share
 */
public ChatMsg sendShare(String uid, String uName, String avatarUrl, String shareUrl, String shareTitle, String shareContent, String shareThumb, boolean isGroup, boolean isSend) {
    ChatMsg chatMsg = new ChatMsg();
    chatMsg.setType(103);
    chatMsg.setContent(shareContent);
    chatMsg.setShareUrl(shareUrl);
    chatMsg.setShareTitle(shareTitle);
    chatMsg.setShareThumb(shareThumb);
    return send(uid, uName, avatarUrl, chatMsg, true, isGroup, isSend);
}
Also used : ChatMsg(com.lingtuan.firefly.vo.ChatMsg)

Example 38 with ChatMsg

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

the class XmppMessageUtil method sendCard.

/**
 * Send business card information
 */
public ChatMsg sendCard(String uid, String uName, String avatarUrl, String cardName, String cardSign, String cardImage, String cardId, boolean isGroup, boolean isSend) {
    ChatMsg chatMsg = new ChatMsg();
    chatMsg.setType(6);
    chatMsg.setThirdId(cardId);
    chatMsg.setThirdImage(cardImage);
    chatMsg.setThirdName(cardName);
    chatMsg.setCardSign(cardSign);
    return send(uid, uName, avatarUrl, chatMsg, true, isGroup, isSend);
}
Also used : ChatMsg(com.lingtuan.firefly.vo.ChatMsg)

Example 39 with ChatMsg

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

the class ContactSelectedUI method onItemClick.

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    if (position == 0) {
        return;
    }
    final ChatMsg msg = mAdapter.getItem(position - 1);
    // if(cantTrans(msg.getChatId())){
    // return;
    // }
    List<UserBaseVo> members = msg.getMemberAvatarUserBaseList();
    if (members == null || members.size() == 0) {
        members = new ArrayList<>();
        UserBaseVo vo = new UserBaseVo();
        vo.setGender(msg.getGender() + "");
        vo.setThumb(msg.getUserImage());
        vo.setUsername(msg.getUsername());
        members.add(vo);
    }
    showDialogFormat(msg.getChatId(), msg.getUsername(), msg.getUserImage(), msg.getGender() + "", msg.isGroup(), members);
}
Also used : ChatMsg(com.lingtuan.firefly.vo.ChatMsg) UserBaseVo(com.lingtuan.firefly.vo.UserBaseVo)

Example 40 with ChatMsg

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

the class ContactSelectedUI method showDialogFormat.

/**
 * Forwarding operation box
 */
private void showDialogFormat(final String chatId, final String username, final String avatarUrl, final String gender, final boolean isNewGroup, List<UserBaseVo> members) {
    MyViewDialogFragment mdf = new MyViewDialogFragment(MyViewDialogFragment.DIALOG_FORWOED, chatId, getString(R.string.chat_send_to), username, linkTitle, members);
    FragmentManager manager = getSupportFragmentManager();
    mdf.setLeaveMsgCallBack(new MyViewDialogFragment.LeaveMsgCallBack() {

        @Override
        public void leaveMsgMethod(String content) {
            if (msgList != null && msgList.size() > 0) {
                if (!TextUtils.isEmpty(content)) {
                    ChatMsg chatmsg = new ChatMsg();
                    chatmsg.setType(0);
                    chatmsg.setContent(content);
                    chatmsg.setCreateTime(System.currentTimeMillis() / 1000);
                    chatmsg.parseUserBaseVo(NextApplication.myInfo);
                    msgList.add(chatmsg);
                }
                new SendMsgThread(ContactSelectedUI.this, msgList, chatId, username, avatarUrl, gender, false, false, isNewGroup);
            }
        }
    });
    if (manager != null && !isFinishing()) {
        try {
            mdf.show(manager, "mdf");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) MyViewDialogFragment(com.lingtuan.firefly.util.MyViewDialogFragment) ChatMsg(com.lingtuan.firefly.vo.ChatMsg)

Aggregations

ChatMsg (com.lingtuan.firefly.vo.ChatMsg)61 Bundle (android.os.Bundle)17 Intent (android.content.Intent)12 ArrayList (java.util.ArrayList)11 UserBaseVo (com.lingtuan.firefly.vo.UserBaseVo)9 Cursor (android.database.Cursor)8 SuppressLint (android.annotation.SuppressLint)6 WifiPeopleVO (com.lingtuan.firefly.offline.vo.WifiPeopleVO)5 View (android.view.View)4 ImageView (android.widget.ImageView)4 GroupMemberAvatarVo (com.lingtuan.firefly.contact.vo.GroupMemberAvatarVo)4 PendingIntent (android.app.PendingIntent)3 TextView (android.widget.TextView)3 MyDialogFragment (com.lingtuan.firefly.util.MyDialogFragment)3 LoginThread (com.lingtuan.firefly.xmpp.LoginThread)3 File (java.io.File)3 JSONObject (org.json.JSONObject)3 Bitmap (android.graphics.Bitmap)2 Message (android.os.Message)2 Editable (android.text.Editable)2