当前位置: 首页>>代码示例>>Java>>正文


Java BmobConfig.TYPE_TEXT属性代码示例

本文整理汇总了Java中cn.bmob.im.config.BmobConfig.TYPE_TEXT属性的典型用法代码示例。如果您正苦于以下问题:Java BmobConfig.TYPE_TEXT属性的具体用法?Java BmobConfig.TYPE_TEXT怎么用?Java BmobConfig.TYPE_TEXT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在cn.bmob.im.config.BmobConfig的用法示例。


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

示例1: showMsgNotify

public void showMsgNotify(Context context,BmobMsg msg) {
    wakePhoneAndUnlock();
    // 更新通知栏
    int icon = R.mipmap.ic_launcher;
    String trueMsg = "";
    if(msg.getMsgType()==BmobConfig.TYPE_TEXT && msg.getContent().contains("\\ue")){
        trueMsg = "[表情]";
    }else if(msg.getMsgType()==BmobConfig.TYPE_IMAGE){
        trueMsg = "[图片]";
    }else if(msg.getMsgType()==BmobConfig.TYPE_VOICE){
        trueMsg = "[语音]";
    }else if(msg.getMsgType()==BmobConfig.TYPE_LOCATION){
        trueMsg = "[位置]";
    }else{
        trueMsg = msg.getContent();
    }
    CharSequence tickerText = msg.getBelongNick() + ":" + trueMsg;
    String contentTitle = msg.getBelongNick()+ " (" + mNewNum + "条新消息)";

    Intent intent = new Intent(context, MessageActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
    intent.putExtra("isshowchat", true);


    BmobNotifyManager.getInstance(context).showNotifyWithExtras(application.isVoiceAllowed, application.isVibrateAllowed,icon, tickerText.toString(), contentTitle, tickerText.toString(),intent);
}
 
开发者ID:JoeSteven,项目名称:BiBi,代码行数:26,代码来源:MyMessageReceiver.java

示例2: getView

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View v=convertView;
    ViewHolder holder=null;
    BmobRecent recent=mRecents.get(position);
    if(v==null){
        v=View.inflate(MessageActivity.this,R.layout.item_chat_message,null);
        holder=new ViewHolder();
        holder.nickChat= (TextView) v.findViewById(R.id.tv_nick_chat);
        holder.msg= (TextView) v.findViewById(R.id.tv_msg_chat);
        holder.date= (TextView) v.findViewById(R.id.tv_date_chat);
        holder.unread= (TextView) v.findViewById(R.id.tv_unread_chat);
        holder.avatarChat= (CircularImageView) v.findViewById(R.id.iv_avatar_chat);
        v.setTag(holder);
    }else{
        holder= (ViewHolder) v.getTag();
    }

    x.image().bind(holder.avatarChat, recent.getAvatar());
    holder.nickChat.setText(recent.getNick());
    holder.date.setText(TimeUtil.getChatTime(recent.getTime()));
    if(recent.getType()==BmobConfig.TYPE_TEXT){
        SpannableString spannableString = FaceTextUtils.toSpannableString(MessageActivity.this, recent.getMessage());
        holder.msg.setText(spannableString);
    }else if(recent.getType()==BmobConfig.TYPE_IMAGE){
        holder.msg.setText("[图片]");
    } else if(recent.getType()==BmobConfig.TYPE_VOICE){
        holder.msg.setText("[语音]");
    }
    int num = BmobDB.create(MessageActivity.this).getUnreadCount(recent.getTargetid());
    if(num>0){
        holder.unread.setVisibility(View.VISIBLE);
        if(num>100){
            holder.unread.setText("99¨");
        }
        holder.unread.setText(num+"");
    }
    return v;
}
 
开发者ID:JoeSteven,项目名称:BiBi,代码行数:39,代码来源:MessageActivity.java

示例3: showMsgNotify

/**
 * ��ʾ��������Ϣ��֪ͨ
 * 
 * @param context
 * @param msg
 */
protected void showMsgNotify(Context context, BmobMsg msg) {
	// ����֪ͨ��
	int icon = R.drawable.ic_launcher;
	String trueMsg = "";
	if (msg.getMsgType() == BmobConfig.TYPE_TEXT
			&& msg.getContent().contains("\\ue")) {
		trueMsg = "[����]";
	} else if (msg.getMsgType() == BmobConfig.TYPE_IMAGE) {
		trueMsg = "[ͼƬ]";
	} else if (msg.getMsgType() == BmobConfig.TYPE_VOICE) {
		trueMsg = "[����]";
	} else if (msg.getMsgType() == BmobConfig.TYPE_LOCATION) {
		trueMsg = "[�]";
	} else {
		trueMsg = msg.getContent();
	}
	
	CharSequence tickerText = msg.getBelongUsername() + ":" + trueMsg;
	String contentTitle = msg.getBelongUsername()+ " (" + mNewNum + "������Ϣ)";
	Intent intent = new Intent(context, MainActivity.class);
	intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
	
	boolean isAllowVoice = CustomApplication.getInstance().getSpUtil().isAllowVoice();
	boolean isAllowVibrate = CustomApplication.getInstance().getSpUtil().isAllowVibrate();
	
	BmobNotifyManager.getInstance(context).showNotifyWithExtras(isAllowVoice,isAllowVibrate,icon, tickerText.toString(), contentTitle, tickerText.toString(),intent);
}
 
开发者ID:JasonGaoH,项目名称:enjoychat,代码行数:33,代码来源:MyMessageReceiver.java

示例4: showMsgNotify

/**
 * 显示与聊天消息的通知
 * 
 * @Title: showNotify
 * @return void
 * @throws
 */
public void showMsgNotify(Context context, BmobMsg msg) {
	// 更新通知栏
	int icon = R.drawable.ic_launcher;
	String trueMsg = "";
	if (msg.getMsgType() == BmobConfig.TYPE_TEXT
			&& msg.getContent().contains("\\ue")) {
		trueMsg = "[表情]";
	} else if (msg.getMsgType() == BmobConfig.TYPE_IMAGE) {
		trueMsg = "[图片]";
	} else if (msg.getMsgType() == BmobConfig.TYPE_VOICE) {
		trueMsg = "[语音]";
	} else if (msg.getMsgType() == BmobConfig.TYPE_LOCATION) {
		trueMsg = "[位置]";
	} else {
		trueMsg = msg.getContent();
	}
	CharSequence tickerText = msg.getBelongUsername() + ":" + trueMsg;
	String contentTitle = msg.getBelongUsername() + " (" + mNewNum
			+ "条新消息)";

	Intent intent = new Intent(context, MainActivity.class);
	intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);

	boolean isAllowVoice = CustomApplcation.getInstance().getSpUtil()
			.isAllowVoice();
	boolean isAllowVibrate = CustomApplcation.getInstance().getSpUtil()
			.isAllowVibrate();

	BmobNotifyManager.getInstance(context).showNotifyWithExtras(
			isAllowVoice, isAllowVibrate, icon, tickerText.toString(),
			contentTitle, tickerText.toString(), intent);
}
 
开发者ID:nEdAy,项目名称:XPPLE_IM,代码行数:39,代码来源:MyMessageReceiver.java

示例5: showMsgNotify

/** 
 *  ��ʾ��������Ϣ��֪ͨ
  * @Title: showNotify
  * @return void
  * @throws
  */
public void showMsgNotify(Context context,BmobMsg msg) {
	
	int icon = R.drawable.ic_launcher;
	String trueMsg = "";
	if(msg.getMsgType()==BmobConfig.TYPE_TEXT && msg.getContent().contains("\\ue")){
		trueMsg = "[表情]";
	}else if(msg.getMsgType()==BmobConfig.TYPE_IMAGE){
		trueMsg = "[图片]";
	}else if(msg.getMsgType()==BmobConfig.TYPE_VOICE){
		trueMsg = "[语音]";
	}else if(msg.getMsgType()==BmobConfig.TYPE_LOCATION){
		trueMsg = "[位置]";
	}else{
		trueMsg = msg.getContent();
	}
	CharSequence tickerText = msg.getBelongUsername() + ":" + trueMsg;
	String contentTitle = msg.getBelongUsername()+ " (" + mNewNum + "条新消息)";
	
	Intent intent = new Intent(context, MainActivity.class);
	intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
	
	boolean isAllowVoice = CustomApplcation.getInstance().getSpUtil().isAllowVoice();
	boolean isAllowVibrate = CustomApplcation.getInstance().getSpUtil().isAllowVibrate();
	
	BmobNotifyManager.getInstance(context).showNotifyWithExtras(isAllowVoice,isAllowVibrate,icon, tickerText.toString(), contentTitle, tickerText.toString(),intent);
}
 
开发者ID:HuTianQi,项目名称:QQ,代码行数:32,代码来源:MyMessageReceiver.java

示例6: showMsgNotify

/** 
 *  ��ʾ��������Ϣ��֪ͨ
  * @Title: showNotify
  * @return void
  * @throws
  */
public void showMsgNotify(Context context,BmobMsg msg) {
	// ����֪ͨ��
	int icon = R.drawable.ic_launcher;
	String trueMsg = "";
	if(msg.getMsgType()==BmobConfig.TYPE_TEXT && msg.getContent().contains("\\ue")){
		trueMsg = "[����]";
	}else if(msg.getMsgType()==BmobConfig.TYPE_IMAGE){
		trueMsg = "[ͼƬ]";
	}else if(msg.getMsgType()==BmobConfig.TYPE_VOICE){
		trueMsg = "[����]";
	}else if(msg.getMsgType()==BmobConfig.TYPE_LOCATION){
		trueMsg = "[�]";
	}else{
		trueMsg = msg.getContent();
	}
	CharSequence tickerText = msg.getBelongUsername() + ":" + trueMsg;
	String contentTitle = msg.getBelongUsername()+ " (" + mNewNum + "������Ϣ)";
	
	Intent intent = new Intent(context, MainActivity.class);
	intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
	
	boolean isAllowVoice = CustomApplication.getInstance().getSpUtil().isAllowVoice();
	boolean isAllowVibrate = CustomApplication.getInstance().getSpUtil().isAllowVibrate();
	
	BmobNotifyManager.getInstance(context).showNotifyWithExtras(isAllowVoice,isAllowVibrate,icon, tickerText.toString(), contentTitle, tickerText.toString(),intent);
}
 
开发者ID:liuyanggithub,项目名称:Hi,代码行数:32,代码来源:MyMessageReceiver.java

示例7: showMsgNotify

/**
 * 显示与聊天消息的通知
 * 
 * @Title: showNotify
 * @return void
 * @throws
 */
public void showMsgNotify(Context context, BmobMsg msg) {
	// 更新通知栏
	String trueMsg = "";
	if (msg.getMsgType() == BmobConfig.TYPE_TEXT && msg.getContent().contains("\\ue")) {
		trueMsg = "[表情]";
	} else if (msg.getMsgType() == BmobConfig.TYPE_IMAGE) {
		trueMsg = "[图片]";
	} else if (msg.getMsgType() == BmobConfig.TYPE_VOICE) {
		trueMsg = "[语音]";
	} else if (msg.getMsgType() == BmobConfig.TYPE_LOCATION) {
		trueMsg = "[位置]";
	} else {
		trueMsg = msg.getContent();
	}
	// CharSequence tickerText = msg.getBelongUsername() + ":" + trueMsg;
	// String contentTitle = msg.getBelongUsername() + " (" + mNewNum +
	// "条新消息)";
	// 解析trueMsg是任务提醒卡,或者勾搭卡
	try {
		parseCard(context, trueMsg);
	} catch (Exception e) {
		e.printStackTrace();
		CharSequence tickerText = msg.getBelongUsername() + ":" + trueMsg;
		String contentTitle = msg.getBelongUsername() + " (" + mNewNum + "条新消息)";
		Intent intent = new Intent(context, ChatActivity.class);
		intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
		User fuser = new User();
		fuser.setObjectId(msg.getBelongId());
		fuser.setUsername(msg.getBelongUsername());
		fuser.setNick(msg.getBelongNick());
		intent.putExtra("user", fuser);
		boolean isAllowVoice = SP.isAllowVoice(context);
		boolean isAllowVibrate = SP.isAllowVibrate(context);
		BmobNotifyManager.getInstance(context).showNotifyWithExtras(isAllowVoice, isAllowVibrate, R.drawable.ic_launcher,
				tickerText.toString(), contentTitle, tickerText.toString(), intent);
	}
}
 
开发者ID:hanks-zyh,项目名称:Conquer,代码行数:44,代码来源:MyMessageReceiver.java

示例8: showMsgNotify

/**
 * 显示与聊天消息的通知
 *
 * @return void
 * @throws
 * @Title: showNotify
 */
public void showMsgNotify(Context context, BmobMsg msg) {
    // 更新通知栏
    int icon = R.drawable.icc_launcher;
    String trueMsg = "";
    if (msg.getMsgType() == BmobConfig.TYPE_TEXT && msg.getContent().contains("\\ue")) {
        trueMsg = "[表情]";
    } else if (msg.getMsgType() == BmobConfig.TYPE_IMAGE) {
        trueMsg = "[图片]";
    } else if (msg.getMsgType() == BmobConfig.TYPE_VOICE) {
        trueMsg = "[语音]";
    } else if (msg.getMsgType() == BmobConfig.TYPE_LOCATION) {
        trueMsg = "[位置]";
    } else {
        trueMsg = msg.getContent();
    }
    CharSequence tickerText = msg.getBelongUsername() + ":" + trueMsg;
    String contentTitle = msg.getBelongUsername() + " (" + mNewNum + "条新消息)";

    Intent intent = new Intent(context, MainActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);

    boolean isAllowVoice = CustomApplication.getInstance().getSpUtil().isAllowVoice();
    boolean isAllowVibrate = CustomApplication.getInstance().getSpUtil().isAllowVibrate();

    BmobNotifyManager.getInstance(context).showNotifyWithExtras(isAllowVoice, isAllowVibrate, icon, tickerText.toString(), contentTitle, tickerText.toString(), intent);
}
 
开发者ID:klob,项目名称:Diandi1.20,代码行数:33,代码来源:MyMessageReceiver.java

示例9: getView

@Override
public View getView(int position, View convertView, ViewGroup parent) {

	BmobRecent item = mData.get(position);
	if (convertView == null) {
		convertView = inflater.inflate(R.layout.item_conversation, null);
	}
	ImageView iv_recent_avatar = ViewHolder.get(convertView,
			R.id.iv_recent_avatar);
	TextView tv_recent_name = ViewHolder.get(convertView,
			R.id.tv_recent_name);
	TextView tv_recent_msg = ViewHolder
			.get(convertView, R.id.tv_recent_msg);
	TextView tv_recent_time = ViewHolder.get(convertView,
			R.id.tv_recent_time);
	TextView tv_recent_unread = ViewHolder.get(convertView,
			R.id.tv_recent_unread);

	// �������
	String avatar = item.getAvatar();
	if (avatar != null && !avatar.equals("")) {
		ImageLoader.getInstance().displayImage(avatar, iv_recent_avatar,
				ImageLoadOptions.getOptions());
	} else {
		iv_recent_avatar.setImageResource(R.drawable.head);
	}

	tv_recent_name.setText(item.getUserName());
	tv_recent_time.setText(TimeUtil.getChatTime(item.getTime()));

	// ��ʾ����
	if (item.getType() == BmobConfig.TYPE_TEXT) {
		SpannableString spannableString = FaceTextUtils.toSpannableString(
				mContext, item.getMessage());
		tv_recent_msg.setText(spannableString);
	} else if (item.getType() == BmobConfig.TYPE_IMAGE) {
		tv_recent_msg.setText("[ͼƬ]");
	} else if (item.getType() == BmobConfig.TYPE_LOCATION) {
		String all = item.getMessage();
		if (all != null && !all.equals("")) {// λ�����͵���Ϣ��װ��ʽ������λ��&ά��&����
			String address = all.split("&")[0];
			tv_recent_msg.setText("[�]" + address);
		}
	} else if (item.getType() == BmobConfig.TYPE_VOICE) {
		tv_recent_msg.setText("[����]");
	}
	int num = BmobDB.create(mContext).getUnreadCount(item.getTargetid());
	if (num > 0) {
		tv_recent_unread.setVisibility(View.VISIBLE);
		tv_recent_unread.setText(num + "");
	} else {
		tv_recent_unread.setVisibility(View.GONE);
	}
	return convertView;
}
 
开发者ID:JasonGaoH,项目名称:enjoychat,代码行数:55,代码来源:MessageRecentAdapter.java

示例10: getView

@Override
public View getView(int position, View convertView, ViewGroup parent) {
	// TODO Auto-generated method stub
	final BmobRecent item = mData.get(position);
	if (convertView == null) {
		convertView = inflater.inflate(R.layout.item_conversation, parent,
				false);
	}
	ImageView iv_recent_avatar = ViewHolder.get(convertView,
			R.id.iv_recent_avatar);
	TextView tv_recent_name = ViewHolder.get(convertView,
			R.id.tv_recent_name);
	TextView tv_recent_msg = ViewHolder
			.get(convertView, R.id.tv_recent_msg);
	TextView tv_recent_time = ViewHolder.get(convertView,
			R.id.tv_recent_time);
	TextView tv_recent_unread = ViewHolder.get(convertView,
			R.id.tv_recent_unread);

	// 填充数据
	String avatar = item.getAvatar();
	if (avatar != null && !avatar.equals("")) {
		ImageLoader.getInstance().displayImage(avatar, iv_recent_avatar,
				ImageLoadOptions.getOptions());
	} else {
		iv_recent_avatar.setImageResource(R.drawable.default_head);
	}

	tv_recent_name.setText(item.getNick());
	tv_recent_time.setText(TimeUtil.getChatTime(item.getTime()));
	// 显示内容
	if (item.getType() == BmobConfig.TYPE_TEXT) {
		SpannableString spannableString = FaceTextUtils.toSpannableString(
				mContext, item.getMessage());
		tv_recent_msg.setText(spannableString);
	} else if (item.getType() == BmobConfig.TYPE_IMAGE) {
		tv_recent_msg.setText("[图片]");
	} else if (item.getType() == BmobConfig.TYPE_LOCATION) {
		String all = item.getMessage();
		if (all != null && !all.equals("")) {// 位置类型的信息组装格式:地理位置&维度&经度
			String address = all.split("&")[0];
			tv_recent_msg.setText("[位置]" + address);
		}
	} else if (item.getType() == BmobConfig.TYPE_VOICE) {
		tv_recent_msg.setText("[语音]");
	}

	int num = BmobDB.create(mContext).getUnreadCount(item.getTargetid());
	if (num > 0) {
		tv_recent_unread.setVisibility(View.VISIBLE);
		tv_recent_unread.setText(num + "");
	} else {
		tv_recent_unread.setVisibility(View.GONE);
	}
	return convertView;
}
 
开发者ID:nEdAy,项目名称:XPPLE_IM,代码行数:56,代码来源:MessageRecentAdapter.java

示例11: getView

@Override
public View getView(int position, View convertView, ViewGroup parent) {
	// TODO Auto-generated method stub
	final BmobRecent item = mData.get(position);
	if (convertView == null) {
		convertView = inflater.inflate(R.layout.item_conversation, parent, false);
	}
	ImageView iv_recent_avatar = ViewHolder.get(convertView, R.id.iv_recent_avatar);
	TextView tv_recent_name = ViewHolder.get(convertView, R.id.tv_recent_name);
	TextView tv_recent_msg = ViewHolder.get(convertView, R.id.tv_recent_msg);
	TextView tv_recent_time = ViewHolder.get(convertView, R.id.tv_recent_time);
	TextView tv_recent_unread = ViewHolder.get(convertView, R.id.tv_recent_unread);
	
	//������
	String avatar = item.getAvatar();
	if(avatar!=null&& !avatar.equals("")){
		ImageLoader.getInstance().displayImage(avatar, iv_recent_avatar, ImageLoadOptions.getOptions());
	}else{
		iv_recent_avatar.setImageResource(R.drawable.head);
	}
	
	tv_recent_name.setText(item.getUserName());
	tv_recent_time.setText(TimeUtil.getChatTime(item.getTime()));
	//��ʾ����
	if(item.getType()==BmobConfig.TYPE_TEXT){
		SpannableString spannableString = FaceTextUtils.toSpannableString(mContext, item.getMessage());
		tv_recent_msg.setText(spannableString);
	}else if(item.getType()==BmobConfig.TYPE_IMAGE){
		tv_recent_msg.setText("[图片]");
	}else if(item.getType()==BmobConfig.TYPE_LOCATION){
		String all =item.getMessage();
		if(all!=null &&!all.equals("")){//λ�����͵���Ϣ��װ��ʽ������λ��&ά��&����
			String address = all.split("&")[0];
			tv_recent_msg.setText("[位置]"+address);
		}
	}else if(item.getType()==BmobConfig.TYPE_VOICE){
		tv_recent_msg.setText("[语音]");
	}
	
	int num = BmobDB.create(mContext).getUnreadCount(item.getTargetid());
	if (num > 0) {
		tv_recent_unread.setVisibility(View.VISIBLE);
		tv_recent_unread.setText(num + "");
	} else {
		tv_recent_unread.setVisibility(View.GONE);
	}
	return convertView;
}
 
开发者ID:HuTianQi,项目名称:QQ,代码行数:48,代码来源:MessageRecentAdapter.java

示例12: getView

@Override
public View getView(int position, View convertView, ViewGroup parent) {
	// TODO Auto-generated method stub
	final BmobRecent item = mData.get(position);
	if (convertView == null) {
		convertView = inflater.inflate(R.layout.item_conversation, parent, false);
	}
	ImageView iv_recent_avatar = ViewHolder.get(convertView, R.id.iv_recent_avatar);
	TextView tv_recent_name = ViewHolder.get(convertView, R.id.tv_recent_name);
	TextView tv_recent_msg = ViewHolder.get(convertView, R.id.tv_recent_msg);
	TextView tv_recent_time = ViewHolder.get(convertView, R.id.tv_recent_time);
	TextView tv_recent_unread = ViewHolder.get(convertView, R.id.tv_recent_unread);
	
	//�������
	String avatar = item.getAvatar();
	if(avatar!=null&& !avatar.equals("")){
		ImageLoader.getInstance().displayImage(avatar, iv_recent_avatar, ImageLoadOptions.getOptions());
	}else{
		iv_recent_avatar.setImageResource(R.drawable.head);
	}
	
	tv_recent_name.setText(item.getUserName());
	tv_recent_time.setText(TimeUtil.getChatTime(item.getTime()));
	//��ʾ����
	if(item.getType()==BmobConfig.TYPE_TEXT){
		SpannableString spannableString = FaceTextUtils.toSpannableString(mContext, item.getMessage());
		tv_recent_msg.setText(spannableString);
	}else if(item.getType()==BmobConfig.TYPE_IMAGE){
		tv_recent_msg.setText("[ͼƬ]");
	}else if(item.getType()==BmobConfig.TYPE_LOCATION){
		String all =item.getMessage();
		if(all!=null &&!all.equals("")){//λ�����͵���Ϣ��װ��ʽ������λ��&ά��&����
			String address = all.split("&")[0];
			tv_recent_msg.setText("[�]"+address);
		}
	}else if(item.getType()==BmobConfig.TYPE_VOICE){
		tv_recent_msg.setText("[����]");
	}
	
	int num = BmobDB.create(mContext).getUnreadCount(item.getTargetid());
	if (num > 0) {
		tv_recent_unread.setVisibility(View.VISIBLE);
		tv_recent_unread.setText(num + "");
	} else {
		tv_recent_unread.setVisibility(View.GONE);
	}
	return convertView;
}
 
开发者ID:liuyanggithub,项目名称:Hi,代码行数:48,代码来源:MessageRecentAdapter.java

示例13: getView

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub
    final BmobRecent item = mData.get(position);
    if (convertView == null) {
        convertView = inflater.inflate(R.layout.item_conversation, parent, false);
    }
    ImageView iv_recent_avatar = ViewHolder.get(convertView, R.id.iv_recent_avatar);
    TextView tv_recent_name = ViewHolder.get(convertView, R.id.tv_recent_name);
    TextView tv_recent_msg = ViewHolder.get(convertView, R.id.tv_recent_msg);
    TextView tv_recent_time = ViewHolder.get(convertView, R.id.tv_recent_time);
    TextView tv_recent_unread = ViewHolder.get(convertView, R.id.tv_recent_unread);

    //填充数据
    String avatar = item.getAvatar();
    if (avatar != null && !avatar.equals("")) {
        ImageLoader.getInstance().displayImage(avatar, iv_recent_avatar, ImageLoadOptions.getOptions());
    } else {
        iv_recent_avatar.setImageResource(R.drawable.default_head_cry);
    }

    tv_recent_name.setText(item.getNick());
    tv_recent_time.setText(TimeUtil.getChatTime(item.getTime()));
    int num = BmobDB.create(mContext).getUnreadCount(item.getTargetid());
    //显示内容
    if (item.getType() == BmobConfig.TYPE_TEXT) {
        SpannableString spannableString = FaceTextUtils.toSpannableString(mContext, item.getMessage());
        tv_recent_msg.setText(spannableString);
    } else if (item.getType() == BmobConfig.TYPE_IMAGE) {
        tv_recent_msg.setText("[图片]");
    } else if (item.getType() == BmobConfig.TYPE_LOCATION) {
        String all = item.getMessage();
        if (all != null && !all.equals("")) {//位置类型的信息组装格式:地理位置&维度&经度
            String address = all.split("&")[0];
            tv_recent_msg.setText("[位置]" + address);
        }
    } else if (item.getType() == BmobConfig.TYPE_VOICE) {
        tv_recent_msg.setText("[语音]");
    }

    if (num > 0) {
        tv_recent_unread.setVisibility(View.VISIBLE);
        tv_recent_unread.setText(num + "");
    } else {
        tv_recent_unread.setVisibility(View.GONE);
    }
    return convertView;
}
 
开发者ID:klob,项目名称:Diandi1.20,代码行数:48,代码来源:MessageRecentAdapter.java


注:本文中的cn.bmob.im.config.BmobConfig.TYPE_TEXT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。