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


Java Messages类代码示例

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


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

示例1: showMessageListOptionDialog

import net.oschina.app.bean.Messages; //导入依赖的package包/类
/**
 * 消息列表操作选择框
 * 
 * @param context
 * @param msg
 * @param thread
 */
public static void showMessageListOptionDialog(final Activity context,
		final Messages msg, final Thread thread) {
	AlertDialog.Builder builder = new AlertDialog.Builder(context);
	builder.setIcon(R.drawable.ic_dialog_menu);
	builder.setTitle(context.getString(R.string.select));
	builder.setItems(R.array.message_list_options,
			new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface arg0, int arg1) {
					switch (arg1) {
					case 0:// 回复
						showMessagePub(context, msg.getFriendId(),
								msg.getFriendName());
						break;
					case 1:// 转发
						showMessageForward(context, msg.getFriendName(),
								msg.getContent());
						break;
					case 2:// 删除
						thread.start();
						break;
					}
				}
			});
	builder.create().show();
}
 
开发者ID:WallaceLiu,项目名称:oschina-android-app,代码行数:33,代码来源:UIHelper.java

示例2: showMessageListOptionDialog

import net.oschina.app.bean.Messages; //导入依赖的package包/类
/**
 * 消息列表操作选择框
 * @param context
 * @param msg
 * @param thread
 */
public static void showMessageListOptionDialog(final Activity context,final Messages msg,final Thread thread)
{
	AlertDialog.Builder builder = new AlertDialog.Builder(context);
	builder.setIcon(R.drawable.ic_dialog_menu);
	builder.setTitle(context.getString(R.string.select));
	builder.setItems(R.array.message_list_options,new DialogInterface.OnClickListener(){
		public void onClick(DialogInterface arg0, int arg1) {
			switch (arg1) {
				case 0://回复
					showMessagePub(context,msg.getFriendId(),msg.getFriendName());
					break;
				case 1://转发
					showMessageForward(context,msg.getFriendName(),msg.getContent());
					break;
				case 2://删除
					thread.start();
					break;
			}				
		}
	});
	builder.create().show();
}
 
开发者ID:segerbing,项目名称:OSChina,代码行数:29,代码来源:UIHelper.java

示例3: getRealView

import net.oschina.app.bean.Messages; //导入依赖的package包/类
@Override
protected View getRealView(int position, View convertView,
                           final ViewGroup parent) {
    ViewHolder vh = null;
    if (convertView == null || convertView.getTag() == null) {
        convertView = getLayoutInflater(parent.getContext()).inflate(
                R.layout.list_cell_message, null);
        vh = new ViewHolder(convertView);
        convertView.setTag(vh);
    } else {
        vh = (ViewHolder) convertView.getTag();
    }

    final Messages item = (Messages) mDatas.get(position);

    if (AccountHelper.getUserId() == item.getSenderId()) {
        vh.sender.setVisibility(View.VISIBLE);
    } else {
        vh.sender.setVisibility(View.GONE);
    }

    vh.name.setText(item.getFriendName());

    vh.content.setMovementMethod(MyLinkMovementMethod.a());
    vh.content.setFocusable(false);
    vh.content.setDispatchToParent(true);
    vh.content.setLongClickable(false);
    Spanned span = Html.fromHtml(item.getContent());
    vh.content.setText(span);
    MyURLSpan.parseLinkText(vh.content, span);

    vh.time.setText(StringUtils.formatSomeAgo(item.getPubDate()));
    vh.count.setText(parent.getResources().getString(R.string.message_count, item.getMessageCount() + ""));

    vh.avatar.setAvatarUrl(item.getPortrait());
    vh.avatar.setUserInfo(item.getSenderId(), item.getSender());
    return convertView;
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:39,代码来源:MessageAdapter.java

示例4: ListViewMessageAdapter

import net.oschina.app.bean.Messages; //导入依赖的package包/类
/**
 * 实例化Adapter
 * 
 * @param context
 * @param data
 * @param resource
 */
public ListViewMessageAdapter(Context context, List<Messages> data,
		int resource) {
	this.context = context;
	this.listContainer = LayoutInflater.from(context); // 创建视图容器并设置上下文
	this.itemViewResource = resource;
	this.listItems = data;
	this.bmpManager = new BitmapManager(BitmapFactory.decodeResource(
			context.getResources(), R.drawable.widget_dface_loading));
}
 
开发者ID:WallaceLiu,项目名称:oschina-android-app,代码行数:17,代码来源:ListViewMessageAdapter.java

示例5: onClick

import net.oschina.app.bean.Messages; //导入依赖的package包/类
public void onClick(View v) {
	if(!isLinkViewClick()){
		Messages msg = (Messages)v.getTag();
		UIHelper.showMessageDetail(v.getContext(),
				msg.getFriendId(), msg.getFriendName());
	}
	setLinkViewClick(false);
}
 
开发者ID:WallaceLiu,项目名称:oschina-android-app,代码行数:9,代码来源:ListViewMessageAdapter.java

示例6: ListViewMessageAdapter

import net.oschina.app.bean.Messages; //导入依赖的package包/类
/**
 * 实例化Adapter
 * @param context
 * @param data
 * @param resource
 */
public ListViewMessageAdapter(Context context, List<Messages> data,int resource) {
	this.context = context;			
	this.listContainer = LayoutInflater.from(context);	//创建视图容器并设置上下文
	this.itemViewResource = resource;
	this.listItems = data;
	this.bmpManager = new BitmapManager(BitmapFactory.decodeResource(context.getResources(), R.drawable.widget_dface_loading));
}
 
开发者ID:segerbing,项目名称:OSChina,代码行数:14,代码来源:ListViewMessageAdapter.java

示例7: getView

import net.oschina.app.bean.Messages; //导入依赖的package包/类
/**
 * ListView Item设置
 */
public View getView(int position, View convertView, ViewGroup parent) {
	//Log.d("method", "getView");
	
	//自定义视图
	ListItemView  listItemView = null;
	
	if (convertView == null) {
		//获取list_item布局文件的视图
		convertView = listContainer.inflate(this.itemViewResource, null);
		
		listItemView = new ListItemView();
		//获取控件对象
		listItemView.userface = (ImageView)convertView.findViewById(R.id.message_listitem_userface);
		listItemView.username = (TextView)convertView.findViewById(R.id.message_listitem_username);
		listItemView.date = (TextView)convertView.findViewById(R.id.message_listitem_date);
		listItemView.messageCount = (TextView)convertView.findViewById(R.id.message_listitem_messageCount);
		listItemView.client= (TextView)convertView.findViewById(R.id.message_listitem_client);
		
		//设置控件集到convertView
		convertView.setTag(listItemView);
	}else {
		listItemView = (ListItemView)convertView.getTag();
	}
	
	//设置文字和图片
	Messages msg = listItems.get(position);
	AppContext ac = (AppContext)context.getApplicationContext();
	if(msg.getSenderId() == ac.getLoginUid()){
		listItemView.username.setText(UIHelper.parseMessageSpan(msg.getFriendName(), msg.getContent(), "发给 "));
	}else{
		listItemView.username.setText(UIHelper.parseMessageSpan(msg.getSender(), msg.getContent(), ""));
	}
	listItemView.username.setTag(msg);//设置隐藏参数(实体类)
	listItemView.date.setText(StringUtils.friendly_time(msg.getPubDate()));
	listItemView.messageCount.setText("共有 "+msg.getMessageCount()+" 条留言");
	
	switch(msg.getAppClient())
	{	
		default:
			listItemView.client.setText("");
			break;
		case Messages.CLIENT_MOBILE:
			listItemView.client.setText("来自:手机");
			break;
		case Messages.CLIENT_ANDROID:
			listItemView.client.setText("来自:Android");
			break;
		case Messages.CLIENT_IPHONE:
			listItemView.client.setText("来自:iPhone");
			break;
		case Messages.CLIENT_WINDOWS_PHONE:
			listItemView.client.setText("来自:Windows Phone");
			break;
	}
	if(StringUtils.isEmpty(listItemView.client.getText().toString()))
		listItemView.client.setVisibility(View.GONE);
	else
		listItemView.client.setVisibility(View.VISIBLE);
	
	String faceURL = msg.getFace();
	if(faceURL.endsWith("portrait.gif") || StringUtils.isEmpty(faceURL)){
		listItemView.userface.setImageResource(R.drawable.widget_dface);
	}else{
		bmpManager.loadBitmap(faceURL, listItemView.userface);
	}
	listItemView.userface.setOnClickListener(faceClickListener);
	listItemView.userface.setTag(msg);
	
	return convertView;
}
 
开发者ID:segerbing,项目名称:OSChina,代码行数:74,代码来源:ListViewMessageAdapter.java

示例8: onClick

import net.oschina.app.bean.Messages; //导入依赖的package包/类
public void onClick(View v) {
	Messages msg = (Messages)v.getTag();
	UIHelper.showUserCenter(v.getContext(), msg.getFriendId(), msg.getFriendName());
}
 
开发者ID:segerbing,项目名称:OSChina,代码行数:5,代码来源:ListViewMessageAdapter.java


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