public View_NoScrollListItem( Context context, boolean isMoreItem, Parser_ListItem parserListItem, Handler handler, int index, int curIndex, int totalpage, int tag) { super(context, handler, null); // TODO Auto-generated constructor stub mHandler = handler; this.isMoreItem = isMoreItem; this.curIndex = curIndex; this.totalpage = totalpage; parserListItemCommentC = (Parser_ListItem_Comment_C) parserListItem; if (isMoreItem) { l = (LinearLayout) ((Activity) context) .getLayoutInflater() .inflate(R.layout.listitem_comment_c_more, null); l.setGravity(Gravity.CENTER_HORIZONTAL); listItem_more = (TextView) l.findViewById(R.id.listItem_c_comment); listItem_more.setGravity(Gravity.CENTER_HORIZONTAL); l.setOnClickListener(moreClickListener); } else { if (parserListItemCommentC.getCommentButton() == null) { buttonAction = -1; } else { buttonAction = parserListItemCommentC.getCommentButton().getAction(); } String url = null; LinearLayout lListitem_c_icon; if (buttonAction == Parser_Layout_AbsLayout.ACTION_COMMENT) { l = (LinearLayout) ((Activity) context) .getLayoutInflater() .inflate(R.layout.listitem_comment_c_more, null); lListItem_c = (LinearLayout) l.findViewById(R.id.lListItem_c); listItem_c_comment = (TextView) l.findViewById(R.id.listItem_c_comment); } else { l = (LinearLayout) ((Activity) context).getLayoutInflater().inflate(R.layout.listitem_comment_c, null); lListItem_c = (LinearLayout) l.findViewById(R.id.lListItem_c); lListitem_c_icon = (LinearLayout) l.findViewById(R.id.lListItem_c_icon); listItem_c_icon = (ImageView) l.findViewById(R.id.listItem_c_icon); listItem_c_name = (TextView) l.findViewById(R.id.listItem_c_name); listItem_c_time = (TextView) l.findViewById(R.id.listItem_c_time); listItem_c_comment = (TextView) l.findViewById(R.id.listItem_c_comment); if (parserListItemCommentC.getImage().getSrc() == null || parserListItemCommentC.getImage().getSrc().equalsIgnoreCase("null") || parserListItemCommentC.getImage().getSrc().equalsIgnoreCase("")) { url = null; lListitem_c_icon.setVisibility(GONE); } else { url = parserListItemCommentC.getImage().getSrc(); } } lListItem_c.setOnClickListener(itemClickListener); // 压入下载队列 DownImageItem downImageItem = new DownImageItem( Parser_Layout_AbsLayout.MODELTYPE_LISTITEM, index, url, parserListItemCommentC.getPageId(), tag); DownImageManager.add(downImageItem); } addView(l); }
public View_FriendList_item( Context context, Handler handler, boolean isMoreitem, Parser_ListItem_OnlyText parserListItemOnlyText, int index, Handler mHandler) { super(context, handler, null); // TODO Auto-generated constructor stub this.isMoreItem = isMoreitem; this.parserListItemOnlyText = parserListItemOnlyText; this.mHandler = mHandler; String url = null; if (isMoreitem) { l = (LinearLayout) ((Activity) context).getLayoutInflater().inflate(R.layout.listitem_friend_more, null); l.setGravity(Gravity.CENTER_HORIZONTAL); listItem_more = (TextView) l.findViewById(R.id.listItem_c_comment); listItem_more.setGravity(Gravity.CENTER_HORIZONTAL); } else { if (parserListItemOnlyText.getPageId() == PageID.PAGEID_PUSH_FRIEDN) { l = (LinearLayout) ((Activity) context) .getLayoutInflater() .inflate(R.layout.listitem_pushfriend, null); } else { l = (LinearLayout) ((Activity) context).getLayoutInflater().inflate(R.layout.listitem_onlytext, null); llistitem_friend_state = (LinearLayout) l.findViewById(R.id.llistitem_friend_state); llistitem_friend_state.setFocusable(false); listitem_friend_state = (Button) l.findViewById(R.id.listitem_friend_state); listitem_friend_state.setFocusable(false); // 这里需要设置一下,否则list中将无法响应onitemclick事件 // listitem_friend_state.setClickable(false); listitem_friend_state.setClickable(true); } listitem_friend_icon = (ImageView) l.findViewById(R.id.listitem_friend_icon); listitem_friend_name = (TextView) l.findViewById(R.id.listitem_friend_name); switch (parserListItemOnlyText.getPageId()) { case PageID.PAGEID_PUSH_FRIEDN: break; case PageID.PAGEID_FRIEND_SEARCH: break; default: // listitem_friend_state.setOnClickListener(childcListener); listitem_friend_state.setOnTouchListener( new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_UP) { childEvent(); } return false; } }); break; } if (parserListItemOnlyText.getImage().getSrc() == null || parserListItemOnlyText.getImage().getSrc().equalsIgnoreCase("null") || parserListItemOnlyText.getImage().getSrc().equalsIgnoreCase("")) { url = null; } else { url = parserListItemOnlyText.getImage().getSrc(); } // 压入下载队列 DownImageItem downImageItem = new DownImageItem( Parser_Layout_AbsLayout.MODELTYPE_LISTITEM, index, url, parserListItemOnlyText.getPageId(), 0); DownImageManager.add(downImageItem); } addView(l); }