List of usage examples for android.app Fragment setMenuVisibility
public void setMenuVisibility(boolean menuVisible)
From source file:com.ls.android.bt.FragmentPagerMyAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); }// w w w .ja v a 2s . co m // Do we already have this fragment? String name = makeFragmentName(container.getId(), position); Fragment fragment = mFragmentManager.findFragmentByTag(name); if (fragment != null) { if (DEBUG) Log.v(TAG, "Attaching item #" + position + ": f=" + fragment); mCurTransaction.attach(fragment); } else { fragment = getItem(position); if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment); mCurTransaction.add(container.getId(), fragment, makeFragmentName(container.getId(), position)); } if (fragment != mCurrentPrimaryItem) { fragment.setMenuVisibility(false); fragment.setUserVisibleHint(false); } return fragment; }
From source file:com.commonsware.cwac.pager.ArrayPagerAdapter.java
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) @Override/* www.java 2s .c om*/ public Object instantiateItem(ViewGroup container, int position) { if (currTransaction == null) { currTransaction = fm.beginTransaction(); } Fragment fragment = getExistingFragment(position); if (fragment != null) { retentionStrategy.attach(fragment, currTransaction); } else { fragment = createFragment(entries.get(position).getDescriptor()); currTransaction.add(container.getId(), fragment, getFragmentTag(position)); } if (fragment != currPrimaryItem) { fragment.setMenuVisibility(false); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { fragment.setUserVisibleHint(false); } } return (fragment); }
From source file:com.acttogethermoving.estimator.widget.FragmentPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); }/*from w w w . j a v a 2 s. c o m*/ final long itemId = getItemId(position); // Do we already have this fragment? String name = makeFragmentName(container.getId(), itemId); Fragment fragment = mFragmentManager.findFragmentByTag(name); if (fragment != null) { if (DEBUG) Log.v(TAG, "Attaching item #" + itemId + ": f=" + fragment); mCurTransaction.attach(fragment); } else { fragment = getItem(position); if (DEBUG) Log.v(TAG, "Adding item #" + itemId + ": f=" + fragment); mCurTransaction.add(container.getId(), fragment, makeFragmentName(container.getId(), itemId)); } if (fragment != mCurrentPrimaryItem) { fragment.setMenuVisibility(false); fragment.setUserVisibleHint(false); } return fragment; }
From source file:com.cleveroad.slidingtutorial.FragmentPagerAdapter.java
@SuppressLint("CommitTransaction") @Override/*from w w w. j a v a 2 s.c om*/ public Object instantiateItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); } final long itemId = getItemId(position); // Do we already have this fragment? String name = makeFragmentName(container.getId(), itemId); Fragment fragment = mFragmentManager.findFragmentByTag(name); if (fragment != null) { if (DEBUG) Log.v(TAG, "Attaching item #" + itemId + ": f=" + fragment); mCurTransaction.attach(fragment); } else { fragment = getItem(position); if (DEBUG) Log.v(TAG, "Adding item #" + itemId + ": f=" + fragment); mCurTransaction.add(container.getId(), fragment, makeFragmentName(container.getId(), itemId)); } if (fragment != mCurrentPrimaryItem) { fragment.setMenuVisibility(false); setUserVisibilityHint(fragment, false); } return fragment; }
From source file:com.cgogolin.penandpdf.FragmentPagerAdapter.java
@Override public void setPrimaryItem(ViewGroup container, int position, Object object) { Fragment fragment = (Fragment) object; if (fragment != mCurrentPrimaryItem) { if (mCurrentPrimaryItem != null) { // Fragment.setMenuVisibility(mCurrentPrimaryItem, false); // Fragment.setUserVisibleHint(mCurrentPrimaryItem, false); mCurrentPrimaryItem.setMenuVisibility(false); mCurrentPrimaryItem.setUserVisibleHint(false); }/*www . jav a 2s. c o m*/ if (fragment != null) { // Fragment.setMenuVisibility(fragment, true); // Fragment.setUserVisibleHint(fragment, true); fragment.setMenuVisibility(true); fragment.setUserVisibleHint(true); } mCurrentPrimaryItem = fragment; } }
From source file:com.frostwire.android.gui.views.FragmentPagerAdapter.java
@SuppressWarnings("ReferenceEquality") @Override//from ww w . jav a2s.com public Object instantiateItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); } final long itemId = getItemId(position); // Do we already have this fragment? String name = makeFragmentName(container.getId(), itemId); Fragment fragment = mFragmentManager.findFragmentByTag(name); if (fragment != null) { if (DEBUG) Log.v(TAG, "Attaching item #" + itemId + ": f=" + fragment); mCurTransaction.attach(fragment); } else { fragment = getItem(position); if (DEBUG) Log.v(TAG, "Adding item #" + itemId + ": f=" + fragment); mCurTransaction.add(container.getId(), fragment, makeFragmentName(container.getId(), itemId)); } if (fragment != mCurrentPrimaryItem) { fragment.setMenuVisibility(false); fragment.setUserVisibleHint(false); } return fragment; }
From source file:com.way.adapter.FragmentPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); }//from w w w . j a va2 s . com final long itemId = getItemId(position); // Do we already have this fragment? String name = makeFragmentName(position); Fragment fragment = mFragmentManager.findFragmentByTag(name); if (fragment != null) { if (DEBUG) Log.v(TAG, "Attaching item #" + itemId + ": f=" + fragment); // mCurTransaction.attach(fragment); freshUI(fragment); } else { fragment = getItem(position); if (DEBUG) Log.v(TAG, "Adding item #" + itemId + ": f=" + fragment); mCurTransaction.add(container.getId(), fragment, makeFragmentName(position)); } if (fragment != mCurrentPrimaryItem) { fragment.setMenuVisibility(false); fragment.setUserVisibleHint(false); } return fragment; }
From source file:com.drownedinsound.ui.base.FragmentPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); }//from www .j ava2 s .c om final long itemId = getItemId(position); // Do we already have this fragment? String name = makeFragmentName(container.getId(), itemId); Fragment fragment = mFragmentManager.findFragmentByTag(name); if (fragment != null) { if (DEBUG) { Log.v(TAG, "Attaching item #" + itemId + ": f=" + fragment); } mCurTransaction.attach(fragment); } else { fragment = getItem(position); if (DEBUG) { Log.v(TAG, "Adding item #" + itemId + ": f=" + fragment); } mCurTransaction.add(container.getId(), fragment, makeFragmentName(container.getId(), itemId)); } if (fragment != mCurrentPrimaryItem) { fragment.setMenuVisibility(false); fragment.setUserVisibleHint(false); } return fragment; }
From source file:org.kegbot.app.util.SortableFragmentStatePagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { createIdCache();/*from w w w . j a v a 2 s . c o m*/ // If we already have this item instantiated, there is nothing // to do. This can happen when we are restoring the entire pager // from its saved state, where the fragment manager has already // taken care of restoring the fragments we previously had instantiated. if (mFragments.size() > position) { Fragment f = mFragments.get(position); if (f != null) { return f; } } if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); } Fragment fragment = getItem(position); if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment); if (mSavedState.size() > position) { Fragment.SavedState fss = mSavedState.get(position); if (fss != null) { fragment.setInitialSavedState(fss); } } while (mFragments.size() <= position) { mFragments.add(null); } fragment.setMenuVisibility(false); if (Build.VERSION.SDK_INT >= 15) { fragment.setUserVisibleHint(false); } mFragments.set(position, fragment); mCurTransaction.add(container.getId(), fragment); return fragment; }
From source file:com.m.support.adapter.FragmentPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); }/*from w ww . ja v a 2s .c om*/ final long itemId = getItemId(position); // Do we already have this fragment? String name = makeFragmentName(position); Fragment fragment = mFragmentManager.findFragmentByTag(name); if (fragment != null) { if (DEBUG) Log.v(TAG, "Attaching item #" + itemId + ": f=" + fragment); // mCurTransaction.attach(fragment); freshUI(fragment); } else { fragment = getItem(position); if (DEBUG) Log.v(TAG, "Adding item #" + itemId + ": f=" + fragment); mCurTransaction.add(container.getId(), fragment, makeFragmentName(position)); } if (fragment != mCurrentPrimaryItem) { fragment.setMenuVisibility(false); } if (fragment instanceof FragmentPagerChangeListener) ((FragmentPagerChangeListener) fragment).instantiate(makeFragmentName(position)); return fragment; }