use of com.lingtuan.firefly.vo.UserBaseVo in project SmartMesh_Android by SmartMeshFoundation.
the class DiscussGroupSettingUI method inviteOthersChatMsg.
/**
* Forge a invite others to join group chat message
*/
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(nameEdit.getText().toString());
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(), nameEdit.getText().toString(), url, false);
}
use of com.lingtuan.firefly.vo.UserBaseVo in project SmartMesh_Android by SmartMeshFoundation.
the class DiscussGroupSettingUI method reNameChatMsg.
/**
* Forge a system modification group chat information
*/
private void reNameChatMsg(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(17);
chatmsg.setSend(1);
chatmsg.setContent(getString(R.string.discuss_group_rename, chatmsg.getGroupName()));
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);
}
use of com.lingtuan.firefly.vo.UserBaseVo in project SmartMesh_Android by SmartMeshFoundation.
the class RecommentContactListUI method onItemClick.
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
UserBaseVo info = new UserBaseVo();
info.setLocalId(mList.get(position).getUid());
info.setUsername(mList.get(position).getUsername());
info.setThumb(mList.get(position).getThumb());
Utils.intentFriendUserInfo(this, info, false);
}
use of com.lingtuan.firefly.vo.UserBaseVo in project SmartMesh_Android by SmartMeshFoundation.
the class SelectContactUI method initSearchData.
/**
* Initializes the search related
*/
private void initSearchData(View headerView) {
searchResultLayout = (LinearLayout) findViewById(R.id.contact_search_bg);
searchResultLayout.setOnClickListener(this);
searchListLayout = (FrameLayout) findViewById(R.id.contact_search_list_bg);
mSearchListView = (ListView) findViewById(R.id.contact_search_lv);
mSearchListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
UserBaseVo baseVo = mSearchAdapter.getItem(arg2);
if (isMultipleChoice) {
// multi-select
if (baseVo.isCantChecked()) {
return;
}
baseVo.setChecked(!baseVo.isChecked());
mSearchAdapter.notifyDataSetChanged();
mNewContactListAdapter.notifyDataSetChanged();
if (baseVo.isChecked()) {
final ImageView imageView = new ImageView(SelectContactUI.this);
imageView.setTag(baseVo.getLocalId());
imageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
clickSelectVo(imageView);
}
});
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(Utils.dip2px(SelectContactUI.this, 40), Utils.dip2px(SelectContactUI.this, 40));
lp.setMargins(Utils.dip2px(SelectContactUI.this, 10), Utils.dip2px(SelectContactUI.this, 5), 0, 0);
mHorizontalScrollViewContent.addView(imageView, lp);
NextApplication.displayCircleImage(imageView, baseVo.getThumb());
selectList.add(baseVo);
new Handler().postDelayed(new Runnable() {
public void run() {
mHorizontalScrollView.smoothScrollTo(mHorizontalScrollViewContent.getChildCount() * Utils.dip2px(SelectContactUI.this, 50), 0);
}
}, 0);
if (hasSelectList == null && !mFinishBtn.isEnabled()) {
mFinishBtn.setEnabled(true);
}
if (hasSelectList != null) {
// Over the selected user data
hasSelectList.add(baseVo);
}
} else {
int count = mHorizontalScrollViewContent.getChildCount();
for (int i = 0; i < count; i++) {
View imageView = mHorizontalScrollViewContent.getChildAt(i);
if (baseVo.getLocalId().equals(imageView.getTag())) {
mHorizontalScrollViewContent.removeViewAt(i);
break;
}
}
for (int i = 0; i < selectList.size(); i++) {
if (selectList.get(i).getLocalId().equals(baseVo.getLocalId())) {
selectList.remove(i);
break;
}
}
if (hasSelectList == null && selectList.size() <= 0) {
if (mFinishBtn.isEnabled()) {
mFinishBtn.setEnabled(false);
}
}
if (hasSelectList != null) {
// Over the selected user data
int hasSelectCount = hasSelectList.size();
for (int i = 0; i < hasSelectCount; i++) {
UserBaseVo vo = hasSelectList.get(i);
if (vo.getLocalId().equals(baseVo.getLocalId())) {
hasSelectList.remove(i);
break;
}
}
}
}
} else {
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mInputSearch.getWindowToken(), 0);
clickSingleItem(baseVo);
}
}
});
mEmpty = (LinearLayout) findViewById(R.id.empty);
mSearchListView.setEmptyView(mEmpty);
mInTextView = (TextView) headerView.findViewById(R.id.include_friends_search_text);
mInputSearch = (EditText) findViewById(R.id.include_friends_search_content);
mInputSearchLayout = (LinearLayout) findViewById(R.id.include_friends_search_content_bg);
mInputSearchCancel = (TextView) findViewById(R.id.include_friends_search_cancel);
mInputSearch.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public synchronized void afterTextChanged(Editable s) {
if (s != null) {
friendFilterList.clear();
if (s.toString().length() <= 0) {
searchListLayout.setVisibility(View.GONE);
searchResultLayout.setOnClickListener(SelectContactUI.this);
} else {
searchListLayout.setVisibility(View.VISIBLE);
searchResultLayout.setOnClickListener(null);
String searchString = s.toString().toUpperCase();
if (curSearchTask != null && curSearchTask.getStatus() != AsyncTask.Status.FINISHED) {
try {
curSearchTask.cancel(true);
} catch (Exception e) {
}
}
curSearchTask = new SearchListTask();
curSearchTask.execute(searchString);
}
} else {
searchListLayout.setVisibility(View.GONE);
searchResultLayout.setOnClickListener(SelectContactUI.this);
}
}
});
mInputSearchCancel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
hideSearch();
}
});
}
use of com.lingtuan.firefly.vo.UserBaseVo in project SmartMesh_Android by SmartMeshFoundation.
the class SelectContactUI method onItemClick.
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (position >= mContactList.size() + 1) {
return;
} else if (position == 0) {
showSearch();
return;
}
if (isMultipleChoice) {
// multi-select
NewContactVO baseVo = (NewContactVO) mContactList.get(position - 1);
if (baseVo.isCantChecked()) {
return;
}
baseVo.setChecked(!baseVo.isChecked());
mNewContactListAdapter.notifyDataSetChanged();
if (baseVo.isChecked()) {
final ImageView imageView = new ImageView(SelectContactUI.this);
imageView.setTag(baseVo.getLocalId());
imageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
clickSelectVo(imageView);
}
});
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(Utils.dip2px(SelectContactUI.this, 40), Utils.dip2px(SelectContactUI.this, 40));
lp.setMargins(Utils.dip2px(SelectContactUI.this, 10), Utils.dip2px(SelectContactUI.this, 5), 0, 0);
mHorizontalScrollViewContent.addView(imageView, lp);
NextApplication.displayCircleImage(imageView, baseVo.getThumb());
selectList.add(baseVo);
new Handler().postDelayed(new Runnable() {
public void run() {
mHorizontalScrollView.smoothScrollTo(mHorizontalScrollViewContent.getChildCount() * Utils.dip2px(SelectContactUI.this, 50), 0);
}
}, 0);
if (hasSelectList == null && !mFinishBtn.isEnabled()) {
mFinishBtn.setEnabled(true);
}
if (hasSelectList != null) {
hasSelectList.add(baseVo);
}
} else {
for (int i = 0; i < mHorizontalScrollViewContent.getChildCount(); i++) {
View imageView = mHorizontalScrollViewContent.getChildAt(i);
if (baseVo.getLocalId().equals(imageView.getTag())) {
mHorizontalScrollViewContent.removeViewAt(i);
break;
}
}
for (int i = 0; i < selectList.size(); i++) {
if (selectList.get(i).getLocalId().equals(baseVo.getLocalId())) {
selectList.remove(i);
break;
}
}
if (hasSelectList == null && selectList.size() <= 0) {
if (mFinishBtn.isEnabled()) {
mFinishBtn.setEnabled(false);
}
}
if (hasSelectList != null) {
int hasSelectCount = hasSelectList.size();
for (int i = 0; i < hasSelectCount; i++) {
UserBaseVo vo = hasSelectList.get(i);
if (vo.getLocalId().equals(baseVo.getLocalId())) {
hasSelectList.remove(i);
break;
}
}
}
}
} else {
NewContactVO baseVo = (NewContactVO) mContactList.get(position - 1);
clickSingleItem(baseVo);
}
}
Aggregations