• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java EaseUser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.hyphenate.easeui.domain.EaseUser的典型用法代码示例。如果您正苦于以下问题:Java EaseUser类的具体用法?Java EaseUser怎么用?Java EaseUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EaseUser类属于com.hyphenate.easeui.domain包,在下文中一共展示了EaseUser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: containsAtUsername

import com.hyphenate.easeui.domain.EaseUser; //导入依赖的package包/类
/**
 * check if be mentioned(@) in the content
 * @param content
 * @return
 */
public boolean containsAtUsername(String content){
    if(TextUtils.isEmpty(content)){
        return false;
    }
    synchronized (toAtUserList) {
        for(String username : toAtUserList){
            String nick = username;
            if(EaseUserUtils.getUserInfo(username) != null){
                EaseUser user = EaseUserUtils.getUserInfo(username);
                if (user != null) {
                    nick = user.getNick();
                }
            }
            if(content.contains(nick)){
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:26,代码来源:EaseAtMessageHelper.java


示例2: getAtMessageUsernames

import com.hyphenate.easeui.domain.EaseUser; //导入依赖的package包/类
/**
 * get the users be mentioned(@) 
 * @param content
 * @return
 */
public List<String> getAtMessageUsernames(String content){
    if(TextUtils.isEmpty(content)){
        return null;
    }
    synchronized (toAtUserList) {
        List<String> list = null;
        for(String username : toAtUserList){
            String nick = username;
            if(EaseUserUtils.getUserInfo(username) != null){
                EaseUser user = EaseUserUtils.getUserInfo(username);
                if (user != null) {
                    nick = user.getNick();
                }
            }
            if(content.contains(nick)){
                if(list == null){
                    list = new ArrayList<String>();
                }
                list.add(username);
            }
        }
        return list;
    }
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:30,代码来源:EaseAtMessageHelper.java


示例3: isAtMeMsg

import com.hyphenate.easeui.domain.EaseUser; //导入依赖的package包/类
public boolean isAtMeMsg(EMMessage message){
    EaseUser user = EaseUserUtils.getUserInfo(message.getFrom());
    if(user != null){
        try {
            JSONArray jsonArray = message.getJSONArrayAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG);
            
            for(int i = 0; i < jsonArray.length(); i++){
                String username = jsonArray.getString(i);
                if(username.equals(EMClient.getInstance().getCurrentUser())){
                    return true;
                }
            }
        } catch (Exception e) {
            //perhaps is a @ all message
            String atUsername = message.getStringAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG, null);
            if(atUsername != null){
                if(atUsername.toUpperCase().equals(EaseConstant.MESSAGE_ATTR_VALUE_AT_MSG_ALL)){
                    return true;
                }
            }
            return  false;
        }
        
    }
    return false;
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:27,代码来源:EaseAtMessageHelper.java


示例4: inputAtUsername

import com.hyphenate.easeui.domain.EaseUser; //导入依赖的package包/类
/**
 * input @
 * @param username
 */
protected void inputAtUsername(String username, boolean autoAddAtSymbol){
    if(EMClient.getInstance().getCurrentUser().equals(username) ||
            chatType != EaseConstant.CHATTYPE_GROUP){
        return;
    }
    EaseAtMessageHelper.get().addAtUser(username);
    EaseUser user = EaseUserUtils.getUserInfo(username);
    if (user != null){
        username = user.getNick();
    }
    if(autoAddAtSymbol)
        inputMenu.insertText("@" + username + " ");
    else
        inputMenu.insertText(username + " ");
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:20,代码来源:EaseChatFragment.java


示例5: refreshContact

import com.hyphenate.easeui.domain.EaseUser; //导入依赖的package包/类
private void refreshContact() {

        // 获取数据
        List<UserInfo> contacts = Model.getInstance().getDbManager().getContactTableDao().getContacts();

        // 校验
        if (contacts != null && contacts.size() >= 0) {

            // 设置数据
            Map<String, EaseUser> contactsMap = new HashMap<>();

            // 转换
            for (UserInfo contact : contacts) {
                EaseUser easeUser = new EaseUser(contact.getHxid());

                contactsMap.put(contact.getHxid(), easeUser);
            }

            setContactsMap(contactsMap);

            // 刷新页面
            refresh();
        }
    }
 
开发者ID:turoDog,项目名称:KTalk,代码行数:25,代码来源:ContactListFragment.java


示例6: setUserInitialLetter

import com.hyphenate.easeui.domain.EaseUser; //导入依赖的package包/类
/**
 * 设置user昵称(没有昵称取username)的首字母属性,方便通讯中对联系人按header分类显示,以及通过右侧ABCD...字母栏快速定位联系人
 * 
 * @param username
 * @param user
 */
public static void setUserInitialLetter(EaseUser user) {
    String headerName = null;
    if (!TextUtils.isEmpty(user.getNick())) {
        headerName = user.getNick();
    } else {
        headerName = user.getUsername();
    }
    if (Character.isDigit(headerName.charAt(0))) {
        user.setInitialLetter("#");
    } else {
        user.setInitialLetter(HanziToPinyin.getInstance().get(headerName.substring(0, 1)).get(0).target.substring(0, 1)
                .toUpperCase());
        char header = user.getInitialLetter().toLowerCase().charAt(0);
        if (header < 'a' || header > 'z') {
            user.setInitialLetter("#");
        }
    }
}
 
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:25,代码来源:EaseCommonUtils.java


示例7: isAtMeMsg

import com.hyphenate.easeui.domain.EaseUser; //导入依赖的package包/类
public boolean isAtMeMsg(EMMessage message){
    EaseUser user = EaseUserUtils.getUserInfo(message.getFrom());
    if(user != null){
        String atUsername = message.getStringAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG, null);
        if(atUsername != null){
            String[] atUsernames = atUsername.split(",");
            for(String username : atUsernames){
                if(username.equals(EMClient.getInstance().getCurrentUser())){
                    return true;
                }
            }
        }
        
    }
    return false;
}
 
开发者ID:HyphenateInc,项目名称:Hyphenate-EaseUI-Android,代码行数:17,代码来源:EaseAtMessageHelper.java


示例8: asyncFetchUserInfo

import com.hyphenate.easeui.domain.EaseUser; //导入依赖的package包/类
public void asyncFetchUserInfo(String username){
	DemoHelper.getInstance().getUserProfileManager().asyncGetUserInfo(username, new EMValueCallBack<EaseUser>() {
		
		@Override
		public void onSuccess(EaseUser user) {
			if (user != null) {
			    DemoHelper.getInstance().saveContact(user);
			    if(isFinishing()){
			        return;
			    }
				tvNickName.setText(user.getNick());
				if(!TextUtils.isEmpty(user.getAvatar())){
					 Glide.with(UserProfileActivity.this).load(user.getAvatar()).placeholder(R.drawable.em_default_avatar).into(headAvatar);
				}else{
				    Glide.with(UserProfileActivity.this).load(R.drawable.em_default_avatar).into(headAvatar);
				}
			}
		}
		
		@Override
		public void onError(int error, String errorMsg) {
		}
	});
}
 
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:25,代码来源:UserProfileActivity.java


示例9: onCreate

import com.hyphenate.easeui.domain.EaseUser; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.em_activity_pick_contact_no_checkbox);
	listView = (ListView) findViewById(R.id.list);
	sidebar = (EaseSidebar) findViewById(R.id.sidebar);
	sidebar.setListView(listView);
	contactList = new ArrayList<EaseUser>();
	// get contactlist
	getContactList();
	// set adapter
	contactAdapter = new EaseContactAdapter(this, R.layout.ease_row_contact, contactList);
	listView.setAdapter(contactAdapter);
	listView.setOnItemClickListener(new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
			onListItemClick(position);
		}
	});

}
 
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:23,代码来源:PickContactNoCheckboxActivity.java


示例10: refresh

import com.hyphenate.easeui.domain.EaseUser; //导入依赖的package包/类
@Override
public void refresh() {
    Map<String, EaseUser> m = DemoHelper.getInstance().getContactList();
    if (m instanceof Hashtable<?, ?>) {
        m = (Map<String, EaseUser>) ((Hashtable<String, EaseUser>)m).clone();
    }
    setContactsMap(m);
    super.refresh();
    if(inviteMessgeDao == null){
        inviteMessgeDao = new InviteMessgeDao(getActivity());
    }
    if(inviteMessgeDao.getUnreadMessagesCount() > 0){
        applicationItem.showUnreadMsgView();
    }else{
        applicationItem.hideUnreadMsgView();
    }
}
 
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:18,代码来源:ContactListFragment.java


示例11: saveContactList

import com.hyphenate.easeui.domain.EaseUser; //导入依赖的package包/类
/**
 * save contact list
 * 
 * @param contactList
 */
synchronized public void saveContactList(List<EaseUser> contactList) {
    SQLiteDatabase db = dbHelper.getWritableDatabase();
    if (db.isOpen()) {
        db.delete(UserDao.TABLE_NAME, null, null);
        for (EaseUser user : contactList) {
            ContentValues values = new ContentValues();
            values.put(UserDao.COLUMN_NAME_ID, user.getUsername());
            if(user.getNick() != null)
                values.put(UserDao.COLUMN_NAME_NICK, user.getNick());
            if(user.getAvatar() != null)
                values.put(UserDao.COLUMN_NAME_AVATAR, user.getAvatar());
            db.replace(UserDao.TABLE_NAME, null, values);
        }
    }
}
 
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:21,代码来源:DemoDBManager.java


示例12: getContactList

import com.hyphenate.easeui.domain.EaseUser; //导入依赖的package包/类
/**
 * get contact list
 * 
 * @return
 */
synchronized public Map<String, EaseUser> getContactList() {
    SQLiteDatabase db = dbHelper.getReadableDatabase();
    Map<String, EaseUser> users = new Hashtable<String, EaseUser>();
    if (db.isOpen()) {
        Cursor cursor = db.rawQuery("select * from " + UserDao.TABLE_NAME /* + " desc" */, null);
        while (cursor.moveToNext()) {
            String username = cursor.getString(cursor.getColumnIndex(UserDao.COLUMN_NAME_ID));
            String nick = cursor.getString(cursor.getColumnIndex(UserDao.COLUMN_NAME_NICK));
            String avatar = cursor.getString(cursor.getColumnIndex(UserDao.COLUMN_NAME_AVATAR));
            EaseUser user = new EaseUser(username);
            user.setNick(nick);
            user.setAvatar(avatar);
            if (username.equals(Constant.NEW_FRIENDS_USERNAME) || username.equals(Constant.GROUP_USERNAME)
                    || username.equals(Constant.CHAT_ROOM)|| username.equals(Constant.CHAT_ROBOT)) {
                    user.setInitialLetter("");
            } else {
                EaseCommonUtils.setUserInitialLetter(user);
            }
            users.put(username, user);
        }
        cursor.close();
    }
    return users;
}
 
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:30,代码来源:DemoDBManager.java


示例13: asyncGetCurrentUserInfo

import com.hyphenate.easeui.domain.EaseUser; //导入依赖的package包/类
public void asyncGetCurrentUserInfo() {
	ParseManager.getInstance().asyncGetCurrentUserInfo(new EMValueCallBack<EaseUser>() {

		@Override
		public void onSuccess(EaseUser value) {
		    if(value != null){
   				setCurrentUserNick(value.getNick());
   				setCurrentUserAvatar(value.getAvatar());
		    }
		}

		@Override
		public void onError(int error, String errorMsg) {

		}
	});

}
 
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:19,代码来源:UserProfileManager.java


示例14: getContactInfos

import com.hyphenate.easeui.domain.EaseUser; //导入依赖的package包/类
public void getContactInfos(List<String> usernames, final EMValueCallBack<List<EaseUser>> callback) {
	ParseQuery<ParseObject> pQuery = ParseQuery.getQuery(CONFIG_TABLE_NAME);
	pQuery.whereContainedIn(CONFIG_USERNAME, usernames);
	pQuery.findInBackground(new FindCallback<ParseObject>() {

		@Override
		public void done(List<ParseObject> arg0, ParseException arg1) {
			if (arg0 != null) {
				List<EaseUser> mList = new ArrayList<EaseUser>();
				for (ParseObject pObject : arg0) {
				    EaseUser user = new EaseUser(pObject.getString(CONFIG_USERNAME));
					ParseFile parseFile = pObject.getParseFile(CONFIG_AVATAR);
					if (parseFile != null) {
						user.setAvatar(parseFile.getUrl());
					}
					user.setNick(pObject.getString(CONFIG_NICK));
					EaseCommonUtils.setUserInitialLetter(user);
					mList.add(user);
				}
				callback.onSuccess(mList);
			} else {
				callback.onError(arg1.getCode(), arg1.getMessage());
			}
		}
	});
}
 
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:27,代码来源:ParseManager.java


示例15: onCreate

import com.hyphenate.easeui.domain.EaseUser; //导入依赖的package包/类
@Override
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(R.layout.activity_main);
    
    unreadLabel = (TextView) findViewById(R.id.unread_msg_number);
    mTabs = new Button[3];
    mTabs[0] = (Button) findViewById(R.id.btn_conversation);
    mTabs[1] = (Button) findViewById(R.id.btn_address_list);
    mTabs[2] = (Button) findViewById(R.id.btn_setting);
    // set first tab as selected
    mTabs[0].setSelected(true);
    
    conversationListFragment = new EaseConversationListFragment();
    contactListFragment = new EaseContactListFragment();
    settingFragment = new SettingsFragment();
    contactListFragment.setContactsMap(getContacts());
    conversationListFragment.setConversationListItemClickListener(new EaseConversationListItemClickListener() {
        
        @Override
        public void onListItemClicked(EMConversation conversation) {
            startActivity(new Intent(MainActivity.this, ChatActivity.class).putExtra(EaseConstant.EXTRA_USER_ID, conversation.getUserName()));
        }
    });
    contactListFragment.setContactListItemClickListener(new EaseContactListItemClickListener() {
        
        @Override
        public void onListItemClicked(EaseUser user) {
            startActivity(new Intent(MainActivity.this, ChatActivity.class).putExtra(EaseConstant.EXTRA_USER_ID, user.getUsername()));
        }
    });
    fragments = new Fragment[] { conversationListFragment, contactListFragment, settingFragment };
    // add and show first fragment
    getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, conversationListFragment)
            .add(R.id.fragment_container, contactListFragment).hide(contactListFragment).show(conversationListFragment)
            .commit();
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:38,代码来源:MainActivity.java


示例16: getContacts

import com.hyphenate.easeui.domain.EaseUser; //导入依赖的package包/类
/**
 * prepared users, password is "123456"
 * you can use these user to test
 * @return
 */
private Map<String, EaseUser> getContacts(){
    Map<String, EaseUser> contacts = new HashMap<String, EaseUser>();
    for(int i = 1; i <= 10; i++){
        EaseUser user = new EaseUser("easeuitest" + i);
        contacts.put("easeuitest" + i, user);
    }
    return contacts;
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:14,代码来源:MainActivity.java


示例17: getUserInfo

import com.hyphenate.easeui.domain.EaseUser; //导入依赖的package包/类
/**
 * get EaseUser according username
 * @param username
 * @return
 */
public static EaseUser getUserInfo(String username){
    if(userProvider != null)
        return userProvider.getUser(username);
    
    return null;
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:12,代码来源:EaseUserUtils.java


示例18: setUserAvatar

import com.hyphenate.easeui.domain.EaseUser; //导入依赖的package包/类
/**
 * set user avatar
 * @param username
 */
public static void setUserAvatar(Context context, String username, ImageView imageView){
	EaseUser user = getUserInfo(username);
    if(user != null && user.getAvatar() != null){
        try {
            int avatarResId = Integer.parseInt(user.getAvatar());
            Glide.with(context).load(avatarResId).into(imageView);
        } catch (Exception e) {
            //use default avatar
            Glide.with(context).load(user.getAvatar()).diskCacheStrategy(DiskCacheStrategy.ALL).placeholder(R.drawable.ease_default_avatar).into(imageView);
        }
    }else{
        Glide.with(context).load(R.drawable.ease_default_avatar).into(imageView);
    }
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:19,代码来源:EaseUserUtils.java


示例19: setUserNick

import com.hyphenate.easeui.domain.EaseUser; //导入依赖的package包/类
/**
 * set user's nickname
 */
public static void setUserNick(String username,TextView textView){
    if(textView != null){
    	EaseUser user = getUserInfo(username);
    	if(user != null && user.getNick() != null){
    		textView.setText(user.getNick());
    	}else{
    		textView.setText(username);
    	}
    }
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:14,代码来源:EaseUserUtils.java


示例20: EaseContactAdapter

import com.hyphenate.easeui.domain.EaseUser; //导入依赖的package包/类
public EaseContactAdapter(Context context, int resource, List<EaseUser> objects) {
    super(context, resource, objects);
    this.res = resource;
    this.userList = objects;
    copyUserList = new ArrayList<EaseUser>();
    copyUserList.addAll(objects);
    layoutInflater = LayoutInflater.from(context);
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:9,代码来源:EaseContactAdapter.java



注:本文中的com.hyphenate.easeui.domain.EaseUser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RAMDictionary类代码示例发布时间:2022-05-22
下一篇:
Java LSTORE类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap