Merge commit '42b2e5ca519766e37ce6941ba4faecc9691cc403' into upstream
[debian/openrocket] / android / src / net / sf / openrocket / android / util / ExpandableListFragment.java
index e72cc36fd3ac21baa1e4c8410c09f623368b7257..4fab124627fb86bdfcda29a6cbb843a41a589afe 100644 (file)
@@ -2,7 +2,6 @@ package net.sf.openrocket.android.util;
 \r
 import android.os.Bundle;\r
 import android.os.Handler;\r
-import android.support.v4.app.Fragment;\r
 import android.view.ContextMenu;\r
 import android.view.ContextMenu.ContextMenuInfo;\r
 import android.view.Gravity;\r
@@ -19,6 +18,8 @@ import android.widget.ListAdapter;
 import android.widget.ListView;\r
 import android.widget.TextView;\r
 \r
+import com.actionbarsherlock.app.SherlockFragment;\r
+\r
 /**\r
  * \r
  * Pulled from https://gist.github.com/1316903\r
@@ -30,7 +31,7 @@ import android.widget.TextView;
  *\r
  * All ASLv2 licensed.\r
  */\r
-public class ExpandableListFragment extends Fragment\r
+public class ExpandableListFragment extends SherlockFragment\r
 implements OnCreateContextMenuListener, ExpandableListView.OnChildClickListener,\r
 ExpandableListView.OnGroupCollapseListener, ExpandableListView.OnGroupExpandListener\r
 {\r
@@ -50,6 +51,14 @@ ExpandableListView.OnGroupCollapseListener, ExpandableListView.OnGroupExpandList
                        onListItemClick((ListView) parent, v, position, id);\r
                }\r
        };\r
+       \r
+       final private AdapterView.OnItemLongClickListener mOnLongClickListener = new AdapterView.OnItemLongClickListener() {\r
+               @Override\r
+               public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {\r
+                       return onListItemLongClick( (ListView) parent, view, position, id);\r
+               }\r
+               \r
+       };\r
 \r
        ExpandableListAdapter mAdapter;\r
        ExpandableListView mList;\r
@@ -134,6 +143,10 @@ ExpandableListView.OnGroupCollapseListener, ExpandableListView.OnGroupExpandList
        public void onListItemClick(ListView l, View v, int position, long id) {\r
        }\r
 \r
+       public boolean onListItemLongClick(ListView l, View v, int position, long id ) {\r
+               return false;\r
+       }\r
+       \r
        /** Provide the cursor for the list view. */\r
        public void setListAdapter(ExpandableListAdapter adapter) {\r
                boolean hadAdapter = mAdapter != null;\r
@@ -282,6 +295,7 @@ ExpandableListView.OnGroupCollapseListener, ExpandableListView.OnGroupExpandList
                }\r
                mListShown = true;\r
                mList.setOnItemClickListener(mOnClickListener);\r
+               mList.setOnItemLongClickListener(mOnLongClickListener);\r
                if (mAdapter != null) {\r
                        setListAdapter(mAdapter);\r
                } else {\r