List of usage examples for android.view ViewGroup getId
@IdRes @ViewDebug.CapturedViewProperty public int getId()
From source file:com.example.li.demo.tab.FragmentListPageAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { // 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. // TODO: 2016/10/28 ???page? Fragment f = mFragments.get(position); if (f != null) { return f; }//w ww . jav a 2 s .c o m if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); } Fragment fragment = getItem(position); Fragment.SavedState fss = mSavedState.get(position); if (fss != null) { fragment.setInitialSavedState(fss); } fragment.setMenuVisibility(false); fragment.setUserVisibleHint(false); mFragments.put(position, fragment); mCurTransaction.add(container.getId(), fragment); return fragment; }
From source file:org.mythdroid.fragments.RecDetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle icicle) { if (container == null) return null; activity = (MDFragmentActivity) getActivity(); view = inflater.inflate(R.layout.recording_detail, null, false); Bundle args = getArguments();// w ww . j a v a 2 s . c o m if (args != null) { livetv = args.getBoolean(Extras.LIVETV.toString()); guide = args.getBoolean(Extras.GUIDE.toString()); } View detailsFrame = activity.findViewById(R.id.recdetails); dualPane = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE; embedded = activity.getClass().equals(Recordings.class); if (!embedded) activity.addHereToFrontendChooser(VideoPlayer.class); containerId = container.getId(); return view; }
From source file:com.cokus.fangdouyu.widget.viewpagerindicator.view.indicator.FragmentListPageAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { // 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. Fragment f = mFragments.get(position); if (f != null) { return f; }//from ww w.ja v a 2 s .c o m if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); } Fragment fragment = getItem(position); // if (DEBUG) // Log.v(TAG, "Adding item #" + position + ": f=" + fragment); Fragment.SavedState fss = mSavedState.get(position); if (fss != null) { fragment.setInitialSavedState(fss); } fragment.setMenuVisibility(false); fragment.setUserVisibleHint(false); mFragments.put(position, fragment); mCurTransaction.add(container.getId(), fragment); return fragment; }
From source file:edt.com.edt.view.mainpage.indicator.FragmentListPageAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { // 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_home manager has already // taken care of restoring the fragments we previously had instantiated. Fragment f = mFragments.get(position); if (f != null) { return f; }/* w w w . j ava 2s. c om*/ if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); } Fragment fragment = getItem(position); // if (DEBUG) // Log.v(TAG, "Adding item #" + position + ": f=" + fragment_home); Fragment.SavedState fss = mSavedState.get(position); if (fss != null) { fragment.setInitialSavedState(fss); } fragment.setMenuVisibility(false); fragment.setUserVisibleHint(false); mFragments.put(position, fragment); mCurTransaction.add(container.getId(), fragment); return fragment; }
From source file:com.github.michalbednarski.intentslab.uihelpers.FragmentTabMergingPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int page) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); }/*from w ww . ja v a2s . com*/ // Get info about page final MultiFragmentPageInfo pageInfo = mPagesInfoMap[page]; final int fragmentsOnPage = pageInfo != null ? pageInfo.fillInIds.length : 1; final int firstFragmentOnPage = mPageToFirstFragmentMap[page]; // Prepare wrapper layout final View view; final Fragment[] addedFragments; if (pageInfo != null) { view = LayoutInflater.from(container.getContext()).inflate(pageInfo.containerLayout, container, false); container.addView(view); addedFragments = new Fragment[fragmentsOnPage]; } else { view = null; addedFragments = null; } // Prepare all fragments on page final int pagerId = container.getId(); for (int i = 0; i < fragmentsOnPage; i++) { final int fragmentIndex = firstFragmentOnPage + i; final int containerId = pageInfo == null ? pagerId : pageInfo.fillInIds[i]; // Do we already have this fragment? String name = makeFragmentName(pagerId, fragmentIndex); Fragment fragment = mFragmentManager.findFragmentByTag(name); if (fragment != null) { if (DEBUG) Log.v(TAG, "Attaching item #" + fragmentIndex + ": f=" + fragment); if (fragment.getId() != containerId) { // Added to another container moveFragment(fragment, containerId); } else { // Already added, possibly detached if (pageInfo != null) { // When activity was created this tab wasn't ready // Detach and re-attach this fragment mCurTransaction.detach(fragment); } mCurTransaction.attach(fragment); } } else { // Not added fragment = mFragments[fragmentIndex]; if (DEBUG) Log.v(TAG, "Adding item #" + fragmentIndex + ": f=" + fragment); mCurTransaction.add(containerId, fragment, name); } // Deactivate menu if not on current page if (page != mCurrentPrimaryPage) { fragment.setMenuVisibility(false); fragment.setUserVisibleHint(false); } // For single fragment page return fragment if (pageInfo == null) { return fragment; } // On multi fragment page add to page addedFragments[i] = fragment; } // Return descriptor of multi fragment page return new AddedPageInfo(view, addedFragments); }
From source file:jahirfiquitiva.iconshowcase.fragments.base.FragmentStatePagerAdapter.java
@SuppressLint("CommitTransaction") @Override//from www .j a v a 2 s. co m public Object instantiateItem(ViewGroup container, int position) { // 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 (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); fragment.setUserVisibleHint(false); mFragments.set(position, fragment); mCurTransaction.add(container.getId(), fragment, "page:" + position); return fragment; }
From source file:com.example.study.studyproject.adapter.FragmentStatePagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { // 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; }/*from w w w . j a v a 2 s .c o m*/ } if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); } Fragment fragment = getItem(position); 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); fragment.setUserVisibleHint(false); mFragments.set(position, fragment); mCurTransaction.add(container.getId(), fragment); return fragment; }
From source file:com.thinkman.thinkviewpagerindicator.view.indicator.FragmentListPageAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { // 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; }// w w w. j ava 2 s . c o m } if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); } Fragment fragment = getItem(position); 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); fragment.setUserVisibleHint(false); mFragments.set(position, fragment); mCurTransaction.add(container.getId(), fragment); return fragment; }
From source file:com.bullshite.tvs.DSFragmentPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { // 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; }/*from w w w . j ava 2s. c o m*/ } 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); mFragments.set(position, fragment); mCurTransaction.add(container.getId(), fragment); return fragment; }
From source file:com.collegiate.core.FragmentStatePagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { // 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; }// w w w . ja v a 2s . co m } if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); } Fragment fragment = getItem(position); 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); fragment.setUserVisibleHint(false); mFragments.set(position, fragment); mCurTransaction.add(container.getId(), fragment); return fragment; }