use of com.juns.wechat.bean.User in project wechat by motianhuo.
the class Fragment_Friends method onItemClick.
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
User user = GloableParams.UserInfos.get(arg2 - 1);
if (user != null) {
Intent intent = new Intent(getActivity(), FriendMsgActivity.class);
intent.putExtra(Constants.NAME, user.getUserName());
intent.putExtra(Constants.TYPE, ChatActivity.CHATTYPE_SINGLE);
intent.putExtra(Constants.User_ID, user.getTelephone());
getActivity().startActivity(intent);
getActivity().overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
}
}
use of com.juns.wechat.bean.User in project wechat by motianhuo.
the class Fragment_Friends method initData.
private void initData() {
if (GloableParams.UserInfos != null) {
lvContact.setAdapter(new ContactAdapter(getActivity(), GloableParams.UserInfos));
} else {
FinalDb db = FinalDb.create(getActivity(), Constants.DB_NAME, false);
GloableParams.UserInfos = db.findAllByWhere(User.class, "type='N'");
lvContact.setAdapter(new ContactAdapter(getActivity(), GloableParams.UserInfos));
for (User user : GloableParams.UserInfos) {
GloableParams.Users.put(user.getTelephone(), user);
}
// Intent intent = new Intent(getActivity(), UpdateService.class);
// getActivity().startService(intent);
}
}
use of com.juns.wechat.bean.User in project wechat by motianhuo.
the class Fragment_Msg method onItemClick.
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
if (adpter.PublicMsg != null && position == 0) {
// 打开订阅号列表页面
Utils.start_Activity(getActivity(), PublishMsgListActivity.class);
} else {
((MainActivity) getActivity()).updateUnreadLabel();
EMConversation conversation = conversationList.get(position);
Intent intent = new Intent(getActivity(), ChatActivity.class);
Hashtable<String, String> ChatRecord = adpter.getChatRecord();
if (ChatRecord != null) {
if (conversation.isGroup()) {
GroupInfo info = GloableParams.GroupInfos.get(conversation.getUserName());
if (info != null) {
intent.putExtra(Constants.TYPE, ChatActivity.CHATTYPE_GROUP);
intent.putExtra(Constants.GROUP_ID, info.getGroup_id());
// 设置标题
intent.putExtra(Constants.NAME, info.getGroup_name());
getActivity().startActivity(intent);
} else {
intent.putExtra(Constants.TYPE, ChatActivity.CHATTYPE_GROUP);
intent.putExtra(Constants.GROUP_ID, info.getGroup_id());
// 设置标题
intent.putExtra(Constants.NAME, R.string.group_chats);
getActivity().startActivity(intent);
}
} else {
User user = GloableParams.Users.get(conversation.getUserName());
if (user != null) {
// 设置昵称
intent.putExtra(Constants.NAME, user.getUserName());
intent.putExtra(Constants.TYPE, ChatActivity.CHATTYPE_SINGLE);
intent.putExtra(Constants.User_ID, conversation.getUserName());
getActivity().startActivity(intent);
} else {
intent.putExtra(Constants.NAME, "好友");
intent.putExtra(Constants.TYPE, ChatActivity.CHATTYPE_SINGLE);
intent.putExtra(Constants.User_ID, conversation.getUserName());
getActivity().startActivity(intent);
}
}
}
}
}
use of com.juns.wechat.bean.User in project wechat by motianhuo.
the class PinyinComparator method compare.
@Override
public int compare(Object arg0, Object arg1) {
// 按照名字排序
User user0 = (User) arg0;
User user1 = (User) arg1;
String catalog0 = "";
String catalog1 = "";
if (user0 != null && user0.getUserName() != null && user0.getUserName().length() > 1)
catalog0 = PingYinUtil.converterToFirstSpell(user0.getUserName()).substring(0, 1);
if (user1 != null && user1.getUserName() != null && user1.getUserName().length() > 1)
catalog1 = PingYinUtil.converterToFirstSpell(user1.getUserName()).substring(0, 1);
int flag = catalog0.compareTo(catalog1);
return flag;
}
use of com.juns.wechat.bean.User in project wechat by motianhuo.
the class UserUtils method getUserModel.
/**
* 获取用户信息
*
* @param context
* @return
*/
public static User getUserModel(Context context) {
User user = null;
String jsondata = Utils.getValue(context, Constants.UserInfo);
// Log.e("", jsondata);
if (!TextUtils.isEmpty(jsondata))
user = JSON.parseObject(jsondata, User.class);
return user;
}
Aggregations