Java Code Examples for android.support.v4.app.DialogFragment#show()

The following examples show how to use android.support.v4.app.DialogFragment#show() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PhotosetsFragment.java    From glimmr with Apache License 2.0 6 votes vote down vote up
@Override
public void onLongClickDialogSelection(Photoset photoset, int which) {
    Log.d(TAG, "onLongClickDialogSelection()");
    FragmentTransaction ft =
        mActivity.getSupportFragmentManager().beginTransaction();
    ft.setCustomAnimations(android.R.anim.fade_in,
            android.R.anim.fade_out);
    if (photoset != null) {
        Fragment prev = mActivity.getSupportFragmentManager()
            .findFragmentByTag(AddToPhotosetDialogFragment.TAG);
        if (prev != null) {
            ft.remove(prev);
        }
        ft.addToBackStack(null);

        DialogFragment newFragment =
            AddToPhotosetDialogFragment.newInstance(photoset);
        newFragment.show(ft, AddToPhotosetDialogFragment.TAG);
    } else {
        Log.e(TAG, "onLongClickDialogSelection: photoset is null");
    }
}
 
Example 2
Source File: SettingsFragment.java    From RememBirthday with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onDisplayPreferenceDialog(Preference preference) {
    DialogFragment dialogFragment = null;
    if (preference instanceof TimePreference) {
        dialogFragment = new TimePreferenceDialogFragmentCompat();
        Bundle bundle = new Bundle(1);
        bundle.putString("key", preference.getKey());
        dialogFragment.setArguments(bundle);
    }

    // Show dialog
    if (dialogFragment != null) {
        dialogFragment.setTargetFragment(this, 0);
        dialogFragment.show(getChildFragmentManager(), TAG_FRAGMENT_DIALOG);
    } else {
        super.onDisplayPreferenceDialog(preference);
    }
}
 
Example 3
Source File: CustomCommandActivity.java    From rpicheck with MIT License 6 votes vote down vote up
private void parseNonPromptingAndShow(String keyPassphrase, CommandBean command) {
    final DialogFragment runCommandDialog = new RunCommandDialog();
    final Bundle args = new Bundle();
    String cmdString = command.getCommand();
    Map<String, String> nonPromptingPlaceholders = parseNonPromptingPlaceholders(command.getCommand(), currentDevice);
    for (Map.Entry<String, String> entry : nonPromptingPlaceholders.entrySet()) {
        cmdString = cmdString.replace(entry.getKey(), entry.getValue());
    }
    command.setCommand(cmdString);
    args.putSerializable("pi", currentDevice);
    args.putSerializable("cmd", command);
    if (keyPassphrase != null) {
        args.putString("passphrase", keyPassphrase);
    }
    runCommandDialog.setArguments(args);
    runCommandDialog.show(getSupportFragmentManager(), "runCommand");
}
 
Example 4
Source File: BasePurchaseActivity.java    From aptoide-client with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onClick(int payType, String imsi,  String price, String currency) {
    DialogFragment df = new ProgressDialogFragment();

    df.setCancelable(false);
    df.show(getSupportFragmentManager(), "pleaseWaitDialog");
    PayProductRequestUnitel requestUnitel = new PayProductRequestUnitel();
    requestUnitel.setProductId(String.valueOf(aptoideProductId));
    requestUnitel.setPayType(String.valueOf(payType));
    requestUnitel.setToken(token);
    requestUnitel.setImsi(imsi);
    requestUnitel.setPrice(price);
    requestUnitel.setCurrency(currency);
    requestUnitel.setRepo(repo);
    requestsetExtra(requestUnitel);
    requestUnitel.setRetryPolicy(noRetryPolicy);
    spiceManager.execute(requestUnitel, new PurchaseRequestListener());

}
 
Example 5
Source File: ChameleonMiniRevERebootedActivity.java    From Walrus with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onDisplayPreferenceDialog(Preference preference) {
    if (preference instanceof ChameleonMiniSlotPickerPreference) {
        DialogFragment dialogFragment =
                new ChameleonMiniSlotPickerPreference.NumberPickerFragment();
        final Bundle b = new Bundle();
        b.putString("key", preference.getKey());
        dialogFragment.setArguments(b);
        dialogFragment.show(this.getChildFragmentManager(),
                "settings_dialog");
    } else {
        super.onDisplayPreferenceDialog(preference);
    }
}
 
Example 6
Source File: EditRecipeActivity.java    From biermacht with Apache License 2.0 5 votes vote down vote up
@Override
public void onMissedClick(View v) {
  super.onMissedClick(v);

  AlertDialog alert;
  if (v.equals(measuredFGView)) {
    alert = alertBuilder.editTextFloatAlert(measuredFGViewText, measuredFGViewTitle).create();
  }
  else if (v.equals(measuredOGView)) {
    alert = alertBuilder.editTextFloatAlert(measuredOGViewText, measuredOGViewTitle).create();
  }
  else if (v.equals(measuredBatchSizeView)) {
    alert = alertBuilder.editTextFloatAlert(measuredBatchSizeViewText,
                                            measuredBatchSizeViewTitle).create();
  }
  else if (v.equals(brewDateView)) {
    // Show the brew date picker and return.
    DialogFragment newFragment = new DatePickerFragment();
    Bundle args = new Bundle();
    newFragment.setArguments(args);
    newFragment.show(this.getSupportFragmentManager(), "datePicker");
    return;
  }
  else {
    Log.d("EditRecipeActivity", "onMissedClick did not handle the clicked view");
    return; // In case its none of those views...
  }

  // Force keyboard open and show popup
  alert.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
  alert.show();
}
 
Example 7
Source File: Utility.java    From iBeebo with GNU General Public License v3.0 5 votes vote down vote up
public static void forceShowDialog(FragmentActivity activity, DialogFragment dialogFragment) {
    try {
        dialogFragment.show(activity.getSupportFragmentManager(), "");
        activity.getSupportFragmentManager().executePendingTransactions();
    } catch (Exception ignored) {

    }
}
 
Example 8
Source File: BricksListDialogFragment.java    From 4pdaClient-plus with Apache License 2.0 5 votes vote down vote up
public static void showDialog(IBricksListDialogCaller bricksListDialogCaller, String dialogId,
                              String[] brickNames, Bundle args) {
    FragmentTransaction ft = bricksListDialogCaller.getSupportFragmentManager().beginTransaction();
    Fragment prev = bricksListDialogCaller.getSupportFragmentManager().findFragmentByTag(TAG);
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    // Create and show the dialog.
    DialogFragment newFragment = BricksListDialogFragment.newInstance(dialogId, brickNames, args);
    newFragment.show(ft, TAG);
}
 
Example 9
Source File: MainActivity.java    From bitcoinpos with MIT License 5 votes vote down vote up
@Override
// from ItemFragment
public void onListItemClickFragmentInteraction(Item item) {
    DialogFragment myDialog = ItemActionListFragment.newInstance(item.getItemId().toString());
    // for API >= 23 the title is disable by default -- we set a style that enables it
    myDialog.setStyle(DialogFragment.STYLE_NORMAL, R.style.ItemActionListDialogFragment);
    myDialog.show(getSupportFragmentManager(), getString(R.string.item_action_list_dialog_fragment_tag));
}
 
Example 10
Source File: PreferencesFragment.java    From ShaderEditor with MIT License 5 votes vote down vote up
@Override
public void onDisplayPreferenceDialog(Preference preference) {
	if (preference instanceof ShaderListPreference) {
		DialogFragment f = ShaderListPreferenceDialogFragment
				.newInstance(preference.getKey());

		f.setTargetFragment(this, 0);
		f.show(getFragmentManager(),
				"ShaderListPreferenceDialogFragment");

		return;
	}

	super.onDisplayPreferenceDialog(preference);
}
 
Example 11
Source File: LicensesFragment.java    From AndroidLicensesPage with Apache License 2.0 5 votes vote down vote up
/**
 * Builds and displays a licenses fragment with no Close button. Requires
 * "/res/raw/licenses.html" and "/res/layout/licenses_fragment.xml" to be
 * present.
 *
 * @param fm A fragment manager instance used to display this LicensesFragment.
 */
public static void displayLicensesFragment(FragmentManager fm) {
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag(FRAGMENT_TAG);
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    // Create and show the dialog.
    DialogFragment newFragment = LicensesFragment.newInstance();
    newFragment.show(ft, FRAGMENT_TAG);
}
 
Example 12
Source File: GameActivity.java    From open_flood with MIT License 5 votes vote down vote up
private void showEndGameDialog() {
    DialogFragment endGameDialog = new EndGameDialogFragment();
    Bundle args = new Bundle();
    args.putInt("steps", game.getSteps());
    args.putBoolean("game_won", game.checkWin());
    args.putString("seed", game.getSeed());
    endGameDialog.setArguments(args);
    endGameDialog.show(getSupportFragmentManager(), "EndGameDialog");
    return;
}
 
Example 13
Source File: DeleteItemDialogFragment.java    From PainlessMusicPlayer with Apache License 2.0 5 votes vote down vote up
public static void show(@NonNull final Context context,
        @NonNull final Class<? extends DeleteItemDialogFragment> tClass,
        @NonNull final FragmentManager fragmentManager,
        @NonNull final String tag,
        final long targetId,
        @Nullable final String targetName) {
    final DialogFragment f = (DialogFragment) Fragment.instantiate(context,
            tClass.getCanonicalName(), createArguments(targetId, targetName));
    f.show(fragmentManager, tag);
}
 
Example 14
Source File: SensorListAdapter.java    From gsn with GNU General Public License v3.0 5 votes vote down vote up
private void showDialogDetail(String name) {
	SqliteStorageManager storage = new SqliteStorageManager();
	StringBuilder sb = new StringBuilder("This sensor is used by the following Virtual Sensors:\n");
	for (String s : storage.getVSfromSource(name)) {
		sb.append(" - ").append(s).append("\n");
	}
	DialogFragment newFragment = DetailedDataFragment.newInstance(sb.toString());
	newFragment.show(((FragmentActivity) context).getSupportFragmentManager(), "dialog");
}
 
Example 15
Source File: OtherAppsFragment.java    From candybar-library with Apache License 2.0 5 votes vote down vote up
public static void showOtherAppsDialog(@NonNull FragmentManager fm) {
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag(TAG);
    if (prev != null) {
        ft.remove(prev);
    }

    try {
        DialogFragment dialog = OtherAppsFragment.newInstance();
        dialog.show(ft, TAG);
    } catch (IllegalStateException | IllegalArgumentException ignored) {}
}
 
Example 16
Source File: WifiAuthenticatorActivity.java    From WiFiAfterConnect with Apache License 2.0 5 votes vote down vote up
protected void performAction (WifiAuthenticator.AuthAction action) {
	if (action == WifiAuthenticator.AuthAction.DEFAULT)
		return;
	
	if (authParams.authAction != action && isAlwaysDoThat()) {
		authParams.authAction = action;
		wifiAuth.storeAuthAction(action);
	}
	switch (action) {
		case BROWSER : 
			try {
				startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url.toURI().toString())));
			} catch (URISyntaxException e) {	}
			finish();
			break;
		case IGNORE : 
			if (authParams.wifiAction.perform(this))
				finish();
			else {
				DialogFragment dialogDiableWifi = new DisableWifiDialogFragment();
				dialogDiableWifi.show (getSupportFragmentManager(),"DisableWifiDialogFragment");
			}
			break;
	default:
		break;
	}
}
 
Example 17
Source File: MainActivity.java    From three-things-today with Apache License 2.0 4 votes vote down vote up
public void showDatePickerDialog(View v) {
    DialogFragment fragment = DatePickerFragment.newInstance(this, mSelectedYear,
            mSelectedMonth, mSelectedDayOfMonth);
    fragment.show(getSupportFragmentManager(), "DatePicker");
}
 
Example 18
Source File: DocumentListFragment.java    From MongoExplorer with MIT License 4 votes vote down vote up
private void editCollection() {
       DialogFragment fragment = CollectionEditDialogFragment.newInstance(mCollectionIndex);
       fragment.show(getFragmentManager(), null);
}
 
Example 19
Source File: ZulipActivity.java    From zulip-android with Apache License 2.0 4 votes vote down vote up
public void showListDialog() {
    // Create an instance of the dialog fragment and show it
    DialogFragment dialog = new ListDialog();
    dialog.show(getSupportFragmentManager(), "ListDialogFragment");
}
 
Example 20
Source File: BaseActivity.java    From MongoExplorer with MIT License 4 votes vote down vote up
private void showAddConnection() {
	DialogFragment fragment = ConnectionEditDialogFragment.newInstance(0);
	fragment.show(getSupportFragmentManager(), null);
}