當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。