List of usage examples for android.view ViewGroup getId
@IdRes @ViewDebug.CapturedViewProperty public int getId()
From source file:de.sourcestream.movieDB.adapter.MovieSlideAdapter.java
/** * @param container - our Viewpager/*from ww w .j a v a2 s . com*/ * Fired when we are in Movie or TV details and we pressed back button. * Recreates our fragments. */ public void reAttachFragments(ViewGroup container) { if (mCurTransaction == null) { mCurTransaction = manager.beginTransaction(); } for (int i = 0; i < getCount(); i++) { final long itemId = getItemId(i); // Do we already have this fragment? String name = "android:switcher:" + container.getId() + ":" + itemId; Fragment fragment = manager.findFragmentByTag(name); if (fragment != null) { mCurTransaction.detach(fragment); } } // Add this check for JUnit testing // This try block is added, because JUnit test fails in MainActivityTest.java, setUp() method. // java.lang.IllegalStateException: Recursive entry to executePendingTransactions try { mCurTransaction.commit(); } catch (java.lang.IllegalStateException e) { } mCurTransaction = null; }
From source file:com.joysoft.andutils.adapter.FragmentPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); }//w w w. ja v a 2 s . co m final long itemId = getItemId(position); // Do we already have this fragment? String name = makeFragmentName(container.getId(), itemId); Fragment 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); // fragment.setRetainInstance(true); 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.nononsenseapps.support.app.FragmentPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); }// w ww .j av a 2s . 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) { Log.d(TAG, "Attaching item #" + itemId + ": f=" + fragment); mCurTransaction.attach(fragment); } else { fragment = getItem(position); Log.d(TAG, "Adding item #" + itemId + ": f=" + fragment); mCurTransaction.add(container.getId(), fragment, makeFragmentName(container.getId(), itemId)); } // if (fragment != mCurrentPrimaryItem) { setMenuVisibility(fragment, false); setUserVisibleHint(fragment, false); // } return fragment; }
From source file:cn.ieclipse.af.adapter.AfFragmentPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); }//w w w. java 2 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) { // FragmentCompat.setMenuVisibility(fragment, false); // FragmentCompat.setUserVisibleHint(fragment, false); setMenuVisibility(fragment, false); setUserVisibleHint(fragment, false); } return fragment; }
From source file:com.duy.pascal.ui.common.app.FragmentsAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); }//from www .j a v a 2s. c om Fragment fragment = getItem(position); DLog.v(TAG, "Adding item #" + position + ": f=" + fragment); fragment.setMenuVisibility(false); fragment.setUserVisibleHint(false); mCurTransaction.add(container.getId(), fragment); return fragment; }
From source file:nz.ac.otago.psyanlab.common.designer.program.util.ProgramPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { if (mMaxFragmentsSeen < position + 1) { mMaxFragmentsSeen = position + 1; }//from ww w. j a va 2s. com if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); } // Do we already have this fragment? String name = makeFragmentName(container.getId(), position); Fragment fragment = mFragmentManager.findFragmentByTag(name); if (fragment != null) { mCurTransaction.attach(fragment); } else { fragment = getItem(position); mCurTransaction.add(container.getId(), fragment, makeFragmentName(container.getId(), position)); } fragment.setMenuVisibility(false); fragment.setUserVisibleHint(false); return fragment; }
From source file:com.github.paradam.infinitepager.InfiniteFragmentPagerAdapter.java
@Override public Object instantiateRelativeItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); }//from ww w .ja v a 2 s . co m final long itemId = getRelativeItemId(position); // Do we already have this fragment? String name = makeFragmentName(container.getId(), itemId); Fragment fragment = mFragmentManager.findFragmentByTag(name); if (fragment != null) { mCurTransaction.attach(fragment); } else { fragment = getRelativeItem(position); mCurTransaction.add(container.getId(), fragment, makeFragmentName(container.getId(), itemId)); } if (fragment != mCurrentPrimaryItem) { FragmentCompat.setMenuVisibility(fragment, false); FragmentCompat.setUserVisibleHint(fragment, false); } return fragment; }
From source file:com.github.paradam.support.v4.infinitepager.InfiniteFragmentPagerAdapter.java
@Override public Object instantiateRelativeItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); }/*from ww w. j a v a 2 s . co m*/ final long itemId = getRelativeItemId(position); // Do we already have this fragment? String name = makeFragmentName(container.getId(), itemId); Fragment fragment = mFragmentManager.findFragmentByTag(name); if (fragment != null) { mCurTransaction.attach(fragment); } else { fragment = getRelativeItem(position); mCurTransaction.add(container.getId(), fragment, makeFragmentName(container.getId(), itemId)); } if (fragment != mCurrentPrimaryItem) { fragment.setMenuVisibility(false); fragment.setUserVisibleHint(false); } return fragment; }
From source file:com.my.infiniteviewpager.app.InfiniteFragmentPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); }// w w w . j a v a2 s .co m final long itemId = getItemId(position); Fragment 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.jecelyin.common.app.FragmentsAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); }/*from w w w . jav a2 s. c o m*/ Fragment fragment = getItem(position); if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment); fragment.setMenuVisibility(false); fragment.setUserVisibleHint(false); mCurTransaction.add(container.getId(), fragment); return fragment; }