OSDN Git Service

Implement #29731
authoreagletmt <eagletmt@gmail.com>
Wed, 17 Oct 2012 12:56:53 +0000 (21:56 +0900)
committereagletmt <eagletmt@gmail.com>
Wed, 17 Oct 2012 12:56:53 +0000 (21:56 +0900)
CUTEn/src/jp/ac/titech/sharp4k/cuten/RecordActivity.java

index 20c166b..a5643d8 100644 (file)
@@ -13,6 +13,7 @@ import android.widget.Button;
 import android.widget.ExpandableListAdapter;
 import android.widget.ExpandableListView;
 import android.widget.ExpandableListView.OnChildClickListener;
+import android.widget.ExpandableListView.OnGroupClickListener;
 import android.widget.SimpleExpandableListAdapter;
 import android.widget.TextView;
 
@@ -60,6 +61,24 @@ public class RecordActivity extends BaseMenuActivity {
                        }
                });
 
+               recordList.setOnGroupClickListener(new OnGroupClickListener() {
+                       @Override
+                       public boolean onGroupClick(ExpandableListView parent, View v,
+                                       int groupPosition, long id) {
+                               if (parent.expandGroup(groupPosition)) {
+                                       for (int i = 0; i < parent.getExpandableListAdapter()
+                                                       .getGroupCount(); i++) {
+                                               if (i != groupPosition) {
+                                                       parent.collapseGroup(i);
+                                               }
+                                       }
+                               } else {
+                                       parent.collapseGroup(groupPosition);
+                               }
+                               return true;
+                       }
+               });
+
                recordList.setOnChildClickListener(new OnChildClickListener() {
                        @Override
                        public boolean onChildClick(ExpandableListView arg0, View arg1,