|
@@ -2,6 +2,8 @@ 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.os.Bundle;
|
|
@@ -11,10 +13,8 @@ import android.view.Menu;
|
|
|
import android.view.MenuInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
-import android.widget.AdapterView;
|
|
|
import android.widget.ExpandableListView;
|
|
|
import android.widget.ImageButton;
|
|
|
-import android.widget.Toast;
|
|
|
|
|
|
import com.google.android.gms.maps.model.LatLng;
|
|
|
|
|
@@ -266,8 +266,11 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
|
|
|
|
|
|
ExpandableListItem item = new ExpandableListItem();
|
|
|
item.setData(map);
|
|
|
+
|
|
|
item.setId_Mapping(mapping);
|
|
|
|
|
|
+ item.setTag(val.getId());
|
|
|
+
|
|
|
String groupID = this.getGroupValue(val);
|
|
|
|
|
|
ArrayList<ExpandableListItem> items = sectionData.get(groupID);
|
|
@@ -311,37 +314,20 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
|
|
|
}
|
|
|
|
|
|
private void registerListClickCallback(ExpandableListView mylist) {
|
|
|
+ mylist.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
|
|
|
+ @Override
|
|
|
+ public boolean onChildClick(ExpandableListView expandableListView, View view, int i, int i2, long l) {
|
|
|
+ RecordListAdapter adapter = (RecordListAdapter)expandableListView.getExpandableListAdapter();
|
|
|
|
|
|
- mylist.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
|
- public void onItemClick(AdapterView<?> parent, View viewClicked,
|
|
|
- int position, long idInDB) {
|
|
|
- UglyDbHelper dbh = new UglyDbHelper(getBaseContext());
|
|
|
- Record rec = dbh.getRecord((int) idInDB);
|
|
|
- String message = createInformationStringFromRecord(rec);
|
|
|
- Toast.makeText(getApplicationContext(), message,
|
|
|
- Toast.LENGTH_LONG).show();
|
|
|
- // TODO add detail view in here
|
|
|
- /*OPEN DETAIL VIEW*/
|
|
|
- }
|
|
|
+ ExpandableListItem item = (ExpandableListItem)adapter.getChild(i,i2);
|
|
|
|
|
|
- private String createInformationStringFromRecord(Record rec) {
|
|
|
- String message = "id: " + rec.getId() + "\n" + "attack_id: "
|
|
|
- + rec.getAttack_id() + "\n" + "protocol: "
|
|
|
- + rec.getProtocol() + "\n" + "type: " + rec.getType()
|
|
|
- + "\n" + "externalIP: " + rec.getExternalIP() + "\n"
|
|
|
- + "localIP: " + rec.getLocalIP() + "\n"
|
|
|
- + "local port: " + rec.getLocalPort() + "\n"
|
|
|
- + "remoteIP: " + rec.getRemoteIP() + "\n" + "BSSID: "
|
|
|
- + rec.getBssid() + "\n" + "SSID: " + rec.getSsid()
|
|
|
- + "\n" + "latitude: " + rec.getLatitude() + "\n"
|
|
|
- + "longitude: " + rec.getLongitude() + "\n"
|
|
|
- + "accuracy: " + rec.getAccuracy() + "\n" + "packet: "
|
|
|
- + rec.getPacket() + "\n"
|
|
|
- + getDateAsString(rec.getTimestamp()) + "";
|
|
|
- return message;
|
|
|
- }
|
|
|
+ UglyDbHelper dbh = new UglyDbHelper(getBaseContext());
|
|
|
+ Record rec = dbh.getRecord((int) item.getTag());
|
|
|
+ RecordOverviewFragment.this.pushRecordDetailViewForRecord(rec);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- });
|
|
|
}
|
|
|
|
|
|
|
|
@@ -357,7 +343,7 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
|
|
|
private String getDateAsString(long timeStamp) {
|
|
|
|
|
|
try {
|
|
|
- DateFormat sdf = new SimpleDateFormat("H:mm dd/MM/yyyy");
|
|
|
+ DateFormat sdf = new SimpleDateFormat("H:mm d.M.yy");
|
|
|
Date netDate = (new Date(timeStamp));
|
|
|
return sdf.format(netDate);
|
|
|
} catch (Exception ex) {
|
|
@@ -786,4 +772,22 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /*Navigation*/
|
|
|
+ private void pushRecordDetailViewForRecord(Record record){
|
|
|
+
|
|
|
+ FragmentManager fm = this.getActivity().getFragmentManager();
|
|
|
+
|
|
|
+ if (fm != null){
|
|
|
+ RecordDetailFragment newFragment = new RecordDetailFragment();
|
|
|
+ newFragment.setRecord(record);
|
|
|
+
|
|
|
+ FragmentTransaction transaction = fm.beginTransaction();
|
|
|
+ transaction.replace(R.id.content_frame, newFragment, newFragment.getTag());
|
|
|
+ transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
|
|
|
+ transaction.addToBackStack(null);
|
|
|
+
|
|
|
+ transaction.commit();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|