package com.bentonq.newsexpress;

import java.util.List;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class NewsListActivity extends Activity {

	private NewsUpdater mNewsUpdater;
	private ListView mNewsListView;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		mNewsListView = (ListView) findViewById(R.id.news_list);
		mNewsListView
				.setOnItemClickListener(new AdapterView.OnItemClickListener() {

					@Override
					public void onItemClick(AdapterView<?> parent, View view,
							int position, long id) {
						String link = (String) parent
								.getItemAtPosition(position);
						Intent intent = new Intent(Intent.ACTION_VIEW);
						intent.setData(Uri.parse(link));
						startActivity(intent);
					}
				});
		mNewsListView.setOnTouchListener(new View.OnTouchListener() {

			@Override
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				return false;
			}
		});

		String url = new String(
				"http://news.163.com/special/00011K6L/rss_newstop.xml");
		mNewsUpdater = new NewsUpdater();
		mNewsUpdater.update(url, new NewsUpdater.UpdateListener() {

			@Override
			public void onNewsUpdated(List<News> news) {
				final List<News> fnews = news;

				mNewsListView.setAdapter(new BaseAdapter() {

					@Override
					public int getCount() {
						return fnews.size();
					}

					@Override
					public Object getItem(int position) {
						return fnews.get(position).link;
					}

					@Override
					public long getItemId(int position) {
						return position;
					}

					@Override
					public View getView(int position, View convertView,
							ViewGroup parent) {
						LayoutInflater inflater = LayoutInflater
								.from(NewsListActivity.this);
						View view = inflater.inflate(R.layout.view_summary,
								parent, false);

						TextView textView = (TextView) view
								.findViewById(R.id.title);
						textView.setText(fnews.get(position).title);

						TextView summaryView = (TextView) view
								.findViewById(R.id.summary);
						summaryView.setText(fnews.get(position).summary);

						return view;
					}
				});
			}
		});

	}
}

@@ -161,16 +161,41 @@
 Bundle;%0A
+import android.util.Log;%0A
 import a
@@ -218,24 +218,24 @@
 utInflater;%0A
-
 import andro
@@ -497,16 +497,72 @@
 vity %7B%0A%0A
+%09private static final String TAG = %22NewsListActivity%22;%0A%0A
 %09private
@@ -1343,16 +1343,19 @@
 h(View v
+iew
 , Motion
@@ -1377,42 +1377,653 @@
 %09%09%09%09
-// TODO Auto-generated method stub
+final int historySize = event.getHistorySize();%0A%09%09%09%09final int pointerCount = event.getPointerCount();%0A%09%09%09%09for (int h = 0; h %3C historySize; h++) %7B%0A%09%09%09%09%09Log.d(TAG, %22At time %22 + event.getHistoricalEventTime(h));%0A%09%09%09%09%09for (int p = 0; p %3C pointerCount; p++) %7B%0A%09%09%09%09%09%09Log.d(TAG,%0A%09%09%09%09%09%09%09%09%22  pointer %22 + event.getPointerId(p) + %22 (%22%0A%09%09%09%09%09%09%09%09%09%09+ event.getHistoricalX(p, h) + %22, %22%0A%09%09%09%09%09%09%09%09%09%09+ event.getHistoricalY(p, h) + %22)%22);%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D%0A%09%09%09%09Log.d(TAG, %22At time %22 + event.getEventTime());%0A%09%09%09%09for (int p = 0; p %3C pointerCount; p++) %7B%0A%09%09%09%09%09Log.d(TAG, %22  pointer %22 + event.getPointerId(p) + %22 (%22%0A%09%09%09%09%09%09%09+ event.getX(p) + %22, %22 + event.getY(p) + %22)%22);%0A%09%09%09%09%7D
 %0A%09%09%09

Add logcat to debug the touch event