Search in sources :

Example 6 with User

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);
    }
}
Also used : User(com.juns.wechat.bean.User) Intent(android.content.Intent)

Example 7 with User

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);
    }
}
Also used : User(com.juns.wechat.bean.User) ContactAdapter(com.juns.wechat.adpter.ContactAdapter) FinalDb(net.tsz.afinal.FinalDb)

Example 8 with User

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);
                }
            }
        }
    }
}
Also used : EMConversation(com.easemob.chat.EMConversation) User(com.juns.wechat.bean.User) GroupInfo(com.juns.wechat.bean.GroupInfo) Intent(android.content.Intent) MainActivity(com.juns.wechat.MainActivity)

Example 9 with User

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;
}
Also used : User(com.juns.wechat.bean.User)

Example 10 with User

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;
}
Also used : User(com.juns.wechat.bean.User)

Aggregations

User (com.juns.wechat.bean.User)23 Intent (android.content.Intent)5 ImageView (android.widget.ImageView)5 GroupInfo (com.juns.wechat.bean.GroupInfo)5 TextView (android.widget.TextView)4 FinalDb (net.tsz.afinal.FinalDb)4 View (android.view.View)3 OnClickListener (android.view.View.OnClickListener)3 EaseMobException (com.easemob.exceptions.EaseMobException)3 BaseJsonRes (com.juns.wechat.net.BaseJsonRes)3 List (java.util.List)3 EMConversation (com.easemob.chat.EMConversation)2 RequestParams (com.juns.health.net.loopj.android.http.RequestParams)2 FriendMsgActivity (com.juns.wechat.view.activity.FriendMsgActivity)2 Bitmap (android.graphics.Bitmap)1 Editable (android.text.Editable)1 TextWatcher (android.text.TextWatcher)1 EMGroup (com.easemob.chat.EMGroup)1 EMMessage (com.easemob.chat.EMMessage)1 ImageMessageBody (com.easemob.chat.ImageMessageBody)1