List of usage examples for android.support.v4.app FragmentActivity getSupportFragmentManager
public FragmentManager getSupportFragmentManager()
From source file:org.kaaproject.kaa.demo.cityguide.fragment.BaseFragment.java
public void move(FragmentActivity activity, Fragment fragment, String tag) { if (activity == null) { GuideConstants.LOGGER.error("Unable pop fragment. Invalid args."); return;//from www . ja v a2s . c om } activity.getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment, tag) .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).addToBackStack(tag).commit(); }
From source file:io.atrac613.AbstractNfcTagFragment.java
/** * Activity????/*from w ww .j ava 2s. co m*/ * @param activity ???? * @param tag ? */ protected void unRegisterFragment(FragmentActivity activity, String tag) { FragmentManager fm = activity.getSupportFragmentManager(); Fragment fragment = fm.findFragmentByTag(tag); if (fragment != null) { FragmentTransaction trans = fm.beginTransaction(); { trans.remove(fragment); } trans.commit(); fm.executePendingTransactions(); } }
From source file:com.app.blockydemo.ui.fragment.FormulaEditorScriptListFragment.java
public void showFragment(Context context) { FragmentActivity activity = (FragmentActivity) context; FragmentManager fragmentManager = activity.getSupportFragmentManager(); FragmentTransaction fragTransaction = fragmentManager.beginTransaction(); Fragment formulaEditorFragment = fragmentManager .findFragmentByTag(FormulaEditorFragment.FORMULA_EDITOR_FRAGMENT_TAG); fragTransaction.hide(formulaEditorFragment); BottomBar.showBottomBar(activity);//from ww w .j ava 2 s. com BottomBar.hidePlayButton(activity); fragTransaction.show(this); fragTransaction.commit(); if (adapter != null) { initializeScriptAdapter(); } }
From source file:android.support.v17.leanback.app.BackgroundManager.java
private static BackgroundManager getSupportInstance(FragmentActivity activity) { BackgroundSupportFragment fragment = (BackgroundSupportFragment) activity.getSupportFragmentManager() .findFragmentByTag(FRAGMENT_TAG); if (fragment != null) { BackgroundManager manager = fragment.getBackgroundManager(); if (manager != null) { return manager; }/*www .ja v a2 s .co m*/ // manager is null: this is a fragment restored by FragmentManager, // fall through to create a BackgroundManager attach to it. } return new BackgroundManager(activity, true); }
From source file:it.mb.whatshare.Dialogs.java
/** * Shows a dialog informing the user that the QR code she's taken a picture * of is not valid.//from w w w . ja va 2s . c o m * * @param activity * the caller activity */ public static void onQRFail(final FragmentActivity activity) { DialogFragment failDialog = new PatchedDialogFragment() { public Dialog onCreateDialog(Bundle savedInstanceState) { return getBuilder(activity).setMessage(R.string.qr_code_fail) .setPositiveButton(R.string.qr_code_retry, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // do nothing } }).create(); } }; failDialog.show(activity.getSupportFragmentManager(), "fail"); }
From source file:com.javielinux.utils.TweetActions.java
public static void goToFavorite(final FragmentActivity activity, final InfoTweet infoTweet) { ArrayList<Entity> ents = DataFramework.getInstance().getEntityList("users", "service is null or service = \"twitter.com\""); if (ents.size() == 1) { createFavorite(activity, infoTweet, ents.get(0).getId()); } else {//from w w w.java 2s .c o m TwitterUsersConnectedDialogFragment frag = new TwitterUsersConnectedDialogFragment( new OnSelectedIconAndText() { @Override public void OnSelectedItem(IconAndTextSimpleAdapter.IconAndText item) { createFavorite(activity, infoTweet, Long.parseLong(item.extra.toString())); } }); frag.show(activity.getSupportFragmentManager(), "dialog"); } }
From source file:com.koushikdutta.widgets.ListContentFragmentInternal.java
public void setContent(FragmentInterfaceWrapper content, boolean clearChoices, String breadcrumb) { mCurrentContent = content;/*from w w w .java2 s .c om*/ if (getActivity() instanceof FragmentActivity) { Fragment f = (Fragment) mCurrentContent; FragmentActivity fa = (FragmentActivity) getActivity(); final FragmentManager fm = fa.getSupportFragmentManager(); FragmentTransaction ft = fa.getSupportFragmentManager().beginTransaction(); if (isPaged()) { View v = getFragment().getView(); Assert.assertNotNull(v); final View l = v.findViewById(R.id.list_fragment); Assert.assertNotNull(l); l.setVisibility(View.GONE); fm.addOnBackStackChangedListener(new OnBackStackChangedListener() { { listener = this; } @Override public void onBackStackChanged() { Fragment f = (Fragment) getFragment(); if (f.isDetached() || f.isRemoving()) { fm.removeOnBackStackChangedListener(this); return; } View v = getFragment().getView(); if (v == null) return; final View l = v.findViewById(R.id.list_fragment); if (l == null) return; if (fm.getBackStackEntryCount() > 0 && "content" .equals(fm.getBackStackEntryAt(fm.getBackStackEntryCount() - 1).getName())) { l.setVisibility(View.GONE); } else { l.setVisibility(View.VISIBLE); } } }); fm.popBackStack("content", FragmentManager.POP_BACK_STACK_INCLUSIVE); ft.setBreadCrumbTitle(breadcrumb); ft.setBreadCrumbShortTitle(breadcrumb); ft.addToBackStack("content"); } ft.replace(getContentId(), f, "content"); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.commit(); } else { setContentNative(breadcrumb); } if (clearChoices) getListView().clearChoices(); }
From source file:net.sarangnamu.common.frgmt.FrgmtManager.java
public void setFragmentManager(FragmentActivity act) { if (act == null) { DLog.e(TAG, "setFragmentManager act is null"); return;// w w w . j a v a 2 s. c o m } fm = act.getSupportFragmentManager(); }
From source file:bbct.android.common.activity.BaseballCardList.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { if (position == 0) { return;//from w w w. jav a 2 s . co m } Fragment details = BaseballCardDetails.getInstance(id); FragmentActivity activity = Objects.requireNonNull(this.getActivity()); activity.getSupportFragmentManager().beginTransaction() .replace(R.id.fragment_holder, details, FragmentTags.EDIT_CARD) .addToBackStack(FragmentTags.EDIT_CARD).commit(); }
From source file:com.devergence.widget.fraglistview.adapter.BaseAdapter.java
/** * Devuelve la vista para el elemento destacado * //w w w . ja v a2s . c o m * @param convertView * @return */ private View getCustomViewFeatured(View convertView) { View fakeView = mInflater.inflate(R.layout.frame_fragment_featured, null); FragmentActivity activity = getFragmentParentFragmentActivity(); Fragment fragment = getFeaturedFragment(mFeaturedItem); FragmentTransaction fragmentTransaction = activity.getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.contenedor_fragment_featured, fragment); //frame should exists fragmentTransaction.commit(); return fakeView; }