// Path: src/cn/yo2/aquarium/pocketvoa/parser/IDataSource.java
// public interface IDataSource {
// 	
// 	/*=========================================================================
// 	 * First category 
// 	 ========================================================================*/
// 	public static final String STANDARD_ENGLISH = "Standard English";
// 	public static final String SPECIAL_ENGLISH  = "Special English";
// 	public static final String ENGLISH_LEARNING = "English Learning";
// 	
// 	/*=========================================================================
// 	 * Second category 
// 	 ========================================================================*/
// 	/*
// 	 * Standard English
// 	 */
// 	public static final String ENGLISH_NEWS = "English News";
// 	/*
// 	 * Special English
// 	 */
// 	public static final String TECHNOLOGY_REPORT = "Technology Report";
// 	public static final String THIS_IS_AMERICA = "This is America";
// 	public static final String AGRICULTURE_REPORT = "Agriculture Report";
// 	public static final String SCIENCE_IN_THE_NEWS = "Science in the News";
// 	public static final String HEALTH_REPORT = "Health Report";
// 	public static final String EXPLORATIONS = "Explorations";
// 	public static final String EDUCATION_REPORT = "Education Report";
// 	public static final String THE_MAKING_OF_A_NATION = "The Making of a Nation";
// 	public static final String ECONOMICS_REPORT = "Economics Report";
// 	public static final String AMERICAN_MOSAIC = "American Mosaic";
// 	public static final String IN_THE_NEWS = "In the News";
// 	public static final String AMERICAN_STORIES = "American Stories";
// 	public static final String WORDS_AND_THEIR_STORIES = "Words And Their Stories";
// 	public static final String PEOPLE_IN_AMERICA = "People in America";
// 	/*
// 	 * English Learning
// 	 */
// 	public static final String GO_ENGLISH = "Go English";
// 	public static final String WORD_MASTER = "Word Master";
// 	public static final String AMERICAN_CAFE = "American Cafe";
// 	public static final String POPULAR_AMERICAN = "Popular American";
// 	public static final String BUSINESS_ETIQUETTE = "Business Etiquette";
// 	public static final String SPORTS_ENGLISH = "Sports English";
// 	public static final String WORDS_AND_IDIOMS = "Words And Idioms";
// 
// 		
// 	public void init(int maxCount);
// 	
// 	public HashMap<String, String> getListUrls();
// 	public HashMap<String, IListParser> getListParsers();
// 	public HashMap<String, IPageParser> getPageParsers();
// 	public HashMap<String, IPageParser> getPageZhParsers();
// 	
// 	public String getName();
// }


import java.io.IOException;
import java.util.ArrayList;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.res.Configuration;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import android.widget.Spinner;
import android.widget.TabHost;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.SimpleCursorAdapter.ViewBinder;
import cn.yo2.aquarium.pocketvoa.parser.IDataSource;
package cn.yo2.aquarium.pocketvoa;




public class MainActivity extends Activity {

	private static final String KEY_SAVED_ERROR = "key_saved_error";
	private static final String KEY_SAVED_COMMAND = "key_saved_command";
	private static final String KEY_SAVED_ARTICLE = "key_saved_article";
	
	private static final String CLASSTAG = MainActivity.class.getSimpleName();

	private static final int MENU_SETTINGS = Menu.FIRST;
	private static final int MENU_UPDATE     = Menu.FIRST + 1;
	private static final int MENU_BACKUP   = Menu.FIRST + 2;
	private static final int MENU_EXIT     = Menu.FIRST + 3;

	private static final int DLG_ERROR                        = 0;
	private static final int DLG_PROGRESS                     = 1;
	private static final int DLG_MENU_LOCAL_LIST              = 2;
	private static final int DLG_MENU_REMOTE_LIST             = 3;
	private static final int DLG_CONFIRM_DELETE               = 4;
	private static final int DLG_CONFIRM_DOWNLOAD             = 5;
	private static final int DLG_INTERNET_STATUS_CONNECTED    = 6;
	private static final int DLG_INTERNET_STATUS_DISCONNECTED = 7;
	private static final int DLG_CHANGE_LOG                   = 8;
	private static final int DLG_CONFIRM_EXIT                 = 9;

	private static final int WHAT_SUCCESS    = 0;
	private static final int WHAT_FAIL_IO    = 1;
	private static final int WHAT_FAIL_PARSE = 2;

	private static final int CMD_REFRESH_REMOTE_LIST = 0;
	private static final int CMD_REFRESH_LOCAL_LIST  = 1;
	private static final int CMD_DOWNLOAD_ARTICLE    = 2;
	private static final int CMD_SHOW_ARTICLE        = 3;

// Path: src/cn/yo2/aquarium/pocketvoa/parser/IDataSource.java
// public interface IDataSource {
// 	
// 	/*=========================================================================
// 	 * First category 
// 	 ========================================================================*/
// 	public static final String STANDARD_ENGLISH = "Standard English";
// 	public static final String SPECIAL_ENGLISH  = "Special English";
// 	public static final String ENGLISH_LEARNING = "English Learning";
// 	
// 	/*=========================================================================
// 	 * Second category 
// 	 ========================================================================*/
// 	/*
// 	 * Standard English
// 	 */
// 	public static final String ENGLISH_NEWS = "English News";
// 	/*
// 	 * Special English
// 	 */
// 	public static final String TECHNOLOGY_REPORT = "Technology Report";
// 	public static final String THIS_IS_AMERICA = "This is America";
// 	public static final String AGRICULTURE_REPORT = "Agriculture Report";
// 	public static final String SCIENCE_IN_THE_NEWS = "Science in the News";
// 	public static final String HEALTH_REPORT = "Health Report";
// 	public static final String EXPLORATIONS = "Explorations";
// 	public static final String EDUCATION_REPORT = "Education Report";
// 	public static final String THE_MAKING_OF_A_NATION = "The Making of a Nation";
// 	public static final String ECONOMICS_REPORT = "Economics Report";
// 	public static final String AMERICAN_MOSAIC = "American Mosaic";
// 	public static final String IN_THE_NEWS = "In the News";
// 	public static final String AMERICAN_STORIES = "American Stories";
// 	public static final String WORDS_AND_THEIR_STORIES = "Words And Their Stories";
// 	public static final String PEOPLE_IN_AMERICA = "People in America";
// 	/*
// 	 * English Learning
// 	 */
// 	public static final String GO_ENGLISH = "Go English";
// 	public static final String WORD_MASTER = "Word Master";
// 	public static final String AMERICAN_CAFE = "American Cafe";
// 	public static final String POPULAR_AMERICAN = "Popular American";
// 	public static final String BUSINESS_ETIQUETTE = "Business Etiquette";
// 	public static final String SPORTS_ENGLISH = "Sports English";
// 	public static final String WORDS_AND_IDIOMS = "Words And Idioms";
// 
// 		
// 	public void init(int maxCount);
// 	
// 	public HashMap<String, String> getListUrls();
// 	public HashMap<String, IListParser> getListParsers();
// 	public HashMap<String, IPageParser> getPageParsers();
// 	public HashMap<String, IPageParser> getPageZhParsers();
// 	
// 	public String getName();
// }


// Path: src/cn/yo2/aquarium/pocketvoa/MainActivity.java
import java.io.IOException;
import java.util.ArrayList;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.res.Configuration;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import android.widget.Spinner;
import android.widget.TabHost;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.SimpleCursorAdapter.ViewBinder;
import cn.yo2.aquarium.pocketvoa.parser.IDataSource;

package cn.yo2.aquarium.pocketvoa;




public class MainActivity extends Activity {

	private static final String KEY_SAVED_ERROR = "key_saved_error";
	private static final String KEY_SAVED_COMMAND = "key_saved_command";
	private static final String KEY_SAVED_ARTICLE = "key_saved_article";
	
	private static final String CLASSTAG = MainActivity.class.getSimpleName();

	private static final int MENU_SETTINGS = Menu.FIRST;
	private static final int MENU_UPDATE     = Menu.FIRST + 1;
	private static final int MENU_BACKUP   = Menu.FIRST + 2;
	private static final int MENU_EXIT     = Menu.FIRST + 3;

	private static final int DLG_ERROR                        = 0;
	private static final int DLG_PROGRESS                     = 1;
	private static final int DLG_MENU_LOCAL_LIST              = 2;
	private static final int DLG_MENU_REMOTE_LIST             = 3;
	private static final int DLG_CONFIRM_DELETE               = 4;
	private static final int DLG_CONFIRM_DOWNLOAD             = 5;
	private static final int DLG_INTERNET_STATUS_CONNECTED    = 6;
	private static final int DLG_INTERNET_STATUS_DISCONNECTED = 7;
	private static final int DLG_CHANGE_LOG                   = 8;
	private static final int DLG_CONFIRM_EXIT                 = 9;

	private static final int WHAT_SUCCESS    = 0;
	private static final int WHAT_FAIL_IO    = 1;
	private static final int WHAT_FAIL_PARSE = 2;

	private static final int CMD_REFRESH_REMOTE_LIST = 0;
	private static final int CMD_REFRESH_LOCAL_LIST  = 1;
	private static final int CMD_DOWNLOAD_ARTICLE    = 2;
	private static final int CMD_SHOW_ARTICLE        = 3;

	private static final String[] TYPES_REMOTE = { IDataSource.STANDARD_ENGLISH,