Search in sources :

Example 31 with UserBaseVo

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

the class DiscussGroupMemberListUI method removeMember.

public void removeMember(final int arg2) {
    if (mProgressDialog != null) {
        mProgressDialog.dismiss();
        mProgressDialog = null;
    }
    mProgressDialog = LoadingDialog.showDialog(this, null, null);
    mProgressDialog.setCancelable(false);
    NetRequestImpl.getInstance().removeDiscussMember(data.get(arg2).getLocalId(), cid, new RequestListener() {

        @Override
        public void start() {
        }

        @Override
        public void success(JSONObject response) {
            if (mProgressDialog != null) {
                mProgressDialog.dismiss();
                mProgressDialog = null;
            }
            showToast(response.optString("msg"));
            UserBaseVo user = data.get(arg2);
            data.remove(user);
            showdata.remove(user);
            removeMemberChatMsg(user.getShowName());
            mAdapter.notifyDataSetChanged();
        }

        @Override
        public void error(int errorCode, String errorMsg) {
            if (mProgressDialog != null) {
                mProgressDialog.dismiss();
                mProgressDialog = null;
            }
            showToast(errorMsg);
        }
    });
}
Also used : RequestListener(com.lingtuan.firefly.listener.RequestListener) JSONObject(org.json.JSONObject) UserBaseVo(com.lingtuan.firefly.vo.UserBaseVo)

Example 32 with UserBaseVo

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

the class DiscussGroupSettingUI method resetlist.

private void resetlist() {
    int size = 0;
    if (isAdmin) {
        size = data.size() <= 38 ? data.size() : 38;
    } else {
        size = data.size() <= 39 ? data.size() : 39;
    }
    showdata.clear();
    for (int i = 0; i < size; i++) {
        showdata.add(data.get(i));
    }
    if (isAdmin) {
        showdata.add(new UserBaseVo());
        showdata.add(new UserBaseVo());
    } else {
        showdata.add(new UserBaseVo());
    }
    allNum.setText(getString(R.string.discuss_all, data.size()));
    adapter.notifyDataSetChanged();
}
Also used : UserBaseVo(com.lingtuan.firefly.vo.UserBaseVo)

Example 33 with UserBaseVo

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

the class DiscussGroupSettingUI method addMembers.

public void addMembers() {
    ArrayList<String> alreadySelected = new ArrayList<>();
    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(DiscussGroupSettingUI.this, SelectContactUI.class);
    intent.putExtra("cantSelectList", alreadySelected);
    intent.putExtra("isMultipleChoice", true);
    startActivityForResult(intent, 0);
    Utils.openNewActivityAnim(DiscussGroupSettingUI.this, false);
}
Also used : ArrayList(java.util.ArrayList) Intent(android.content.Intent) UserBaseVo(com.lingtuan.firefly.vo.UserBaseVo)

Example 34 with UserBaseVo

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

the class DiscussGroupSettingUI method removeMemberChatMsg.

/**
 * Forge a delete members of the group chat message
 */
private void removeMemberChatMsg(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(nameEdit.getText().toString());
    chatmsg.setGroup(true);
    chatmsg.setType(14);
    chatmsg.setSend(1);
    chatmsg.setContent(getString(R.string.discuss_group_remove_other, 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(), nameEdit.getText().toString(), url, false);
}
Also used : Bundle(android.os.Bundle) UserBaseVo(com.lingtuan.firefly.vo.UserBaseVo) ChatMsg(com.lingtuan.firefly.vo.ChatMsg)

Example 35 with UserBaseVo

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

the class SelectContactUI method findViewById.

@Override
protected void findViewById() {
    if (getIntent() != null) {
        cantSelectList = (ArrayList<String>) getIntent().getSerializableExtra("cantSelectList");
        hasSelectList = (ArrayList<UserBaseVo>) getIntent().getSerializableExtra("hasSelectList");
        isMultipleChoice = getIntent().getBooleanExtra("isMultipleChoice", false);
    }
    mTitle = (TextView) findViewById(R.id.app_title);
    mTitleRela = (RelativeLayout) findViewById(R.id.app_title_rela);
    mNewListView = (ListView) findViewById(R.id.contact_list);
    mSelectContactBg = (LinearLayout) findViewById(R.id.contact_select_bg);
    mHorizontalScrollView = (HorizontalScrollView) findViewById(R.id.contact_horizontalscrollview);
    mHorizontalScrollViewContent = (LinearLayout) findViewById(R.id.contact_horizontalscrollview_content);
    mFinishBtn = (TextView) findViewById(R.id.contact_select_finish);
    if (isMultipleChoice) {
        mSelectContactBg.setVisibility(View.VISIBLE);
    }
    if (hasSelectList != null) {
        mFinishBtn.setEnabled(true);
    }
    swipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container);
    swipeLayout.setColorSchemeResources(R.color.black);
    View headerView0 = View.inflate(this, R.layout.include_friends_header_search, null);
    initSearchData(headerView0);
    mNewListView.addHeaderView(headerView0);
    View footerView = View.inflate(this, R.layout.include_friends_footer, null);
    contactNum = (TextView) footerView.findViewById(R.id.include_contact_num);
    mNewListView.addFooterView(footerView);
    contactNum.setText(getString(R.string.contact_num, 0));
    mNewContactListAdapter = new NewContactListAdapter(this, R.layout.contact_child_item, mContactList, isMultipleChoice);
    mNewListView.setAdapter(mNewContactListAdapter);
}
Also used : NewContactListAdapter(com.lingtuan.firefly.contact.adapter.NewContactListAdapter) ImageView(android.widget.ImageView) HorizontalScrollView(android.widget.HorizontalScrollView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) 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