Browse Source

Merge branch 'master' into feature_profile_manager_edit

Alexander Brakowski 10 years ago
parent
commit
52d2e48e0f

+ 3 - 2
res/layout/date_time_dialog.xml

@@ -11,11 +11,12 @@
         android:id="@+id/DatePicker"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginRight="40dp" />
+         />
 
     <TimePicker
         android:id="@+id/TimePicker"
         android:layout_width="wrap_content"
-        android:layout_height="wrap_content" />
+        android:layout_height="wrap_content"
+         />
 
 </LinearLayout>

+ 19 - 0
res/layout/expandable_section_header.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical"
+    android:padding="8dp"
+    android:background="#000000">
+
+
+    <TextView
+        android:id="@+id/sectionHeaderTitle"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:paddingLeft="?android:attr/expandableListPreferredItemPaddingLeft"
+        android:textSize="17dp"
+        android:textColor="#f9f93d" />
+
+</LinearLayout>

+ 19 - 13
res/layout/fragment_record_list.xml

@@ -4,17 +4,23 @@
     android:layout_height="match_parent"
     >
 
-    <ListView
-        android:id="@+id/loglistview"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true"
-        android:paddingBottom="50dp"
-        android:clipToPadding="false"
-        >
+            <ExpandableListView
+                xmlns:android="http://schemas.android.com/apk/res/android"
+                android:id="@+id/loglistview"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_above="@+id/linearLayout"
+                android:layout_alignParentLeft="true"
+                android:layout_alignParentTop="true"
+                android:layout_marginLeft="0dp"
+                android:layout_marginTop="0dp"
+                android:background="#F2F2F2"
+                android:choiceMode="singleChoice"
+                android:divider="@android:color/transparent"
+                android:dividerHeight="10dp"
+                android:padding="5dp" >
 
-    </ListView>
+    </ExpandableListView>
 
     <RelativeLayout
         style="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse"
@@ -31,7 +37,7 @@
             style="@android:style/Widget.DeviceDefault.ActionButton.Overflow"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:id="@+id/imageButton2"
+            android:id="@+id/SortButton"
             android:src="@drawable/ic_sort_by_size"
             android:layout_gravity="right"
             android:layout_alignParentTop="true"
@@ -42,10 +48,10 @@
             style="@android:style/Widget.DeviceDefault.ActionButton.Overflow"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:id="@+id/imageButton"
+            android:id="@+id/FilterButton"
             android:src="@drawable/ic_filter"
             android:layout_alignParentTop="true"
-            android:layout_toLeftOf="@+id/imageButton2"/>
+            android:layout_toLeftOf="@+id/SortButton"/>
     </RelativeLayout>
 
 </RelativeLayout>

+ 4 - 572
res/layout/fragment_services.xml

@@ -106,580 +106,12 @@
             android:layout_marginRight="15dp"
             android:background="@android:color/darker_gray" />
 
-    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-                android:layout_width="fill_parent"
-                android:layout_height="fill_parent"
+    <ListView android:layout_width="fill_parent"
+              android:layout_height="wrap_content"
+              android:id="@+id/services_list_view"
             >
-        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                      android:orientation="vertical"
-                      android:layout_width="match_parent"
-                      android:layout_height="match_parent">
-    <RelativeLayout android:layout_width="fill_parent"
-                    android:layout_height="wrap_content"
-                    android:baselineAligned="false"
-                    android:orientation="horizontal"
-                    android:weightSum="1" >
-        <TextView
-                android:id="@+id/textViewSSH"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentRight="false"
-                android:layout_marginLeft="50dp"
-                android:layout_marginTop="5dp"
-                android:layout_weight="1"
-                android:text="SSH"
-                android:textStyle="bold"
-                android:textSize="16dp"/>
-        <TextView
-                android:id="@+id/textViewSSHAttacks"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentRight="false"
-                android:layout_marginLeft="50dp"
-                android:layout_marginTop="25dp"
-                android:layout_weight="1"
-                android:text="recorded attacks: 20"
-                android:textStyle="bold"
-                android:textSize="12dp"/>
-        <Switch
-                android:id="@+id/ssh_switch"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentBottom="false"
-                android:layout_alignParentEnd="false"
-                android:layout_alignParentLeft="false"
-                android:layout_alignParentRight="true"
-                android:layout_alignParentTop="false"
-                android:layout_gravity="right"
-                android:layout_marginLeft="0dp"
-                android:layout_marginRight="15dp"
-                android:layout_marginTop="10dp"
-                android:layout_marginBottom="0dp"
-                android:layout_weight="1"
-                android:checked="false"
-                android:textSize="10dp" />
-    </RelativeLayout>
-
-    <View
-            android:layout_width="fill_parent"
-            android:layout_height="1dp"
-            android:layout_marginLeft="15dp"
-            android:layout_marginRight="15dp"
-            android:background="@android:color/darker_gray" />
-
-    <RelativeLayout android:layout_width="fill_parent"
-                    android:layout_height="wrap_content"
-                    android:baselineAligned="false"
-                    android:orientation="horizontal"
-                    android:weightSum="1" >
-    <TextView
-            android:id="@+id/textViewFTP"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignParentEnd="true"
-            android:layout_alignParentLeft="true"
-            android:layout_alignParentRight="false"
-            android:layout_marginLeft="50dp"
-            android:layout_marginTop="5dp"
-            android:layout_weight="1"
-            android:text="FTP"
-            android:textStyle="bold"
-            android:textSize="16dp"/>
-    <TextView
-            android:id="@+id/textViewFTPAttacks"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignParentEnd="true"
-            android:layout_alignParentLeft="true"
-            android:layout_alignParentRight="false"
-            android:layout_marginLeft="50dp"
-            android:layout_marginTop="25dp"
-            android:layout_weight="1"
-            android:text="recorded attacks: 2"
-            android:textStyle="bold"
-            android:textSize="12dp"/>
-    <Switch
-            android:id="@+id/ftp_switch"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignParentBottom="false"
-            android:layout_alignParentEnd="false"
-            android:layout_alignParentLeft="false"
-            android:layout_alignParentRight="true"
-            android:layout_alignParentTop="false"
-            android:layout_gravity="right"
-            android:layout_marginLeft="0dp"
-            android:layout_marginRight="15dp"
-            android:layout_marginTop="10dp"
-            android:layout_marginBottom="0dp"
-            android:layout_weight="1"
-            android:checked="false"
-            android:textSize="10dp" />
-</RelativeLayout>
-
-    <View
-            android:layout_width="fill_parent"
-            android:layout_height="1dp"
-            android:layout_marginLeft="15dp"
-            android:layout_marginRight="15dp"
-            android:background="@android:color/darker_gray" />
-
-    <RelativeLayout android:layout_width="fill_parent"
-                    android:layout_height="wrap_content"
-                    android:baselineAligned="false"
-                    android:orientation="horizontal"
-                    android:weightSum="1" >
-        <TextView
-                android:id="@+id/textViewHTTP"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentRight="false"
-                android:layout_marginLeft="50dp"
-                android:layout_marginTop="5dp"
-                android:layout_weight="1"
-                android:text="HTTP"
-                android:textStyle="bold"
-                android:textSize="16dp"/>
-        <TextView
-                android:id="@+id/textViewHTTPAttacks"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentRight="false"
-                android:layout_marginLeft="50dp"
-                android:layout_marginTop="25dp"
-                android:layout_weight="1"
-                android:text="recorded attacks: 13"
-                android:textStyle="bold"
-                android:textSize="12dp"/>
-        <Switch
-                android:id="@+id/http_switch"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentBottom="false"
-                android:layout_alignParentEnd="false"
-                android:layout_alignParentLeft="false"
-                android:layout_alignParentRight="true"
-                android:layout_alignParentTop="false"
-                android:layout_gravity="right"
-                android:layout_marginLeft="0dp"
-                android:layout_marginRight="15dp"
-                android:layout_marginTop="10dp"
-                android:layout_marginBottom="0dp"
-                android:layout_weight="1"
-                android:checked="false"
-                android:textSize="10dp" />
-    </RelativeLayout>
-
-    <View
-            android:layout_width="fill_parent"
-            android:layout_height="1dp"
-            android:layout_marginLeft="15dp"
-            android:layout_marginRight="15dp"
-            android:background="@android:color/darker_gray" />
-
-    <RelativeLayout android:layout_width="fill_parent"
-                    android:layout_height="wrap_content"
-                    android:baselineAligned="false"
-                    android:orientation="horizontal"
-                    android:weightSum="1" >
-        <TextView
-                android:id="@+id/textViewHTTPS"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentRight="false"
-                android:layout_marginLeft="50dp"
-                android:layout_marginTop="5dp"
-                android:layout_weight="1"
-                android:text="HTTPS"
-                android:textStyle="bold"
-                android:textSize="16dp"/>
-        <TextView
-                android:id="@+id/textViewHTTPSAttacks"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentRight="false"
-                android:layout_marginLeft="50dp"
-                android:layout_marginTop="25dp"
-                android:layout_weight="1"
-                android:text="recorded attacks: 20"
-                android:textStyle="bold"
-                android:textSize="12dp"/>
-        <Switch
-                android:id="@+id/https_switch"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentBottom="false"
-                android:layout_alignParentEnd="false"
-                android:layout_alignParentLeft="false"
-                android:layout_alignParentRight="true"
-                android:layout_alignParentTop="false"
-                android:layout_gravity="right"
-                android:layout_marginLeft="0dp"
-                android:layout_marginRight="15dp"
-                android:layout_marginTop="10dp"
-                android:layout_marginBottom="0dp"
-                android:layout_weight="1"
-                android:checked="false"
-                android:textSize="10dp" />
-    </RelativeLayout>
-
-    <View
-            android:layout_width="fill_parent"
-            android:layout_height="1dp"
-            android:layout_marginLeft="15dp"
-            android:layout_marginRight="15dp"
-            android:background="@android:color/darker_gray" />
-
-    <RelativeLayout android:layout_width="fill_parent"
-                    android:layout_height="wrap_content"
-                    android:baselineAligned="false"
-                    android:orientation="horizontal"
-                    android:weightSum="1" >
-        <TextView
-                android:id="@+id/textViewSAMBA"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentRight="false"
-                android:layout_marginLeft="50dp"
-                android:layout_marginTop="5dp"
-                android:layout_weight="1"
-                android:text="SAMBA"
-                android:textStyle="bold"
-                android:textSize="16dp"/>
-        <TextView
-                android:id="@+id/textViewSAMBAAttacks"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentRight="false"
-                android:layout_marginLeft="50dp"
-                android:layout_marginTop="25dp"
-                android:layout_weight="1"
-                android:text="recorded attacks: 0"
-                android:textStyle="bold"
-                android:textSize="12dp"/>
-        <Switch
-                android:id="@+id/samba_switch"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentBottom="false"
-                android:layout_alignParentEnd="false"
-                android:layout_alignParentLeft="false"
-                android:layout_alignParentRight="true"
-                android:layout_alignParentTop="false"
-                android:layout_gravity="right"
-                android:layout_marginLeft="0dp"
-                android:layout_marginRight="15dp"
-                android:layout_marginTop="10dp"
-                android:layout_marginBottom="0dp"
-                android:layout_weight="1"
-                android:checked="false"
-                android:textSize="10dp" />
-    </RelativeLayout>
-
-    <View
-            android:layout_width="fill_parent"
-            android:layout_height="1dp"
-            android:layout_marginLeft="15dp"
-            android:layout_marginRight="15dp"
-            android:background="@android:color/darker_gray" />
-
-    <RelativeLayout android:layout_width="fill_parent"
-                    android:layout_height="wrap_content"
-                    android:baselineAligned="false"
-                    android:orientation="horizontal"
-                    android:weightSum="1" >
-        <TextView
-                android:id="@+id/textViewTELNET"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentRight="false"
-                android:layout_marginLeft="50dp"
-                android:layout_marginTop="5dp"
-                android:layout_weight="1"
-                android:text="TELNET"
-                android:textStyle="bold"
-                android:textSize="16dp"/>
-        <TextView
-                android:id="@+id/textViewTELNETAttacks"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentRight="false"
-                android:layout_marginLeft="50dp"
-                android:layout_marginTop="25dp"
-                android:layout_weight="1"
-                android:text="recorded attacks: 20"
-                android:textStyle="bold"
-                android:textSize="12dp"/>
-        <Switch
-                android:id="@+id/telnet_switch"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentBottom="false"
-                android:layout_alignParentEnd="false"
-                android:layout_alignParentLeft="false"
-                android:layout_alignParentRight="true"
-                android:layout_alignParentTop="false"
-                android:layout_gravity="right"
-                android:layout_marginLeft="0dp"
-                android:layout_marginRight="15dp"
-                android:layout_marginTop="10dp"
-                android:layout_marginBottom="0dp"
-                android:layout_weight="1"
-                android:checked="false"
-                android:textSize="10dp" />
-    </RelativeLayout>
 
-    <View
-            android:layout_width="fill_parent"
-            android:layout_height="1dp"
-            android:layout_marginLeft="15dp"
-            android:layout_marginRight="15dp"
-            android:background="@android:color/darker_gray" />
 
-    <RelativeLayout android:layout_width="fill_parent"
-                    android:layout_height="wrap_content"
-                    android:baselineAligned="false"
-                    android:orientation="horizontal"
-                    android:weightSum="1" >
-        <TextView
-                android:id="@+id/textViewSSH"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentRight="false"
-                android:layout_marginLeft="50dp"
-                android:layout_marginTop="5dp"
-                android:layout_weight="1"
-                android:text="SSH"
-                android:textStyle="bold"
-                android:textSize="16dp"/>
-        <TextView
-                android:id="@+id/textViewSSHAttacks"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentRight="false"
-                android:layout_marginLeft="50dp"
-                android:layout_marginTop="25dp"
-                android:layout_weight="1"
-                android:text="recorded attacks: 20"
-                android:textStyle="bold"
-                android:textSize="12dp"/>
-        <Switch
-                android:id="@+id/home_switch_connection"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentBottom="false"
-                android:layout_alignParentEnd="false"
-                android:layout_alignParentLeft="false"
-                android:layout_alignParentRight="true"
-                android:layout_alignParentTop="false"
-                android:layout_gravity="right"
-                android:layout_marginLeft="0dp"
-                android:layout_marginRight="15dp"
-                android:layout_marginTop="10dp"
-                android:layout_marginBottom="0dp"
-                android:layout_weight="1"
-                android:checked="false"
-                android:textSize="10dp" />
-    </RelativeLayout>
+    </ListView>
 
-    <View
-            android:layout_width="fill_parent"
-            android:layout_height="1dp"
-            android:layout_marginLeft="15dp"
-            android:layout_marginRight="15dp"
-            android:background="@android:color/darker_gray" />
-    <RelativeLayout android:layout_width="fill_parent"
-                    android:layout_height="wrap_content"
-                    android:baselineAligned="false"
-                    android:orientation="horizontal"
-                    android:weightSum="1" >
-        <TextView
-                android:id="@+id/textViewSSH"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentRight="false"
-                android:layout_marginLeft="50dp"
-                android:layout_marginTop="5dp"
-                android:layout_weight="1"
-                android:text="SSH"
-                android:textStyle="bold"
-                android:textSize="16dp"/>
-        <TextView
-                android:id="@+id/textViewSSHAttacks"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentRight="false"
-                android:layout_marginLeft="50dp"
-                android:layout_marginTop="25dp"
-                android:layout_weight="1"
-                android:text="recorded attacks: 20"
-                android:textStyle="bold"
-                android:textSize="12dp"/>
-        <Switch
-                android:id="@+id/home_switch_connection"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentBottom="false"
-                android:layout_alignParentEnd="false"
-                android:layout_alignParentLeft="false"
-                android:layout_alignParentRight="true"
-                android:layout_alignParentTop="false"
-                android:layout_gravity="right"
-                android:layout_marginLeft="0dp"
-                android:layout_marginRight="15dp"
-                android:layout_marginTop="10dp"
-                android:layout_marginBottom="0dp"
-                android:layout_weight="1"
-                android:checked="false"
-                android:textSize="10dp" />
-    </RelativeLayout>
-
-    <View
-            android:layout_width="fill_parent"
-            android:layout_height="1dp"
-            android:layout_marginLeft="15dp"
-            android:layout_marginRight="15dp"
-            android:background="@android:color/darker_gray" />
-    <RelativeLayout android:layout_width="fill_parent"
-                    android:layout_height="wrap_content"
-                    android:baselineAligned="false"
-                    android:orientation="horizontal"
-                    android:weightSum="1" >
-        <TextView
-                android:id="@+id/textViewSSH"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentRight="false"
-                android:layout_marginLeft="50dp"
-                android:layout_marginTop="5dp"
-                android:layout_weight="1"
-                android:text="SSH"
-                android:textStyle="bold"
-                android:textSize="16dp"/>
-        <TextView
-                android:id="@+id/textViewSSHAttacks"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentRight="false"
-                android:layout_marginLeft="50dp"
-                android:layout_marginTop="25dp"
-                android:layout_weight="1"
-                android:text="recorded attacks: 20"
-                android:textStyle="bold"
-                android:textSize="12dp"/>
-        <Switch
-                android:id="@+id/home_switch_connection"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentBottom="false"
-                android:layout_alignParentEnd="false"
-                android:layout_alignParentLeft="false"
-                android:layout_alignParentRight="true"
-                android:layout_alignParentTop="false"
-                android:layout_gravity="right"
-                android:layout_marginLeft="0dp"
-                android:layout_marginRight="15dp"
-                android:layout_marginTop="10dp"
-                android:layout_marginBottom="0dp"
-                android:layout_weight="1"
-                android:checked="false"
-                android:textSize="10dp" />
-    </RelativeLayout>
-
-    <View
-            android:layout_width="fill_parent"
-            android:layout_height="1dp"
-            android:layout_marginLeft="15dp"
-            android:layout_marginRight="15dp"
-            android:background="@android:color/darker_gray" />
-    <RelativeLayout android:layout_width="fill_parent"
-                    android:layout_height="wrap_content"
-                    android:baselineAligned="false"
-                    android:orientation="horizontal"
-                    android:weightSum="1" >
-        <TextView
-                android:id="@+id/textViewSSH"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentRight="false"
-                android:layout_marginLeft="50dp"
-                android:layout_marginTop="5dp"
-                android:layout_weight="1"
-                android:text="SSH"
-                android:textStyle="bold"
-                android:textSize="16dp"/>
-        <TextView
-                android:id="@+id/textViewSSHAttacks"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentRight="false"
-                android:layout_marginLeft="50dp"
-                android:layout_marginTop="25dp"
-                android:layout_weight="1"
-                android:text="recorded attacks: 20"
-                android:textStyle="bold"
-                android:textSize="12dp"/>
-        <Switch
-                android:id="@+id/home_switch_connection"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentBottom="false"
-                android:layout_alignParentEnd="false"
-                android:layout_alignParentLeft="false"
-                android:layout_alignParentRight="true"
-                android:layout_alignParentTop="false"
-                android:layout_gravity="right"
-                android:layout_marginLeft="0dp"
-                android:layout_marginRight="15dp"
-                android:layout_marginTop="10dp"
-                android:layout_marginBottom="0dp"
-                android:layout_weight="1"
-                android:checked="false"
-                android:textSize="10dp" />
-    </RelativeLayout>
-
-    <View
-            android:layout_width="fill_parent"
-            android:layout_height="1dp"
-            android:layout_marginLeft="15dp"
-            android:layout_marginRight="15dp"
-            android:background="@android:color/darker_gray" />
-    </LinearLayout>
-    </ScrollView>
 </LinearLayout>

+ 20 - 33
res/layout/loglist_row.xml

@@ -1,38 +1,25 @@
 <?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent" >
 
-    <TextView
-        android:id="@+id/RecordTextFieldBSSID"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true"
-        android:text="BSSID" />
-
-    <TextView
-        android:id="@+id/RecordTextFieldSSID"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_alignParentLeft="true"
-        android:layout_below="@+id/RecordTextFieldBSSID"
-        android:text="SSID" />
+<RelativeLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:id="@+id/profile_manager_root_view">
 
-    <TextView
-        android:id="@+id/RecordTextFieldProtocol"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
+    <ListView
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/profile_manager_listview"
+        android:choiceMode="singleChoice"
+        android:background="#F2F2F2"
+        android:dividerHeight="10dp"
+        android:divider="@android:color/transparent"
+        android:padding="5dp"
         android:layout_alignParentLeft="true"
-        android:layout_below="@+id/RecordTextFieldSSID"
-        android:text="Protocol" />
-
-    <TextView
-        android:id="@+id/RecordTextFieldTimestamp"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_alignParentLeft="true"
-        android:layout_below="@+id/RecordTextFieldProtocol"
-        android:text="Timestamp" />
+        android:layout_marginLeft="0dp"
+        android:layout_alignParentTop="true"
+        android:layout_marginTop="0dp" />
 
-</RelativeLayout>
+</RelativeLayout>

+ 50 - 0
res/layout/record_list_item.xml

@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:padding="5dp"
+    android:baselineAligned="false"
+    android:background="@drawable/panel_bg">
+
+    <TextView
+        android:id="@+id/RecordTextFieldBSSID"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentLeft="true"
+        android:layout_alignParentTop="true"
+        android:text="BSSID"
+        android:textAppearance="?android:attr/textAppearanceLarge" />
+
+    <TextView
+        android:id="@+id/RecordTextFieldSSID"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignLeft="@+id/RecordTextFieldBSSID"
+        android:layout_below="@+id/RecordTextFieldBSSID"
+        android:layout_marginTop="24dp"
+        android:text="ESSID"
+        android:textAppearance="?android:attr/textAppearanceSmall" />
+
+    <TextView
+        android:id="@+id/RecordTextFieldTimestamp"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignBaseline="@+id/RecordTextFieldSSID"
+        android:layout_alignBottom="@+id/RecordTextFieldSSID"
+        android:layout_alignParentRight="true"
+        android:layout_marginRight="5dp"
+        android:text="00:00:00"
+        android:textAppearance="?android:attr/textAppearanceSmall" />
+
+    <TextView
+        android:id="@+id/RecordTextFieldProtocol"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignBaseline="@+id/RecordTextFieldBSSID"
+        android:layout_alignBottom="@+id/RecordTextFieldBSSID"
+        android:layout_alignRight="@+id/RecordTextFieldTimestamp"
+        android:text="Protocol"
+        android:textAppearance="?android:attr/textAppearanceMedium" />
+
+</RelativeLayout>

+ 66 - 0
res/layout/services_list_item.xml

@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:orientation="vertical"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent">
+
+    <RelativeLayout android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:baselineAligned="false"
+                    android:orientation="horizontal"
+                    android:weightSum="1" >
+        <TextView
+                android:id="@+id/services_item_name"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentEnd="true"
+                android:layout_alignParentLeft="true"
+                android:layout_alignParentRight="false"
+                android:layout_marginLeft="50dp"
+                android:layout_marginTop="5dp"
+                android:layout_weight="1"
+                android:text="SSH"
+                android:textStyle="bold"
+                android:textSize="16dp"/>
+        <TextView
+                android:id="@+id/services_item_rec_attacks"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentEnd="true"
+                android:layout_alignParentLeft="true"
+                android:layout_alignParentRight="false"
+                android:layout_marginLeft="50dp"
+                android:layout_marginTop="25dp"
+                android:layout_weight="1"
+                android:text="recorded attacks: 20"
+                android:textStyle="bold"
+                android:textSize="12dp"/>
+        <Switch
+                android:id="@+id/services_item_switch"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentBottom="false"
+                android:layout_alignParentEnd="false"
+                android:layout_alignParentLeft="false"
+                android:layout_alignParentRight="true"
+                android:layout_alignParentTop="false"
+                android:layout_gravity="right"
+                android:layout_marginLeft="0dp"
+                android:layout_marginRight="15dp"
+                android:layout_marginTop="10dp"
+                android:layout_marginBottom="0dp"
+                android:layout_weight="1"
+                android:checked="false"
+                android:textSize="10dp" />
+    </RelativeLayout>
+
+    <View
+            android:layout_width="fill_parent"
+            android:layout_height="1dp"
+            android:layout_marginLeft="15dp"
+            android:layout_marginRight="15dp"
+            android:background="@android:color/darker_gray" />
+
+
+</LinearLayout>

+ 6 - 0
res/values/arrays.xml

@@ -12,4 +12,10 @@
         <item>All</item>
     </string-array>
 
+    <string-array name="Grouping">
+        <item>Protocol</item>
+        <item>BSSID</item>
+        <item>ESSID</item>
+    </string-array>
+
 </resources>

+ 22 - 11
src/de/tudarmstadt/informatik/hostage/ui/LogFilter.java

@@ -25,8 +25,8 @@ public class LogFilter implements Parcelable{
 				protocol(1),
 				_bssid(1),
 				ssid(3),
-				remoteHostName(5),
-				lcaolHostName(6),
+				//remoteHostName(5),
+				//lcaolHostName(6),
 				_attack_id(7),
 				_id(8);
 		        private final int id;
@@ -51,17 +51,19 @@ public class LogFilter implements Parcelable{
 	
 	
 	public LogFilter(){
-		this.belowTimestamp = Long.MAX_VALUE;
-		this.aboveTimestamp = Long.MIN_VALUE;
-		this.sorttype = SortType.timestamp;
-		this.BSSIDs = new ArrayList<String>();
-		this.ESSIDs = new ArrayList<String>();
-		this.protocols = new ArrayList<String>();
+		this.clear();
 
 	}
-	
-	
-	
+
+    public void clear(){
+        this.belowTimestamp = Long.MAX_VALUE;
+        this.aboveTimestamp = Long.MIN_VALUE;
+        this.sorttype = SortType.timestamp;
+        this.BSSIDs = new ArrayList<String>();
+        this.ESSIDs = new ArrayList<String>();
+        this.protocols = new ArrayList<String>();
+    }
+
 	    public int describeContents() {
 	        return 0;
 	    }
@@ -180,6 +182,15 @@ public class LogFilter implements Parcelable{
 		return this.convertArrayListToQueryString(this.protocols, key);
 	}
 
+    public boolean isSet(){
+        boolean hasTime = this.belowTimestamp != Long.MAX_VALUE|| this.aboveTimestamp != Long.MIN_VALUE;
+        boolean hasBSSIDs = this.getBSSIDs().size() > 0;
+        boolean hasESSIDs = this.getBSSIDs().size() > 0;
+        boolean hasProtocols = this.getProtocols().size() > 0;
+
+        return hasBSSIDs || hasESSIDs || hasProtocols | hasTime;
+    }
+
 	
 	public String convertArrayListToQueryString(ArrayList<String> list, String key){
 		String statement = "";

+ 37 - 37
src/de/tudarmstadt/informatik/hostage/ui/ViewLogTable.java

@@ -1,37 +1,37 @@
-package de.tudarmstadt.informatik.hostage.ui;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.widget.ScrollView;
-import android.widget.TextView;
-import de.tudarmstadt.informatik.hostage.logging.UglyDbHelper;
-import de.tudarmstadt.informatik.hostage.logging.Record;
-
-/**
- * Creates a simple log view. Shows the Information for every attack. The format
- * ist defined in {@link Record#toString(int)}.
- * 
- * @author Lars Pandikow
- * 
- */
-public class ViewLogTable extends Activity {
-
-	@Override
-	protected void onCreate(Bundle savedInstanceState) {
-		super.onCreate(savedInstanceState);
-		UglyDbHelper dbh = new UglyDbHelper(getBaseContext());
-		StringBuffer log = new StringBuffer();
-		// Create a log entry for every attack in the Database
-		for (Record record : dbh.getAllRecords()) {
-			log.append(record.toString());
-		}
-
-		ScrollView scroll = new ScrollView(this);
-		TextView text = new TextView(getApplicationContext());
-		text.setText(log);
-		text.setTextAppearance(this, android.R.style.TextAppearance_Medium);
-		scroll.addView(text);
-		setContentView(scroll);
-	}
-
-}
+package de.tudarmstadt.informatik.hostage.ui;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.widget.ScrollView;
+import android.widget.TextView;
+import de.tudarmstadt.informatik.hostage.logging.UglyDbHelper;
+import de.tudarmstadt.informatik.hostage.logging.Record;
+
+/**
+ * Creates a simple log view. Shows the Information for every attack. The format
+ * ist defined in {@link Record#toString(int)}.
+ * 
+ * @author Lars Pandikow
+ * 
+ */
+public class ViewLogTable extends Activity {
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		UglyDbHelper dbh = new UglyDbHelper(getBaseContext());
+		StringBuffer log = new StringBuffer();
+		// Create a log entry for every attack in the Database
+		for (Record record : dbh.getAllRecords()) {
+			log.append(record.toString());
+		}
+
+		ScrollView scroll = new ScrollView(this);
+		TextView text = new TextView(getApplicationContext());
+		text.setText(log);
+		text.setTextAppearance(this, android.R.style.TextAppearance_Medium);
+		scroll.addView(text);
+		setContentView(scroll);
+	}
+
+}

+ 1 - 3
src/de/tudarmstadt/informatik/hostage/ui2/activity/MainActivity.java

@@ -157,10 +157,8 @@ public class MainActivity extends Activity {
 				fragment = new HomeFragment();
 				break;
 			case 2:
-				//LogFilter filter = new LogFilter();
-				Intent intent = this.getIntent(); //new Intent(this, ViewLogTable.class);
+				Intent intent = this.getIntent();
 				intent.removeExtra(LogFilter.LOG_FILTER_INTENT_KEY);
-				//intent.putExtra(LogFilter.LOG_FILTER_INTENT_KEY, null);
 				fragment = new RecordOverviewFragment();
 				break;
 			case 3:

+ 122 - 0
src/de/tudarmstadt/informatik/hostage/ui2/adapter/ExpandableListAdapter.java

@@ -0,0 +1,122 @@
+package de.tudarmstadt.informatik.hostage.ui2.adapter;
+
+import android.view.View;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+        import java.util.List;
+
+        import android.content.Context;
+        import android.view.LayoutInflater;
+        import android.view.ViewGroup;
+        import android.widget.BaseExpandableListAdapter;
+
+import de.tudarmstadt.informatik.hostage.ui2.model.ExpandableListItem;
+
+/**
+ * Created by Julien on 06.02.14.
+ */
+public abstract class ExpandableListAdapter extends BaseExpandableListAdapter {
+
+    private Context _context;
+
+    // header titles
+    public List<String> _sectionHeader;
+    // data in format of header title, childs list
+    public HashMap<String, ArrayList<ExpandableListItem>> _sectionTitleToChildData;
+
+    /*CONSTRUCTOR*/
+    public ExpandableListAdapter(Context context, List<String> listSectionHeaders,
+                                 HashMap<String, ArrayList<ExpandableListItem>> dataMapping) {
+        this._context = context;
+        this._sectionHeader = listSectionHeaders;
+        this._sectionTitleToChildData = dataMapping;
+    }
+
+    @Override
+    public Object getChild(int section, int row) {
+        return this._sectionTitleToChildData.get(this._sectionHeader.get(section))
+                .get(row);
+    }
+
+    @Override
+    public long getChildId(int section, int row) {
+        return row;
+    }
+
+    @Override
+    public View getChildView(int section, final int row,
+                             boolean isLastChild, View convertView, ViewGroup parent) {
+        if (convertView == null) {
+            LayoutInflater infalInflater = (LayoutInflater) this._context
+                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+            convertView = infalInflater.inflate(this.getCellLayoutID(), null);
+        }
+        this.configureCellView(convertView, section, row);
+        return convertView;
+    }
+
+    @Override
+    public int getChildrenCount(int section) {
+        return this._sectionTitleToChildData.get(this._sectionHeader.get(section))
+                .size();
+    }
+
+    @Override
+    public Object getGroup(int section) {
+        return this._sectionHeader.get(section);
+    }
+
+    @Override
+    public int getGroupCount() {
+        return this._sectionHeader.size();
+    }
+
+    @Override
+    public long getGroupId(int section) {
+        return section;
+    }
+
+    @Override
+    public View getGroupView(int section, boolean isExpanded,
+                             View convertView, ViewGroup parent) {
+
+        if (convertView == null) {
+            LayoutInflater infalInflater = (LayoutInflater) this._context
+                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+            convertView = infalInflater.inflate(this.getSectionLayoutID(), null);
+        }
+        this.configureSectionHeaderView(convertView, section);
+
+        return convertView;
+    }
+
+
+    public ExpandableListItem getDataForRow(int section, int row){
+        return this._sectionTitleToChildData.get(this._sectionHeader.get(section)).get(row);
+    }
+
+
+    public abstract void configureCellView(View cell, int section, int row);
+    public abstract void configureSectionHeaderView(View sectionHeader, int section);
+
+    /*
+    * @return R.layout.list_section
+    * */
+    public abstract  int getSectionLayoutID();
+    /*
+     * @return R.layout.list_cell
+     * */
+    public abstract  int getCellLayoutID();
+
+
+    @Override
+    public boolean hasStableIds() {
+        return false;
+    }
+
+    @Override
+    public boolean isChildSelectable(int section, int row) {
+        return true;
+    }
+}

+ 0 - 1
src/de/tudarmstadt/informatik/hostage/ui2/adapter/ProfileManagerListAdapter.java

@@ -2,7 +2,6 @@ package de.tudarmstadt.informatik.hostage.ui2.adapter;
 
 import android.content.Context;
 import android.view.LayoutInflater;
-import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.animation.Animation;

+ 53 - 0
src/de/tudarmstadt/informatik/hostage/ui2/adapter/RecordListAdapter.java

@@ -0,0 +1,53 @@
+package de.tudarmstadt.informatik.hostage.ui2.adapter;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import android.content.Context;
+import android.view.View;
+import android.widget.TextView;
+import de.tudarmstadt.informatik.hostage.R;
+import de.tudarmstadt.informatik.hostage.ui2.model.ExpandableListItem;
+
+public class RecordListAdapter extends ExpandableListAdapter {
+
+    public RecordListAdapter(Context context, List<String> listSectionHeaders, HashMap<String, ArrayList<ExpandableListItem>> dataMapping) {
+        super(context, listSectionHeaders, dataMapping);
+    }
+
+
+    /*****************************
+     *
+     *          Required Methods
+     *
+     * ***************************/
+
+    @Override
+    public void configureCellView(View cell, int section, int row) {
+        ExpandableListItem object = this.getDataForRow(section, row);
+        for (String key : object.getId_Mapping().keySet()){
+            int viewID = object.getId_Mapping().get(key);
+            String textualInfo = object.getData().get(key);
+            TextView tView = (TextView) cell.findViewById(viewID);
+            tView.setText(textualInfo);
+        }
+    }
+
+    @Override
+    public void configureSectionHeaderView(View sectionHeader, int section) {
+        int headerLabelID = R.id.sectionHeaderTitle;
+        TextView tView = (TextView) sectionHeader.findViewById(headerLabelID);
+        tView.setText(this._sectionHeader.get(section));
+    }
+
+    @Override
+    public int getSectionLayoutID() {
+        return R.layout.expandable_section_header;
+    }
+
+    @Override
+    public int getCellLayoutID() {
+        return R.layout.record_list_item;
+    }
+}

+ 70 - 0
src/de/tudarmstadt/informatik/hostage/ui2/adapter/ServicesListAdapter.java

@@ -0,0 +1,70 @@
+package de.tudarmstadt.informatik.hostage.ui2.adapter;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.Switch;
+import android.widget.TextView;
+import android.widget.ViewSwitcher;
+
+import java.util.List;
+
+import de.tudarmstadt.informatik.hostage.R;
+import de.tudarmstadt.informatik.hostage.ui2.model.ServicesListItem;
+
+/**
+ * Created by Daniel Lazar on 06.02.14.
+ */
+public class ServicesListAdapter extends ArrayAdapter<ServicesListItem> {
+		private class ViewHolder {
+			public TextView protocolName;
+			public TextView recordedAttacks;
+			public Switch activated;
+		}
+
+	private final Context context;
+	private final List<ServicesListItem> values;
+
+	public ServicesListAdapter(Context context, List<ServicesListItem> objects){
+		super(context, R.layout.services_list_item, objects);
+
+		this.context = context;
+		this.values = objects;
+	}
+
+	@Override
+	public View getView(final int position, View convertView, ViewGroup parent) {
+		LayoutInflater inflater = (LayoutInflater) context
+				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+		View rowView = convertView;
+		ViewHolder holder = null;
+
+		final ServicesListItem item = values.get(position);
+
+		if(rowView == null){
+			rowView = inflater.inflate(R.layout.services_list_item, parent, false);
+
+			holder = new ViewHolder();
+			holder.protocolName = (TextView) rowView.findViewById(R.id.services_item_name);
+			holder.recordedAttacks = (TextView) rowView.findViewById(R.id.services_item_rec_attacks);
+			holder.activated = (Switch) rowView.findViewById(R.id.services_item_switch);
+
+			rowView.setTag(holder);
+		} else {
+			holder = (ViewHolder) rowView.getTag();
+		}
+
+		holder.protocolName.setText(item.protocol);
+		holder.recordedAttacks.setText(item.attacks);
+
+
+		return rowView;
+	}
+
+}

+ 45 - 38
src/de/tudarmstadt/informatik/hostage/ui2/dialog/ChecklistDialog.java

@@ -2,35 +2,39 @@ package de.tudarmstadt.informatik.hostage.ui2.dialog;
 
 import java.util.ArrayList;
 
+import android.annotation.SuppressLint;
 import android.app.Activity;
 import android.app.AlertDialog;
 import android.app.Dialog;
 import android.app.DialogFragment;
 import android.content.DialogInterface;
-import android.content.Intent;
+//import android.content.Intent;
 import android.os.Bundle;
 import de.tudarmstadt.informatik.hostage.R;
 import de.tudarmstadt.informatik.hostage.ui2.activity.MainActivity;
 
+@SuppressLint("ValidFragment")
 public class ChecklistDialog extends DialogFragment {
 	
 	private ArrayList<Integer> mSelectedItems;
 	private ArrayList<String> itemTitles;
     private ChecklistDialogListener mListener;
     
+    private int selectedIndex;
     private boolean isMultipleChoice;
     
     public String title;
 
-	static public final String DIALOG_TITLE_KEY = "DIALOG_TITLE_KEY";
-	static public final String DIALOG_IS_MULTIPLECHOICE_KEY = "DIALOG_IS_MULTIPLECHOICE_KEY";
-	static public final String DIALOG_SELECTED_INDEX_KEY = "DIALOG_SELECTED_INDEX_KEY";
-
-	static public final String DIALOG_TITLE_ARRAY_KEY = "DIALOG_TITLE_ARRAY_KEY";
-	static public final String DIALOG_MULTIPLECHOICE_SELECTED_KEY = "DIALOG_MULTIPLECHOICE_SELECTED_KEY";
+//	static public final String DIALOG_TITLE_KEY = "DIALOG_TITLE_KEY";
+//	static public final String DIALOG_IS_MULTIPLECHOICE_KEY = "DIALOG_IS_MULTIPLECHOICE_KEY";
+//	static public final String DIALOG_SELECTED_INDEX_KEY = "DIALOG_SELECTED_INDEX_KEY";
+//
+//	static public final String DIALOG_TITLE_ARRAY_KEY = "DIALOG_TITLE_ARRAY_KEY";
+//	static public final String DIALOG_MULTIPLECHOICE_SELECTED_KEY = "DIALOG_MULTIPLECHOICE_SELECTED_KEY";
 	
 	
-    public interface ChecklistDialogListener {
+    @SuppressLint("ValidFragment")
+	public interface ChecklistDialogListener {
         public void onDialogPositiveClick(ChecklistDialog dialog);
         public void onDialogNegativeClick(ChecklistDialog dialog);
     }
@@ -43,9 +47,38 @@ public class ChecklistDialog extends DialogFragment {
     	return this.isMultipleChoice;
     }
     
+    public ChecklistDialog(String title, ArrayList<String> itemTitles, boolean[] selected, boolean isMultipleChoice , ChecklistDialogListener listener){
+    	mListener = listener;
+    	this.mSelectedItems = new ArrayList<Integer>();
+	    
+    	this.isMultipleChoice = isMultipleChoice;
+	    this.title = title;
+	    this.itemTitles = itemTitles;
+
+	    
+	    
+	    boolean[] selectedArray = new boolean[this.itemTitles.size()];
+
+	    if(this.isMultipleChoice){
+		    for(int i = 0; i < this.itemTitles.size(); i++){
+		    	boolean isSelected = selected[i];
+		    	selectedArray[i] = isSelected;
+		    	if(isSelected) this.mSelectedItems.add(i);
+		    }
+	    } else {
+		    for(int i = 0; i < this.itemTitles.size(); i++){
+		    	boolean isSelected = selected[i];
+		    	selectedArray[i] = isSelected;
+		    	if(isSelected) this.selectedIndex = i;
+		    }
+	    }
+    }
+    
     @Override
     public void onAttach(Activity activity) {
         super.onAttach(activity);
+        
+        if(this.mListener == null)
         try {
             
             if (activity.getClass().equals(MainActivity.class)){
@@ -69,39 +102,15 @@ public class ChecklistDialog extends DialogFragment {
 	
 	@Override
 	public Dialog onCreateDialog(Bundle savedInstanceState) {
-	    mSelectedItems = new ArrayList<Integer>();
 	    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
 	    
-	    Intent intent = this.getActivity().getIntent();
-	    String title = intent.getStringExtra(DIALOG_TITLE_KEY);
-	    this.isMultipleChoice = intent.getBooleanExtra(DIALOG_IS_MULTIPLECHOICE_KEY, true);
-
-	    this.title = title;
-	    
-	    this.itemTitles =  intent.getStringArrayListExtra(DIALOG_TITLE_ARRAY_KEY);
 	    CharSequence[] titles = this.itemTitles.toArray(new CharSequence[this.itemTitles.size()]);
-
-	    ArrayList<String> selectedTitles = null;
-	    
-	    int selectedIndex = 0;
 	    
 	    boolean[] selectedArray = new boolean[this.itemTitles.size()];
-
-	    if(this.isMultipleChoice){
-	    	selectedTitles = intent.getStringArrayListExtra(DIALOG_MULTIPLECHOICE_SELECTED_KEY);
-	        int i = 0;
-		    for(String t : this.itemTitles){
-		    	boolean isSelected = selectedTitles.contains(t);
-		    	selectedArray[i] = isSelected;
-		    	if(isSelected) this.mSelectedItems.add(i);
-		    	i++;
-		    }
-	    } else {
-	    	 selectedIndex = intent.getIntExtra(DIALOG_SELECTED_INDEX_KEY,selectedIndex); 
+	    for(Integer selection : this.mSelectedItems){
+	    	selectedArray[selection.intValue()] = true;
 	    }
-	    
-	
-	    
+
 	    if(this.isMultipleChoice){
 	        builder.setTitle(title).setMultiChoiceItems(titles, selectedArray,
                     new DialogInterface.OnMultiChoiceClickListener() {
@@ -126,7 +135,7 @@ public class ChecklistDialog extends DialogFragment {
 	        
 	    } else {
 	    	
-	    	 builder.setTitle(title).setSingleChoiceItems(titles, selectedIndex, 
+	    	 builder.setTitle(title).setSingleChoiceItems(titles, this.selectedIndex, 
 	    			 new DialogInterface.OnClickListener() {
 	             public void onClick(DialogInterface dialog, int id) {
 	                 mSelectedItems.clear();
@@ -145,8 +154,6 @@ public class ChecklistDialog extends DialogFragment {
 	         });
 	    }
 	    
-	
-
 	    return builder.create();
 	}
 }

+ 17 - 1
src/de/tudarmstadt/informatik/hostage/ui2/dialog/DateTimeDialogFragment.java

@@ -2,6 +2,7 @@ package de.tudarmstadt.informatik.hostage.ui2.dialog;
 
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
+import java.util.Date;
 import java.util.Locale;
 
 import de.tudarmstadt.informatik.hostage.R;
@@ -85,7 +86,21 @@ public class DateTimeDialogFragment extends DialogFragment implements OnDateChan
             break;
         }
     }
-    
+
+    public void setDate(long timeInMillis){
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTimeInMillis (timeInMillis);
+
+        int year    = calendar.get(Calendar.YEAR) ;
+        int month   = calendar.get(Calendar.MONTH);
+        int day     = calendar.get(Calendar.DATE);
+        int hour    = calendar.get(Calendar.HOUR);
+        int min     = calendar.get(Calendar.MINUTE);
+
+        datePicker.updateDate(year, month, day);
+        timePicker.setCurrentHour(hour);
+        timePicker.setCurrentMinute(min);
+    }
 
    public long getDate(){
 	   
@@ -97,6 +112,7 @@ public class DateTimeDialogFragment extends DialogFragment implements OnDateChan
        int minute = timePicker.getCurrentMinute();
 
        Calendar calendar = Calendar.getInstance();
+
        calendar.set(year, month, day, hourOfDay, minute);
 
        return calendar.getTime().getTime();

+ 342 - 187
src/de/tudarmstadt/informatik/hostage/ui2/fragment/RecordOverviewFragment.java

@@ -1,7 +1,5 @@
 package de.tudarmstadt.informatik.hostage.ui2.fragment;
 
-import java.net.InetAddress;
-import java.net.UnknownHostException;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -13,18 +11,21 @@ import android.annotation.SuppressLint;
 import android.app.Fragment;
 import android.content.Context;
 import android.content.Intent;
+import android.graphics.Color;
 import android.os.Bundle;
+import android.text.SpannableString;
+import android.text.style.ForegroundColorSpan;
 import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
 import android.view.View;
 import android.view.ViewGroup;
-import android.widget.AbsListView;
 import android.widget.AdapterView;
-import android.widget.ListAdapter;
-import android.widget.ListView;
-import android.widget.SimpleAdapter;
+import android.widget.ExpandableListView;
+import android.widget.ImageButton;
+import android.widget.PopupMenu;
+import android.widget.PopupMenu.OnMenuItemClickListener;
 import android.widget.Toast;
 import de.tudarmstadt.informatik.hostage.R;
 import de.tudarmstadt.informatik.hostage.logging.Record;
@@ -32,8 +33,10 @@ import de.tudarmstadt.informatik.hostage.logging.Record.TYPE;
 import de.tudarmstadt.informatik.hostage.logging.UglyDbHelper;
 import de.tudarmstadt.informatik.hostage.ui.LogFilter;
 import de.tudarmstadt.informatik.hostage.ui.LogFilter.SortType;
+import de.tudarmstadt.informatik.hostage.ui2.adapter.RecordListAdapter;
 import de.tudarmstadt.informatik.hostage.ui2.dialog.ChecklistDialog;
 import de.tudarmstadt.informatik.hostage.ui2.dialog.DateTimeDialogFragment;
+import de.tudarmstadt.informatik.hostage.ui2.model.ExpandableListItem;
 
 public class RecordOverviewFragment extends Fragment implements ChecklistDialog.ChecklistDialogListener, DateTimeDialogFragment.DateTimeDialogFragmentListener {
 	static final String SELECTED_KEY = "Selected";
@@ -45,83 +48,165 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
 	static final String FILTER_MENU_TITLE_TIMESTAMP_BELOW = "To Date";
 	static final String FILTER_MENU_TITLE_TIMESTAMP_ABOVE = "From Date";
 	static final String FILTER_MENU_TITLE_SORTING = "Sort by";
-	static final String FILTER_MENU_TITLE_REMOVE = "Remove";
+	static final String FILTER_MENU_TITLE_REMOVE = "Reset Filter";
 	
 	private boolean wasBelowTimePicker;
 
 	private LogFilter filter;
-	private ListView listView;
 	private boolean showFilterButton;
+
+    public String groupingKey;
+
+    private ExpandableListView expListView;
+
 	UglyDbHelper dbh;
 	
-	
+
     public RecordOverviewFragment(){}
+    
 	
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setHasOptionsMenu(true);
     }
+    
 	public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
-
 		
 		dbh = new UglyDbHelper(this.getActivity().getBaseContext());
+
 	    // Get the message from the intent
-	    Intent intent = this.getActivity().getIntent();
-	    LogFilter filter = intent.getParcelableExtra(LogFilter.LOG_FILTER_INTENT_KEY);
 
-	    if(filter == null){
-	    	this.clearFilter();
-	    } else {
-	    	this.filter = filter;
-	    }
+        if (this.filter == null){
+            Intent intent = this.getActivity().getIntent();
+            LogFilter filter = intent.getParcelableExtra(LogFilter.LOG_FILTER_INTENT_KEY);
+
+            if(filter == null){
+                this.clearFilter();
+            } else {
+                this.filter = filter;
+            }
+        }
+
+
+
+        if (this.groupingKey == null) this.groupingKey = this.groupingTitles().get(0);
 
 	    this.setShowFilterButton(!this.filter.isNotEditable());
 	    
 	    this.addRecordToDB();
 	    
 		View rootView = inflater.inflate(R.layout.fragment_record_list, container, false);
-		ListView mylist = (ListView) rootView.findViewById(R.id.loglistview);
-		this.listView = mylist;
+		ExpandableListView mylist = (ExpandableListView) rootView.findViewById(R.id.loglistview);
+		this.expListView = mylist;
 		populateListViewFromDB(mylist);
 		
 		registerListClickCallback(mylist);
 		
+        ImageButton filterButton = (ImageButton) rootView.findViewById(R.id.FilterButton);
+        filterButton.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+            	RecordOverviewFragment.this.openFilterPopupMenuOnView(v);
+            }
+        });
+        filterButton.setVisibility(this.showFilterButton? View.VISIBLE : View.INVISIBLE);
+        
+        ImageButton sortButton = (ImageButton) rootView.findViewById(R.id.SortButton);
+        sortButton.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                // Open SortMenu
+                RecordOverviewFragment.this.openSortingDialog();
+            }
+        });
+		
 		return rootView;
 	 }
-	
-	private void clearFilter(){
-    	this.filter = new LogFilter();
-    	this.filter.setProtocols(this.protocolTitles());
-    	this.filter.setBSSIDs(this.bssids());
-    	this.filter.setESSIDs(this.essids());
+
+
+
+	public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+		super.onCreateOptionsMenu(menu, inflater);
 	}
+
+	public boolean onFilterMenuItemSelected(MenuItem item) {
+		String title = item.getTitle().toString();
+		
+		if(title.equals(FILTER_MENU_TITLE_BSSID)){
+			this.openBSSIDFilterDialog();
+		}
+		if(title.equals(FILTER_MENU_TITLE_ESSID)){
+			this.openESSIDFilterDialog();
+		}		
+		if(title.equals(FILTER_MENU_TITLE_PROTOCOLS)){
+			this.openProtocolsFilterDialog();
+		}
+		if(title.equals(FILTER_MENU_TITLE_SORTING)){
+			this.openSortingDialog();
+		}
+		if(title.equals(FILTER_MENU_TITLE_REMOVE)){
+			this.clearFilter();
+		}
+		if(title.equals(FILTER_MENU_TITLE_TIMESTAMP_BELOW)){
+			this.openTimestampToFilterDialog();
+		}
+		if(title.equals(FILTER_MENU_TITLE_TIMESTAMP_ABOVE)){
+			this.openTimestampFromFilterDialog();
+		}
+		return super.onOptionsItemSelected(item);
+	}
+	
 	
-	private void populateListViewFromDB(ListView mylist) {
+	
+	/*****************************
+	 * 
+	 *          ListView Stuff
+	 * 
+	 * ***************************/
+	
+	private void populateListViewFromDB(ExpandableListView mylist) {
 		
-		ArrayList<HashMap<String, String>> Items = new ArrayList<HashMap<String, String>>();
+		HashMap<String, ArrayList<ExpandableListItem>> sectionData = new HashMap<String, ArrayList<ExpandableListItem>>();
 
-		ArrayList<Record> data = dbh.getRecordsForFilter(this.filter);    
-		
+		ArrayList<Record> data = dbh.getRecordsForFilter(this.filter);
+
+        // Adding Items to ListView
+        String keys[] = new String[] { this.getString(R.string.RecordBSSID), this.getString(R.string.RecordSSID), this.getString(R.string.RecordProtocol), this.getString(R.string.RecordTimestamp)};
+        int ids[] = new int[] {R.id.RecordTextFieldBSSID, R.id.RecordTextFieldSSID, R.id.RecordTextFieldProtocol, R.id.RecordTextFieldTimestamp };
+
+        HashMap<String, Integer> mapping = new HashMap<String, Integer>();
+        int i = 0;
+        for(String key : keys){
+            mapping.put(key, ids[i]);
+            i++;
+        }
 
 		for (Record val : data) {
+            // DO GROUPING IN HERE
 			HashMap<String, String> map = new HashMap<String, String>();
 			map.put(this.getString(R.string.RecordBSSID), val.getBssid());
 			map.put(this.getString(R.string.RecordSSID), val.getSsid());
 			map.put(this.getString(R.string.RecordProtocol), val.getProtocol());
 			map.put(this.getString(R.string.RecordTimestamp),
 					this.getDateAsString(val.getTimestamp()));
-			Items.add(map);
+
+            ExpandableListItem item = new ExpandableListItem();
+            item.setData(map);
+            item.setId_Mapping(mapping);
+
+            String groupID = this.getGroupValue(val);
+
+            ArrayList<ExpandableListItem> items = sectionData.get(groupID);
+            if (items == null) {
+                items = new ArrayList<ExpandableListItem>();
+                sectionData.put(groupID, items);
+            }
+			items.add(item);
 		}
-	        
-	     // Adding Items to ListView
-	        String keys[] = new String[] { this.getString(R.string.RecordBSSID), this.getString(R.string.RecordSSID), this.getString(R.string.RecordProtocol), this.getString(R.string.RecordTimestamp)};
-	        int ids[] = new int[] {R.id.RecordTextFieldBSSID, R.id.RecordTextFieldSSID, R.id.RecordTextFieldProtocol, R.id.RecordTextFieldTimestamp };
-	        
-	        ListAdapter adapter = new SimpleAdapter(this.getActivity(), Items, R.layout.loglist_row, keys, ids);
-	        
-	        mylist.setAdapter(adapter);
+
+        RecordListAdapter adapter = new RecordListAdapter(this.getApplicationContext(),this.getGroupTitle(), sectionData);
+
+        mylist.setAdapter(adapter);
 	}
 	
 	private Context getBaseContext(){
@@ -132,7 +217,7 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
 		return this.getActivity().getApplicationContext();
 	}
 	
-	private void registerListClickCallback(ListView mylist) {
+	private void registerListClickCallback(ExpandableListView mylist) {
 
 		mylist.setOnItemClickListener(new AdapterView.OnItemClickListener() {
 			public void onItemClick(AdapterView<?> parent, View viewClicked,
@@ -161,97 +246,67 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
 				return message;
 			}
 
-			@SuppressLint("SimpleDateFormat")
-			private String getDateAsString(long timeStamp) {
-
-				try {
-					DateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
-					Date netDate = (new Date(timeStamp));
-					return sdf.format(netDate);
-				} catch (Exception ex) {
-					return "xx";
-				}
-			}
-
 		});
 	}
 	
+	
+	
+	/*****************************
+	 * 
+	 *          Date Transform
+	 * 
+	 * ***************************/
+	
+	
+	@SuppressLint("SimpleDateFormat")
+	private String getDateAsString(long timeStamp) {
 
-	public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
-		super.onCreateOptionsMenu(menu, inflater);
-		if(this.showFilterButton){
-			for(String title : this.filterTitles()){
-				MenuItem item = menu.add(title);
-				
-			}
+		try {
+			DateFormat sdf = new SimpleDateFormat("H:mm  dd/MM/yyyy");
+			Date netDate = (new Date(timeStamp));
+			return sdf.format(netDate);
+		} catch (Exception ex) {
+			return "xx";
 		}
 	}
+	
+	
+	/*****************************
+	 * 
+	 *          Getter / Setter
+	 * 
+	 * ***************************/
 
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item) {
-		String title = item.getTitle().toString();
-		
-		if(title.equals(FILTER_MENU_TITLE_BSSID)){
-			this.openBSSIDFilterDialog();
-		}
-		if(title.equals(FILTER_MENU_TITLE_ESSID)){
-			this.openESSIDFilterDialog();
-		}		
-		if(title.equals(FILTER_MENU_TITLE_PROTOCOLS)){
-			this.openProtocolsFilterDialog();
-		}
-		if(title.equals(FILTER_MENU_TITLE_SORTING)){
-			this.openSortingDialog();
-		}
-		if(title.equals(FILTER_MENU_TITLE_REMOVE)){
-			this.clearFilter();
-		}
-		if(title.equals(FILTER_MENU_TITLE_TIMESTAMP_BELOW)){
-			this.openTimestampToFilterDialog();
-		}
-		if(title.equals(FILTER_MENU_TITLE_TIMESTAMP_ABOVE)){
-			this.openTimestampFromFilterDialog();
-		}
-		return super.onOptionsItemSelected(item);
+	public boolean isShowFilterButton() {
+		return showFilterButton;
 	}
+
+	public void setShowFilterButton(boolean showFilterButton) {
+		this.showFilterButton = showFilterButton;
+	}
+	
 	
 	
+
+	/*****************************
+	 * 
+	 *          Open Dialog Methods
+	 * 
+	 * ***************************/
 	
 	
 	private void openBSSIDFilterDialog(){
-	    Intent intent = this.getActivity().getIntent();
-	    intent.putExtra(ChecklistDialog.DIALOG_TITLE_KEY, FILTER_MENU_TITLE_BSSID);
-	    intent.putExtra(ChecklistDialog.DIALOG_IS_MULTIPLECHOICE_KEY, true);
-
-	     intent.putStringArrayListExtra(ChecklistDialog.DIALOG_TITLE_ARRAY_KEY, this.bssids());
-	     intent.putStringArrayListExtra(ChecklistDialog.DIALOG_MULTIPLECHOICE_SELECTED_KEY, this.selectedBSSIDs());
-		
-		ChecklistDialog newFragment = new ChecklistDialog();
+		ChecklistDialog newFragment = new ChecklistDialog(FILTER_MENU_TITLE_BSSID,this.bssids(), this.selectedBSSIDs(), true , this);
 	    newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_TITLE_BSSID);
 	}
 	
 	private void openESSIDFilterDialog(){
-		
-	    Intent intent = this.getActivity().getIntent();
-	    intent.putExtra(ChecklistDialog.DIALOG_TITLE_KEY, FILTER_MENU_TITLE_ESSID);
-	    intent.putExtra(ChecklistDialog.DIALOG_IS_MULTIPLECHOICE_KEY, true);
-
-	     intent.putStringArrayListExtra(ChecklistDialog.DIALOG_TITLE_ARRAY_KEY, this.essids());
-	     intent.putStringArrayListExtra(ChecklistDialog.DIALOG_MULTIPLECHOICE_SELECTED_KEY, this.selectedESSIDs());
-		
-		ChecklistDialog newFragment = new ChecklistDialog();
+		ChecklistDialog newFragment = new ChecklistDialog(FILTER_MENU_TITLE_ESSID,this.essids(), this.selectedESSIDs(), true , this);
 	    newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_TITLE_ESSID);
 	}
 	
 	private void openProtocolsFilterDialog(){
-	    Intent intent = this.getActivity().getIntent();
-	    intent.putExtra(ChecklistDialog.DIALOG_TITLE_KEY, FILTER_MENU_TITLE_PROTOCOLS);
-	    intent.putExtra(ChecklistDialog.DIALOG_IS_MULTIPLECHOICE_KEY, true);
-
-	     intent.putStringArrayListExtra(ChecklistDialog.DIALOG_TITLE_ARRAY_KEY, this.protocolTitles());
-	     intent.putStringArrayListExtra(ChecklistDialog.DIALOG_MULTIPLECHOICE_SELECTED_KEY, this.selectedProtocols());
-		
-		ChecklistDialog newFragment = new ChecklistDialog();
+		ChecklistDialog newFragment = new ChecklistDialog(FILTER_MENU_TITLE_PROTOCOLS,this.protocolTitles(), this.selectedProtocols(), true , this);
 	    newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_TITLE_PROTOCOLS);
 	}
 	
@@ -259,74 +314,93 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
 		this.wasBelowTimePicker = false;
 		DateTimeDialogFragment newFragment = new DateTimeDialogFragment(this.getActivity());
 	    newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_TITLE_SORTING);
+        if (this.filter.aboveTimestamp != Long.MIN_VALUE)newFragment.setDate(this.filter.aboveTimestamp);
 	}
 	
 	private void openTimestampToFilterDialog(){
 		this.wasBelowTimePicker = true;
 		DateTimeDialogFragment newFragment = new DateTimeDialogFragment(this.getActivity());
 	    newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_TITLE_SORTING);
-	}
+        if (this.filter.belowTimestamp != Long.MAX_VALUE) newFragment.setDate(this.filter.belowTimestamp);
+    }
 	
 	private void openSortingDialog(){
-	    Intent intent = this.getActivity().getIntent();
-	    intent.putExtra(ChecklistDialog.DIALOG_TITLE_KEY, FILTER_MENU_TITLE_SORTING);
-	    intent.putExtra(ChecklistDialog.DIALOG_IS_MULTIPLECHOICE_KEY, false);
-	    
-	     intent.putStringArrayListExtra(ChecklistDialog.DIALOG_TITLE_ARRAY_KEY, this.sortTypeTtiles());
-	     intent.putExtra(ChecklistDialog.DIALOG_SELECTED_INDEX_KEY, this.filter.sorttype.getValue());
-		
-		ChecklistDialog newFragment = new ChecklistDialog();
+		ChecklistDialog newFragment = new ChecklistDialog(FILTER_MENU_TITLE_SORTING,this.sortTypeTtiles(), this.selectedSorttype(), false , this);
 	    newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_TITLE_SORTING);
 	}
-	
-	
-	public void onDialogPositiveClick(ChecklistDialog dialog) {
-		// TODO Auto-generated method stub
-		String title = dialog.getTitle();
-		if(title.equals(FILTER_MENU_TITLE_BSSID)){
-			this.filter.setBSSIDs(dialog.getSelectedItemTitles());
-		}
-		if(title.equals(FILTER_MENU_TITLE_ESSID)){
-			this.filter.setESSIDs(dialog.getSelectedItemTitles());
-		}
-		if(title.equals(FILTER_MENU_TITLE_PROTOCOLS)){
-			this.filter.setProtocols(dialog.getSelectedItemTitles());
-		}
-		if(title.equals(FILTER_MENU_TITLE_SORTING)){
-			ArrayList<String> titles = dialog.getSelectedItemTitles();
-			String t = titles.get(0);
-			int sortType = this.sortTypeTtiles().indexOf(t);
-			this.filter.setSorttype(SortType.values()[sortType]);
-		}
-		this.populateListViewFromDB(this.listView);
-	}
 
-	public void onDialogNegativeClick(ChecklistDialog dialog) {
-		// nothing in here
-	}
+    /*****************************
+     *
+     *          Grouping Stuff
+     *
+     * ***************************/
+
+    public String getGroupValue(Record rec){
+        int index = this.groupingTitles().indexOf(this.groupingKey);
+        switch (index){
+            case 0:
+                return rec.getProtocol();
+            case 1:
+                return rec.getBssid();
+            case 2:
+                return rec.getSsid();
+            default:
+                return rec.getProtocol();
+        }
+    }
 
-	
-	
-	@SuppressLint("SimpleDateFormat")
-	private String getDateAsString(long timeStamp) {
+    public ArrayList<String> getGroupTitle(){
+        int index = this.groupingTitles().indexOf(this.groupingKey);
+        switch (index){
+            case 0:
+                return this.protocolTitles();
+            case 1:
+                return this.bssids();
+            case 2:
+                return this.essids();
+            default:
+                return this.protocolTitles();
+        }
+    }
 
-		try {
-			DateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
-			Date netDate = (new Date(timeStamp));
-			return sdf.format(netDate);
-		} catch (Exception ex) {
-			return "xx";
+	/*****************************
+	 * 
+	 *          Filter Stuff
+	 * 
+	 * ***************************/
+	
+	private void openFilterPopupMenuOnView(View v){
+        // Open FilterMenu
+        PopupMenu filterMenu = new PopupMenu(getBaseContext(), v);
+		for(String title : RecordOverviewFragment.this.filterMenuTitles()){
+			// Set a white Title
+			SpannableString styledMenuTitle = new SpannableString(title);
+				styledMenuTitle.setSpan(new ForegroundColorSpan(Color.parseColor("#FFFFFF")), 0, title.length(), 0);
+				filterMenu.getMenu().add(styledMenuTitle);
 		}
+		filterMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
+            public boolean onMenuItemClick(MenuItem item) {
+                RecordOverviewFragment.this.onFilterMenuItemSelected(item);
+                return true;
+            }
+        });
+			filterMenu.show();
 	}
-
-	public boolean isShowFilterButton() {
-		return showFilterButton;
+	
+	
+	private void clearFilter(){
+    	if(filter == null) this.filter = new LogFilter();
+    	this.filter.clear();
 	}
 
-	public void setShowFilterButton(boolean showFilterButton) {
-		this.showFilterButton = showFilterButton;
-	}
-	
+    public ArrayList<String> groupingTitles(){
+        ArrayList<String> titles = new ArrayList<String>();
+        for (String groupTitle : this.getResources().getStringArray(
+                R.array.Grouping)) {
+            titles.add(groupTitle);
+        }
+        return titles;
+    }
 	
 	public ArrayList<String> protocolTitles(){
 		ArrayList<String> titles = new ArrayList<String>();
@@ -336,8 +410,16 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
 		}
 		return titles;
 	}
-	public ArrayList<String> selectedProtocols(){
-		return this.filter.protocols;
+	public boolean[] selectedProtocols(){
+		ArrayList<String> protocols = this.protocolTitles();
+		boolean[] selected = new boolean[protocols.size()];
+		
+		int i = 0;
+		for(String protocol : protocols){
+			selected[i] =(this.filter.protocols.contains(protocol));
+			i++;
+		}
+		return selected;
 	}
 
 	public ArrayList<String> sortTypeTtiles(){
@@ -346,48 +428,130 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
 		titles.add("Protocol");
 		titles.add("BSSID");
 		titles.add("ESSID");
-		titles.add("Remote Host Name");
-		titles.add("Local Host Name");
+		//titles.add("Remote Host Name");
+		//titles.add("Local Host Name");
 		//titles.add("Attack ID");
 		//titles.add("ID");
 		return titles;
 	}
+	public boolean[] selectedSorttype(){
+		ArrayList<String> types = this.sortTypeTtiles();
+		boolean[] selected = new boolean[types.size()];	
+		int i = 0;
+		for(String sorttype : types){
+			selected[i] =(this.filter.sorttype.toString() == sorttype);
+			i++;
+		}
+		return selected;
+	}
 	
 	public ArrayList<String> bssids(){
-		ArrayList<String> titles = new ArrayList<String>();
 		ArrayList<String> records = dbh.getUniqueBSSIDRecords();
-
 		return records;
 	}
-	public ArrayList<String> selectedBSSIDs(){
-		return this.filter.BSSIDs;
+	public boolean[] selectedBSSIDs(){
+		ArrayList<String> bssids = this.bssids();
+		boolean[] selected = new boolean[bssids.size()];
+		
+		int i = 0;
+		for(String bssid : bssids){
+			selected[i] =(this.filter.BSSIDs.contains(bssid));
+			i++;
+		}
+		return selected;
 	}
 
 
 	public ArrayList<String> essids(){
-		ArrayList<String> titles = new ArrayList<String>();
 		ArrayList<String> records = dbh.getUniqueESSIDRecords();
-
 		return records;
 	}
-	public ArrayList<String> selectedESSIDs(){
-		return this.filter.ESSIDs;
+	public boolean[] selectedESSIDs(){
+		ArrayList<String> essids = this.essids();
+		boolean[] selected = new boolean[essids.size()];
+		
+		int i = 0;
+		for(String essid : essids){
+			selected[i] =(this.filter.ESSIDs.contains(essid));
+			i++;
+		}
+		return selected;
 	}
 
 	
-	private ArrayList<String> filterTitles(){
+	private ArrayList<String> filterMenuTitles(){
 		ArrayList<String> titles = new ArrayList<String>();
 		titles.add(FILTER_MENU_TITLE_BSSID);
 		titles.add(FILTER_MENU_TITLE_ESSID);
 		titles.add(FILTER_MENU_TITLE_PROTOCOLS);
 		titles.add(FILTER_MENU_TITLE_TIMESTAMP_ABOVE);
 		titles.add(FILTER_MENU_TITLE_TIMESTAMP_BELOW);
-		titles.add(FILTER_MENU_TITLE_SORTING);
-		titles.add(FILTER_MENU_TITLE_REMOVE);
+        if (this.filter.isSet())titles.add(FILTER_MENU_TITLE_REMOVE);
 		return titles;
 	}
 
 	
+	/*****************************
+	 * 
+	 *          Listener Actions
+	 * 
+	 * ***************************/
+	
+	public void onDateTimePickerPositiveClick(DateTimeDialogFragment dialog) {
+		if(this.wasBelowTimePicker){
+			this.filter.setBelowTimestamp(dialog.getDate());
+		} else {
+			this.filter.setAboveTimestamp(dialog.getDate());
+		}
+		this.populateListViewFromDB(this.expListView);
+	}
+
+	public void onDateTimePickerNegativeClick(DateTimeDialogFragment dialog) {
+		if(this.wasBelowTimePicker){
+			this.filter.setBelowTimestamp(Long.MAX_VALUE);
+		} else {
+			this.filter.setAboveTimestamp(Long.MIN_VALUE);
+		}
+	}
+	
+	public void onDialogPositiveClick(ChecklistDialog dialog) {
+		String title = dialog.getTitle();
+		if(title.equals(FILTER_MENU_TITLE_BSSID)){
+            ArrayList<String> titles =dialog.getSelectedItemTitles();
+            if (titles.size() == this.bssids().size()){
+                this.filter.setBSSIDs(new ArrayList<String>());
+            } else {
+                this.filter.setBSSIDs(titles);
+            }
+		}
+		if(title.equals(FILTER_MENU_TITLE_ESSID)){
+            ArrayList<String> titles =dialog.getSelectedItemTitles();
+            if (titles.size() == this.essids().size()){
+                this.filter.setESSIDs(new ArrayList<String>());
+            } else {
+                this.filter.setESSIDs(titles);
+            }
+		}
+		if(title.equals(FILTER_MENU_TITLE_PROTOCOLS)){
+            ArrayList<String> protocols = dialog.getSelectedItemTitles();
+            if (protocols.size() == this.protocolTitles().size()){
+                this.filter.setProtocols(new ArrayList<String>());
+            } else {
+			    this.filter.setProtocols(dialog.getSelectedItemTitles());
+            }
+		}
+		if(title.equals(FILTER_MENU_TITLE_SORTING)){
+			ArrayList<String> titles = dialog.getSelectedItemTitles();
+			String t = titles.get(0);
+			int sortType = this.sortTypeTtiles().indexOf(t);
+			this.filter.setSorttype(SortType.values()[sortType]);
+		}
+		this.populateListViewFromDB(this.expListView);
+	}
+
+	public void onDialogNegativeClick(ChecklistDialog dialog) {
+
+	}
 	
 	
 	/*****************************
@@ -397,6 +561,9 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
 	 * ***************************/
 	
 	private void addRecordToDB() {
+
+        if (dbh.getAllRecords().size() > 0) return;
+
 		Calendar cal = Calendar.getInstance();
 
 		int maxProtocolsIndex = this.getResources().getStringArray(
@@ -425,17 +592,5 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
 		}
 	}
 
-	public void onDateTimePickerPositiveClick(DateTimeDialogFragment dialog) {
-		if(this.wasBelowTimePicker){
-			this.filter.setBelowTimestamp(dialog.getDate());
-		} else {
-			this.filter.setAboveTimestamp(dialog.getDate());
-		}
-		this.populateListViewFromDB(listView);
-	}
-
-	public void onDateTimePickerNegativeClick(DateTimeDialogFragment dialog) {
-		// nothing in here
-	}
 
 }

+ 66 - 47
src/de/tudarmstadt/informatik/hostage/ui2/fragment/ServicesFragment.java

@@ -1,18 +1,28 @@
 package de.tudarmstadt.informatik.hostage.ui2.fragment;
 
 
+import android.app.AlertDialog;
+import android.content.DialogInterface;
 import android.os.Bundle;
 import android.app.Fragment;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.CompoundButton;
+import android.widget.ListView;
 import android.widget.Switch;
 import android.widget.TextView;
 
+import java.util.ArrayList;
+
 import de.tudarmstadt.informatik.hostage.HoneyService;
 import de.tudarmstadt.informatik.hostage.R;
 import de.tudarmstadt.informatik.hostage.commons.HelperUtils;
+import de.tudarmstadt.informatik.hostage.protocol.FTP;
+import de.tudarmstadt.informatik.hostage.ui2.adapter.ServicesListAdapter;
+import de.tudarmstadt.informatik.hostage.ui2.model.ServicesListItem;
+
+import static de.tudarmstadt.informatik.hostage.HoneyService.*;
 
 /**
  * Created by Daniel Lazar on 05.02.14.
@@ -22,27 +32,6 @@ public class ServicesFragment extends Fragment{
 	private Switch mServicesSwitchService;
 	private TextView mServicesTextName;
 
-	private TextView mServicesTextSSH;
-	private TextView mServicesTextFTP;
-	private TextView mServicesTextTELNET;
-	private TextView mServicesTextHTTP;
-	private TextView mServicesTextHTTPS;
-	private TextView mServicesTextSAMBA;
-
-	private TextView mServicesTextSSHAttacks;
-	private TextView mServicesTextFTPAttacks;
-	private TextView mServicesTextTELNETAttacks;
-	private TextView mServicesTextHTTPAttacks;
-	private TextView mServicesTextHTTPSAttacks;
-	private TextView mServicesTextSAMBAAttacks;
-
-	private Switch mServicesSwitchSSH;
-	private Switch mServicesSwitchFTP;
-	private Switch mServicesSwitchTELNET;
-	private Switch mServicesSwitchHTTP;
-	private Switch mServicesSwitchHTTPS;
-	private Switch mServicesSwitchSAMBA;
-
 	private View rootView;
 
 	private CompoundButton.OnCheckedChangeListener switchChangeListener = null;
@@ -51,48 +40,26 @@ public class ServicesFragment extends Fragment{
 	private void assignViews(){
 		mServicesSwitchService = (Switch) rootView.findViewById(R.id.service_switch_connection);
 		mServicesTextName = (TextView) rootView.findViewById(R.id.services_text_name);
-
-		mServicesTextSSH = (TextView) rootView.findViewById(R.id.textViewSSH);
-		mServicesTextFTP = (TextView) rootView.findViewById(R.id.textViewFTP);
-		mServicesTextTELNET = (TextView) rootView.findViewById(R.id.textViewTELNET);
-		mServicesTextHTTP = (TextView) rootView.findViewById(R.id.textViewHTTP);
-		mServicesTextHTTPS = (TextView) rootView.findViewById(R.id.textViewHTTPS);
-		mServicesTextSAMBA = (TextView) rootView.findViewById(R.id.textViewSAMBA);
-
-		mServicesTextSSHAttacks = (TextView) rootView.findViewById(R.id.textViewSSHAttacks);
-		mServicesTextFTPAttacks = (TextView) rootView.findViewById(R.id.textViewFTPAttacks);
-		mServicesTextTELNETAttacks = (TextView) rootView.findViewById(R.id.textViewTELNETAttacks);
-		mServicesTextHTTPAttacks = (TextView) rootView.findViewById(R.id.textViewHTTPAttacks);
-		mServicesTextHTTPSAttacks = (TextView) rootView.findViewById(R.id.textViewHTTPSAttacks);
-		mServicesTextSAMBAAttacks = (TextView) rootView.findViewById(R.id.textViewSAMBAAttacks);
-
-		mServicesSwitchSSH = (Switch) rootView.findViewById(R.id.ssh_switch);
-		mServicesSwitchFTP = (Switch) rootView.findViewById(R.id.ftp_switch);
-		mServicesSwitchTELNET = (Switch) rootView.findViewById(R.id.telnet_switch);
-		mServicesSwitchHTTP = (Switch) rootView.findViewById(R.id.http_switch);
-		mServicesSwitchHTTPS = (Switch) rootView.findViewById(R.id.https_switch);
-		mServicesSwitchSAMBA = (Switch) rootView.findViewById(R.id.samba_switch);
-
 	}
 
 	public void updateUI(){
 		if(!HelperUtils.isWifiConnected(getActivity())){
 			mServicesSwitchService.setOnCheckedChangeListener(null);
+			setStateNotConnected();
+			setStateNotActive();
 			mServicesSwitchService.setOnCheckedChangeListener(switchChangeListener);
 		}
 		else {
 			mServicesTextName.setText(HelperUtils.getSSID(getActivity()));
 		}
 
-
 /*		//check if ftp monitoring is running
-		if(!HoneyService.isRunning("ftp")){
+		if(!HoneyService.isRunning(protocols[1])){
 			mServicesSwitchFTP.setOnCheckedChangeListener(null);
 		}
 		else {
 			mServicesSwitchFTP.setChecked(true);
-		}
-*/
+		}*/
 	}
 	public ServicesFragment(){}
 
@@ -105,8 +72,60 @@ public class ServicesFragment extends Fragment{
 		assignViews();
 
 		updateUI();
+
+		ListView list = (ListView) rootView.findViewById(R.id.services_list_view);
+		String[] protocols = getResources().getStringArray(R.array.protocols);
+		ArrayList<ServicesListItem> protocolList= new ArrayList<ServicesListItem>();
+
+		for(String protocol: protocols){
+			protocolList.add(new ServicesListItem(protocol));
+		}
+
+		ServicesListAdapter adapter = new ServicesListAdapter(getActivity().getBaseContext(), protocolList);
+		list.setAdapter(adapter);
+
+		if(switchChangeListener == null){
+			switchChangeListener = new CompoundButton.OnCheckedChangeListener() {
+				public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+					if(!HelperUtils.isWifiConnected(getActivity())){
+						new AlertDialog.Builder(getActivity())
+								.setTitle("Information")
+								.setMessage("You are not connected to a WiFi network. \n\nPlease connect to one, before trying to activate HosTaGe.")
+								.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+									public void onClick(DialogInterface dialog, int which) {
+
+									}
+								})
+								.setIcon(android.R.drawable.ic_dialog_info)
+								.show();
+
+
+						setStateNotActive();
+						setStateNotConnected();
+					} else {
+						if(isChecked){
+							setStateActive();
+						} else {
+							setStateNotActive();
+						}
+					}
+				}
+			};
+		}
 		return rootView;
 
 	}
 
+	private void setStateActive() {
+
+	}
+
+	private void setStateNotConnected() {
+		mServicesTextName.setText("Not connected");
+	}
+
+	private void setStateNotActive() {
+
+	}
+
 }

+ 32 - 0
src/de/tudarmstadt/informatik/hostage/ui2/model/ExpandableListItem.java

@@ -0,0 +1,32 @@
+package de.tudarmstadt.informatik.hostage.ui2.model;
+
+import java.util.HashMap;
+
+
+/**
+ * Created by Julien on 06.02.14.
+ */
+public class ExpandableListItem {
+
+    /*Mapping Data Key To ViewID*/
+    public HashMap<String, Integer> id_Mapping;
+
+    /*Data Key To Textual Information*/
+    public HashMap<String, String> data;
+
+
+
+    public HashMap<String, Integer> getId_Mapping() {
+        return id_Mapping;
+    }
+    public void setId_Mapping(HashMap<String, Integer> id_Mapping) {
+        this.id_Mapping = id_Mapping;
+    }
+
+    public HashMap<String, String> getData(){
+        return this.data;
+    }
+    public void setData(HashMap<String, String> _data){
+        this.data = _data;
+    }
+}

+ 16 - 0
src/de/tudarmstadt/informatik/hostage/ui2/model/ServicesListItem.java

@@ -0,0 +1,16 @@
+package de.tudarmstadt.informatik.hostage.ui2.model;
+
+/**
+ * Created by Daniel Lazar on 06.02.14.
+ */
+public class ServicesListItem {
+	public String protocol;
+	public String attacks;
+
+	public boolean activated;
+
+	public ServicesListItem(String protocol){
+		this.protocol = protocol;
+		this.activated = false;
+	}
+}