List of usage examples for android.app Fragment setMenuVisibility
public void setMenuVisibility(boolean menuVisible)
From source file:org.aisen.android.ui.fragment.adapter.FragmentPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); }//w w w . j av a2 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(position, 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; }
From source file:com.cgogolin.penandpdf.FragmentPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); }/* w w w . j a 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(fragment, false); // Fragment.setUserVisibleHint(fragment, false); fragment.setMenuVisibility(false); fragment.setUserVisibleHint(false); } return fragment; }
From source file:com.android.contacts.activities.DialtactsActivity.java
private void sendFragmentVisibilityChange(int position, boolean visibility) { if (DEBUG) {// w ww . j a va 2s .com Log.d(TAG, "sendFragmentVisibiltyChange(). position: " + position + ", visibility: " + visibility); } // Position can be -1 initially. See PageChangeListener. if (position >= 0) { final Fragment fragment = getFragmentAt(position); if (fragment != null) { fragment.setMenuVisibility(visibility); fragment.setUserVisibleHint(visibility); } } }