com.actionbarsherlock.app.SherlockFragment Java Examples
The following examples show how to use
com.actionbarsherlock.app.SherlockFragment.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NewsFragmentSupport.java From zhangshangwuda with Apache License 2.0 | 5 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_REFRESH: SherlockFragment fragment = getFragmentByPosition(viewPager .getCurrentItem()); if (fragment != null) { fragment.onOptionsItemSelected(item); } return true; default: return super.onOptionsItemSelected(item); } }
Example #2
Source File: SectionAdapter.java From grilledui with BSD 2-Clause "Simplified" License | 5 votes |
public SectionAdapter add(SherlockFragment fragment, String title) { titles.add(title); sections.add(fragment); if(actionBar != null) { actionBar.addTab(createTab(title)); } if(arrayAdapter != null) { arrayAdapter.notifyDataSetChanged(); } notifyDataSetChanged(); return(this); }
Example #3
Source File: SectionAdapter.java From grilledui with BSD 2-Clause "Simplified" License | 5 votes |
public SectionAdapter add(int position, SherlockFragment fragment, String title) { titles.add(position, title); sections.add(position, fragment); if(actionBar != null) { actionBar.addTab(createTab(title), position); } if(arrayAdapter != null) { arrayAdapter.notifyDataSetChanged(); } notifyDataSetChanged(); return(this); }
Example #4
Source File: SectionAdapter.java From grilledui with BSD 2-Clause "Simplified" License | 5 votes |
public SherlockFragment remove(int position) { titles.remove(position); if(actionBar != null) { actionBar.removeTabAt(position); } if(arrayAdapter != null) { arrayAdapter.notifyDataSetChanged(); } SherlockFragment removed = sections.remove(position); notifyDataSetChanged(); return(removed); }
Example #5
Source File: SectionActivity.java From grilledui with BSD 2-Clause "Simplified" License | 5 votes |
public void onSectionSelected(int position) { SherlockFragment fragment = sectionAdapter.getItem(position); if(hasTwoPanes) { fm.beginTransaction().replace(getSectionDetailContainer(), fragment).commit(); } else { Intent intent = new Intent(this, this.getClass()); intent.putExtra(ARG_SECTION_ID, position); intent.putExtra(ARG_SECTION_FRAGMENT, fragment.getClass().getName()); startActivity(intent); } }
Example #6
Source File: NewsFragmentSupport.java From zhangshangwuda with Apache License 2.0 | 4 votes |
private SherlockFragment getFragmentByPosition(int position) { if (position > lessonsFragmentPagerAdapter.getmFragment().size() - 1) return null; return (SherlockFragment) lessonsFragmentPagerAdapter.getmFragment() .get(position); }
Example #7
Source File: SectionAdapter.java From grilledui with BSD 2-Clause "Simplified" License | 4 votes |
@Override public SherlockFragment getItem(int position) { return(sections.get(position)); }
Example #8
Source File: XmlSectionReader.java From grilledui with BSD 2-Clause "Simplified" License | 4 votes |
private static void addSection(XmlPullParser xml, SectionAdapter adapter, Context context) throws ClassNotFoundException, InstantiationException, IllegalAccessException { Object instance = Class.forName(xml.getAttributeValue(null, FRAGMENT_ATTR)).newInstance(); if(instance instanceof SherlockFragment) { adapter.add((SherlockFragment)instance, parseStringAttribute(xml.getAttributeValue(null, NAME_ATTR), context)); } }