Browse Source

fixed last merge conflicts

Alexander Brakowski 10 years ago
parent
commit
f25536c8e4

+ 0 - 2
res/values/strings.xml

@@ -48,6 +48,4 @@
     <string name="button_title_cancel">Cancel</string>
     <string name="shared_preference_path">de.tudarmstadt.informatik.hostage.preferences</string>
     <string name="UUID">9fc4f490-659e-11e3-949a-0800200c9a66</string>
-    <string name="statistics">Statistics</string>
-    <string name="database">Database</string>
 </resources>

+ 1 - 21
src/de/tudarmstadt/informatik/hostage/logging/UglyDbHelper.java

@@ -29,7 +29,7 @@ public class UglyDbHelper extends SQLiteOpenHelper {
 
 	// All Static variables
 	// Database Version
-	private static final int DATABASE_VERSION = 2;
+	private static final int DATABASE_VERSION = 3;
 
 	// Database Name
 	private static final String DATABASE_NAME = "recordManager";
@@ -87,26 +87,6 @@ public class UglyDbHelper extends SQLiteOpenHelper {
 		super(context, DATABASE_NAME, null, DATABASE_VERSION);
 	}
 
-	// Creating Tables
-	@Override
-	public void onCreate(SQLiteDatabase db) {
-		db.execSQL(CREATE_BSSID_TABLE);
-		db.execSQL(CREATE_ATTACK_INFO_TABLE);
-		db.execSQL(CREATE_RECORD_TABLE);
-	}
-
-	// Upgrading database
-	@Override
-	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
-		// Drop older table if existed
-		db.execSQL("DROP TABLE IF EXISTS " + TABLE_RECORDS);
-		db.execSQL("DROP TABLE IF EXISTS " + TABLE_ATTACK_INFO);
-		db.execSQL("DROP TABLE IF EXISTS " + TABLE_BSSIDS);
-		
-		// Create tables again
-		onCreate(db);
-	}
-
 	  /*
     // Contacts Table Columns names
 	private static final String KEY_ID = "_id";

+ 297 - 362
src/de/tudarmstadt/informatik/hostage/ui/MainActivity.java

@@ -4,7 +4,6 @@ import java.io.BufferedReader;
 import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.HashMap;
-
 import android.app.Activity;
 import android.app.ActivityManager;
 import android.app.ActivityManager.RunningServiceInfo;
@@ -105,91 +104,19 @@ public class MainActivity extends Activity implements Receiver {
 
 	private boolean isBssidSeen = false;
 
-	/**
-	 * Connection to bind the background service
-	 * 
-	 * @see HoneyService
-	 */
-	private ServiceConnection mConnection = new ServiceConnection() {
-		/**
-		 * After the service is bound, check which has been clicked and start
-		 * it.
-		 * 
-		 * @see android.content.ServiceConnection#onServiceConnected(android.content.ComponentName)
-		 */
-		@Override
-		public void onServiceConnected(ComponentName name, IBinder service) {
-			mService = ((LocalBinder) service).getService();
-			serviceBound = true;
-			updateUI();
-		}
-
-		/**
-		 * After the service is unbound, delete reference.
-		 * 
-		 * @see android.content.ServiceConnection#onServiceDisconnected(android.content.ComponentName)
-		 */
-		@Override
-		public void onServiceDisconnected(ComponentName name) {
-			mService = null;
-			serviceBound = false;
-		}
-
-	};
-
-	/**
-	 * Receiver for custom broadcast.
-	 * 
-	 * @see #BROADCAST
-	 */
-	private BroadcastReceiver mReceiver = new BroadcastReceiver() {
-		@Override
-		public void onReceive(Context context, Intent intent) {
-			// Update user interface.
-			updateUI();
-			updateConnectionInfText();
-		}
-	};
-
-	SimpleOnGestureListener simpleOnGestureListener = new SimpleOnGestureListener() {
-		@Override
-		public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
-				float velocityY) {
-			float sensitvity = 50;
-			if ((e1.getX() - e2.getX()) > sensitvity) {
-				swipeRightToLeft();
-			} else if ((e2.getX() - e1.getX()) > sensitvity) {
-				swipeLeftToRight();
-			}
-
-			return true;
-		}
-	};
-
-	/**
-	 * Called when User presses on/off button.
-	 * 
-	 * @param view
-	 */
-	public void buttonOnOffClick(View view) {
-		if (((ToggleButton) view).isChecked()) {
-			if (isParanoid()) {
-				String[] protocols = getResources().getStringArray(
-						R.array.protocols);
-				for (String protocol : protocols) {
-					mService.startListener(protocol);
-				}
-			} else {
-				if (mService.isRunning("SMB")) {
-					mService.stopListener("SMB");
-				} else {
-					mService.startListener("SMB");
-				}
-			}
-		} else {
-			mService.stopListeners();
-			stopAndUnbind();
-		}
+	@Override
+	protected void onCreate(Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		logResultReceiver = new LogResultReceiver(new Handler());
+		setContentView(R.layout.activity_main);
+		connectionInfo = getSharedPreferences(getString(R.string.connection_info), Context.MODE_PRIVATE);
+		
+		// Create dynamic view elements
+		initViewAnimator();
+		initListView();
+		// Initialize Class variables
+		checkRootAndPorthack();
+		startAndBind();
 	}
 
 	@Override
@@ -213,14 +140,66 @@ public class MainActivity extends Activity implements Receiver {
 		return super.onOptionsItemSelected(item);
 	}
 
+	@Override
+	protected void onStart() {
+		super.onStart();
+		// Register Broadcast Receiver
+		registerReceiver();
+		logResultReceiver.setReceiver(this);
+		// Bind service if running, else check for connection change and delete
+		// sessionData
+		if (isServiceRunning()) {
+			bindService(getServiceIntent(), mConnection, BIND_AUTO_CREATE);
+		} 
+		// Update UI
+		updateConnectionInfText();
+	}
+
+	@Override
+	protected void onStop() {
+		// Unregister Broadcast Receiver
+		unregisterReceiver();
+		logResultReceiver.setReceiver(null);
+		super.onStop();
+	}
+
+	@Override
+	protected void onDestroy() {
+		// Unbind running service
+		if(!mService.hasRunningListeners()){
+			stopAndUnbind();
+		}
+		super.onDestroy();
+	}
+
 	@Override
 	public void onReceiveResult(int resultCode, Bundle resultData) {
 		isBssidSeen = resultData.getBoolean("result");
 	}
 
-	@Override
-	public boolean onTouchEvent(MotionEvent event) {
-		return gestureDetector.onTouchEvent(event);
+	/**
+	 * Called when User presses on/off button.
+	 * 
+	 * @param view
+	 */
+	public void buttonOnOffClick(View view) {
+		if (((ToggleButton) view).isChecked()) {
+			if (isParanoid()) {
+				String[] protocols = getResources().getStringArray(R.array.protocols);
+				for(String protocol: protocols){
+					mService.startListener(protocol);	
+				}						
+			} else {
+				if(mService.isRunning("SMB")){
+					mService.stopListener("SMB");
+				}else{
+					mService.startListener("SMB");
+				}	
+			}
+		} else {
+			mService.stopListeners();
+			stopAndUnbind();
+		}
 	}
 
 	/**
@@ -238,6 +217,16 @@ public class MainActivity extends Activity implements Receiver {
 		startActivity(new Intent(this, PlayGroundActivity.class));
 	}
 
+	/**
+	 * If mobile phone is connected to a wireless network starts the background
+	 * service ands binds itself to it. Else notifies the user that service
+	 * could not be started.
+	 */
+	private void startAndBind() {
+		startService(getServiceIntent());
+		bindService();
+	}
+
 	/**
 	 * Binds service to Activity
 	 * 
@@ -278,7 +267,7 @@ public class MainActivity extends Activity implements Receiver {
 		 * 
 		 * @see android.content.ServiceConnection#onServiceConnected(android.content.ComponentName)
 		 */
-		//@Override
+		@Override
 		public void onServiceConnected(ComponentName name, IBinder service) {
 			mService = ((LocalBinder) service).getService();
 			serviceBound = true;
@@ -290,7 +279,7 @@ public class MainActivity extends Activity implements Receiver {
 		 * 
 		 * @see android.content.ServiceConnection#onServiceDisconnected(android.content.ComponentName)
 		 */
-		//@Override
+		@Override
 		public void onServiceDisconnected(ComponentName name) {
 			mService = null;
 			serviceBound = false;
@@ -341,6 +330,15 @@ public class MainActivity extends Activity implements Receiver {
 		return new Intent(this, HoneyService.class);
 	}
 
+	/**
+	 * Checks if user selected paranoid mode.
+	 * 
+	 * @return True when paranoid mode is selected, else returns false.
+	 */
+	private boolean isParanoid() {
+		return ((CheckBox) findViewById(R.id.checkBoxParanoid)).isChecked();
+	}
+
 	/**
 	 * Initializes the ListView. Creating its contents dynamic from protocol
 	 * res/values/protocols.xml
@@ -359,7 +357,7 @@ public class MainActivity extends Activity implements Receiver {
 		listView.setAdapter(adapter);
 		listView.setOnTouchListener(new OnTouchListener() {
 
-			//@Override
+			@Override
 			public boolean onTouch(View v, MotionEvent event) {
 				return gestureDetector.onTouchEvent(event);
 			}
@@ -367,55 +365,20 @@ public class MainActivity extends Activity implements Receiver {
 		});
 		listView.setOnItemClickListener(new OnItemClickListener() {
 
-			//@Override
+			@Override
 			public void onItemClick(AdapterView<?> parent, View view,
 					int position, long id) {
 				String protocolName = (String) ((HashMap<?, ?>) adapter
 						.getItem(position)).get("protocol");
-				if (mService.isRunning(protocolName)) {
+				if(mService.isRunning(protocolName)){
 					mService.stopListener(protocolName);
-				} else {
+				}else{
 					mService.startListener(protocolName);
-				}
+				}				
 			}
 		});
 	}
-
-	/**
-	 * Initializes variables for screen animation
-	 */
-	private void initViewAnimator() {
-		viewAnimator = (ViewAnimator) findViewById(R.id.viewAnimator);
-		gestureDetector = new GestureDetector(this, simpleOnGestureListener);
-
-		animFlipInLR = AnimationUtils.loadAnimation(this,
-				R.anim.in_left_to_right);
-		animFlipOutLR = AnimationUtils.loadAnimation(this,
-				R.anim.out_left_to_right);
-		animFlipInRL = AnimationUtils.loadAnimation(this,
-				R.anim.in_right_to_left);
-		animFlipOutRL = AnimationUtils.loadAnimation(this,
-				R.anim.out_right_to_left);
-	}
-
-	/**
-	 * Checks if user selected paranoid mode.
-	 * 
-	 * @return True when paranoid mode is selected, else returns false.
-	 */
-	private boolean isParanoid() {
-		return ((CheckBox) findViewById(R.id.checkBoxParanoid)).isChecked();
-	}
-
-	/**
-	 * Checks if a {@link HoneyService} instance is running.
-	 * 
-	 * @return True if {@link HoneyService} is running, else false.
-	 */
-	private boolean isServiceBound() {
-		return serviceBound;
-	}
-
+	
 	/**
 	 * Checks if a {@link HoneyService} instance is running.
 	 * 
@@ -432,6 +395,15 @@ public class MainActivity extends Activity implements Receiver {
 		}
 		return false;
 	}
+	
+	/**
+	 * Checks if a {@link HoneyService} instance is running.
+	 * 
+	 * @return True if {@link HoneyService} is running, else false.
+	 */
+	private boolean isServiceBound() {
+		return serviceBound;
+	}
 
 	/**
 	 * Register broadcast receiver for custom broadcast.
@@ -444,230 +416,58 @@ public class MainActivity extends Activity implements Receiver {
 	}
 
 	/**
-	 * If mobile phone is connected to a wireless network starts the background
-	 * service ands binds itself to it. Else notifies the user that service
-	 * could not be started.
-	 */
-	private void startAndBind() {
-		startService(getServiceIntent());
-		bindService();
-	}
-
-	/**
-	 * Stops service and unbinds it.
+	 * Unregisters broadcast receiver for custom broadcast.
 	 * 
-	 * @see HoneyService
+	 * @see #BROADCAST
 	 */
-	private void stopAndUnbind() {
-		unbindService();
-		stopService(getServiceIntent());
+	private void unregisterReceiver() {
+		LocalBroadcastManager.getInstance(this).unregisterReceiver(mReceiver);
 	}
 
 	/**
-	 * Called when a swipe to the Right is registered.
+	 * Receiver for custom broadcast.
+	 * 
+	 * @see #BROADCAST
 	 */
-	private void swipeLeftToRight() {
-		if (viewAnimator.getDisplayedChild() == 1) {
-			viewAnimator.setInAnimation(animFlipInLR);
-			viewAnimator.setOutAnimation(animFlipOutLR);
-			viewAnimator.setDisplayedChild(0);
+	private BroadcastReceiver mReceiver = new BroadcastReceiver() {
+		@Override
+		public void onReceive(Context context, Intent intent) {
+			// Update user interface.
+			updateUI();
+			updateConnectionInfText();
 		}
-	}
+	};
 
 	/**
-	 * Called when a swipe to the Left is registered.
-	 */
-	private void swipeRightToLeft() {
-		if (viewAnimator.getDisplayedChild() == 0) {
-			viewAnimator.setInAnimation(animFlipInRL);
-			viewAnimator.setOutAnimation(animFlipOutRL);
-			viewAnimator.setDisplayedChild(1);
-		}
-	}
-
-	/**
-	 * Unbinds service.
-	 * 
-	 * @see HoneyService
-	 */
-	private void unbindService() {
-		unbindService(mConnection);
-	}
-
-	/**
-	 * Unregisters broadcast receiver for custom broadcast.
-	 * 
-	 * @see #BROADCAST
-	 */
-	private void unregisterReceiver() {
-		LocalBroadcastManager.getInstance(this).unregisterReceiver(mReceiver);
-	}
-
-	/**
-	 * Gets Information about connection state and updates the GUI.
-	 */
-	private void updateConnectionInfText() {
-		TextView ssidView = (TextView) findViewById(R.id.textViewSSIDValue);
-		TextView bssidView = (TextView) findViewById(R.id.textViewBSSIDValue);
-		TextView internalIPView = (TextView) findViewById(R.id.textViewInternalIPValue);
-		TextView externalIPView = (TextView) findViewById(R.id.textViewExternalIPValue);
-
-		// externalIPView.setText("Loading...");
-
-		// Get connection information
-		String ssid = connectionInfo.getString(
-				getString(R.string.connection_info_ssid), null);
-		String bssid = connectionInfo.getString(
-				getString(R.string.connection_info_bssid), null);
-		String internalIP = connectionInfo.getString(
-				getString(R.string.connection_info_internal_ip), null);
-		String externalIP = connectionInfo.getString(
-				getString(R.string.connection_info_external_ip), null);
-
-		// Set text fields
-		if (ssid != null)
-			ssidView.setText(ssid);
-		else
-			ssidView.setText("-");
-
-		if (bssid != null)
-			bssidView.setText(bssid);
-		else
-			bssidView.setText("-");
-
-		if (internalIP != null)
-			internalIPView.setText(internalIP);
-		else
-			internalIPView.setText("-");
-
-		if (externalIP != null)
-			externalIPView.setText(externalIP);
-		else
-			externalIPView.setText("-");
-	}
-
-	/**
-	 * Sets the connections count for a given protocol.
-	 * 
-	 * @param connections
-	 *            New value for recorded connections.
-	 * @param protocolName
-	 *            Name of the protocol which should be updated.
-	 */
-	private void updateProtocolConnections(int connections, String protocolName) {
-		for (int i = 0; i < adapter.getCount(); ++i) {
-			HashMap<String, String> d = ((HashMap<String, String>) adapter
-					.getItem(i));
-			if (d.get("protocol").equals(protocolName)) {
-				d.put("connections", String.valueOf(connections));
-			}
-		}
-		adapter.notifyDataSetChanged();
-	}
-
-	/**
-	 * Sets the light indicator for a given protocol.
-	 * 
-	 * @param light
-	 *            Integer code to set the light color.
-	 * @param protocolName
-	 *            Name of the protocol which should be updated.
-	 */
-	private void updateProtocolLight(int light, String protocolName) {
-		for (int i = 0; i < adapter.getCount(); ++i) {
-			HashMap<String, String> d = (HashMap<String, String>) adapter
-					.getItem(i);
-			if (d.get("protocol").equals(protocolName)) {
-				switch (light) {
-				case LIGHT_GREY:
-					d.put("light", String.valueOf(R.drawable.light_grey));
-					d.put("connections", "-");
-					break;
-				case LIGHT_GREEN:
-					d.put("light", String.valueOf(R.drawable.light_green));
-					break;
-				case LIGHT_RED:
-					d.put("light", String.valueOf(R.drawable.light_red));
-					break;
-				case LIGHT_YELLOW:
-					d.put("light", String.valueOf(R.drawable.light_yellow));
-					break;
-				}
-			}
-		}
-		adapter.notifyDataSetChanged();
-	}
-
-	/**
-	 * Sets the big light indicator.
-	 * 
-	 * @param light
-	 *            Integer code to set the light color.
-	 * @see #LIGHT_GREY
-	 * @see #LIGHT_GREEN
-	 * @see #LIGHT_RED
-	 * @see #LIGHT_YELLOW
-	 */
-	private void updateStatusLight(int light) {
-		switch (light) {
-		case LIGHT_GREY:
-			((ImageView) findViewById(R.id.imageViewLight))
-					.setImageResource(R.drawable.light_grey_large);
-			break;
-		case LIGHT_GREEN:
-			((ImageView) findViewById(R.id.imageViewLight))
-					.setImageResource(R.drawable.light_green_large);
-			break;
-		case LIGHT_RED:
-			((ImageView) findViewById(R.id.imageViewLight))
-					.setImageResource(R.drawable.light_red_large);
-			break;
-		case LIGHT_YELLOW:
-			((ImageView) findViewById(R.id.imageViewLight))
-					.setImageResource(R.drawable.light_yellow_large);
-			break;
-		}
-	}
-
-	/* ############# Help functions for animation ################## */
-
-	/**
-	 * Updates Information shown by the GUI.
+	 * Updates Information shown by the GUI.
 	 */
 	private void updateUI() {
 		boolean activeListeners = false;
 		boolean activeHandlers = false;
 		boolean yellowLight = false;
-
+		
 		// Check for all protocols if listeners are active and attacks have been
 		// recorded
 		// Update protocol lights and connection information.
 		for (String protocol : getResources().getStringArray(R.array.protocols)) {
-			if (isServiceBound()) {
+			if(isServiceBound()){
 				// Check if protocol is active
 				if (mService.isRunning(protocol)) {
 					activeListeners = true;
-					int handlerCount = mService
-							.getNumberOfActiveConnections(protocol);
+					int handlerCount = mService.getNumberOfActiveConnections(protocol);
 					// Check if attacks have been recorded in this session.
 					if (handlerCount > 0) {
 						activeHandlers = true;
 						updateProtocolLight(LIGHT_RED, protocol);
 						updateProtocolConnections(handlerCount, protocol);
 					} else {
-						// Check if the bssid of the wireless network has
-						// already
+						// Check if the bssid of the wireless network has already
 						// been recorded as infected.
 						Logger.isBssidSeen(getApplicationContext(), protocol,
 								HelperUtils.getBSSID(getApplicationContext()),
 								logResultReceiver);
 						UglyDbHelper dbh = new UglyDbHelper(this);
-						if (dbh.bssidSeen(
-								protocol,
-								connectionInfo
-										.getString(
-												getString(R.string.connection_info_bssid),
-												null))) {
+						if (dbh.bssidSeen(protocol, connectionInfo.getString(getString(R.string.connection_info_bssid), null))) {
 							updateProtocolLight(LIGHT_YELLOW, protocol);
 							yellowLight = true;
 						} else {
@@ -678,9 +478,9 @@ public class MainActivity extends Activity implements Receiver {
 				} else {
 					updateProtocolLight(LIGHT_GREY, protocol);
 				}
-			} else {
+			}else{
 				updateProtocolLight(LIGHT_GREY, protocol);
-			}
+			}				
 		}
 
 		// Update the big attack indicator.
@@ -705,52 +505,187 @@ public class MainActivity extends Activity implements Receiver {
 		}
 	}
 
-	@Override
-	protected void onCreate(Bundle savedInstanceState) {
-		super.onCreate(savedInstanceState);
-		logResultReceiver = new LogResultReceiver(new Handler());
-		setContentView(R.layout.activity_main);
-		connectionInfo = getSharedPreferences(
-				getString(R.string.connection_info), Context.MODE_PRIVATE);
+	/**
+	 * Sets the big light indicator.
+	 * 
+	 * @param light
+	 *            Integer code to set the light color.
+	 * @see #LIGHT_GREY
+	 * @see #LIGHT_GREEN
+	 * @see #LIGHT_RED
+	 * @see #LIGHT_YELLOW
+	 */
+	private void updateStatusLight(int light) {
+		switch (light) {
+		case LIGHT_GREY:
+			((ImageView) findViewById(R.id.imageViewLight))
+					.setImageResource(R.drawable.light_grey_large);
+			break;
+		case LIGHT_GREEN:
+			((ImageView) findViewById(R.id.imageViewLight))
+					.setImageResource(R.drawable.light_green_large);
+			break;
+		case LIGHT_RED:
+			((ImageView) findViewById(R.id.imageViewLight))
+					.setImageResource(R.drawable.light_red_large);
+			break;
+		case LIGHT_YELLOW:
+			((ImageView) findViewById(R.id.imageViewLight))
+					.setImageResource(R.drawable.light_yellow_large);
+			break;
+		}
+	}
 
-		// Create dynamic view elements
-		initViewAnimator();
-		initListView();
-		// Initialize Class variables
-		checkRootAndPorthack();
-		startAndBind();
+	/**
+	 * Sets the light indicator for a given protocol.
+	 * 
+	 * @param light
+	 *            Integer code to set the light color.
+	 * @param protocolName
+	 *            Name of the protocol which should be updated.
+	 */
+	private void updateProtocolLight(int light, String protocolName) {
+		for (int i = 0; i < adapter.getCount(); ++i) {
+			HashMap<String, String> d = (HashMap<String, String>) adapter
+					.getItem(i);
+			if (d.get("protocol").equals(protocolName)) {
+				switch (light) {
+				case LIGHT_GREY:
+					d.put("light", String.valueOf(R.drawable.light_grey));
+					d.put("connections", "-");
+					break;
+				case LIGHT_GREEN:
+					d.put("light", String.valueOf(R.drawable.light_green));
+					break;
+				case LIGHT_RED:
+					d.put("light", String.valueOf(R.drawable.light_red));
+					break;
+				case LIGHT_YELLOW:
+					d.put("light", String.valueOf(R.drawable.light_yellow));
+					break;
+				}
+			}
+		}
+		adapter.notifyDataSetChanged();
 	}
 
-	@Override
-	protected void onDestroy() {
-		// Unbind running service
-		if (!mService.hasRunningListeners()) {
-			stopAndUnbind();
+	/**
+	 * Sets the connections count for a given protocol.
+	 * 
+	 * @param connections
+	 *            New value for recorded connections.
+	 * @param protocolName
+	 *            Name of the protocol which should be updated.
+	 */
+	private void updateProtocolConnections(int connections, String protocolName) {
+		for (int i = 0; i < adapter.getCount(); ++i) {
+			HashMap<String, String> d = ((HashMap<String, String>) adapter
+					.getItem(i));
+			if (d.get("protocol").equals(protocolName)) {
+				d.put("connections", String.valueOf(connections));
+			}
 		}
-		super.onDestroy();
+		adapter.notifyDataSetChanged();
 	}
 
+	/**
+	 * Gets Information about connection state and updates the GUI.
+	 */
+	private void updateConnectionInfText() {
+		TextView ssidView = (TextView) findViewById(R.id.textViewSSIDValue);
+		TextView bssidView = (TextView) findViewById(R.id.textViewBSSIDValue);
+		TextView internalIPView = (TextView) findViewById(R.id.textViewInternalIPValue);
+		TextView externalIPView = (TextView) findViewById(R.id.textViewExternalIPValue);
+
+//		externalIPView.setText("Loading...");
+
+		// Get connection information
+		String ssid = connectionInfo.getString(getString(R.string.connection_info_ssid), null);
+		String bssid = connectionInfo.getString(getString(R.string.connection_info_bssid), null);
+		String internalIP = connectionInfo.getString(getString(R.string.connection_info_internal_ip), null);
+		String externalIP = connectionInfo.getString(getString(R.string.connection_info_external_ip), null);
+
+		// Set text fields
+		if (ssid != null)
+			ssidView.setText(ssid);
+		else
+			ssidView.setText("-");
+
+		if (bssid != null)
+			bssidView.setText(bssid);
+		else
+			bssidView.setText("-");
+
+		if (internalIP != null)
+			internalIPView.setText(internalIP);
+		else
+			internalIPView.setText("-");
+		
+		if (externalIP != null)
+			externalIPView.setText(externalIP);
+		else
+			externalIPView.setText("-");
+	}
+
+	/* ############# Help functions for animation ################## */
+
 	@Override
-	protected void onStart() {
-		super.onStart();
-		// Register Broadcast Receiver
-		registerReceiver();
-		logResultReceiver.setReceiver(this);
-		// Bind service if running, else check for connection change and delete
-		// sessionData
-		if (isServiceRunning()) {
-			bindService(getServiceIntent(), mConnection, BIND_AUTO_CREATE);
+	public boolean onTouchEvent(MotionEvent event) {
+		return gestureDetector.onTouchEvent(event);
+	}
+
+	/**
+	 * Initializes variables for screen animation
+	 */
+	private void initViewAnimator() {
+		viewAnimator = (ViewAnimator) findViewById(R.id.viewAnimator);
+		gestureDetector = new GestureDetector(this, simpleOnGestureListener);
+
+		animFlipInLR = AnimationUtils.loadAnimation(this,
+				R.anim.in_left_to_right);
+		animFlipOutLR = AnimationUtils.loadAnimation(this,
+				R.anim.out_left_to_right);
+		animFlipInRL = AnimationUtils.loadAnimation(this,
+				R.anim.in_right_to_left);
+		animFlipOutRL = AnimationUtils.loadAnimation(this,
+				R.anim.out_right_to_left);
+	}
+
+	/**
+	 * Called when a swipe to the Left is registered.
+	 */
+	private void swipeRightToLeft() {
+		if (viewAnimator.getDisplayedChild() == 0) {
+			viewAnimator.setInAnimation(animFlipInRL);
+			viewAnimator.setOutAnimation(animFlipOutRL);
+			viewAnimator.setDisplayedChild(1);
 		}
-		// Update UI
-		updateConnectionInfText();
 	}
 
-	@Override
-	protected void onStop() {
-		// Unregister Broadcast Receiver
-		unregisterReceiver();
-		logResultReceiver.setReceiver(null);
-		super.onStop();
+	/**
+	 * Called when a swipe to the Right is registered.
+	 */
+	private void swipeLeftToRight() {
+		if (viewAnimator.getDisplayedChild() == 1) {
+			viewAnimator.setInAnimation(animFlipInLR);
+			viewAnimator.setOutAnimation(animFlipOutLR);
+			viewAnimator.setDisplayedChild(0);
+		}
 	}
 
+	SimpleOnGestureListener simpleOnGestureListener = new SimpleOnGestureListener() {
+		@Override
+		public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
+				float velocityY) {
+			float sensitvity = 50;
+			if ((e1.getX() - e2.getX()) > sensitvity) {
+				swipeRightToLeft();
+			} else if ((e2.getX() - e1.getX()) > sensitvity) {
+				swipeLeftToRight();
+			}
+
+			return true;
+		}
+	};
+	
 }