List of usage examples for android.app Activity getFragmentManager
@Deprecated
public FragmentManager getFragmentManager()
From source file:io.digibyte.presenter.fragments.FragmentTransactionDetails.java
@Override public void onStop() { super.onStop(); final Activity app = getActivity(); BRAnimator.animateBackgroundDim(backgroundLayout, true); BRAnimator.animateSignalSlide(txViewPager, true, new BRAnimator.OnSlideAnimationEnd() { @Override/* w w w .j av a2 s.c om*/ public void onAnimationEnd() { if (app != null && !app.isDestroyed()) app.getFragmentManager().popBackStack(); else Log.e(TAG, "onAnimationEnd: app is null"); } }); }
From source file:com.appsimobile.appsihomeplugins.dashclock.configuration.AppChooserPreference.java
@Override protected void onAttachedToActivity() { super.onAttachedToActivity(); Activity activity = (Activity) getContext(); AppChooserDialogFragment fragment = (AppChooserDialogFragment) activity.getFragmentManager() .findFragmentByTag(getFragmentTag()); if (fragment != null) { // re-bind preference to fragment fragment.setPreference(this); }//w ww .j a va 2s. co m }
From source file:net.imatruck.betterweather.settings.WeatherLocationPreference.java
@Override protected void onClick() { super.onClick(); LocationChooserDialogFragment fragment = LocationChooserDialogFragment.newInstance(); fragment.setPreference(this); Activity activity = (Activity) getContext(); activity.getFragmentManager().beginTransaction().add(fragment, getFragmentTag()).commit(); }
From source file:net.imatruck.betterweather.settings.WeatherLocationPreference.java
@Override protected void onAttachedToActivity() { super.onAttachedToActivity(); Activity activity = (Activity) getContext(); LocationChooserDialogFragment fragment = (LocationChooserDialogFragment) activity.getFragmentManager() .findFragmentByTag(getFragmentTag()); if (fragment != null) { // re-bind preference to fragment fragment.setPreference(this); }// w w w.ja v a2s . c om }
From source file:com.facebook.react.modules.dialog.DialogModule.java
/** * Creates a new helper to work with either the FragmentManager or the legacy support * FragmentManager transparently. Returns null if we're not attached to an Activity. * * DO NOT HOLD LONG-LIVED REFERENCES TO THE OBJECT RETURNED BY THIS METHOD, AS THIS WILL CAUSE * MEMORY LEAKS.//from ww w.j av a 2s.co m */ private @Nullable FragmentManagerHelper getFragmentManagerHelper() { Activity activity = getCurrentActivity(); if (activity == null) { return null; } if (activity instanceof FragmentActivity) { return new FragmentManagerHelper(((FragmentActivity) activity).getSupportFragmentManager()); } else { return new FragmentManagerHelper(activity.getFragmentManager()); } }
From source file:com.blue.leaves.util.task.SugarTask.java
private void registerHookToContext(@NonNull Activity activity) { FragmentManager manager = activity.getFragmentManager(); HookFragment hookFragment = (HookFragment) manager.findFragmentByTag(TAG_HOOK); if (hookFragment == null) { hookFragment = new HookFragment(); manager.beginTransaction().add(hookFragment, TAG_HOOK).commitAllowingStateLoss(); }// www .j ava 2 s . c o m }
From source file:com.blue.leaves.util.task.SugarTask.java
private void unregisterHookToContext(@NonNull Activity activity) { FragmentManager manager = activity.getFragmentManager(); HookFragment hookFragment = (HookFragment) manager.findFragmentByTag(TAG_HOOK); if (hookFragment != null) { hookFragment.postEnable = false; manager.beginTransaction().remove(hookFragment).commitAllowingStateLoss(); }//from www . ja v a2 s. co m }
From source file:android.support.v17.leanback.app.GuidedStepFragment.java
/** * Adds the specified GuidedStepFragment as content of Activity; no backstack entry is added so * the activity will be dismissed when BACK key is pressed. The method is typically called in * Activity.onCreate() when savedInstanceState is null. When savedInstanceState is not null, * the Activity is being restored, do not call addAsRoot() to duplicate the Fragment restored * by FragmentManager./*w w w .j a v a 2 s . c om*/ * {@link #UI_STYLE_ACTIVITY_ROOT} is assigned. * * Note: currently fragments added using this method must be created programmatically rather * than via XML. * @param activity The Activity to be used to insert GuidedstepFragment. * @param fragment The GuidedStepFragment to be inserted into the fragment stack. * @param id The id of container to add GuidedStepFragment, can be android.R.id.content. * @return The ID returned by the call FragmentTransaction.commit, or -1 there is already * GuidedStepFragment. */ public static int addAsRoot(Activity activity, GuidedStepFragment fragment, int id) { // Workaround b/23764120: call getDecorView() to force requestFeature of ActivityTransition. activity.getWindow().getDecorView(); FragmentManager fragmentManager = activity.getFragmentManager(); if (fragmentManager.findFragmentByTag(TAG_LEAN_BACK_ACTIONS_FRAGMENT) != null) { Log.w(TAG, "Fragment is already exists, likely calling " + "addAsRoot() when savedInstanceState is not null in Activity.onCreate()."); return -1; } FragmentTransaction ft = fragmentManager.beginTransaction(); fragment.setUiStyle(UI_STYLE_ACTIVITY_ROOT); return ft.replace(id, fragment, TAG_LEAN_BACK_ACTIONS_FRAGMENT).commit(); }
From source file:com.ysy.classpower_utils.search_view.OwnSearchViewLayout.java
/*** * Set the fragment which would be shown in the expanded state * @param activity to get fragment manager * @param contentFragment fragment which needs to be shown. *//*from ww w . j av a 2 s .com*/ public void setExpandedContentFragment(Activity activity, Fragment contentFragment) { mExpandedContentFragment = contentFragment; mFragmentManager = activity.getFragmentManager(); mExpandedHeight = Utils.getSizeOfScreen(activity).y; }
From source file:com.example.imagedownloader.ImageDownloader.java
public ImageDownloader(Activity actv) { imagesDirectory = Storage.getImagesDirectory(); if (withRetainFragment) { RetainFragment mRetainFragment = RetainFragment.findOrCreateRetainFragment(actv.getFragmentManager()); mMemoryCache = RetainFragment.mRetainedCache; if (mMemoryCache == null) { mMemoryCache = new LruCache<String, Bitmap>(cacheSize) { @Override/*w ww . j a v a 2s. co m*/ protected int sizeOf(String key, Bitmap bitmap) { return bitmap.getByteCount() / 1024; } }; mRetainFragment.mRetainedCache = mMemoryCache; } } else { mMemoryCache = new LruCache<String, Bitmap>(cacheSize) { @Override protected int sizeOf(String key, Bitmap bitmap) { return bitmap.getByteCount() / 1024; } }; } File diskCacheDir = Storage.getDiskCacheDirectory(IMG_W, IMG_H); Log.d(LOG_TAG, "DISK cache Dir: " + diskCacheDir); new InitDiskCacheTask().execute(diskCacheDir); //------------------------------------------------------ END OF INIT CACHE }