Bläddra i källkod

reopen groups in exp listview for record overview frag

Julien Clauter 10 år sedan
förälder
incheckning
49288a34cc

+ 20 - 0
src/de/tudarmstadt/informatik/hostage/ui2/fragment/RecordOverviewFragment.java

@@ -118,9 +118,29 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
 
 		View rootView = inflater.inflate(this.getLayoutId(), container, false);
 		ExpandableListView mylist = (ExpandableListView) rootView.findViewById(R.id.loglistview);
+
+        ArrayList<Integer> openSections = new ArrayList<Integer>();
+        if(this.expListView != null){
+            int numOfGroups = this.expListView.getExpandableListAdapter().getGroupCount();
+
+            for (int i = 0; i < numOfGroups; i++){
+                boolean isOpen = this.expListView.isGroupExpanded(i);
+                if (isOpen){
+                    openSections.add(i);
+                }
+            }
+        }
+
 		this.expListView = mylist;
 		populateListViewFromDB(mylist);
 
+        if (openSections.size() != 0){
+            for (int i = 0; i < openSections.size(); i++){
+                int index = openSections.get(i);
+                this.expListView.expandGroup(index);
+            }
+        }
+
 		registerListClickCallback(mylist);
 
         ImageButton filterButton = (ImageButton) rootView.findViewById(R.id.FilterButton);