コード例 #1
0
  @Override
  public int compare(Article a0, Article a1) {

    int flag = a1.getUpdateDate().compareTo(a0.getUpdateDate());

    if (flag == 0) flag = a1.getPubDate().compareTo(a0.getPubDate());

    return flag;
  }
  @Override
  public View getChildView(
      int groupPosition,
      final int childPosition,
      boolean isLastChild,
      View convertView,
      ViewGroup parent) {
    tempChild = Childtem.get(groupPosition);
    TextView text = null;

    View share_layout;
    View copy_layout;
    View link_layout;
    LayoutInflater inflater = ((Activity) context).getLayoutInflater();
    if (convertView == null) {
      convertView = inflater.inflate(R.layout.child_view, null);
    }

    text = (TextView) convertView.findViewById(R.id.article_detail);

    share_layout = convertView.findViewById(R.id.layout_share);
    copy_layout = convertView.findViewById(R.id.layout_copy);
    link_layout = convertView.findViewById(R.id.layout_link);

    share_layout.setOnTouchListener(mOnTouchListener);
    link_layout.setOnTouchListener(mOnTouchListener);
    copy_layout.setOnTouchListener(mOnTouchListener);

    link_layout.setOnClickListener(mLinkOnClickListener);
    copy_layout.setOnClickListener(mCopyOnClickListener);
    share_layout.setOnClickListener(mShareOnClickListener);
    text.setText(Html.fromHtml(tempChild.getDescription()));

    /*
    convertView.setOnClickListener(new OnClickListener() {
     @Override
     public void onClick(View v) {
      Toast.makeText(context, tempChild.getDescription(),
        Toast.LENGTH_SHORT).show();
     }
    });
    */
    return convertView;
  }