Search in sources :

Example 26 with UserBaseVo

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

the class ContactSelectedUI method onActivityResult.

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if ((requestCode == 0 || requestCode == 1000) && resultCode == RESULT_OK) {
        ArrayList<UserBaseVo> selectList = (ArrayList<UserBaseVo>) data.getSerializableExtra("selectList");
        if (selectList == null || selectList.isEmpty()) {
            return;
        }
        UserBaseVo userBaseVo = selectList.get(0);
        showDialogFormat(userBaseVo.getLocalId(), userBaseVo.getUsername(), userBaseVo.getThumb(), userBaseVo.getGender(), false, selectList);
    } else if (requestCode == 10 && resultCode == RESULT_OK) {
        final String uid = data.getStringExtra("uid");
        final String avatarUrl = data.getStringExtra("avatarurl");
        final String username = data.getStringExtra("username");
        final String gender = data.getStringExtra("gender");
        final boolean isNewGroup = data.getBooleanExtra("isNewGroup", false);
        // if(cantTrans(uid)){
        // return;
        // }
        ArrayList<UserBaseVo> members = new ArrayList<>();
        members = (ArrayList<UserBaseVo>) data.getSerializableExtra("member");
        showDialogFormat(uid, username, avatarUrl, gender, isNewGroup, members);
    } else if (requestCode == 100 && resultCode == RESULT_OK) {
        final String gid = data.getStringExtra("gid");
        final String avatarUrl = data.getStringExtra("avatarurl");
        final String username = data.getStringExtra("groupName");
        final String gender = data.getStringExtra("gender");
        final boolean isNewGroup = data.getBooleanExtra("isNewGroup", false);
        // if(cantTrans(gid)){
        // return;
        // }
        List<UserBaseVo> members = new ArrayList<>();
        UserBaseVo vo = new UserBaseVo();
        vo.setThumb(avatarUrl);
        members.add(vo);
        showDialogFormat(gid, username, avatarUrl, gender, isNewGroup, members);
    }
}
Also used : ArrayList(java.util.ArrayList) UserBaseVo(com.lingtuan.firefly.vo.UserBaseVo)

Example 27 with UserBaseVo

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

the class DiscussGroupListUI method onActivityResult.

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == 0 && resultCode == 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(DiscussGroupListUI.this, vo.getLocalId(), vo.getThumb(), vo.getShowName(), vo.getGender(), vo.getFriendLog(), false, false, false, 0, true);
        } 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);
        }
    }
    super.onActivityResult(requestCode, resultCode, data);
}
Also used : ArrayList(java.util.ArrayList) UserBaseVo(com.lingtuan.firefly.vo.UserBaseVo)

Example 28 with UserBaseVo

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

the class DiscussGroupListUI method onItemClick.

@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
    DiscussionGroupsVo gVo = source.get(position);
    String uid = "group-" + gVo.getCid();
    String username = gVo.getName();
    StringBuilder sb = new StringBuilder();
    for (UserBaseVo vo : gVo.getMembers()) {
        sb.append(vo.getThumb()).append("___").append(vo.getGender()).append("#");
    }
    sb.deleteCharAt(sb.lastIndexOf("#"));
    String url = sb.toString();
    if (isSingleSelect) {
        Intent intent = new Intent();
        intent.putExtra("uid", uid);
        intent.putExtra("username", username);
        intent.putExtra("avatarurl", url);
        intent.putExtra("isgroup", true);
        ArrayList<UserBaseVo> members = new ArrayList<>();
        int max = gVo.getMembers().size() <= 5 ? gVo.getMembers().size() : 5;
        for (int i = 0; i < max; i++) {
            members.add(gVo.getMembers().get(i));
        }
        intent.putExtra("member", members);
        setResult(RESULT_OK, intent);
        Utils.exitActivityAndBackAnim(this, true);
        return;
    }
    Utils.intentChattingUI(this, uid, url, username, "1", 0, true, false, false, 0, true);
}
Also used : ArrayList(java.util.ArrayList) Intent(android.content.Intent) DiscussionGroupsVo(com.lingtuan.firefly.contact.vo.DiscussionGroupsVo) UserBaseVo(com.lingtuan.firefly.vo.UserBaseVo)

Example 29 with UserBaseVo

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

the class DiscussGroupMemberListUI method addMembers.

public void addMembers() {
    ArrayList<String> alreadySelected = new ArrayList<String>();
    for (int i = 0; i < data.size(); i++) {
        UserBaseVo info = data.get(i);
        if (!TextUtils.isEmpty(info.getLocalId()) && !info.getLocalId().equals(NextApplication.myInfo.getLocalId())) {
            alreadySelected.add(info.getLocalId());
        }
    }
    Intent intent = new Intent(DiscussGroupMemberListUI.this, SelectContactUI.class);
    intent.putExtra("cantSelectList", alreadySelected);
    intent.putExtra("isMultipleChoice", true);
    startActivityForResult(intent, 0);
    Utils.openNewActivityAnim(DiscussGroupMemberListUI.this, false);
}
Also used : ArrayList(java.util.ArrayList) Intent(android.content.Intent) UserBaseVo(com.lingtuan.firefly.vo.UserBaseVo)

Example 30 with UserBaseVo

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

the class DiscussGroupMemberListUI method inviteOthersChatMsg.

private void inviteOthersChatMsg(final String name) {
    StringBuilder sb = new StringBuilder();
    int index = 1;
    for (UserBaseVo vo : data) {
        if (// Most need four pictures
        index > 4) {
            break;
        }
        sb.append(vo.getThumb()).append("___").append(vo.getGender()).append("#");
        index++;
    }
    sb.deleteCharAt(sb.lastIndexOf("#"));
    String url = sb.toString();
    ChatMsg chatmsg = new ChatMsg();
    chatmsg.setChatId("group-" + cid);
    chatmsg.setGroupName(name);
    chatmsg.setGroup(true);
    chatmsg.setType(13);
    chatmsg.setSend(1);
    chatmsg.setContent(getString(R.string.discuss_group_invite_others, name));
    chatmsg.setMsgTime(System.currentTimeMillis() / 1000);
    chatmsg.setMessageId(UUID.randomUUID().toString());
    chatmsg.parseUserBaseVo(NextApplication.myInfo.getUserBaseVo());
    Bundle bundle = new Bundle();
    bundle.putSerializable(XmppAction.ACTION_MESSAGE_LISTENER, chatmsg);
    Utils.intentAction(getApplicationContext(), XmppAction.ACTION_MESSAGE_LISTENER, bundle);
    FinalUserDataBase.getInstance().saveChatMsg(chatmsg, chatmsg.getChatId(), name, url, false);
}
Also used : Bundle(android.os.Bundle) UserBaseVo(com.lingtuan.firefly.vo.UserBaseVo) ChatMsg(com.lingtuan.firefly.vo.ChatMsg)

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