// Path: jrdp/core/src/main/java/com/jrdp/core/util/Logger.java
// public class Logger
// {
// 	public static final int INFO = 0;
// 	public static final int DEBUG = 1;
// 	public static final int ERROR = 2;
// 	private static LoggerInterface logger;
// 	
// 	public static void setLogger(LoggerInterface newLogger)
// 	{
// 		logger = newLogger;
// 	}
// 	
// 	public static void log(int type, String message)
// 	{
// 		if(logger != null)
// 			logger.log(type, message);
// 	}
// 	
// 	public static void log(String message)
// 	{
// 		if(logger != null)
// 			logger.log(message);
// 	}
// 	
// 	public static void log(Exception e)
// 	{
// 		if(logger != null)
// 			logger.log(e);
// 	}
// 	
// 	public static void log(Exception e, String message)
// 	{
// 		if(logger != null)
// 			logger.log(e, message);
// 	}
// 	
// 	public interface LoggerInterface
// 	{
// 		public void log(int type, String message);
// 		public void log(String message);
// 		public void log(Exception e);
// 		public void log(Exception e, String message);
// 	}
// }


import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
import com.jrdp.core.util.Logger;
import android.app.Activity;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.ContentValues;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
		uri.query(connectionId + "");

		Intent intent = new Intent(ConnectionSettingsActivity.this, RemoteDesktopActivity.class);
		intent.setData(uri.build());
		this.startActivity(intent);
	}
	
	private void save()
	{
		ContentValues settings = new ContentValues();
		settings.put(Storage.ROW_NICKNAME, "Nickname Placeholder");
		settings.put(Storage.ROW_IP, server.getText().toString());
		settings.put(Storage.ROW_PORT, port.getText().toString());
		settings.put(Storage.ROW_USERNAME, username.getText().toString());
		settings.put(Storage.ROW_PASSWORD, password.getText().toString());
		settings.put(Storage.ROW_DOMAIN, domain.getText().toString());
		settings.put(Storage.ROW_ENCRYPTION_LEVEL, encryption.getSelectedItemPosition());
		settings.put(Storage.ROW_PERFORMANCE_FLAGS, 1);
		settings.put(Storage.ROW_RESOLUTION_INDEX, resolution.getSelectedItemPosition());
		settings.put(Storage.ROW_COLOR, colorDepth.getSelectedItemPosition());
		settings.put(Storage.ROW_INPUT_TYPE, 2);
		//TODO: implement ordering of connection list
		settings.put(Storage.ROW_LIST_ORDER, 1);
		if(isNew)
		{
			connectionId = String.valueOf(storage.insert(Storage.TABLE_CONNECTION_INFO, settings));
			isNew = false;
		}
		else
			storage.updateData(Storage.TABLE_CONNECTION_INFO, settings, Storage.ROW_ID + "=" + connectionId);
// Path: jrdp/core/src/main/java/com/jrdp/core/util/Logger.java
// public class Logger
// {
// 	public static final int INFO = 0;
// 	public static final int DEBUG = 1;
// 	public static final int ERROR = 2;
// 	private static LoggerInterface logger;
// 	
// 	public static void setLogger(LoggerInterface newLogger)
// 	{
// 		logger = newLogger;
// 	}
// 	
// 	public static void log(int type, String message)
// 	{
// 		if(logger != null)
// 			logger.log(type, message);
// 	}
// 	
// 	public static void log(String message)
// 	{
// 		if(logger != null)
// 			logger.log(message);
// 	}
// 	
// 	public static void log(Exception e)
// 	{
// 		if(logger != null)
// 			logger.log(e);
// 	}
// 	
// 	public static void log(Exception e, String message)
// 	{
// 		if(logger != null)
// 			logger.log(e, message);
// 	}
// 	
// 	public interface LoggerInterface
// 	{
// 		public void log(int type, String message);
// 		public void log(String message);
// 		public void log(Exception e);
// 		public void log(Exception e, String message);
// 	}
// }


// Path: jrdp/android/src/main/java/com/jrdp/client/android/ConnectionSettingsActivity.java
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
import com.jrdp.core.util.Logger;
import android.app.Activity;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.ContentValues;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;

		uri.query(connectionId + "");

		Intent intent = new Intent(ConnectionSettingsActivity.this, RemoteDesktopActivity.class);
		intent.setData(uri.build());
		this.startActivity(intent);
	}
	
	private void save()
	{
		ContentValues settings = new ContentValues();
		settings.put(Storage.ROW_NICKNAME, "Nickname Placeholder");
		settings.put(Storage.ROW_IP, server.getText().toString());
		settings.put(Storage.ROW_PORT, port.getText().toString());
		settings.put(Storage.ROW_USERNAME, username.getText().toString());
		settings.put(Storage.ROW_PASSWORD, password.getText().toString());
		settings.put(Storage.ROW_DOMAIN, domain.getText().toString());
		settings.put(Storage.ROW_ENCRYPTION_LEVEL, encryption.getSelectedItemPosition());
		settings.put(Storage.ROW_PERFORMANCE_FLAGS, 1);
		settings.put(Storage.ROW_RESOLUTION_INDEX, resolution.getSelectedItemPosition());
		settings.put(Storage.ROW_COLOR, colorDepth.getSelectedItemPosition());
		settings.put(Storage.ROW_INPUT_TYPE, 2);
		//TODO: implement ordering of connection list
		settings.put(Storage.ROW_LIST_ORDER, 1);
		if(isNew)
		{
			connectionId = String.valueOf(storage.insert(Storage.TABLE_CONNECTION_INFO, settings));
			isNew = false;
		}
		else
			storage.updateData(Storage.TABLE_CONNECTION_INFO, settings, Storage.ROW_ID + "=" + connectionId);
		Logger.log("saved new connection under id: " + connectionId);