Browse Source

some code cleanup and a lot of java doc

Alexander Brakowski 10 years ago
parent
commit
ce80eb5476

+ 1 - 1
src/de/tudarmstadt/informatik/hostage/persistence/ProfileManager.java

@@ -401,7 +401,7 @@ public class ProfileManager {
 	 * @param persist indicates if the profile should be persisted after activating
 	 */
 	public void activateProfile(Profile profile, boolean persist){
-		if(profile.equals(this.mCurrentActivatedProfile)) return;
+		if(profile.equals(this.mCurrentActivatedProfile) || (mCurrentActivatedProfile != null && profile.mId == mCurrentActivatedProfile.mId)) return;
 
 		if(this.mCurrentActivatedProfile != null){
 			this.mCurrentActivatedProfile.mActivated = false;

+ 170 - 90
src/de/tudarmstadt/informatik/hostage/ui2/activity/MainActivity.java

@@ -57,6 +57,8 @@ import de.tudarmstadt.informatik.hostage.ui2.fragment.opengl.ThreatIndicatorGLRe
 import de.tudarmstadt.informatik.hostage.ui2.model.DrawerListItem;
 
 /**
+ * Manages the whole application, and should act like an singleton.
+ *
  * @author Alexander Brakowski
  * @created 12.01.14 23:24
  */
@@ -66,40 +68,61 @@ public class MainActivity extends Activity {
 	/** singleton instance of the MainActivity **/
 	private static MainActivity sInstance = null;
 
+	/**
+	 * The currently displayed fragment
+	 */
 	public Fragment mDisplayedFragment;
 
+	/**
+	 * Holds the Hostage Service
+	 */
 	public Hostage mHoneyService;
 
+	/**
+	 * Manages the navigation drawer
+	 */
 	private DrawerLayout mDrawerLayout;
 
+	/**
+	 * Contains the listview to be displayed in the navigation drawer
+	 */
 	private ListView mDrawerList;
 
+	/**
+	 * Holds the toggler for the navigation drawer in the action bar
+	 */
 	private ActionBarDrawerToggle mDrawerToggle;
 
+	/**
+	 * The text that should be displayed in the drawer toggle
+	 */
 	private CharSequence mDrawerTitle;
 
+	/**
+	 * The text that should be displayed in the action bar
+	 */
 	private CharSequence mTitle;
 
-	private MainMenuItem mSelectedMenuItem = null;
-
+	/**
+	 * Holds the list, that should be displayed in the listview of the navigation drawer
+	 */
 	private ArrayList<DrawerListItem> mDrawerItems;
 
+	/**
+	 * Hold the state of the Hostage service
+	 */
 	private boolean mServiceBound = false;
 
-	private ProfileManager mProfileManager;
-
-	private Fragment rootFragment;
-
 	/**
 	 * Connection to bind the background service
-	 * 
+	 *
 	 * @see de.tudarmstadt.informatik.hostage.Hostage
 	 */
 	private ServiceConnection mConnection = new ServiceConnection() {
 		/**
 		 * After the service is bound, check which has been clicked and start
 		 * it.
-		 * 
+		 *
 		 * @see android.content.ServiceConnection#onServiceConnected(android.content.ComponentName,
 		 *      android.os.IBinder)
 		 */
@@ -111,7 +134,7 @@ public class MainActivity extends Activity {
 
 		/**
 		 * After the service is unbound, delete reference.
-		 * 
+		 *
 		 * @see android.content.ServiceConnection#onServiceDisconnected(android.content.ComponentName)
 		 */
 		@Override
@@ -122,68 +145,103 @@ public class MainActivity extends Activity {
 
 	};
 
-	private HashMap<String, Boolean> mAttacksOnProtocol = new HashMap<String, Boolean>();
+	/**
+	 * Holds an profile manager instance
+	 */
+	private ProfileManager mProfileManager;
+
+	/**
+	 * Holds the root fragment for our hierarchical fragment navigation
+	 */
+	private Fragment rootFragment;
 
+	/**
+	 * Indicates if the warning, that the application will be closed, when pressing back again
+	 */
 	private boolean mCloseWarning = false;
 
+	/**
+	 * Hold the shared preferences for the app
+	 */
 	private SharedPreferences mSharedPreferences;
 
 	/**
 	 * Retrieve the singleton latest instance of the activity
-	 * 
+	 *
 	 * @return MainActivity - the singleton instance
 	 */
 	public static MainActivity getInstance() {
-		assert (sInstance != null);
 		return sInstance;
 	}
 
+	/**
+	 * Retrieves the context of the application
+	 *
+	 * @return the context
+	 */
 	public static Context getContext() {
 		return MainActivity.context;
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onStart() {
 		super.onStart();
 
-		registerReceiver();
-
 		if (isServiceRunning()) {
 			this.bindService();
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onStop() {
 		this.unbindService();
 		super.onStop();
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	protected void onCreate(Bundle savedInstanceState) {
 		super.onCreate(savedInstanceState);
 
+		// make the main activity an singleton
 		sInstance = this;
+
+		// sets the static context reference to the application context
 		MainActivity.context = getApplicationContext();
 
 		setContentView(R.layout.activity_drawer_main);
-
 		mProfileManager = ProfileManager.getInstance();
 
+		// init threat indicator animation
 		ThreatIndicatorGLRenderer.assets = getAssets();
 		ThreatIndicatorGLRenderer.setThreatLevel(ThreatIndicatorGLRenderer.ThreatLevel.NOT_MONITORING);
+
 		// set background color
 		TypedArray arr = getTheme().obtainStyledAttributes(new int[] { android.R.color.background_light });
 		ThreatIndicatorGLRenderer.setBackgroundColor(arr.getColor(0, 0xFFFFFF));
 		arr.recycle();
 
+		// configures the action bar
 		ActionBar actionBar = getActionBar();
 		actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
+		actionBar.setDisplayHomeAsUpEnabled(true);
+		actionBar.setHomeButtonEnabled(true);
+		actionBar.setDisplayShowHomeEnabled(true);
 
+		// sets the drawer and action title to the application title
 		mTitle = mDrawerTitle = getTitle();
 		mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
 		mDrawerList = (ListView) findViewById(R.id.left_drawer);
 
+		// propagates the navigation drawer with items
 		mDrawerItems = new ArrayList<DrawerListItem>();
 		mDrawerItems.add(new DrawerListItem(R.string.drawer_overview, R.drawable.ic_menu_home));
 		mDrawerItems.add(new DrawerListItem(R.string.drawer_threat_map, R.drawable.ic_menu_mapmode));
@@ -200,10 +258,7 @@ public class MainActivity extends Activity {
 		mDrawerList.setAdapter(listAdapter);
 		mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
 
-		getActionBar().setDisplayHomeAsUpEnabled(true);
-		getActionBar().setHomeButtonEnabled(true);
-		getActionBar().setDisplayShowHomeEnabled(true);
-
+		// configures the navigation drawer
 		mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
 			mDrawerLayout, /* DrawerLayout object */
 			R.drawable.ic_navigation_drawer, /*
@@ -228,11 +283,14 @@ public class MainActivity extends Activity {
 
 		mDrawerLayout.setDrawerListener(mDrawerToggle);
 
+		// start the hostage service
 		startAndBind();
 
 		mSharedPreferences = getSharedPreferences(getString(R.string.shared_preference_path), Hostage.MODE_PRIVATE);
 
 		if(mSharedPreferences.getBoolean("isFirstRun", true)){
+
+			// opens navigation drawer if first run
 			mDrawerLayout.postDelayed(new Runnable() {
 				@Override
 				public void run() {
@@ -250,6 +308,9 @@ public class MainActivity extends Activity {
 		}
 	}
 
+	/**
+	 * Displays the disclaimer on first run of the application
+	 */
 	private void onFirstRun(){
 		AlertDialog.Builder builder = new AlertDialog.Builder(this);
 		builder.setMessage(Html.fromHtml(getString(R.string.hostage_disclaimer)))
@@ -276,35 +337,9 @@ public class MainActivity extends Activity {
 		alert.show();
 	}
 
-	private void registerReceiver() {
-		LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver, new IntentFilter(getString(R.string.broadcast)));
-	}
-
-	private void unregisterReceiver() {
-		LocalBroadcastManager.getInstance(this).unregisterReceiver(mReceiver);
-	}
-
-	private BroadcastReceiver mReceiver = new BroadcastReceiver() {
-		@Override
-		public void onReceive(Context context, Intent intent) {
-			Bundle extras = intent.getExtras();
-
-			String sender = extras.getString("SENDER");
-			String[] values = extras.getStringArray("VALUES");
-
-			if (sender.equals(Hostage.class.getName()) && values[0].equals(getString(R.string.broadcast_started))) {
-				mAttacksOnProtocol.put(values[1], true);
-			}
-		}
-	};
-
-	public boolean hasProtocolAttacks(String protocol) {
-		if (!mAttacksOnProtocol.containsKey(protocol))
-			return false;
-
-		return mAttacksOnProtocol.get(protocol);
-	}
-
+	/**
+	 * Starts the hostage service and binds this activity to the service
+	 */
 	public void startAndBind() {
 		if (!isServiceRunning()) {
 			startService(getServiceIntent());
@@ -313,6 +348,9 @@ public class MainActivity extends Activity {
 		bindService();
 	}
 
+	/**
+	 * Stops the hostage service and unbinds from the service
+	 */
 	public void stopAndUnbind() {
 		if (mHoneyService != null) {
 			unbindService();
@@ -321,6 +359,9 @@ public class MainActivity extends Activity {
 		stopService(getServiceIntent());
 	}
 
+	/**
+	 * Unbindes the activity from the service
+	 */
 	public void unbindService() {
 		try {
 			unbindService(mConnection);
@@ -329,17 +370,20 @@ public class MainActivity extends Activity {
 		}
 	}
 
+	/**
+	 * Binds the activity to the service
+	 */
 	public void bindService() {
-		mAttacksOnProtocol.clear();
 		bindService(getServiceIntent(), mConnection, BIND_AUTO_CREATE);
 		// mServiceBound = true;
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	protected void onDestroy() {
 		super.onDestroy();
-		// Unregister Broadcast Receiver
-		unregisterReceiver();
 
 		// Unbind running service
 		if (!mHoneyService.hasRunningListeners()) {
@@ -347,22 +391,9 @@ public class MainActivity extends Activity {
 		}
 	}
 
-	@Override
-	protected void onResume() {
-		super.onResume();
-
-		String action = getIntent().getAction();
-
-		if (action != null && action.equals("SHOW_HOME")) {
-			/*if (this.mDisplayedFragment != null && !this.mDisplayedFragment.getClass().equals(HomeFragment.class)) {
-				getFragmentManager().popBackStackImmediate(HomeFragment.class.getName(), FragmentManager.POP_BACK_STACK_INCLUSIVE);
-				displayView(MainMenuItem.HOME.getValue());
-
-				getIntent().setAction(null);
-			}*/
-		}
-	}
-
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public boolean onOptionsItemSelected(MenuItem item) {
 		// toggle nav drawer on selecting action bar app icon/title
@@ -379,6 +410,9 @@ public class MainActivity extends Activity {
 		return super.onOptionsItemSelected(item);
 	}
 
+	/**
+	 * Navigates up to the parent fragment of the current fragment
+	 */
 	public void navigateBack(){
 		if (!(this.mDisplayedFragment instanceof UpNavigatibleFragment)) {
 			mDrawerToggle.setDrawerIndicatorEnabled(true);
@@ -398,6 +432,9 @@ public class MainActivity extends Activity {
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void setTitle(CharSequence title) {
 		mTitle = title;
@@ -408,7 +445,6 @@ public class MainActivity extends Activity {
 	 * When using the ActionBarDrawerToggle, you must call it during
 	 * onPostCreate() and onConfigurationChanged()...
 	 */
-
 	@Override
 	protected void onPostCreate(Bundle savedInstanceState) {
 		super.onPostCreate(savedInstanceState);
@@ -416,6 +452,9 @@ public class MainActivity extends Activity {
 		mDrawerToggle.syncState();
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onConfigurationChanged(Configuration newConfig) {
 		super.onConfigurationChanged(newConfig);
@@ -423,22 +462,21 @@ public class MainActivity extends Activity {
 		mDrawerToggle.onConfigurationChanged(newConfig);
 	}
 
-	public Fragment getCurrentFragment() {
-		return this.mDisplayedFragment;
-	}
-
-	public void setDrawerIndicatorEnabled(boolean val) {
-		mDrawerToggle.setDrawerIndicatorEnabled(val);
-	}
-
+	/**
+	 * Displays the view for the given navigation index
+	 *
+	 * @param position the index of the navigation item
+	 */
 	public void displayView(int position) {
 		MainMenuItem menuItemPosition = MainMenuItem.create(position);
 
+		// close the drawer if the to be displayed fragment is already being displayed
 		if (this.mDisplayedFragment != null && this.mDisplayedFragment.getClass() == menuItemPosition.getKlass()) {
 			mDrawerLayout.closeDrawer(mDrawerList);
 			return;
 		}
 
+		// open help video list when pressing help navigation item
 		if(menuItemPosition == MainMenuItem.HELP){
 			Intent intent = new Intent(Intent.ACTION_VIEW);
 			intent.setData(Uri.parse("https://www.youtube.com/playlist?list=PLJyUmtMldh3s1XtRfE4YFaQ8ME7xjf7Gx"));
@@ -462,15 +500,7 @@ public class MainActivity extends Activity {
 				rootFragment = fragment;
 			}
 
-			boolean isFirst = getFragmentManager().getBackStackEntryCount() == 0;
-
-			//getFragmentManager().popBackStackImmediate(HomeFragment.class.getName(), FragmentManager.POP_BACK_STACK_INCLUSIVE);
-			// update selected item and title, then close the drawer if needed
-			//if(!(fragment instanceof HomeFragment) || isFirst) {
-				injectFragment(fragment);// , false, menuItemPosition);
-			//} else {
-			//	injectFragment(rootFragment);
-			//}
+			injectFragment(fragment);
 
 			mDrawerList.setItemChecked(position, true);
 			mDrawerList.setSelection(position);
@@ -480,14 +510,15 @@ public class MainActivity extends Activity {
 		mDrawerLayout.closeDrawer(mDrawerList);
 	}
 
-	public void injectFragment(Fragment fragment, boolean enableBack) {
-		injectFragment(fragment);
-	}
-
+	/**
+	 * Injects an given fragment into the application content view
+	 *
+	 * @param fragment the fragment to inject
+	 */
 	public void injectFragment(Fragment fragment) {
 		this.mCloseWarning = false;
 
-		// set orientation fixed to portrait in home fragment
+		// set the action bar up navigation according to the nature of the given fragment
 		if (fragment instanceof UpNavigatibleFragment) {
 			UpNavigatibleFragment upFrag = (UpNavigatibleFragment) fragment;
 			if (upFrag.getUpFragment() == null) {
@@ -500,6 +531,7 @@ public class MainActivity extends Activity {
 
 		configureFragment(fragment);
 
+		// exchange the existing fragment with the given one
 		FragmentManager fragmentManager = getFragmentManager();
 		FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
 		fragmentTransaction.replace(R.id.content_frame, fragment, fragment.getClass().getName());
@@ -511,10 +543,16 @@ public class MainActivity extends Activity {
 		this.mDisplayedFragment = fragment;
 	}
 
+
 	private void configureFragment() {
 		configureFragment(this.mDisplayedFragment);
 	}
 
+	/**
+	 * Configures the given fragment, e.g. fixing the screen orientation
+	 *
+	 * @param fragment the fragment to configure
+	 */
 	private void configureFragment(Fragment fragment) {
 		if (fragment == null)
 			return;
@@ -532,6 +570,9 @@ public class MainActivity extends Activity {
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onBackPressed() {
 		if (mDisplayedFragment instanceof HomeFragment) {
@@ -559,6 +600,9 @@ public class MainActivity extends Activity {
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public boolean onKeyDown(int keycode, KeyEvent e) {
 		switch (keycode) {
@@ -576,22 +620,46 @@ public class MainActivity extends Activity {
 		return super.onKeyDown(keycode, e);
 	}
 
+	/**
+	 * Create a new intent intented for binding the hostage service to the activity
+	 *
+	 * @return the new service intent
+	 */
 	public Intent getServiceIntent() {
 		return new Intent(this, Hostage.class);
 	}
 
+	/**
+	 * Retrieves the currently displayed fragment
+	 *
+	 * @return the current fragment
+	 */
 	public Fragment getDisplayedFragment() {
 		return this.mDisplayedFragment;
 	}
 
+	/**
+	 * Retrieves the Hostage service instance
+	 * @return hostage service
+	 */
 	public Hostage getHostageService() {
 		return this.mHoneyService;
 	}
 
+	/**
+	 * Checks if the hostage service is bound to the activity
+	 * @return true,  if bound
+	 *         false, otherwise
+	 */
 	public boolean isServiceBound() {
 		return this.mServiceBound;
 	}
 
+	/**
+	 * Checks whether the hostage service is running
+	 * @return true,  if running
+	 *         false, otherwise
+	 */
 	public boolean isServiceRunning() {
 		ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
 		for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
@@ -602,8 +670,14 @@ public class MainActivity extends Activity {
 		return false;
 	}
 
+	/**
+	 * Start the monitoring of the given protocols in the hostage service
+	 *
+	 * @param protocols the protocols to start
+	 */
 	public void startMonitorServices(List<String> protocols){
 		for(String protocol: protocols){
+			// if the given protocol is ghost start a listener for every defined port for ghost
 			if(protocol.equals("GHOST")){
 				if(mProfileManager.getCurrentActivatedProfile() != null){
 					Profile profile = mProfileManager.getCurrentActivatedProfile();
@@ -619,6 +693,9 @@ public class MainActivity extends Activity {
 		}
 	}
 
+	/**
+	 * Holds the index of the navigation items in an enum and also a reference to an Fragment class for each item
+	 */
 	public enum MainMenuItem {
 		HOME(0, HomeFragment.class),
 		THREAT_MAP(1, ThreatMapFragment.class),
@@ -661,6 +738,9 @@ public class MainActivity extends Activity {
 		}
 	}
 
+	/**
+	 * The listener for the navigation drawer items.
+	 */
 	private class DrawerItemClickListener implements ListView.OnItemClickListener {
 		public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
 			displayView(position);

+ 7 - 0
src/de/tudarmstadt/informatik/hostage/ui2/activity/ProfileEditActivity.java

@@ -14,18 +14,25 @@ import android.provider.MediaStore;
 import de.tudarmstadt.informatik.hostage.ui2.fragment.ProfileEditFragment;
 
 /**
+ * This activity manages an fragment for editing and creating a profile
+ *
  * @author Alexander Brakowski
  * @created 08.02.14 23:36
  */
 public class ProfileEditActivity extends PreferenceActivity {
 	ProfileEditFragment editFragment;
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onCreate(Bundle savedInstanceState){
 		super.onCreate(savedInstanceState);
 
+		// initializes the profile edit fragment
 		editFragment = new ProfileEditFragment();
 
+		// injects the fragment into the view
 		getFragmentManager().beginTransaction()
 				.replace(android.R.id.content, editFragment)
 				.commit();

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

@@ -178,13 +178,6 @@ public class ProfileManagerListAdapter extends ArrayAdapter<Profile> {
 
 			    holder.imageSelected.setVisibility(View.GONE);
 		    } else {
-				/*float d = context.getResources().getDisplayMetrics().density;
-				int dm = (int)(20 * d);
-
-				lp.setMargins(0,0,dm,0);
-
-				holder.textView.setLayoutParams(lp);*/
-
 			    holder.imageSelected.setVisibility(View.VISIBLE);
 		    }
 

+ 2 - 0
src/de/tudarmstadt/informatik/hostage/ui2/fragment/AboutFragment.java

@@ -12,6 +12,8 @@ import android.widget.TextView;
 import de.tudarmstadt.informatik.hostage.R;
 
 /**
+ * Shows informations about the developers of the app
+ *
  * Created by Fabio Arnold on 25.02.14.
  * displays credits for the app
  */

+ 34 - 10
src/de/tudarmstadt/informatik/hostage/ui2/fragment/PreferenceHostageFrament.java

@@ -11,27 +11,37 @@ import java.util.HashMap;
 import de.tudarmstadt.informatik.hostage.R;
 
 /**
+ * Manages and creates the application preferences view
+ *
  * @author Alexander Brakowski
  * @created 02.03.14 21:03
  */
 public class PreferenceHostageFrament extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
+
+	/**
+	 * Maps an text preference to an suffix string
+	 */
 	private HashMap<String, String> mSuffixMap;
-	private String[] mTextPreferences;
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onCreate(Bundle savedInstanceState){
 		super.onCreate(savedInstanceState);
 
-		this.mTextPreferences = new String[]{
-			"pref_external_location",
-			"pref_upload_server",
-			"pref_max_connections",
-			"pref_timeout",
-			"pref_sleeptime",
-			"pref_location_time",
-			"pref_location_retries"
+		// these preferences are all text preferences
+		String[] textPreferences = new String[]{
+				"pref_external_location",
+				"pref_upload_server",
+				"pref_max_connections",
+				"pref_timeout",
+				"pref_sleeptime",
+				"pref_location_time",
+				"pref_location_retries"
 		};
 
+		// map the text preferences to suffixes
 		this.mSuffixMap = new HashMap<String, String>();
 		this.mSuffixMap.put("pref_timeout", "s");
 		this.mSuffixMap.put("pref_sleeptime", "ms");
@@ -39,11 +49,16 @@ public class PreferenceHostageFrament extends PreferenceFragment implements Shar
 
 		addPreferencesFromResource(R.xml.settings_preferences);
 
-		for(String k: this.mTextPreferences){
+		for(String k: textPreferences){
 			updatePreferenceSummary(k);
 		}
 	}
 
+	/**
+	 * Updates the summary text of the given preference
+	 *
+	 * @param key the preference key
+	 */
 	private void updatePreferenceSummary(String key){
 		Preference p = findPreference(key);
 		SharedPreferences sharedPreferences = this.getPreferenceManager().getSharedPreferences();
@@ -59,12 +74,18 @@ public class PreferenceHostageFrament extends PreferenceFragment implements Shar
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onResume() {
 		super.onResume();
 		getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onPause() {
 		getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
@@ -87,6 +108,9 @@ public class PreferenceHostageFrament extends PreferenceFragment implements Shar
 		return false;
 	}*/
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
 		updatePreferenceSummary(key);

+ 54 - 31
src/de/tudarmstadt/informatik/hostage/ui2/fragment/ProfileEditFragment.java

@@ -29,30 +29,42 @@ import de.tudarmstadt.informatik.hostage.persistence.ProfileManager;
 import de.tudarmstadt.informatik.hostage.model.Profile;
 
 /**
+ * Creates an preference screen to edit an profile
+ *
  * @author Alexander Brakowski
  * @created 08.02.14 23:39
  */
 public class ProfileEditFragment extends PreferenceFragment implements
 		SharedPreferences.OnSharedPreferenceChangeListener {
 
-	private LayoutInflater mInflater;
-	private SharedPreferences.Editor prefs;
+	/**
+	 * Holds the shared preference editor for out preference screen
+	 */
+	private SharedPreferences.Editor mPrefs;
 
-	private HashMap<String, Boolean> profileProtocols;
+	/**
+	 * A map which mirrors the state protocols in the preferencescreen
+	 */
+	private HashMap<String, Boolean> mProfileProtocols;
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onCreate(Bundle savedInstanceState){
 		getActivity().getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
 		super.onCreate(savedInstanceState);
 
-		mInflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+		LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 
-		View actionBarButtons = mInflater.inflate(R.layout.actionbar_donebar, new LinearLayout(getActivity()), false);
+		// remove default action bar and replace it with an "done"/"discard" action bar
+		View actionBarButtons = inflater.inflate(R.layout.actionbar_donebar, new LinearLayout(getActivity()), false);
 		getActivity().getActionBar().setCustomView(actionBarButtons);
 
 		View doneButton = actionBarButtons.findViewById(R.id.action_done);
 		View cancelButton = actionBarButtons.findViewById(R.id.action_cancel);
 
+		// add click listener for the save button
 		doneButton.setOnClickListener(new View.OnClickListener() {
 			@Override
 			public void onClick(View v) {
@@ -63,10 +75,12 @@ public class ProfileEditFragment extends PreferenceFragment implements
 
 				boolean createNew = false;
 
+				// no profile was given to the fragment, which means this is a new profile
 				if(profile == null){
 					profile = new Profile();
 					createNew = true;
 				} else {
+					// profile was given, if profile is not editable, clone the profile and make it editable
 					if(!profile.isEditable()){
 						profile = profile.cloneProfile();
 						profile.mEditable = true;
@@ -74,6 +88,7 @@ public class ProfileEditFragment extends PreferenceFragment implements
 					}
 				}
 
+				// update the profile object data with data from the preferences
 				profile.mLabel = prefs.getString("pref_profile_general_name", profile.mLabel);
 				profile.mIconPath = prefs.getString("pref_profile_general_image", profile.mIconPath);
 				profile.mText = prefs.getString("pref_profile_general_description", profile.mText);
@@ -84,8 +99,9 @@ public class ProfileEditFragment extends PreferenceFragment implements
 					profile.mGhostActive = false;
 				}
 
-				profile.mActiveProtocols = new HashMap<String, Boolean>(profileProtocols);
+				profile.mActiveProtocols = new HashMap<String, Boolean>(mProfileProtocols);
 
+				// persist the changes of the profile
 				if(createNew){
 					profile.mId = -1;
 					profile.mIconId = 0;
@@ -109,7 +125,7 @@ public class ProfileEditFragment extends PreferenceFragment implements
 		});
 
 		Profile profile = getProfile();
-		prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()).edit();
+		mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity()).edit();
 
 		String pname = "",
 			   pimage = null,
@@ -126,14 +142,16 @@ public class ProfileEditFragment extends PreferenceFragment implements
 			pbghost = profile.mGhostActive;
 		}
 
-		prefs.putString("pref_profile_general_name", pname);
-		prefs.putString("pref_profile_general_image", pimage);
-		prefs.putString("pref_profile_general_description", pdesc);
-		prefs.putString("pref_profile_protocols_ghost_text", pghost);
-		prefs.putBoolean("pref_profile_protocols_ghost_active", pbghost);
+		// fill the preferences of the preference screen with data from the profile object
+		mPrefs.putString("pref_profile_general_name", pname);
+		mPrefs.putString("pref_profile_general_image", pimage);
+		mPrefs.putString("pref_profile_general_description", pdesc);
+		mPrefs.putString("pref_profile_protocols_ghost_text", pghost);
+		mPrefs.putBoolean("pref_profile_protocols_ghost_active", pbghost);
 
-		prefs.commit();
+		mPrefs.commit();
 
+		// create the preference view
 		addPreferencesFromResource(R.xml.profile_preferences);
 
 		Preference pref = findPreference("pref_profile_general_image");
@@ -142,11 +160,12 @@ public class ProfileEditFragment extends PreferenceFragment implements
 
 		if(profile != null){
 			pref.setIcon(profile.getIconDrawable());
-			profileProtocols = new HashMap<String, Boolean>(profile.mActiveProtocols);
+			mProfileProtocols = new HashMap<String, Boolean>(profile.mActiveProtocols);
 		} else {
-			profileProtocols = new HashMap<String, Boolean>();
+			mProfileProtocols = new HashMap<String, Boolean>();
 		}
 
+		// show an image chooser dialog when pressing the image preference
 		pref.setOnPreferenceClickListener(
 				new Preference.OnPreferenceClickListener() {
 					@Override
@@ -176,28 +195,30 @@ public class ProfileEditFragment extends PreferenceFragment implements
 		String[] protocols = getResources().getStringArray(R.array.protocols);
 		String[] protocols_summary = getResources().getStringArray(R.array.protocols_description);
 
+		// add all available protocols to the preference screen with an checkbox
 		for(int i = 0; i<protocols.length; i++){
 			if(protocols[i].equals("GHOST")) continue;
 
-			prefs.putBoolean("pref_profile_protocol_" + protocols[i], profile != null && profile.isProtocolActive(protocols[i]));
-			prefs.commit();
+			mPrefs.putBoolean("pref_profile_protocol_" + protocols[i], profile != null && profile.isProtocolActive(protocols[i]));
+			mPrefs.commit();
 
 			CheckBoxPreference check = new CheckBoxPreference(getActivity());
 			check.setTitle(protocols[i]);
 			check.setKey("pref_profile_protocol_" + protocols[i]);
 			check.setSummary(protocols_summary[i]);
-			//check.setChecked(profile != null && profile.isProtocolActive(protocols[i]));
-			//System.out.println("-----------------_> " + profile.isProtocolActive(protocols[i]) + " :: " + protocols[i]);
+
 			protocolsCategory.addPreference(check);
 		}
 	}
 
+	/**
+	 * Retrieve the given profile from the intent
+	 * @return the profile
+	 */
 	public Profile getProfile(){
 		ProfileManager pmanager = ProfileManager.getInstance();
 
 		Intent intent = getActivity().getIntent();
-		//Profile profile = (Profile) intent.getSerializableExtra("profile");
-
 		int profile_id = intent.getIntExtra("profile_id", -1);
 
 		if(profile_id != -1){
@@ -207,12 +228,18 @@ public class ProfileEditFragment extends PreferenceFragment implements
 		return null;
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onResume() {
 		super.onResume();
 		getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onPause() {
 		getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
@@ -236,21 +263,19 @@ public class ProfileEditFragment extends PreferenceFragment implements
 		if(p instanceof EditTextPreference){
 			p.setSummary(sharedPreferences.getString(key, ""));
 		} else if(p instanceof CheckBoxPreference && !p.getKey().equals("pref_profile_protocols_ghost_active")){
-			profileProtocols.put(p.getTitle().toString(), ((CheckBoxPreference) p).isChecked());
+			mProfileProtocols.put(p.getTitle().toString(), ((CheckBoxPreference) p).isChecked());
 			//System.out.println("------------------------------- P: " + ((CheckBoxPreference) p).isChecked());
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) {
 		super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
 
 		if(resultCode == Activity.RESULT_OK){
-			Uri selectedImage = imageReturnedIntent.getData();
-			String[] filePathColumn = {MediaStore.Images.Media.DATA};
-
-			assert selectedImage != null;
-
 			Cursor cursor = getActivity().getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
 					new String[]{
 							MediaStore.Images.Media.DATA,
@@ -259,7 +284,6 @@ public class ProfileEditFragment extends PreferenceFragment implements
 					},
 			MediaStore.Images.Media.DATE_ADDED, null, "date_added ASC");
 
-			assert cursor != null;
 			String filePath = "";
 			if(cursor != null && cursor.moveToFirst())
 			{
@@ -275,11 +299,10 @@ public class ProfileEditFragment extends PreferenceFragment implements
 			options.inPreferredConfig = Bitmap.Config.ARGB_8888;
 			Bitmap bitmap = BitmapFactory.decodeFile(filePath, options);
 
-			assert pref != null;
 			pref.setIcon(new BitmapDrawable(getResources(), bitmap));
 
-			prefs.putString("pref_profile_general_image", filePath);
-			prefs.commit();
+			mPrefs.putString("pref_profile_general_image", filePath);
+			mPrefs.commit();
 		}
 	}
 }

+ 33 - 2
src/de/tudarmstadt/informatik/hostage/ui2/fragment/ProfileManagerFragment.java

@@ -26,25 +26,44 @@ import de.tudarmstadt.informatik.hostage.ui2.adapter.ProfileManagerListAdapter;
 import de.tudarmstadt.informatik.hostage.ui2.swipelist.SwipeListView;
 
 /**
+ * Displays a list of all available profiles and allows invocation of the edit activity for an profile
+ *
  * @author Alexander Brakowski
  * @created 14.01.14 15:05
  */
 public class ProfileManagerFragment extends Fragment {
+
+	/**
+	 * The adapter for the profile list
+	 */
 	private ProfileManagerListAdapter mAdapter;
 
+	/**
+	 * Holds the shared preferences for the app
+	 */
 	private SharedPreferences mSharedPreferences;
 
 	public ProfileManagerFragment(){}
 
+	/**
+	 * Holds the listview for the profile list
+	 */
 	private SwipeListView list;
-    @Override
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
                              Bundle savedInstanceState) {
 
 	    super.onCreateView(inflater, container, savedInstanceState);
 	    getActivity().setTitle(getResources().getString(R.string.drawer_profile_manager));
-	    setHasOptionsMenu(true);
 
+		// show action bar menu items
+		setHasOptionsMenu(true);
+
+		// inflate the view
         View rootView = inflater.inflate(R.layout.fragment_profile_manager, container, false);
 	    list = (SwipeListView) rootView.findViewById(R.id.profile_manager_listview);
 
@@ -56,6 +75,7 @@ public class ProfileManagerFragment extends Fragment {
 
         final List<Profile> strList = new LinkedList<Profile>(pmanager.getProfilesList());
 
+		// show an help item in the listview to indicate, that the items in the list are swipeable
 	    if(strList.size() > 0 && !mSharedPreferences.getBoolean("dismissedProfileSwipeHelp", false)){
 		    Profile tProfile = new Profile();
 		    tProfile.mShowTooltip = true;
@@ -68,6 +88,7 @@ public class ProfileManagerFragment extends Fragment {
 
         list.setAdapter(mAdapter);
 
+		// add open and close actions to the items of the list view
 		list.setSwipeListViewListener(new BaseSwipeListViewListener() {
 			@Override
 			public void onOpened(int position, boolean toRight){
@@ -83,6 +104,7 @@ public class ProfileManagerFragment extends Fragment {
 
 			@Override
 			public void onClickFrontView(int position) {
+				// active the pressed profile
 				Profile profile = mAdapter.getItem(position);
 				if(profile.mShowTooltip) return;
 
@@ -95,6 +117,9 @@ public class ProfileManagerFragment extends Fragment {
         return rootView;
     }
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onResume() {
 		super.onResume();
@@ -102,12 +127,18 @@ public class ProfileManagerFragment extends Fragment {
 		mAdapter.notifyDataSetChanged();
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
 		// Inflate the menu items for use in the action bar
 		inflater.inflate(R.menu.profile_manager_actions, menu);
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public boolean onOptionsItemSelected(MenuItem item) {
 		switch(item.getItemId()){

+ 85 - 70
src/de/tudarmstadt/informatik/hostage/ui2/fragment/RecordDetailFragment.java

@@ -25,56 +25,33 @@ import de.tudarmstadt.informatik.hostage.logging.MessageRecord;
 import de.tudarmstadt.informatik.hostage.persistence.HostageDBOpenHelper;
 
 /**
- * Created by Julien on 02.03.14.
+ * Displays detailed informations about an record.
+ *
+ * @author Fabio Arnold
+ * @author Alexander Brakowski
+ * @author Julien Clauter
  */
 public class RecordDetailFragment extends UpNavigatibleFragment {
-	private class Location {
-		private double longitude;
-		private double latitude;
-		private float accuracy;
 
-		public double getLatitude() {
-			return latitude;
-		}
-
-		public void setLatitude(double latitude) {
-			this.latitude = latitude;
-		}
+	/**
+	 * Hold the record of which the detail informations should be shown
+	 */
+	private Record mRecord;
 
-		public float getAccuracy() {
-			return accuracy;
-		}
-
-		public void setAccuracy(float accuracy) {
-			this.accuracy = accuracy;
-		}
+	/**
+	 * The database helper to retrieve data from the database
+	 */
+	private HostageDBOpenHelper mDBOpenHelper;
 
-		public double getLongitude() {
-			return this.longitude;
-		}
-
-		public void setLongitude(double longitude) {
-			this.longitude = longitude;
-		}
-
-		public Location() {
-			super();
-		}
-
-		public Location(double latitude, double longitude, float accuracy) {
-			super();
-			this.latitude = latitude;
-			this.longitude = longitude;
-			this.accuracy = accuracy;
-		}
-	}
-
-	private Record record;
-	private HostageDBOpenHelper dbh;
-	private View rootView;
+	/**
+	 * The layout inflater
+	 */
 	private LayoutInflater mInflater;
 
-	private ScrollView mScrollView;
+	/*
+	 * References to the views in the layout
+	 */
+	private View mRootView;
 	private LinearLayout mRecordOverviewConversation;
 	private TextView mRecordDetailsTextSsid;
 	private TextView mRecordDetailsTextBssid;
@@ -82,46 +59,73 @@ public class RecordDetailFragment extends UpNavigatibleFragment {
 	private TextView mRecordDetailsTextProtocol;
 	private Button mRecordDeleteButton;
 
+	/**
+	 * Sets the record of which the details should be displayed
+	 * @param rec the record to be used
+	 */
 	public void setRecord(Record rec) {
-		this.record = rec;
+		this.mRecord = rec;
 	}
 
+	/**
+	 * Retriebes the record which is used for the display of the detail informations
+	 * @return the record
+	 */
 	public Record getRecord() {
-		return this.record;
+		return this.mRecord;
 	}
 
+	/**
+	 * Retrieves the id of the layout
+	 * @return the id of the layout
+	 */
 	public int getLayoutId() {
-		// return R.layout.fragment_record_detail;
 		return R.layout.fragment_record_detail;
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
 	public void onCreate(Bundle savedInstanceState) {
 		super.onCreate(savedInstanceState);
 		setHasOptionsMenu(true);
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
 	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
 		super.onCreateView(inflater, container, savedInstanceState);
 
 		mInflater = inflater;
-		getActivity().setTitle(record.getSsid());
+		getActivity().setTitle(mRecord.getSsid());
 
-		this.dbh = new HostageDBOpenHelper(this.getActivity().getBaseContext());
+		this.mDBOpenHelper = new HostageDBOpenHelper(this.getActivity().getBaseContext());
 
-		this.rootView = inflater.inflate(this.getLayoutId(), container, false);
-		this.assignViews(rootView);
-		this.configurateRootView(rootView);
+		this.mRootView = inflater.inflate(this.getLayoutId(), container, false);
+		this.assignViews(mRootView);
+		this.configurateRootView(mRootView);
 
-		return rootView;
+		return mRootView;
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
 	public void onStart() {
 		super.onStart();
 
 	}
 
+	/**
+	 * Retrieves all the views from the given view
+	 *
+	 * @param view the layout view
+	 */
 	private void assignViews(View view) {
-		mScrollView = (ScrollView) view.findViewById(R.id.scrollView);
 		mRecordOverviewConversation = (LinearLayout) view.findViewById(R.id.record_overview_conversation);
 		mRecordDetailsTextSsid = (TextView) view.findViewById(R.id.record_details_text_ssid);
 		mRecordDetailsTextBssid = (TextView) view.findViewById(R.id.record_details_text_bssid);
@@ -130,16 +134,24 @@ public class RecordDetailFragment extends UpNavigatibleFragment {
 		mRecordDeleteButton = (Button) view.findViewById(R.id.record_delete_button);
 	}
 
+
+	/**
+	 * Configures the given view and fills it with the detail information
+	 *
+	 * @param rootView the view to use to display the informations
+	 */
 	private void configurateRootView(View rootView) {
 
-		mRecordDetailsTextBssid.setText(record.getBssid());
-		mRecordDetailsTextSsid.setText(record.getSsid());
-		if (record.getRemoteIP() != null)
-			mRecordDetailsTextRemoteip.setText(record.getRemoteIP() + ":" + record.getRemotePort());
-		mRecordDetailsTextProtocol.setText(record.getProtocol());
+		mRecordDetailsTextBssid.setText(mRecord.getBssid());
+		mRecordDetailsTextSsid.setText(mRecord.getSsid());
+		if (mRecord.getRemoteIP() != null)
+			mRecordDetailsTextRemoteip.setText(mRecord.getRemoteIP() + ":" + mRecord.getRemotePort());
 
-		ArrayList<Record> conversation = this.dbh.getConversationForAttackID(record.getAttack_id());
+			mRecordDetailsTextProtocol.setText(mRecord.getProtocol());
 
+		ArrayList<Record> conversation = this.mDBOpenHelper.getConversationForAttackID(mRecord.getAttack_id());
+
+		// display the conversation of the attack
 		for (Record r : conversation) {
 			View row;
 
@@ -195,14 +207,8 @@ public class RecordDetailFragment extends UpNavigatibleFragment {
 								new DialogInterface.OnClickListener() {
 									public void onClick(DialogInterface dialog,
 											int which) {
-										dbh.deleteByAttackID(record.getAttack_id());
-
-										// TODO: just navigate back...
-										/*RecordOverviewFragment recordOverviewFragment = new RecordOverviewFragment();
-										recordOverviewFragment.setFilter(new LogFilter());
-										recordOverviewFragment.setGroupKey("Protocol");
+										mDBOpenHelper.deleteByAttackID(mRecord.getAttack_id());
 
-										MainActivity.getInstance().injectFragment(recordOverviewFragment, false);*/
 										MainActivity.getInstance().navigateBack();
 									}
 								}
@@ -217,15 +223,24 @@ public class RecordDetailFragment extends UpNavigatibleFragment {
 	 * Date Transform
 	 * 
 	 * ***************************/
+
+	/**
+	 * Converts the given data to an localized string
+	 *
+	 * @param date the date to convert
+	 * @return the converted date as an string
+	 */
 	private String getDateAsString(Date date) {
 		return DateFormat.getDateFormat(getActivity()).format(date);
 	}
 
+	/**
+	 * Converts the given date to an localized time
+	 *
+	 * @param date the date to convert
+	 * @return the converted time as an string
+	 */
 	private String getTimeAsString(Date date) {
 		return DateFormat.getTimeFormat(getActivity()).format(date);
 	}
-
-	public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
-		super.onCreateOptionsMenu(menu, inflater);
-	}
 }

+ 11 - 0
src/de/tudarmstadt/informatik/hostage/ui2/fragment/SettingsFragment.java

@@ -10,10 +10,17 @@ import de.tudarmstadt.informatik.hostage.R;
 import de.tudarmstadt.informatik.hostage.system.Device;
 
 /**
+ * Creates the view to edit the preferences of the app and shows the porthack and rooted state of the device
+ *
  * @author Alexander Brakowski
  * @created 24.02.14 23:37
  */
 public class SettingsFragment extends UpNavigatibleFragment {
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
 	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
 		super.onCreateView(inflater, container, savedInstanceState);
 		getActivity().setTitle(getResources().getString(R.string.drawer_settings));
@@ -41,6 +48,10 @@ public class SettingsFragment extends UpNavigatibleFragment {
 		return v;
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
 	public void onViewCreated(View view, Bundle savedInstanceState) {
 		super.onViewCreated(view, savedInstanceState);
 

+ 28 - 0
src/de/tudarmstadt/informatik/hostage/ui2/fragment/UpNavigatibleFragment.java

@@ -3,27 +3,55 @@ package de.tudarmstadt.informatik.hostage.ui2.fragment;
 import android.app.Fragment;
 
 /**
+ * This abstract fragments allows the definition of an child - parent relation of fragments. It is necessary for the app to allow Up navigation of fragments.
+ *
  * @author Alexander Brakowski
  * @created 12.03.14 16:20
  */
 public abstract class UpNavigatibleFragment extends Fragment {
+	/**
+	 * Holds a reference to the parent fragment
+	 */
 	private Class<?> mUpFragment;
+
+	/**
+	 * Indicates whether the fragment is up navigatible
+	 */
 	private boolean mIsUpNavigatible = false;
 
 	private boolean mAllowBack = false;
 
+	/**
+	 * Retrieves the parent fragment to be used for up navigation
+	 * @return the parent fragment
+	 */
 	public Class<?> getUpFragment(){
 		return mUpFragment;
 	}
 
+	/**
+	 * Sets the parent fragment of this fragment.
+	 * @param upFragment the fragment to set as parent
+	 */
 	public void setUpFragment(Class<?> upFragment){
 		this.mUpFragment = upFragment;
 	}
 
+	/**
+	 * Checks whether this fragment can be navigated up
+	 *
+	 * @return true if this fragment can be up navigated,
+	 *         false otherwise
+	 */
 	public boolean isUpNavigatible(){
 		return mIsUpNavigatible;
 	}
 
+	/**
+	 * Sets the state of up navigation for this fragment
+	 * @param isUpNavigatible true to allow up navigation
+	 *                        false no up navigation
+	 */
 	public void setUpNavigatible(boolean isUpNavigatible){
 		this.mIsUpNavigatible = isUpNavigatible;
 	}

+ 5 - 0
src/de/tudarmstadt/informatik/hostage/ui2/layouts/FlowLayout.java

@@ -16,6 +16,11 @@ import android.view.View;
 import android.view.ViewGroup;
 import de.tudarmstadt.informatik.hostage.R;
 
+/**
+ * Subviews of this View will be positioned in an "flowing" manner.
+ *
+ * See {@link https://github.com/ApmeM/android-flowlayout}
+ */
 public class FlowLayout extends ViewGroup {
 	public static final int HORIZONTAL = 0;
 	public static final int VERTICAL = 1;

+ 10 - 0
src/de/tudarmstadt/informatik/hostage/ui2/model/DrawerListItem.java

@@ -4,11 +4,21 @@ import android.widget.ImageView;
 import android.widget.TextView;
 
 /**
+ * Holds the data for an navigation item in the navigation drawer
+ *
  * @author Alexander Brakowski
  * @created 13.01.14 16:37
  */
 public class DrawerListItem {
+
+	/**
+	 * The icon of the item
+	 */
     public int icon;
+
+	/**
+	 * The text of the item
+	 */
     public int text;
 
     public DrawerListItem(int text, int icon){

+ 0 - 31
src/de/tudarmstadt/informatik/hostage/ui2/model/ProfileListItem.java

@@ -1,31 +0,0 @@
-package de.tudarmstadt.informatik.hostage.ui2.model;
-
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-
-import de.tudarmstadt.informatik.hostage.ui2.activity.MainActivity;
-
-/**
- * @author Alexander Brakowski
- * @created 14.01.14 18:04
- */
-public class ProfileListItem {
-    public String label;
-    public String text;
-
-    public boolean activated;
-    public Bitmap icon;
-
-	public boolean isBackVisible = false;
-
-    public ProfileListItem(String text, String label, Bitmap icon){
-        this.text = text;
-        this.label = label;
-        this.activated = false;
-        this.icon = icon;
-    }
-
-    public ProfileListItem(String text, String label, int icon){
-        this(text, label, BitmapFactory.decodeResource(MainActivity.context.getResources(), icon));
-    }
-}