@Override public int getId(Fragment fragment) { return fragment.getId(); }
public S hasId(int id) { isNotNull(); int actualId = actual.getId(); assertThat(actualId) // .overridingErrorMessage("Expected ID <%s> but was <%s>", id, actualId) // .isEqualTo(id); return myself; }
public S hasId(int id) { isNotNull(); int actualId = actual.getId(); assertThat(actualId) // .overridingErrorMessage("Expected ID <%s> but was <%s>", id, actualId) // .isEqualTo(id); return myself; }
/** * Same as {@link #createTransaction(Fragment, FragmentTransactionOptions)} with default transaction * options. */ @NonNull public FragmentTransaction createTransaction(@NonNull Fragment fragment) { return createTransaction(fragment, new FragmentTransactionOptions(fragment.getId())); }
/** * Shows the given <var>fragment</var> using the specified options. * * @param fragment The fragment instance to show. * @param options Options used by this controller to properly set up fragment transaction. * @return {@code True} if the fragment has been successfully shown, {@code false} * if there is already fragment with the same TAG already showing and should not be replaced. * @see #showFragment(Fragment) * @see #showFragment(Fragment, String) */ public boolean showFragment(@NonNull Fragment fragment, @Nullable FragmentTransactionOptions options) { final boolean success = onShowFragment(fragment, options); return success && notifyFragmentChanged(fragment.getId(), fragment.getTag(), false); }
/** * Creates a new instance of DialogController within the given <var>parentFragment</var>'s context. * <p> * Passed fragment will be used to obtain an instance of {@link android.app.FragmentManager} * by {@link android.app.Fragment#getFragmentManager()} that will be used to mange * dialog fragments by this controller. * <p> * If the given <var>parentFragment</var> implements {@link com.albedinsky.android.dialog.manage.DialogController.OnRestoreListener} * it will be automatically set as such a callback to this controller. * * @param parentFragment A fragment in which will be this controller used. * @see #DialogController(android.app.Activity) */ public DialogController(@NonNull Fragment parentFragment) { this(parentFragment.getFragmentManager()); if (parentFragment instanceof OnRestoreListener) { this.mRestoreListener = (OnRestoreListener) parentFragment; } this.mParentFragmentTag = parentFragment.getTag(); this.mParentFragmentId = parentFragment.getId(); }
/** * Creates a new instance of DialogController within the given <var>parentFragment</var>'s context. * <p> * Passed fragment will be used to obtain an instance of {@link android.app.FragmentManager} * by {@link android.app.Fragment#getFragmentManager()} that will be used to mange * dialog fragments by this controller. * <p> * If the given <var>parentFragment</var> implements {@link com.albedinsky.android.dialog.manage.DialogController.OnRestoreListener} * it will be automatically set as such a callback to this controller. * * @param parentFragment A fragment in which will be this controller used. * @see #DialogController(android.app.Activity) */ public DialogController(@NonNull Fragment parentFragment) { this(parentFragment.getFragmentManager()); if (parentFragment instanceof OnRestoreListener) { this.mRestoreListener = (OnRestoreListener) parentFragment; } this.mParentFragmentTag = parentFragment.getTag(); this.mParentFragmentId = parentFragment.getId(); }
@Override protected HashMap<String, Object> fillValues(Fragment fragment, HashMap<String, Object> data, HashMap<String, Object> contextData) { data.put("Type", fragment.getClass().getName()); data.put("IDi", fragment.getId()); data.put("IDs", IdsHelper.getNameForId(fragment.getId())); data.put("Tag", fragment.getTag()); data.put("TargetFragment", fragment.getTargetFragment() != null ? String.valueOf(fragment.getTargetFragment()) : null);
public static MessageDialogFragment showDialog(final Fragment parent, final int requestCode, final int id_title, final int id_message, final String[] permissions) { final MessageDialogFragment dialog = newInstance(requestCode, id_title, id_message, permissions); dialog.setTargetFragment(parent, parent.getId()); dialog.show(parent.getFragmentManager(), TAG); return dialog; }