List of usage examples for android.view ViewGroup getId
@IdRes @ViewDebug.CapturedViewProperty public int getId()
From source file:fr.shywim.antoinedaniel.ui.fragment.SoundPagerFragment.java
private void switchFragmentsIfNecessary(boolean filter, String constraint) { final String FRAGMENT_TAG = "filter_fragment"; FragmentManager fm = getFragmentManager(); View root = getView();//www. ja v a 2s. c o m if (root != null) { ViewGroup container = (ViewGroup) root.findViewById(R.id.filter_container); Fragment fragment = fm.findFragmentByTag(FRAGMENT_TAG); if (filter) { if (fragment == null) { fragment = SoundFragment.newInstance(MainActivity.LoaderID.SOUND_FILTER); } if (!fragment.isAdded()) { FragmentTransaction ft = fm.beginTransaction(); ft.add(container.getId(), fragment, FRAGMENT_TAG); ft.addToBackStack(null); ft.commit(); } sendFilterToFragment((FilterListener) fragment, constraint); } else { if (fragment != null) { FragmentTransaction ft = fm.beginTransaction(); ft.remove(fragment); ft.commit(); } } } }
From source file:org.mythdroid.fragments.RecEditFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle icicle) { synchronized (initLock) { while (!initErr && rule == null) try { initLock.wait();/* ww w .ja va2s . c om*/ } catch (InterruptedException e) { } } if (container == null || initErr) return null; containerId = container.getId(); view = inflater.inflate(R.layout.recording_edit, null, false); View schedOptFrame = view.findViewById(R.id.schedOptFrame); inlineOpts = schedOptFrame != null && schedOptFrame.getVisibility() == View.VISIBLE; if (inlineOpts) { resf = new RecEditSchedFragment(); regf = new RecEditGroupsFragment(); getFragmentManager().beginTransaction() .replace(R.id.schedOptFrame, resf, resf.getClass().getSimpleName()) .replace(R.id.groupOptFrame, regf, regf.getClass().getSimpleName()) .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).commitAllowingStateLoss(); } if ((prog = Globals.curProg) == null) { initError(new IllegalArgumentException(Messages.getString("RecEditFragment.0") //$NON-NLS-1$ )); return view; } setViews(); if (!inlineOpts) checkChildren(); return view; }
From source file:com.travoca.app.utils.FragmentPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); }//from w ww. j ava 2s. c o m final long itemId = getItemId(position); // Do we already have this fragment? String name = getTag(position); Fragment fragment = mFragmentManager.findFragmentByTag(name); if (fragment != null) { if (DEBUG) { AppLog.v(TAG, "Attaching item #" + itemId + ": f=" + fragment); } mCurTransaction.attach(fragment); } else { fragment = getItem(position); if (DEBUG) { AppLog.v(TAG, "Adding item #" + itemId + ": f=" + fragment); } mCurTransaction.add(container.getId(), fragment, getTag(position)); } if (fragment != mCurrentPrimaryItem) { fragment.setMenuVisibility(false); fragment.setUserVisibleHint(false); } return fragment; }
From source file:com.android.deskclock.timer.FragmentStatePagerAdapter2.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. final Fragment existing = mFragments.get(position); if (existing != null) { return existing; }//from w w w. java2 s .co m if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); } Fragment fragment = getItem(position); if (fragment != mCurrentPrimaryItem) { setItemVisible(fragment, false); } mFragments.put(position, fragment); mCurTransaction.add(container.getId(), fragment); return fragment; }
From source file:com.alexgwyn.taggablefragmentpageradapter.TaggableFragmentPagerAdapter.java
@SuppressLint("CommitTransaction") @Override/* www . java 2 s .co m*/ public Object instantiateItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); } // Do we already have this fragment? String name = getTag(position); Fragment fragment = mFragmentManager.findFragmentByTag(name); if (fragment != null) { if (DEBUG) Log.v(TAG, "Attaching item #" + getTag(position) + ": f=" + fragment); mCurTransaction.attach(fragment); } else { fragment = getItem(position); String tag = getTag(position); if (DEBUG) Log.v(TAG, "Adding item #" + tag + ": f=" + fragment); mTagArray.put(tag, position); mCurTransaction.add(container.getId(), fragment, tag); } 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(); }//ww w .jav 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); fragment.setUserVisibleHint(false); } return fragment; }
From source file:com.example.search.adapter.FragmentPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); }//ww w .j a v a2s.c o m 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; }
From source file:com.tesla.framework.ui.fragment.adpater.FragmentPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { if (mCurTransaction == null) { mCurTransaction = mFragmentManager.beginTransaction(); }// w w w. j ava 2 s .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(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.juick.android.MainActivity.java
private static void restyleViewGroup(ViewGroup view, ColorsTheme.ColorTheme colorTheme, boolean pressed, boolean selected, boolean dontBackground) { ViewGroup parent = view; if (parent.getId() == R.id.navigation_panel) return;/* ww w. ja v a 2 s. co m*/ int childCount = parent.getChildCount(); int background = colorTheme.getBackground(pressed); int foreground = colorTheme.getForeground(pressed); if (selected) { background = calculatePressedBackground(background, foreground); } if (!dontBackground) { boolean skipDraw = false; if ((view instanceof LinearLayout || view instanceof FrameLayout || view instanceof RelativeLayout)) { Context context = view.getContext(); if (context instanceof MainActivity || context instanceof MessagesActivity || context instanceof ThreadActivity) { // no unneeded background in given scrolling activities skipDraw = true; if (view.getBackground() != null) { // but enable for layouts that with color skipDraw = false; } if (!skipDraw && view.getClass().getName().toLowerCase().contains("decorview")) { // given activities manage themselves skipDraw = true; } } } if (!skipDraw) parent.setBackgroundColor(background); } if (view instanceof ListView) dontBackground = true; for (int i = 0; i < childCount; i++) { View child = parent.getChildAt(i); restyleChildrenOrWidget(child, dontBackground); } }
From source file:com.app_software.chromisstock.ProductListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_product_list); // Restore state if (savedInstanceState != null) { m_ListFragment = (ProductListFragment) getSupportFragmentManager().getFragment(savedInstanceState, "m_ListFragment"); } else {// w ww . j a va 2 s. co m // If our layout has a container for the image selector fragment, // create and add it ViewGroup layout = (ViewGroup) findViewById(R.id.product_list); if (layout != null) { Bundle args = new Bundle(); Intent i = getIntent(); if (i != null) { if (Intent.ACTION_SEARCH.equals(i.getAction())) { String search = i.getStringExtra(SearchManager.QUERY); args.putString(ProductListFragment.ARG_SEARCH, search); } } // Add image selector fragment to the activity's container layout m_ListFragment = new ProductListFragment(); m_ListFragment.setArguments(args); FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(layout.getId(), m_ListFragment, ProductListFragment.class.getName()); // Commit the transaction fragmentTransaction.commit(); } } if (findViewById(R.id.product_detail_container) != null) { // The detail container view will be present only in the // large-screen layouts (res/values-large and // res/values-sw600dp). If this view is present, then the // activity should be in two-pane mode. mTwoPane = true; // In two-pane mode, list items should be given the // 'activated' state when touched. m_ListFragment.setActivateOnItemClick(true); } }