// Path: java/anyremote/client/android/util/Address.java
// public class Address {
// 	public String name;
// 	public String URL;
// 	public String pass;	
// 	public boolean autoconnect;	
// }
// 
// Path: java/anyremote/client/android/util/InfoMessage.java
// public class InfoMessage {
// 	public int id;
// 	public int stage;
// }
// 
// Path: java/anyremote/client/android/util/ListItem.java
// public class ListItem {
// 	public String text;
//     public String icon;
// }
// 
// Path: java/anyremote/client/android/util/ProtocolMessage.java
// public class ProtocolMessage {
// 	public static final int FULL     = 0;
// 	public static final int FIRST    = 1;
// 	public static final int INTERMED = 2;
// 	public static final int LAST     = 3;
// 	
// 	public int id;
// 	public int stage;
// 	public Vector tokens;
// }


import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
import java.util.TimerTask;
import java.util.Vector;
import android.content.ComponentName;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.AsyncTask;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.os.Vibrator;
import android.view.Display;
import android.view.Surface;
import android.view.WindowManager;
import anyremote.client.android.util.Address;
import anyremote.client.android.util.InfoMessage;
import anyremote.client.android.util.ListItem;
import anyremote.client.android.util.ProtocolMessage;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
			if (keepaliveCounter == 0) {
				log("keepaliveTask seems connection is lost, do disconnect");
				disconnect(true);
			} else {
				keepaliveCounter = 0;
			    scheduleKeepaliveTask();
			}
		}
	}

	public void handleEditFieldResult(int id, String button, String value) {
		if (id == Dispatcher.CMD_GETPASS) {
			queueCommand("_PASSWORD_(,"+value+")");
			setPassForConnection(value);
		} else {
			queueCommand(button + "(0," + value + ")");
		}
	}

	private void setPassForConnection(String pass) {

		SharedPreferences preference = context.getPreferences(Context.MODE_PRIVATE);
		SharedPreferences.Editor editor = preference.edit();

		String UP = currentConnection + "\n" + pass;

		editor.putString(currentConnName, UP);
		editor.commit();
	}
	
// Path: java/anyremote/client/android/util/Address.java
// public class Address {
// 	public String name;
// 	public String URL;
// 	public String pass;	
// 	public boolean autoconnect;	
// }
// 
// Path: java/anyremote/client/android/util/InfoMessage.java
// public class InfoMessage {
// 	public int id;
// 	public int stage;
// }
// 
// Path: java/anyremote/client/android/util/ListItem.java
// public class ListItem {
// 	public String text;
//     public String icon;
// }
// 
// Path: java/anyremote/client/android/util/ProtocolMessage.java
// public class ProtocolMessage {
// 	public static final int FULL     = 0;
// 	public static final int FIRST    = 1;
// 	public static final int INTERMED = 2;
// 	public static final int LAST     = 3;
// 	
// 	public int id;
// 	public int stage;
// 	public Vector tokens;
// }


// Path: java/anyremote/client/android/Dispatcher.java
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
import java.util.TimerTask;
import java.util.Vector;
import android.content.ComponentName;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.AsyncTask;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.os.Vibrator;
import android.view.Display;
import android.view.Surface;
import android.view.WindowManager;
import anyremote.client.android.util.Address;
import anyremote.client.android.util.InfoMessage;
import anyremote.client.android.util.ListItem;
import anyremote.client.android.util.ProtocolMessage;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;

			if (keepaliveCounter == 0) {
				log("keepaliveTask seems connection is lost, do disconnect");
				disconnect(true);
			} else {
				keepaliveCounter = 0;
			    scheduleKeepaliveTask();
			}
		}
	}

	public void handleEditFieldResult(int id, String button, String value) {
		if (id == Dispatcher.CMD_GETPASS) {
			queueCommand("_PASSWORD_(,"+value+")");
			setPassForConnection(value);
		} else {
			queueCommand(button + "(0," + value + ")");
		}
	}

	private void setPassForConnection(String pass) {

		SharedPreferences preference = context.getPreferences(Context.MODE_PRIVATE);
		SharedPreferences.Editor editor = preference.edit();

		String UP = currentConnection + "\n" + pass;

		editor.putString(currentConnName, UP);
		editor.commit();
	}
	
	public Vector<Address> loadPrefs() {