List of usage examples for android.support.v4.app FragmentActivity getSupportFragmentManager
public FragmentManager getSupportFragmentManager()
From source file:org.droidparts.inner.reader.SupportFragmentsReader.java
@Override public Fragment getFragment(Object fragmentActivityObj, int fragmentId, String valName) { FragmentActivity fragmentActivity = (FragmentActivity) fragmentActivityObj; if (fragmentId == 0) { fragmentId = ResourceUtils.getResourceId(fragmentActivity, valName); }/* www. ja va 2 s. co m*/ return fragmentActivity.getSupportFragmentManager().findFragmentById(fragmentId); }
From source file:com.github.hobbe.android.openkarotz.adapter.RadioTabsPagerAdapter.java
/** * Initialize the adapter.// w w w .ja v a 2s . c om * @param activity the parent activity * @param pager the associated view pager * @param groups a list of radio groups */ public RadioTabsPagerAdapter(FragmentActivity activity, ViewPager pager, RadioGroupModel[] groups) { super(activity.getSupportFragmentManager()); this.actionBar = activity.getActionBar(); this.viewPager = pager; this.viewPager.setAdapter(this); this.viewPager.setOnPageChangeListener(this); this.fragments = new RadioTabFragment[groups.length]; this.groups = groups; // Clean up current action bar actionBar.removeAllTabs(); // Adding Tabs for (RadioGroupModel group : groups) { addTab(actionBar.newTab(), group); } }
From source file:com.jaspersoft.android.jaspermobile.test.acceptance.viewer.WebViewInjector.java
@Override public void onActivityLifecycleChanged(Activity activity, Stage stage) { ComponentName targetComponentName = new ComponentName(activity, mClass.getName()); ComponentName currentComponentName = activity.getComponentName(); if (!currentComponentName.equals(targetComponentName)) return;// w w w.ja v a2s.com switch (stage) { case RESUMED: // As soon as, we are trying to register inject of idle resource during on Resume. // We need to do this only first time. And yes, I know it is dirty. Any suggestions welcomed :) if (!mInjected) { FragmentActivity htmlViewerActivity = (FragmentActivity) activity; WebViewFragment fragment = (WebViewFragment) htmlViewerActivity.getSupportFragmentManager() .findFragmentByTag(WebViewFragment.TAG); ViewGroup holder = (ViewGroup) fragment.getView().findViewById(R.id.webViewPlaceholder); // We need to wait for the activity to be created before getting a reference // to the webview JSWebView webView = (JSWebView) holder.getChildAt(0); mWebViewIdlingResource.inject(webView); mInjected = true; } break; case STOPPED: // Clean up reference if (activity.isFinishing()) mWebViewIdlingResource.clear(); break; default: // NOP } }
From source file:org.dmfs.oauth2.android.BasicOAuth2Authorization.java
@Override public void start(@NonNull FragmentActivity fragmentActivity) { OAuth2GrantProxyFragment oAuth2GrantProxyFragment = new OAuth2GrantProxyFragment(); oAuth2GrantProxyFragment.setArguments(mArguments); fragmentActivity.getSupportFragmentManager().beginTransaction() .add(mFragmentHostId, oAuth2GrantProxyFragment).commit(); }
From source file:org.coursera.android.shift.ShiftLauncherView.java
/** * Displays the Shift Menu// www .j a v a2 s .c om * User can call this if they want to show the Shift Menu without * using {@link #showFloatingIcon(FragmentActivity)}. */ public void showShiftMenu(FragmentActivity activity) { if (ShiftManager.getInstance().getVisibilityClient().isVisible()) { FragmentManager manager = activity.getSupportFragmentManager(); Fragment tabsFragment = manager.findFragmentByTag(TABS_TAG); //Don't allow user to open another menu if menu is currently open if (tabsFragment != null && tabsFragment.isVisible()) { return; } showTabsFragment(activity); } }
From source file:nz.org.winters.android.custompreference.ColorPickerPreferenceCompat.java
@Override protected void onClick() { super.onClick(); ColorPickerDialogCompat colorcalendar = (ColorPickerDialogCompat) ColorPickerDialogCompat.newInstance( R.string.color_picker_default_title, mColorChoices, getValue(), mNumColumns, Utils.isTablet(getContext()) ? ColorPickerDialogCompat.SIZE_LARGE : ColorPickerDialogCompat.SIZE_SMALL); //colorcalendar.setPreference(this); FragmentActivity activity = (FragmentActivity) getContext(); activity.getSupportFragmentManager().beginTransaction().add(colorcalendar, getFragmentTag()).commit(); colorcalendar.setOnColorSelectedListener(listener); }
From source file:rx_fcm.internal.GetFcmReceiversUIForeground.java
Wrapper retrieve(String screenName, Activity activity) { Wrapper receiverCandidate = null; if (activity == null) return receiverCandidate; if (activity instanceof FcmReceiverUIForeground) { FcmReceiverUIForeground fcmReceiverUIForeground = (FcmReceiverUIForeground) activity; boolean targetScreen = fcmReceiverUIForeground.matchesTarget(screenName); receiverCandidate = new Wrapper(fcmReceiverUIForeground, targetScreen); if (targetScreen) return receiverCandidate; }/*from w w w. ja v a 2 s . c om*/ if (!(activity instanceof FragmentActivity)) return receiverCandidate; FragmentActivity fragmentActivity = (FragmentActivity) activity; FragmentManager fragmentManager = fragmentActivity.getSupportFragmentManager(); fcmReceiversUIForegroundNotTargetScreen = new ArrayList<>(); Fragment fragment = getFcmReceiverUIForeground(fragmentManager.getFragments(), screenName); fcmReceiversUIForegroundNotTargetScreen.clear(); if (fragment != null) { FcmReceiverUIForeground fcmReceiverUIForeground = (FcmReceiverUIForeground) fragment; boolean isTargetScreen = fcmReceiverUIForeground.matchesTarget(screenName); return new Wrapper(fcmReceiverUIForeground, isTargetScreen); } else { return receiverCandidate; } }
From source file:rx_gcm.internal.GetGcmReceiversUIForeground.java
Wrapper retrieve(String screenName, Activity activity) { Wrapper receiverCandidate = null; if (activity == null) return receiverCandidate; if (activity instanceof GcmReceiverUIForeground) { GcmReceiverUIForeground gcmReceiverUIForeground = (GcmReceiverUIForeground) activity; boolean targetScreen = gcmReceiverUIForeground.matchesTarget(screenName); receiverCandidate = new Wrapper(gcmReceiverUIForeground, targetScreen); if (targetScreen) return receiverCandidate; }/* w ww . j a v a2s .c o m*/ if (!(activity instanceof FragmentActivity)) return receiverCandidate; FragmentActivity fragmentActivity = (FragmentActivity) activity; FragmentManager fragmentManager = fragmentActivity.getSupportFragmentManager(); gcmReceiversUIForegroundNotTargetScreen = new ArrayList<>(); Fragment fragment = getGcmReceiverUIForeground(fragmentManager.getFragments(), screenName); gcmReceiversUIForegroundNotTargetScreen.clear(); if (fragment != null) { GcmReceiverUIForeground gcmReceiverUIForeground = (GcmReceiverUIForeground) fragment; boolean isTargetScreen = gcmReceiverUIForeground.matchesTarget(screenName); return new Wrapper(gcmReceiverUIForeground, isTargetScreen); } else { return receiverCandidate; } }
From source file:com.app.blockydemo.ui.fragment.FormulaEditorListFragment.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); fragTransaction.show(this); fragTransaction.commit();/* ww w. ja va2s . co m*/ }
From source file:com.koushikdutta.widgets.ListContentFragmentInternal.java
@Override public void onDetach() { super.onDetach(); if (getActivity() == null || getActivity().isFinishing() || getActivity().isChangingConfigurations()) return;/*from w w w.jav a2s . com*/ if (!isPaged()) return; if (getActivity() instanceof FragmentActivity) { FragmentActivity fa = (FragmentActivity) getActivity(); fa.getSupportFragmentManager().popBackStack("content", FragmentManager.POP_BACK_STACK_INCLUSIVE); } else { onDetachNative(); } }