Browse Source

Merge branch 'master' of https://git.tk.informatik.tu-darmstadt.de/scm-ssi-student-hostagev2

Alexander Brakowski 10 years ago
parent
commit
60ee6a1396

+ 22 - 0
res/layout-land/date_time_dialog.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/DateTimePicker"
+    android:layout_width="wrap_content"
+    android:layout_height="fill_parent"
+    android:gravity="center"
+    android:orientation="horizontal"
+    android:padding="5dip" >
+
+    <DatePicker
+        android:id="@+id/DatePicker"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+         />
+
+    <TimePicker
+        android:id="@+id/TimePicker"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+         />
+
+</LinearLayout>

+ 2 - 17
res/layout/services_list_item.xml

@@ -29,32 +29,17 @@
                 android:textStyle="bold"
                 android:textSize="16dp"/>
         <TextView
-                android:id="@+id/services_item_text"
+                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="@string/recorded_attacks"
                 android:textStyle="bold"
                 android:textSize="12dp"/>
-        <TextView
-                android:id="@+id/services_item_rec_attacks"
-                android:layout_toRightOf="@id/services_item_text"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentEnd="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentRight="false"
-                android:layout_marginTop="25dp"
-                android:layout_marginLeft="150dp"
-                android:layout_weight="1"
-                android:text="20"
-                android:textStyle="bold"
-                android:textSize="12dp"/>
+
         <Switch
                 android:id="@+id/services_item_switch"
                 android:layout_width="wrap_content"

+ 16 - 0
res/layout/simple_popup_table.xml

@@ -23,4 +23,20 @@
 			android:layout_height="2dp"
 			android:background="@android:color/holo_blue_bright"
 			/>
+
+    <ScrollView
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:id="@+id/item_scrollview">
+
+        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+            android:orientation="vertical"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:id="@+id/item_scroll_layout"
+            >
+
+        </LinearLayout>
+        </ScrollView>
+
 </LinearLayout>

+ 2 - 1
src/de/tudarmstadt/informatik/hostage/ui2/adapter/ServicesListAdapter.java

@@ -19,6 +19,7 @@ import java.util.List;
 import de.tudarmstadt.informatik.hostage.R;
 import de.tudarmstadt.informatik.hostage.commons.HelperUtils;
 import de.tudarmstadt.informatik.hostage.ui2.activity.MainActivity;
+import de.tudarmstadt.informatik.hostage.ui2.fragment.ServicesFragment;
 import de.tudarmstadt.informatik.hostage.ui2.model.ServicesListItem;
 
 /**
@@ -145,7 +146,7 @@ public class ServicesListAdapter extends ArrayAdapter<ServicesListItem> {
 			holder.activated.setChecked(false);
 			setBackground(holder, R.drawable.services_circle);
 		}
-		holder.recordedAttacks.setText(item.attacks);
+		holder.recordedAttacks.setText(String.format(MainActivity.getContext().getResources().getString(R.string.recorded_attacks) + "  %d", Integer.valueOf(item.attacks)));
 	}
 
 	private void setBackground(ViewHolder holder, int drawable){

+ 30 - 9
src/de/tudarmstadt/informatik/hostage/ui2/dialog/DateTimeDialogFragment.java

@@ -7,9 +7,11 @@ import android.app.AlertDialog.Builder;
 import android.app.Dialog;
 import android.app.DialogFragment;
 import android.content.DialogInterface;
+import android.content.res.Configuration;
 import android.os.Bundle;
 import android.view.LayoutInflater;
 import android.view.View;
+import android.view.ViewGroup;
 import android.widget.DatePicker;
 import android.widget.DatePicker.OnDateChangedListener;
 import android.widget.TimePicker;
@@ -53,14 +55,33 @@ public class DateTimeDialogFragment extends DialogFragment implements OnDateChan
     }
 
     public DateTimeDialogFragment(Activity activity, int DialogType) {
+
         this.activity = activity;
         this.DialogType = DialogType;
 
-        // Inflate layout for the view
-        // Pass null as the parent view because its going in the dialog layout
         LayoutInflater inflater = activity.getLayoutInflater();
-        mView = inflater.inflate(R.layout.date_time_dialog, null);  
+        mView = inflater.inflate(R.layout.date_time_dialog, null);
+
+        this.setupRootView(mView);
+
+    }
+
+
+    @Override
+    public void onConfigurationChanged(Configuration newConfig){
+        super.onConfigurationChanged(newConfig);
+        LayoutInflater inflater = LayoutInflater.from(this.activity);
+
+        ViewGroup container = (ViewGroup) this.mView.getParent();
+
+        container.removeView(this.mView);
+
+        mView = inflater.inflate(R.layout.date_time_dialog, null);
+        container.addView(mView);
+        this.setupRootView(mView);
+    }
 
+    private void setupRootView(View mView){
         // Grab a Calendar instance
         mCalendar = Calendar.getInstance();
 
@@ -76,12 +97,12 @@ public class DateTimeDialogFragment extends DialogFragment implements OnDateChan
         setCalendarViewShown(false);
 
         switch (DialogType) {
-        case DATE_PICKER:
-            timePicker.setVisibility(View.GONE);
-            break;
-        case TIME_PICKER:
-            datePicker.setVisibility(View.GONE);
-            break;
+            case DATE_PICKER:
+                timePicker.setVisibility(View.GONE);
+                break;
+            case TIME_PICKER:
+                datePicker.setVisibility(View.GONE);
+                break;
         }
     }
 

+ 6 - 1
src/de/tudarmstadt/informatik/hostage/ui2/fragment/AboutFragment.java

@@ -1,5 +1,6 @@
 package de.tudarmstadt.informatik.hostage.ui2.fragment;
 
+import android.app.Activity;
 import android.app.Fragment;
 import android.os.Bundle;
 import android.view.LayoutInflater;
@@ -10,12 +11,16 @@ import de.tudarmstadt.informatik.hostage.R;
 
 /**
  * Created by Fabio Arnold on 25.02.14.
+ * displays credits for the app
  */
 public class AboutFragment extends Fragment {
 	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
 		super.onCreateView(inflater, container, savedInstanceState);
 
-		getActivity().setTitle(getResources().getString(R.string.drawer_app_info));
+		final Activity activity = getActivity();
+		if (activity != null) {
+			activity.setTitle(getResources().getString(R.string.drawer_app_info));
+		}
 
 		return inflater.inflate(R.layout.fragment_about, container, false);
 	}

+ 28 - 12
src/de/tudarmstadt/informatik/hostage/ui2/fragment/ConnectionInfoDialogFragment.java

@@ -1,5 +1,6 @@
 package de.tudarmstadt.informatik.hostage.ui2.fragment;
 
+import android.app.Activity;
 import android.app.AlertDialog;
 import android.app.Dialog;
 import android.app.DialogFragment;
@@ -20,15 +21,25 @@ import de.tudarmstadt.informatik.hostage.ui2.activity.MainActivity;
 
 /**
  * Created by Fabio Arnold on 03.03.14.
+ * displays details about the current connection
  */
 public class ConnectionInfoDialogFragment extends DialogFragment {
 	public Dialog onCreateDialog(Bundle savedInstance) {
-		// get connection infos
-		SharedPreferences sharedPreferences = getActivity().getSharedPreferences(getString(R.string.connection_info), Context.MODE_PRIVATE);
-		final String ssid = sharedPreferences.getString(getString(R.string.connection_info_ssid), "");
-		String bssid = sharedPreferences.getString(getString(R.string.connection_info_bssid), "");
-		String internalIP = sharedPreferences.getString(getString(R.string.connection_info_internal_ip), "");
-		String externalIP = sharedPreferences.getString(getString(R.string.connection_info_external_ip), "");
+		// the data we want to display
+		String ssid = "undefined";
+		String bssid = "undefined";
+		String internalIP = "undefined";
+		String externalIP = "undefined";
+
+		// get infos about the current connection using SharedPreferences
+		final Activity activity = getActivity();
+		if (activity != null) {
+			SharedPreferences sharedPreferences = activity.getSharedPreferences(getString(R.string.connection_info), Context.MODE_PRIVATE);
+			ssid = sharedPreferences.getString(getString(R.string.connection_info_ssid), "");
+			bssid = sharedPreferences.getString(getString(R.string.connection_info_bssid), "");
+			internalIP = sharedPreferences.getString(getString(R.string.connection_info_internal_ip), "");
+			externalIP = sharedPreferences.getString(getString(R.string.connection_info_external_ip), "");
+		}
 
 		// inflate the layout with a dark theme
 		Context context = new ContextThemeWrapper(getActivity(), android.R.style.Theme_Holo);
@@ -36,12 +47,17 @@ public class ConnectionInfoDialogFragment extends DialogFragment {
 		View view = localInflater.inflate(R.layout.fragment_connectioninfo_dialog, null);
 
 		// assign values in layout
-		((TextView)view.findViewById(R.id.connectioninfo_ssid_value)).setText(ssid);
-		((TextView)view.findViewById(R.id.connectioninfo_bssid_value)).setText(bssid);
-		((TextView)view.findViewById(R.id.connectioninfo_internalip_value)).setText(internalIP);
-		((TextView)view.findViewById(R.id.connectioninfo_externalip_value)).setText(externalIP);
+		if (view != null) {
+			((TextView)view.findViewById(R.id.connectioninfo_ssid_value)).setText(ssid);
+			((TextView)view.findViewById(R.id.connectioninfo_bssid_value)).setText(bssid);
+			((TextView)view.findViewById(R.id.connectioninfo_internalip_value)).setText(internalIP);
+			((TextView)view.findViewById(R.id.connectioninfo_externalip_value)).setText(externalIP);
+		}
+
+		// capture the SSID for the button action
+		final String filterSSID = ssid;
 
-		// build the dialog
+		// build the actual dialog
 		AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), AlertDialog.THEME_HOLO_DARK);
 		builder.setView(view);
 		builder.setTitle(R.string.title_connection_info);
@@ -50,7 +66,7 @@ public class ConnectionInfoDialogFragment extends DialogFragment {
 			@Override
 			public void onClick(DialogInterface dialog, int which) {
 				ArrayList<String> ssids = new ArrayList<String>();
-				ssids.add(ssid);
+				ssids.add(filterSSID);
 
 				LogFilter filter = new LogFilter();
 				filter.setESSIDs(ssids);

+ 10 - 5
src/de/tudarmstadt/informatik/hostage/ui2/fragment/HomeFragment.java

@@ -1,4 +1,5 @@
 package de.tudarmstadt.informatik.hostage.ui2.fragment;
+import android.app.Activity;
 import android.app.AlertDialog;
 import android.app.Fragment;
 import android.app.FragmentManager;
@@ -10,7 +11,6 @@ import android.content.IntentFilter;
 import android.content.SharedPreferences;
 import android.os.Bundle;
 import android.support.v4.content.LocalBroadcastManager;
-import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -153,7 +153,6 @@ public class HomeFragment extends Fragment {
 
 		boolean hasActiveListeners = false;
 		int totalAttacks = dbh.numBssidSeen(mConnectionInfo.getString(getString(R.string.connection_info_bssid), null));
-		int totalLogged = 0;
 
 		if(MainActivity.getInstance().isServiceBound()){
 			for(String protocol: getResources().getStringArray(R.array.protocols)){
@@ -225,7 +224,10 @@ public class HomeFragment extends Fragment {
 
 	    super.onCreateView(inflater, container, savedInstanceState);
 
-	    getActivity().setTitle(getResources().getString(R.string.drawer_overview));
+		final Activity activity = getActivity();
+		if (activity != null) {
+			activity.setTitle(getResources().getString(R.string.drawer_overview));
+		}
 
 	    dbh = new UglyDbHelper(getActivity());
 
@@ -239,8 +241,11 @@ public class HomeFragment extends Fragment {
 		mHomeConnectionInfoButton.setOnClickListener(new View.OnClickListener() {
 			@Override
 			public void onClick(View v) {
-				ConnectionInfoDialogFragment connectionInfoDialogFragment = new ConnectionInfoDialogFragment();
-				connectionInfoDialogFragment.show(getFragmentManager().beginTransaction(), connectionInfoDialogFragment.getTag());
+				final FragmentManager fragmentManager = getFragmentManager();
+				if (fragmentManager != null) {
+					ConnectionInfoDialogFragment connectionInfoDialogFragment = new ConnectionInfoDialogFragment();
+					connectionInfoDialogFragment.show(fragmentManager.beginTransaction(), connectionInfoDialogFragment.getTag());
+				}
 			}
 		});
 

+ 15 - 11
src/de/tudarmstadt/informatik/hostage/ui2/fragment/StatisticsFragment.java

@@ -3,7 +3,6 @@ package de.tudarmstadt.informatik.hostage.ui2.fragment;
 import android.annotation.SuppressLint;
 import android.app.Fragment;
 import android.app.FragmentManager;
-import android.app.FragmentTransaction;
 import android.content.Context;
 import android.content.Intent;
 import android.content.res.Configuration;
@@ -39,6 +38,7 @@ import de.tudarmstadt.informatik.hostage.R;
 import de.tudarmstadt.informatik.hostage.logging.Record;
 import de.tudarmstadt.informatik.hostage.logging.UglyDbHelper;
 import de.tudarmstadt.informatik.hostage.ui.LogFilter;
+import de.tudarmstadt.informatik.hostage.ui2.activity.MainActivity;
 import de.tudarmstadt.informatik.hostage.ui2.adapter.StatisticListAdapter;
 import de.tudarmstadt.informatik.hostage.ui2.dialog.ChecklistDialog;
 import de.tudarmstadt.informatik.hostage.ui2.dialog.DateTimeDialogFragment;
@@ -622,9 +622,10 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
             if (protocol.length() > 0){
                 if (this.selectedCompareData.equals(COMPARE_TITLE_AttacksPerBSSID)){
                     titles.add(FILTER_MENU_TITLE_BSSID);
+                } else {
+                    // DEFAULT
+                    titles.add(FILTER_MENU_TITLE_ESSID);
                 }
-                // DEFAULT
-                titles.add(FILTER_MENU_TITLE_ESSID);
             }
             titles.add(FILTER_MENU_TITLE_TIMESTAMP_ABOVE);
             if (this.filter.hasATimestamp() || this.filter.hasESSIDs() || this.filter.hasBSSIDs()
@@ -1040,7 +1041,7 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
          Collections.sort(plotItems, new Comparator<PlotComparisonItem>() {
              @Override
              public int compare(PlotComparisonItem s1, PlotComparisonItem s2) {
-                 return s1.getValue2().compareTo(s2.getValue2());
+                 return s2.getValue2().compareTo(s1.getValue2());
              }
          });
          return this.resizeData(plotItems);
@@ -1153,7 +1154,7 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
         Collections.sort(plotItems, new Comparator<PlotComparisonItem>() {
             @Override
             public int compare(PlotComparisonItem s1, PlotComparisonItem s2) {
-                return s1.getValue2().compareTo(s2.getValue2());
+                return s2.getValue2().compareTo(s1.getValue2());
             }
         });
         return this.resizeData(plotItems);
@@ -1190,7 +1191,7 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
         Collections.sort(plotItems, new Comparator<PlotComparisonItem>() {
             @Override
             public int compare(PlotComparisonItem s1, PlotComparisonItem s2) {
-                return s1.getValue2().compareTo(s2.getValue2());
+                return s2.getValue2().compareTo(s1.getValue2());
             }
         });
 
@@ -1220,6 +1221,13 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
                 otherItem.setOtherData(others);
                 copy.add(otherItem);
 
+                Collections.sort(copy, new Comparator<PlotComparisonItem>() {
+                    @Override
+                    public int compare(PlotComparisonItem s1, PlotComparisonItem s2) {
+                        return s2.getValue2().compareTo(s1.getValue2());
+                    }
+                });
+
                 return copy;
             }
         }
@@ -1446,12 +1454,8 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
 
             if (sortKey != null && sortKey.length() != 0) newFragment.setGroupKey(sortKey);
 
-            FragmentTransaction transaction = fm.beginTransaction();
-            transaction.replace(R.id.content_frame, newFragment, newFragment.getTag());
-            transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
-            transaction.addToBackStack(null);
+            MainActivity.getInstance().injectFragment(newFragment, true, MainActivity.MainMenuItem.RECORDS);
 
-            transaction.commit();
         }
 
     }

+ 18 - 7
src/de/tudarmstadt/informatik/hostage/ui2/fragment/ThreatMapFragment.java

@@ -1,6 +1,8 @@
 package de.tudarmstadt.informatik.hostage.ui2.fragment;
 
+import android.app.Activity;
 import android.app.Fragment;
+import android.app.FragmentManager;
 import android.graphics.Color;
 import android.location.Location;
 import android.os.Bundle;
@@ -251,9 +253,9 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
 	 * view must be removed if this object has been created once before
 	 * that is why view is static
 	 *
-	 * @param inflater
-	 * @param container
-	 * @param savedInstanceState
+	 * @param inflater the inflater
+	 * @param container the container
+	 * @param savedInstanceState the savedInstanceState
 	 * @return the view
 	 */
 	@Override
@@ -261,7 +263,10 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
 	                         Bundle savedInstanceState) {
 		super.onCreateView(inflater, container, savedInstanceState);
 
-		getActivity().setTitle(getResources().getString(R.string.drawer_threat_map));
+		final Activity activity = getActivity();
+		if (activity != null) {
+			activity.setTitle(getResources().getString(R.string.drawer_threat_map));
+		}
 
 		if (sView != null) {
 			ViewGroup parent = (ViewGroup) sView.getParent();
@@ -272,9 +277,15 @@ public class ThreatMapFragment extends Fragment implements GoogleMap.OnInfoWindo
 		try {
 			sView = inflater.inflate(R.layout.fragment_threatmap, container, false);
 			if (isGooglePlay()) {
-				sMap = ((MapFragment) getFragmentManager()
-						.findFragmentById(R.id.threatmapfragment)).getMap();
-				populateMap();
+				final FragmentManager fragmentManager = getFragmentManager();
+				if (fragmentManager != null) {
+					final MapFragment mapFragment = (MapFragment) getFragmentManager()
+							.findFragmentById(R.id.threatmapfragment);
+					if (mapFragment != null) {
+						sMap = mapFragment.getMap();
+						populateMap();
+					}
+				}
 			}
 		} catch (InflateException e) {
         	// map already exists

+ 1 - 2
src/de/tudarmstadt/informatik/hostage/ui2/helper/ColorSequenceGenerator.java

@@ -7,7 +7,7 @@ import android.graphics.Color;
  * Created by Fabio Arnold on 25.02.14.
  */
 public class ColorSequenceGenerator {
-	private static final int BIT_COUNT = 31; // sadly there is no unsigned type in java
+	private static final int BIT_COUNT = 30; // sadly there is no unsigned type in java
 	public static int getColorForIndex(int index) {
 		int reverseIndex = 0;
 		for (int i = 0; i  < BIT_COUNT; i++) {
@@ -16,7 +16,6 @@ public class ColorSequenceGenerator {
 		}
 		float hue = ((float)reverseIndex / (float)(1 << BIT_COUNT) + 0.6f) % 1.0f;
 
-
 		float[] hsv = new float[3];
 		hsv[0] = 360.0f * hue;
 		hsv[1] = 0.7f; // not fully saturated

+ 26 - 49
src/de/tudarmstadt/informatik/hostage/ui2/popup/AbstractPopup.java

@@ -43,6 +43,12 @@ public abstract class AbstractPopup {
 
     }
 
+    public abstract LinearLayout getScrollableItemLayout();
+
+    public View getRootView(){
+        return this.rootView;
+    }
+
     public void addItem(final AbstractPopupItem item)	{
         View view = item.getItemView();
 
@@ -51,15 +57,17 @@ public abstract class AbstractPopup {
             this.configureView(this.rootView);
         }
         if (this.rootView != null){
-            this.rootView.addView(view);
+            this.getScrollableItemLayout().addView(view);
+            //this.rootView.addView(view);
             view.setOnTouchListener(new View.OnTouchListener() {
                 @Override
                 public boolean onTouch(View view, MotionEvent event) {
 	                if(event.getAction() == MotionEvent.ACTION_DOWN){
-						item.onItemDown(event);
-	                } else if (event.getAction() == MotionEvent.ACTION_UP){
-	                    item.onItemUp(event);
-
+						item.onItemSelect(event);
+	                } else if (event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_MOVE){
+                        item.onItemDeselect(event);
+                    } else if (event.getAction() == MotionEvent.ACTION_UP){
+                        item.onItemDeselect(event);
                         AbstractPopup.this.onPopupItemClickListener.onItemClick(item.onClickedResult(event));
                         AbstractPopup.this.popupWindow.dismiss();
                     }
@@ -90,9 +98,9 @@ public abstract class AbstractPopup {
 
             Window window = this.context.getWindow();
             window.getDecorView().getWindowVisibleDisplayFrame(windowFrame);
-            int orientation = 1; //this.context.getResources().getConfiguration().orientation;
-            int windowWidth = orientation == ORIENTATION_LANDSCAPE ? windowFrame.height() : windowFrame.width();
-            int windowHeight = orientation == ORIENTATION_LANDSCAPE ? windowFrame.width() : windowFrame.height();
+            int orientation = this.context.getResources().getConfiguration().orientation;
+            int windowWidth = windowFrame.width();
+            int windowHeight = windowFrame.height();
 
             final int[] position = new int[2];
             anchorView.getLocationOnScreen(position);
@@ -104,15 +112,22 @@ public abstract class AbstractPopup {
 
             //int alh = (position[0] + width) - windowFrame.width();
             //if (alh < 0) alh = 0;
+            int offset = windowFrame.top;
 
             int x = position[0] + (anchorWidth / 2) - (width / 2);
-            int y = position[1] - height;
+            int y = (position[1] - height) + offset;
+
+            height+=(offset/2);
+
+            width = windowWidth < width ? windowWidth : width;
 
             x = Math.max(0, x);
             x = Math.min(windowWidth - width, x);
 
-            y = Math.min(0,y);
-            y = Math.max(windowHeight - height, y);
+            height = windowHeight < height ? windowHeight : height;
+
+            y = Math.max(0, y);
+            y = Math.min(windowHeight - height, y);
 
             AbstractPopup.this.configureView(this.rootView);
 
@@ -121,44 +136,6 @@ public abstract class AbstractPopup {
             this.popupWindow.setHeight(height);
             this.popupWindow.showAtLocation(anchorView, Gravity.NO_GRAVITY, x, y-smallBottomOffset);
 
-
-
-            /*
-            // TO SET THE REAL SIZE
-            ViewTreeObserver viewTreeObserver = this.rootView.getViewTreeObserver();
-            if (viewTreeObserver != null &&  viewTreeObserver.isAlive()) {
-                viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
-                    @Override
-                    public void onGlobalLayout() {
-                        ViewTreeObserver observer= AbstractPopup.this.rootView.getViewTreeObserver();
-                        if (observer != null)observer.removeOnGlobalLayoutListener(this);
-
-                        View rootView = AbstractPopup.this.rootView;
-
-                        int width = rootView.getWidth();
-                        int height = rootView.getHeight();
-
-                        int x = position[0] + (anchorWidth / 2) - (width / 2);
-                        int y = position[1] - height;
-
-                        x = Math.min(0,x);
-                        x = Math.max(windowFrame.width() - width, x);
-
-                        y = Math.min(0,y);
-                        y = Math.max(windowFrame.height() - height, y);
-
-                        AbstractPopup.this.configureView(rootView);
-
-                        int smallBottomOffset = 10;
-                        AbstractPopup.this.popupWindow.dismiss();
-                        AbstractPopup.this.popupWindow.setWidth(width);
-                        AbstractPopup.this.popupWindow.setHeight(height + smallBottomOffset);
-                        AbstractPopup.this.popupWindow.showAtLocation(anchorView, Gravity.NO_GRAVITY, x, y-smallBottomOffset);
-
-                    }
-                });
-            }
-            */
         }
     }
 

+ 2 - 2
src/de/tudarmstadt/informatik/hostage/ui2/popup/AbstractPopupItem.java

@@ -75,10 +75,10 @@ public abstract class AbstractPopupItem {
         return this;
     }
 
-	public void onItemDown(MotionEvent event){
+	public void onItemSelect(MotionEvent event){
 	}
 
-	public void onItemUp(MotionEvent event){
+	public void onItemDeselect(MotionEvent event){
 
 	}
 }

+ 2 - 2
src/de/tudarmstadt/informatik/hostage/ui2/popup/SimplePopupItem.java

@@ -56,12 +56,12 @@ public class SimplePopupItem extends AbstractPopupItem {
         return this.selected;
     }
 
-	public void onItemDown(MotionEvent event){
+	public void onItemSelect(MotionEvent event){
 		getContainer().setBackgroundColor(
 				context.getResources().getColor(android.R.color.holo_blue_light));
 	}
 
-	public void onItemUp(MotionEvent event){
+	public void onItemDeselect(MotionEvent event){
 		getContainer().setBackgroundColor(context.getResources().getColor(android.R.color.transparent));
 	}
 }

+ 6 - 0
src/de/tudarmstadt/informatik/hostage/ui2/popup/SimplePopupTable.java

@@ -2,6 +2,7 @@ package de.tudarmstadt.informatik.hostage.ui2.popup;
 
 import android.content.Context;
 import android.view.View;
+import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import de.tudarmstadt.informatik.hostage.R;
@@ -25,6 +26,11 @@ public class SimplePopupTable extends AbstractPopup {
         super(context, listener);
     }
 
+    @Override
+    public LinearLayout getScrollableItemLayout() {
+        return (LinearLayout) this.getRootView().findViewById(R.id.item_scroll_layout);
+    }
+
     public int getLayoutId(){
         return R.layout.simple_popup_table;
     }

+ 2 - 2
src/de/tudarmstadt/informatik/hostage/ui2/popup/SplitPopupItem.java

@@ -85,7 +85,7 @@ public class SplitPopupItem extends AbstractPopupItem {
 		return right_container;
 	}
 
-	public void onItemDown(MotionEvent event){
+	public void onItemSelect(MotionEvent event){
 		int blue_color = context.getResources().getColor(android.R.color.holo_blue_light);
 		int trans_color = context.getResources().getColor(android.R.color.transparent);
 
@@ -98,7 +98,7 @@ public class SplitPopupItem extends AbstractPopupItem {
 		}
 	}
 
-	public void onItemUp(MotionEvent event){
+	public void onItemDeselect(MotionEvent event){
 		int trans_color = context.getResources().getColor(android.R.color.transparent);
 
 		getLeftContainer().setBackgroundColor(trans_color);