Example usage for android.support.v4.app FragmentActivity getSupportFragmentManager

List of usage examples for android.support.v4.app FragmentActivity getSupportFragmentManager

Introduction

In this page you can find the example usage for android.support.v4.app FragmentActivity getSupportFragmentManager.

Prototype

public FragmentManager getSupportFragmentManager() 

Source Link

Document

Return the FragmentManager for interacting with fragments associated with this activity.

Usage

From source file:ca.rmen.android.scrumchatter.dialog.DialogFragmentFactory.java

/**
 * Show a visible dialog fragment with the given message.
 * @param tag should be used by the calling activity, when the background task is complete, to find the fragment and dismiss it.
 *///  www  . j  av  a 2  s.  c  o m
public static void showProgressDialog(FragmentActivity activity, String message,
        @SuppressWarnings("SameParameterValue") String tag) {
    Log.v(TAG, "showProgressDialog: message = " + message);
    Bundle arguments = new Bundle(2);
    arguments.putString(EXTRA_MESSAGE, message);
    ProgressDialogFragment result = new ProgressDialogFragment();
    result.setArguments(arguments);
    result.show(activity.getSupportFragmentManager(), tag);
}

From source file:ca.rmen.android.networkmonitor.app.dialog.DialogFragmentFactory.java

/**
 * Show a visible dialog fragment with the given message.
 * @param tag should be used by the calling activity, when the background task is complete, to find the fragment and dismiss it.
 *///from   w ww.jav a2  s.  c om
public static void showProgressDialog(FragmentActivity activity, String message, String tag) {
    Log.v(TAG, "showProgressDialog: message = " + message);
    Bundle arguments = new Bundle(2);
    arguments.putString(EXTRA_MESSAGE, message);
    ProgressDialogFragment result = new ProgressDialogFragment();
    result.setArguments(arguments);
    result.setCancelable(false);
    result.show(activity.getSupportFragmentManager(), tag);
}

From source file:com.kingsman.hp.utils.PermissionUtils.java

/**
 * Requests the fine location permission. If a rationale with an additional explanation should
 * be shown to the user, displays a dialog that triggers the request.
 *//*from w w  w .j  a  va 2  s  .c o  m*/
public static void requestPermission(FragmentActivity activity, int requestId, String permission,
        boolean finishActivity) {
    if (ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) {
        // Display a dialog with rationale.
        PermissionUtils.RationaleDialog.newInstance(requestId, permission, finishActivity)
                .show(activity.getSupportFragmentManager(), "dialog");
    } else {
        // Location permission has not been granted yet, request it.
        ActivityCompat.requestPermissions(activity, new String[] { permission }, requestId);

    }
}

From source file:ca.rmen.android.scrumchatter.dialog.DialogFragmentFactory.java

/**
 * Show a visible dialog fragment with the given title and message, and just one OK button.
 */// w  w w . j  ava2 s  .c om
public static void showInfoDialog(FragmentActivity activity, int titleId, int messageId) {
    Log.v(TAG, "showInfoDialog");
    Bundle arguments = new Bundle(3);
    arguments.putString(EXTRA_TITLE, activity.getString(titleId));
    arguments.putString(EXTRA_MESSAGE, activity.getString(messageId));
    InfoDialogFragment result = new InfoDialogFragment();
    result.setArguments(arguments);
    result.show(activity.getSupportFragmentManager(), InfoDialogFragment.class.getSimpleName());
}

From source file:dev.drsoran.moloko.util.UIUtils.java

public final static void showAboutMolokoDialog(FragmentActivity fragActivity) {
    final DialogFragment dialog = AboutMolokoDialogFragment.newInstance(Bundle.EMPTY);
    dialog.show(fragActivity.getSupportFragmentManager(), String.valueOf(R.id.frag_about_moloko));
}

From source file:org.solovyev.android.calculator.variables.EditVariableFragment.java

public static void showDialog(@Nonnull FragmentActivity activity) {
    EditVariableFragment.showDialog(null, activity.getSupportFragmentManager());
}

From source file:com.android.project.imagefetcher.Utils.java

public static ImageFetcher getImageFetcher(final FragmentActivity activity) {
    ImageCacheParams cacheParams = new ImageCacheParams(activity, IMAGE_CACHE_DIR);
    // Set memory cache to 25% of mem class
    cacheParams.setMemCacheSizePercent(activity, 0.25f);
    // The ImageFetcher takes care of loading images into our ImageView children asynchronously
    ImageFetcher imageFetcher = new ImageFetcher(activity);
    imageFetcher.setImageFadeIn(true);//from  www .  java2s  .c o m
    imageFetcher.addImageCache(activity.getSupportFragmentManager(), cacheParams);
    return imageFetcher;
}

From source file:com.sshine.huochexing.model.FavoriteCharacterDialogFragment.java

public static void show(FragmentActivity activity, int requestCode, String title,
        Map<String, String> mapItems) {
    if (mapItems == null) {
        return;/*from  w ww  .java  2  s. c  o  m*/
    } else {
        String[] strs1 = new String[mapItems.size()];
        int i = 0;
        for (Entry<String, String> entry : mapItems.entrySet()) {
            strs1[i] = entry.getKey();
            i++;
        }
        show(activity.getSupportFragmentManager(), requestCode, title, strs1);
    }
}

From source file:edu.rutgers.css.Rutgers.utils.LocationUtils.java

/**
 * Show Play Services error dialog.//  ww w . ja  va 2 s . co m
 * @param activity Activity to display dialog for
 * @param errorCode Error code
 */
public static void showErrorDialog(@NonNull FragmentActivity activity, int errorCode) {
    Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode, activity,
            CONNECTION_FAILURE_RESOLUTION_REQUEST);

    if (errorDialog != null) {
        ErrorDialogFragment errorDialogFragment = new ErrorDialogFragment();
        errorDialogFragment.setDialog(errorDialog);
        errorDialogFragment.show(activity.getSupportFragmentManager(),
                activity.getResources().getString(R.string.location_updates));
    }
}

From source file:com.watch.customer.util.PermissionUtils.java

/**
 * Requests the fine location permission. If a rationale with an additional explanation should
 * be shown to the user, displays a dialog that triggers the request.
 *//*  w w w  .j av a 2  s.  c o m*/
public static void requestPermission(FragmentActivity activity, int requestId, String permission,
        boolean finishActivity) {
    if (ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) {
        // Display a dialog with rationale.
        Log.e("hjq", "not granted2");
        PermissionUtils.RationaleDialog.newInstance(requestId, finishActivity)
                .show(activity.getSupportFragmentManager(), "dialog");
    } else {
        // Location permission has not been granted yet, request it.
        ActivityCompat.requestPermissions(activity, new String[] { permission }, requestId);

    }
}