Search in sources :

Example 1 with DiscussionGroupsVo

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

the class DiscussGroupSettingUI method parseJson.

/*Parsing json*/
private void parseJson(JSONObject response) {
    JSONObject jsonObject = response.optJSONObject("data");
    DiscussionGroupsVo vo = new DiscussionGroupsVo().parse(jsonObject);
    nameEdit.setText(vo.getName());
    data.clear();
    showdata.clear();
    for (int i = 0; i < vo.getMembers().size(); i++) {
        UserBaseVo info = vo.getMembers().get(i);
        if (i == 0 && info.getLocalId().equals(NextApplication.myInfo.getLocalId())) {
            isAdmin = true;
        }
        data.add(info);
        if (isAdmin) {
            if (i <= 37) {
                showdata.add(info);
            }
        } else if (i <= 38) {
            showdata.add(info);
        }
    }
    if (isAdmin) {
        showdata.add(new UserBaseVo());
        showdata.add(new UserBaseVo());
        eidtNameBg.setClickable(true);
        dissmissBtn.setText(getResources().getString(R.string.group_dismiss_discussion));
    } else {
        showdata.add(new UserBaseVo());
        eidtNameBg.setClickable(false);
        dissmissBtn.setText(getResources().getString(R.string.group_out_discussion));
    }
    allNum.setText(getString(R.string.discuss_all, vo.getMembers().size()));
    switchBtn.setOnCheckedChangeListener(null);
    if (0 == vo.getMask()) {
        switchBtn.setChecked(false);
        switchBtn.setBackColor(getResources().getColorStateList(R.color.switch_button_gray));
    } else {
        switchBtn.setChecked(true);
        switchBtn.setBackColor(getResources().getColorStateList(R.color.switch_button_green));
        notifyClock.setVisibility(View.VISIBLE);
    }
    switchBtn.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                notifyClock.setVisibility(View.VISIBLE);
            } else {
                notifyClock.setVisibility(View.GONE);
            }
            if (isChecked) {
                switchBtn.setBackColor(getResources().getColorStateList(R.color.switch_button_green));
            } else {
                switchBtn.setBackColor(getResources().getColorStateList(R.color.switch_button_gray));
            }
            switchNotify();
        }
    });
    dissmissBtn.setVisibility(View.VISIBLE);
}
Also used : OnCheckedChangeListener(android.widget.CompoundButton.OnCheckedChangeListener) JSONObject(org.json.JSONObject) DiscussionGroupsVo(com.lingtuan.firefly.contact.vo.DiscussionGroupsVo) CompoundButton(android.widget.CompoundButton) UserBaseVo(com.lingtuan.firefly.vo.UserBaseVo)

Example 2 with DiscussionGroupsVo

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

the class DiscussGroupAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    NearHolder holder;
    if (convertView == null) {
        holder = new NearHolder();
        convertView = View.inflate(c, R.layout.discuss_group_item, null);
        holder.nickName = (TextView) convertView.findViewById(R.id.group_nickname);
        holder.avatar = (DiscussGroupImageView) convertView.findViewById(R.id.group_avatar);
        convertView.setTag(holder);
    } else {
        holder = (NearHolder) convertView.getTag();
    }
    DiscussionGroupsVo group = sourceList.get(position);
    holder.nickName.setText(group.getName());
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < group.getMembers().size(); i++) {
        UserBaseVo member = group.getMembers().get(i);
        if (i == group.getMembers().size() - 1) {
            sb.append(member.getShowName());
        } else {
            sb.append(member.getShowName() + ",");
        }
    }
    holder.avatar.setMember(group.getMembers());
    return convertView;
}
Also used : DiscussionGroupsVo(com.lingtuan.firefly.contact.vo.DiscussionGroupsVo) UserBaseVo(com.lingtuan.firefly.vo.UserBaseVo)

Example 3 with DiscussionGroupsVo

use of com.lingtuan.firefly.contact.vo.DiscussionGroupsVo 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 4 with DiscussionGroupsVo

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

the class DiscussGroupListUI method parseJson.

/*Parsing json*/
private void parseJson(JSONArray jsonArray) {
    if (jsonArray != null) {
        int count = jsonArray.length();
        for (int i = 0; i < count; i++) {
            DiscussionGroupsVo uInfo = new DiscussionGroupsVo().parse(jsonArray.optJSONObject(i));
            source.add(uInfo);
        }
    }
}
Also used : DiscussionGroupsVo(com.lingtuan.firefly.contact.vo.DiscussionGroupsVo)

Example 5 with DiscussionGroupsVo

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

the class SelectGroupMemberListUI method parserJson.

private void parserJson(JSONObject response) {
    JSONObject jsonObject = response.optJSONObject("data");
    DiscussionGroupsVo vo = new DiscussionGroupsVo().parse(jsonObject, true);
    if (vo != null) {
        mAdapter.updateList(vo.getMembers());
        // Add a group of members The nickname and the uid data generated for @ function
        String[] usernames = new String[vo.getMembers().size()];
        String[] ids = new String[vo.getMembers().size()];
        for (int i = 0; i < vo.getMembers().size(); i++) {
            UserBaseVo uvo = vo.getMembers().get(i);
            usernames[i] = uvo.getUserName() + " ";
            ids[i] = uvo.getLocalId();
        }
        AtGroupParser.init(usernames, ids);
    }
}
Also used : JSONObject(org.json.JSONObject) DiscussionGroupsVo(com.lingtuan.firefly.contact.vo.DiscussionGroupsVo) UserBaseVo(com.lingtuan.firefly.vo.UserBaseVo)

Aggregations

DiscussionGroupsVo (com.lingtuan.firefly.contact.vo.DiscussionGroupsVo)5 UserBaseVo (com.lingtuan.firefly.vo.UserBaseVo)4 JSONObject (org.json.JSONObject)2 Intent (android.content.Intent)1 CompoundButton (android.widget.CompoundButton)1 OnCheckedChangeListener (android.widget.CompoundButton.OnCheckedChangeListener)1 ArrayList (java.util.ArrayList)1