@Override public void finish() { if (isUpdated) { Intent intent = new Intent(); intent.putExtra(EXTRA_CNT, mChildCount); setResult(RESULT_OK, intent); } super.finish(); overridePendingTransition(R.anim.zoom_enter, R.anim.slide_out_to_right); HttpImageManager imageManager = MainApp.getHttpImageManager(); imageManager.cleanManagedHttpGet(); }
@Override public View getView(int position, View convertView, ViewGroup parent) { if (position == 0) { if (topicView == null) { topicView = View.inflate(UI.getActivity(), R.layout.forum_item, null); topicView.setBackgroundColor(0xddffffff); topicView.setPadding(0, 0, 0, 0); convertView = topicView; JSONObjectExt json = parentObj; String subject = json.getString("Subject", ""); String content = json.getString("Content", ""); String time = json.getString("Timestamp", ""); String photourl = json.getString("PhotoUrl", null); TextView tv = (TextView) convertView.findViewById(R.id.forum_subject); tv.setText(subject); tv = (TextView) convertView.findViewById(R.id.forum_content); tv.setText(content); tv = (TextView) convertView.findViewById(R.id.forum_time); tv.setText(time); final ImageView iv = (ImageView) convertView.findViewById(R.id.forum_image); if (photourl == null) { topicView.findViewById(R.id.forum_image_frame).setVisibility(View.GONE); } else { // photourl = Request.HOST + photourl; photourl = Request.getImageUrl(photourl, 0); final Uri uri = Uri.parse(photourl); topicView.findViewById(R.id.forum_image_frame).setVisibility(View.VISIBLE); Bitmap bitmap = null; bitmap = imageManager.loadImage( new HttpImageManager.LoadRequest( uri, iv, new HttpImageManager.OnLoadResponseListener() { @Override public void onLoadResponse(LoadRequest r, final Bitmap data) {} @Override public void onLoadProgress( LoadRequest r, long totalContentSize, long loadedContentSize) {} @Override public void onLoadError(LoadRequest r, Throwable e) { iv.setImageResource(R.color.transparent); } @Override public boolean onBeforeSetImageBitmap(ImageView v, Bitmap data) { showBitmapForView(v, data); return false; } }), true); if (bitmap != null) { showBitmapForView(iv, bitmap); } } } convertView = topicView; TextView tv = (TextView) convertView.findViewById(R.id.forum_child_count); tv.setText(mChildCount + "条回复"); return convertView; } final DataItem g = (DataItem) getItem(position); if (convertView == null || convertView == topicView) { convertView = View.inflate(UI.getActivity(), R.layout.forum_feedback_item, null); } // animation begin --------------- if (position == Math.max(0, getCount() - mCount) && !mReachEnd) { onLoadMore(false); } // animation end -------------- JSONObjectExt json = g.json; String content = json.getString("Content", ""); TextView tv = (TextView) convertView.findViewById(R.id.subitem_content); tv.setText(content); tv = (TextView) convertView.findViewById(R.id.subitem_time); tv.setText(g.date); // View divider = convertView.findViewById(R.id.subitem_divider); /*if (position != 1) { divider.setVisibility(View.VISIBLE); } else { divider.setVisibility(View.GONE); }*/ return convertView; }