List of usage examples for android.support.v4.app FragmentActivity getSupportFragmentManager
public FragmentManager getSupportFragmentManager()
From source file:org.projectbuendia.client.ui.FunctionalTestCase.java
/** * Instructs espresso to wait for the {@link ProgressFragment} contained in the current * activity to finish loading, if such a fragment is present. Espresso will also wait every * subsequent time the {@link ProgressFragment} returns to the busy state, and * will period check whether or not the fragment is currently idle. * * <p>If the current activity does not contain a progress fragment, then this function will * throw an {@link IllegalArgumentException}. * * <p>Warning: This function will not work properly in setUp() as the current activity won't * be available. If you need to call this function during setUp(), use * {@link #waitForProgressFragment(ProgressFragment)}. * TODO/robustness: Investigate why the current activity isn't available during setUp(). */// w w w . j a v a 2 s . c o m protected void waitForProgressFragment() { Activity activity; try { activity = getCurrentActivity(); } catch (Throwable throwable) { throw new IllegalStateException("Error retrieving current activity.", throwable); } if (!(activity instanceof FragmentActivity)) { throw new IllegalStateException("Activity is not a FragmentActivity."); } FragmentActivity fragmentActivity = (FragmentActivity) activity; try { for (Fragment fragment : fragmentActivity.getSupportFragmentManager().getFragments()) { if (fragment instanceof ProgressFragment) { waitForProgressFragment((ProgressFragment) fragment); return; } } } catch (NullPointerException e) { LOG.w("Unable to wait for ProgressFragment to initialize."); return; } throw new IllegalStateException("Could not find a progress fragment to wait on."); }
From source file:com.andreaszeiser.bob.ImageWorker.java
/** * Adds an {@link ImageCache} to this worker in the background (to prevent * disk access on UI thread) using default cache parameters. * //from www. ja v a 2 s . c o m * @param fragmentActivity * The FragmentActivity to initialize and add the cache */ public void addImageCache(FragmentActivity fragmentActivity) { addImageCache(fragmentActivity.getSupportFragmentManager(), new ImageCache.ImageCacheParams(fragmentActivity)); }
From source file:ro.expectations.expenses.ui.backup.FinancistoImportFragment.java
private void showAlertDialog() { FragmentActivity activity = getActivity(); if (activity != null && isResumed()) { AlertDialogFragment.newInstance(getString(R.string.success), getString(R.string.financisto_import_successful), true) .show(activity.getSupportFragmentManager(), "AlertDialogFragment"); } else {//from ww w. j a v a 2s. co m mLaunchAlertDialog = true; } }
From source file:com.android.volley.cache.plus.SimpleImageLoader.java
/** * Creates an ImageLoader with Bitmap memory cache and a default placeholder image while the * image is being fetched and loaded.//w ww .java2 s . c o m */ public SimpleImageLoader(FragmentActivity activity, int defaultPlaceHolderResId, ImageCacheParams imageCacheParams) { super(newRequestQueue(activity, imageCacheParams), BitmapImageCache.getInstance(activity.getSupportFragmentManager(), imageCacheParams), activity.getResources()); mPlaceHolderDrawables = new ArrayList<Drawable>(1); mPlaceHolderDrawables .add(defaultPlaceHolderResId == -1 ? null : getResources().getDrawable(defaultPlaceHolderResId)); }
From source file:hku.fyp14017.blencode.ProjectManager.java
private void showLoginRegisterDialog(FragmentActivity fragmentActivity) { LoginRegisterDialog loginRegisterDialog = new LoginRegisterDialog(); loginRegisterDialog.show(fragmentActivity.getSupportFragmentManager(), LoginRegisterDialog.DIALOG_FRAGMENT_TAG); }
From source file:hku.fyp14017.blencode.ProjectManager.java
@Override public void onCheckTokenSuccess(FragmentActivity fragmentActivity) { UploadProjectDialog uploadProjectDialog = new UploadProjectDialog(); uploadProjectDialog.show(fragmentActivity.getSupportFragmentManager(), UploadProjectDialog.DIALOG_FRAGMENT_TAG); }
From source file:com.android.volley.cache.plus.SimpleImageLoader.java
/** * Creates an ImageLoader with Bitmap memory cache and a list of default placeholder drawables. *//*from ww w. java 2 s . com*/ public SimpleImageLoader(FragmentActivity activity, ArrayList<Drawable> placeHolderDrawables, ImageCacheParams imageCacheParams) { super(newRequestQueue(activity, imageCacheParams), BitmapImageCache.getInstance(activity.getSupportFragmentManager(), imageCacheParams), activity.getResources()); mPlaceHolderDrawables = placeHolderDrawables; }
From source file:android.bitmap.util.ImageWorker.java
/** * Adds an {@link ImageCache} to this {@link ImageWorker} to handle disk and memory bitmap * caching./*from ww w . j a v a 2s. c o m*/ * @param activity * @param diskCacheDirectoryName See * {@link ImageCache.ImageCacheParams#ImageCacheParams(Context, String)}. */ public void addImageCache(FragmentActivity activity, String diskCacheDirectoryName) { mImageCacheParams = new ImageCache.ImageCacheParams(activity, diskCacheDirectoryName); mImageCache = ImageCache.getInstance(activity.getSupportFragmentManager(), mImageCacheParams); new CacheAsyncTask().execute(MESSAGE_INIT_DISK_CACHE); }
From source file:com.fragmentmaster.app.FragmentMaster.java
FragmentMaster(FragmentActivity activity) { mActivity = activity; mFragmentManager = activity.getSupportFragmentManager(); mEventDispatcher = new MasterEventDispatcher(activity); }
From source file:com.example.mohmurtu.registration.imagesUtil.ImageWorker.java
public void addImageCache(FragmentActivity activity, String diskCacheDirectoryName) { mImageCacheParams = new ImageCache.ImageCacheParams(activity, diskCacheDirectoryName); mImageCache = ImageCache.getInstance(activity.getSupportFragmentManager(), mImageCacheParams); new CacheAsyncTask().execute(MESSAGE_INIT_DISK_CACHE); }