// Path: app/src/main/java/com/ubiqlog/vis/extras/bluetooth/BluetoothDetectionContainer.java
// public class BluetoothDetectionContainer 
// {
// 	private Hashtable<String, BluetoothDetection> hashDetections;
// 	private ArrayList<String> listDevicesAddresses;
// 	
// 	private Calendar dateLow;
// 	private Calendar dateHigh;
// 	private boolean bIsEmpty;
// 
// 	public BluetoothDetectionContainer(Date startDate, Date endDate) 
// 	{
// 		this.hashDetections = new Hashtable<String, BluetoothDetection>();
// 		this.listDevicesAddresses = new ArrayList<String>(); 
// 		
// 		this.dateLow = Calendar.getInstance();
// 		this.dateLow.setTime(startDate);
// 		this.dateHigh = Calendar.getInstance();
// 		this.dateHigh.setTime(endDate);
// 		this.bIsEmpty = true;
// 	}
// 
// 	public void parseJsonList(String[] jsonStringList) 
// 	{
// 		DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);
// 
// 		try 
// 		{
// 			for (String jsonString : jsonStringList) 
// 			{
// 				String[] jsonDecoded = JsonEncodeDecode.DecodeBluetooth(jsonString);
// 
// 				String deviceName = jsonDecoded[0];
// 				String deviceAddress = jsonDecoded[1];
// 				String deviceState = jsonDecoded[2];
// 				String timestampCurrent = jsonDecoded[3];
// 				
// 				Calendar currentEventCalendar = (Calendar)Calendar.getInstance().clone();
// 
// 				currentEventCalendar.setTime(df.parse(timestampCurrent));
// 
// 				if ((currentEventCalendar.compareTo(dateLow) >=0) && (currentEventCalendar.compareTo(dateHigh) <= 0))
// 				{
// 					BluetoothDetection currentDetection;
// 					
// 					if ((currentDetection = hashDetections.get(deviceAddress)) == null)
// 					{
// 						currentDetection = new BluetoothDetection(deviceName, deviceAddress);
// 						hashDetections.put(deviceAddress, currentDetection);
// 						listDevicesAddresses.add(deviceAddress);
// 					}
// 
// 					Bluetooth bluetoothState = Bluetooth.valueOf(deviceState.toUpperCase());
// 					
// 					currentDetection.InsertDetection(currentEventCalendar.getTime().getTime() - dateLow.getTime().getTime(), bluetoothState);
// 
// 					if (bIsEmpty)
// 					{
// 						bIsEmpty = !bIsEmpty;
// 					}
// 				}
// 			}
// 		} 
// 		catch (Exception ex) 
// 		{
// 		}
// 	}
// 	
// 	public ArrayList<Long> getAllDetectionDates(String deviceAddress, Bluetooth deviceState)
// 	{
// 		return hashDetections.get(deviceAddress).getDetectionDates(deviceState);
// 	}
// 	
// 	public int getNumberOfDevices()
// 	{
// 		return listDevicesAddresses.size();
// 	}
// 
// 	public ArrayList<BluetoothDetection> getAllDevicesDetections() 
// 	{
// 		ArrayList<BluetoothDetection> toReturn = new ArrayList<BluetoothDetection>();
// 		
// 		for (BluetoothDetection bluetoothDetection : hashDetections.values())
// 		{
// 			toReturn.add(bluetoothDetection);
// 		}
// 		
// 		return toReturn;
// 	}
// 
// 	public Calendar getLowestDate() 
// 	{
// 		return this.dateLow;
// 	}
// 
// 	public Calendar getHighestDate() 
// 	{
// 		return this.dateHigh;
// 	}
// }


import com.ubiqlog.vis.extras.bluetooth.BluetoothDetectionContainer;
import android.content.Context;
import android.view.ViewGroup;
import android.widget.LinearLayout;
package com.ubiqlog.vis.ui.extras.bluetooth;



/**
 * 
 * @author Dorin Gugonatu
 * 
 */

public class BluetoothLogDataLayout extends LinearLayout
{
	private BluetoothLogHorizontalScrollView bluetoothHorizontalScrollView;
	private BluetoothLogVerticalScrollView bluetoothVerticalScrollView;
	
	private BluetoothLogDataView bluetoothLogDataView;
	private BluetoothLogDevicesView bluetoothLogDevicesView;

	public BluetoothLogDataLayout(Context context) 
	{
		super(context);
		
		this.setOrientation(LinearLayout.HORIZONTAL);
		
		bluetoothHorizontalScrollView = new BluetoothLogHorizontalScrollView(context);
		bluetoothLogDataView = new BluetoothLogDataView(context, 100, 100);
		bluetoothHorizontalScrollView.addView(bluetoothLogDataView);
		bluetoothHorizontalScrollView.addZoomNotificationListener(bluetoothLogDataView);
		
		bluetoothVerticalScrollView = new BluetoothLogVerticalScrollView(context);
		bluetoothLogDevicesView = new BluetoothLogDevicesView(context, bluetoothLogDataView);
		bluetoothVerticalScrollView.addView(bluetoothLogDevicesView);
		bluetoothVerticalScrollView.setPadding(0, 100, 0, 100);
		
		addView(bluetoothVerticalScrollView);
		addView(bluetoothHorizontalScrollView);
	}

// Path: app/src/main/java/com/ubiqlog/vis/extras/bluetooth/BluetoothDetectionContainer.java
// public class BluetoothDetectionContainer 
// {
// 	private Hashtable<String, BluetoothDetection> hashDetections;
// 	private ArrayList<String> listDevicesAddresses;
// 	
// 	private Calendar dateLow;
// 	private Calendar dateHigh;
// 	private boolean bIsEmpty;
// 
// 	public BluetoothDetectionContainer(Date startDate, Date endDate) 
// 	{
// 		this.hashDetections = new Hashtable<String, BluetoothDetection>();
// 		this.listDevicesAddresses = new ArrayList<String>(); 
// 		
// 		this.dateLow = Calendar.getInstance();
// 		this.dateLow.setTime(startDate);
// 		this.dateHigh = Calendar.getInstance();
// 		this.dateHigh.setTime(endDate);
// 		this.bIsEmpty = true;
// 	}
// 
// 	public void parseJsonList(String[] jsonStringList) 
// 	{
// 		DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);
// 
// 		try 
// 		{
// 			for (String jsonString : jsonStringList) 
// 			{
// 				String[] jsonDecoded = JsonEncodeDecode.DecodeBluetooth(jsonString);
// 
// 				String deviceName = jsonDecoded[0];
// 				String deviceAddress = jsonDecoded[1];
// 				String deviceState = jsonDecoded[2];
// 				String timestampCurrent = jsonDecoded[3];
// 				
// 				Calendar currentEventCalendar = (Calendar)Calendar.getInstance().clone();
// 
// 				currentEventCalendar.setTime(df.parse(timestampCurrent));
// 
// 				if ((currentEventCalendar.compareTo(dateLow) >=0) && (currentEventCalendar.compareTo(dateHigh) <= 0))
// 				{
// 					BluetoothDetection currentDetection;
// 					
// 					if ((currentDetection = hashDetections.get(deviceAddress)) == null)
// 					{
// 						currentDetection = new BluetoothDetection(deviceName, deviceAddress);
// 						hashDetections.put(deviceAddress, currentDetection);
// 						listDevicesAddresses.add(deviceAddress);
// 					}
// 
// 					Bluetooth bluetoothState = Bluetooth.valueOf(deviceState.toUpperCase());
// 					
// 					currentDetection.InsertDetection(currentEventCalendar.getTime().getTime() - dateLow.getTime().getTime(), bluetoothState);
// 
// 					if (bIsEmpty)
// 					{
// 						bIsEmpty = !bIsEmpty;
// 					}
// 				}
// 			}
// 		} 
// 		catch (Exception ex) 
// 		{
// 		}
// 	}
// 	
// 	public ArrayList<Long> getAllDetectionDates(String deviceAddress, Bluetooth deviceState)
// 	{
// 		return hashDetections.get(deviceAddress).getDetectionDates(deviceState);
// 	}
// 	
// 	public int getNumberOfDevices()
// 	{
// 		return listDevicesAddresses.size();
// 	}
// 
// 	public ArrayList<BluetoothDetection> getAllDevicesDetections() 
// 	{
// 		ArrayList<BluetoothDetection> toReturn = new ArrayList<BluetoothDetection>();
// 		
// 		for (BluetoothDetection bluetoothDetection : hashDetections.values())
// 		{
// 			toReturn.add(bluetoothDetection);
// 		}
// 		
// 		return toReturn;
// 	}
// 
// 	public Calendar getLowestDate() 
// 	{
// 		return this.dateLow;
// 	}
// 
// 	public Calendar getHighestDate() 
// 	{
// 		return this.dateHigh;
// 	}
// }


// Path: app/src/main/java/com/ubiqlog/vis/ui/extras/bluetooth/BluetoothLogDataLayout.java
import com.ubiqlog.vis.extras.bluetooth.BluetoothDetectionContainer;
import android.content.Context;
import android.view.ViewGroup;
import android.widget.LinearLayout;

package com.ubiqlog.vis.ui.extras.bluetooth;



/**
 * 
 * @author Dorin Gugonatu
 * 
 */

public class BluetoothLogDataLayout extends LinearLayout
{
	private BluetoothLogHorizontalScrollView bluetoothHorizontalScrollView;
	private BluetoothLogVerticalScrollView bluetoothVerticalScrollView;
	
	private BluetoothLogDataView bluetoothLogDataView;
	private BluetoothLogDevicesView bluetoothLogDevicesView;

	public BluetoothLogDataLayout(Context context) 
	{
		super(context);
		
		this.setOrientation(LinearLayout.HORIZONTAL);
		
		bluetoothHorizontalScrollView = new BluetoothLogHorizontalScrollView(context);
		bluetoothLogDataView = new BluetoothLogDataView(context, 100, 100);
		bluetoothHorizontalScrollView.addView(bluetoothLogDataView);
		bluetoothHorizontalScrollView.addZoomNotificationListener(bluetoothLogDataView);
		
		bluetoothVerticalScrollView = new BluetoothLogVerticalScrollView(context);
		bluetoothLogDevicesView = new BluetoothLogDevicesView(context, bluetoothLogDataView);
		bluetoothVerticalScrollView.addView(bluetoothLogDevicesView);
		bluetoothVerticalScrollView.setPadding(0, 100, 0, 100);
		
		addView(bluetoothVerticalScrollView);
		addView(bluetoothHorizontalScrollView);
	}

	public void setData(BluetoothDetectionContainer bluetoothContainer) 