@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Bundle bundle = getArguments(); if (bundle != null) { category = bundle.getString(MATH_ENTITY_CATEGORY_EXTRA_STRING); } fragmentHelper.onCreate(this); }
@Override public void onViewCreated(View root, Bundle savedInstanceState) { super.onViewCreated(root, savedInstanceState); fragmentHelper.onViewCreated(this, root); final ListView lv = getListView(); lv.setTextFilterEnabled(true); lv.setOnItemClickListener( new AdapterView.OnItemClickListener() { public void onItemClick( final AdapterView<?> parent, final View view, final int position, final long id) { final AMenuItem<T> onClick = getOnClickAction(); if (onClick != null) { onClick.onClick(((T) parent.getItemAtPosition(position)), getActivity()); } } }); getListView() .setOnItemLongClickListener( new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick( AdapterView<?> parent, View view, int position, long id) { final T item = (T) parent.getItemAtPosition(position); final List<LabeledMenuItem<T>> menuItems = getMenuItemsOnLongClick(item); if (!menuItems.isEmpty()) { final AMenuBuilder<LabeledMenuItem<T>, T> menuBuilder = AMenuBuilder.newInstance( AbstractMathEntityListFragment.this.getActivity(), MenuImpl.newInstance(menuItems)); menuBuilder.create(item).show(); } return true; } }); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return fragmentHelper.onCreateView(this, inflater, container); }
@Override public void onDestroy() { fragmentHelper.onDestroy(this); super.onDestroy(); }