/** * Creates the {@link BottomSheetMenuDialogFragment} but does not show it. * * @return */ public BottomSheetMenuDialogFragment create() { return new BottomSheetMenuDialogFragment(this); }
/** * Returns a {@link BottomSheetMenuDialogFragment} to be used as a share intent like Android 5.x+ Share Intent.<p> * An example of an intent to pass is sharing some form of text:<br> * Intent intent = new Intent(Intent.ACTION_SEND);<br> * intent.setType("text/*");<br> * intent.putExtra(Intent.EXTRA_TEXT, "Some text to share");<br> * BottomSheet bottomSheet = BottomSheet.createShareBottomSheet(this, intent, "Share");<br> * if (bottomSheet != null) bottomSheet.show();<br> * * @param context App context * @param intent Intent to get apps for * @param shareTitle The optional title for the share intent * @param isGrid If the share intent BottomSheet should be grid styled * @return A {@link BottomSheetMenuDialogFragment} with the apps that can handle the share intent. NULL maybe returned if no * apps can handle the share intent */ public static DialogFragment createShareBottomSheet(Context context, Intent intent, String shareTitle, boolean isGrid) { return createShareBottomSheet(context, intent, shareTitle, isGrid, null, null); }
/** * Creates the {@link BottomSheetMenuDialogFragment} and shows it. * * @param manager @link FragmentManager} the {@link BottomSheetMenuDialogFragment} will be added to * @param tag Optional tag for the {@link BottomSheetDialogFragment} */ public void show(@NonNull FragmentManager manager, @Nullable String tag) { create().show(manager, tag); } }
/** * Sets the menu resource to use for the {@link BottomSheetMenuDialogFragment} * * @param sheetItems The {@link BottomSheetListener} to receive callbacks for * @return */ public Builder setSheet(@MenuRes int sheetItems) { BottomSheetMenu menu = new BottomSheetMenu(context); new MenuInflater(context).inflate(sheetItems, menu); return setMenu(menu); }
/** * Creates the {@link BottomSheetMenuDialogFragment} and shows it. * * @param manager {@link FragmentManager} the {@link BottomSheetMenuDialogFragment} will be added to */ public void show(@NonNull FragmentManager manager) { show(manager, null); }
/** * Sets the title of the {@link BottomSheetMenuDialogFragment} * * @param title String resource for the title * @return */ public Builder setTitle(@StringRes int title) { return setTitle(resources.getString(title)); }
@Override public void onDismiss(DialogInterface dialog) { if (listener != null) { listener.onSheetDismissed(BottomSheetMenuDialogFragment.this, builder.object, dismissEvent); } super.onDismiss(dialog); }
/** * Sets the number of columns that will be shown when set to a grid style * * @param columnCount Integer resource containing number of columns to show * @return */ public Builder setColumnCountResource(@IntegerRes int columnCount) { return setColumnCount(resources.getInteger(columnCount)); }
/** * Called when the {@link BottomSheetMenuDialogFragment} has been dismissed * * @param bottomSheet The {@link BottomSheetMenuDialogFragment} that was dismissed * @param object Optional {@link Object} to pass to the {@link BottomSheetMenuDialogFragment} * @param dismissEvent How the {@link BottomSheetMenuDialogFragment} was dismissed. Possible values are: <br/> * <li>{@link #DISMISS_EVENT_SWIPE}</li> * <li>{@link #DISMISS_EVENT_MANUAL}</li> * <li>{@link #DISMISS_EVENT_ITEM_SELECTED}</li> */ void onSheetDismissed(@NonNull BottomSheetMenuDialogFragment bottomSheet, @Nullable Object object, @DismissEvent int dismissEvent); }
/** * Returns a {@link BottomSheetMenuDialogFragment} to be used as a share intent like Android 5.x+ Share Intent.<p> * An example of an intent to pass is sharing some form of text:<br> * Intent intent = new Intent(Intent.ACTION_SEND);<br> * intent.setType("text/*");<br> * intent.putExtra(Intent.EXTRA_TEXT, "Some text to share");<br> * BottomSheet bottomSheet = BottomSheet.createShareBottomSheet(this, intent, "Share");<br> * if (bottomSheet != null) bottomSheet.show();<br> * * @param context App context * @param intent Intent to get apps for * @param shareTitle The optional title for the share intent * @param isGrid If the share intent BottomSheet should be grid styled * @return A {@link BottomSheetMenuDialogFragment} with the apps that can handle the share intent. NULL maybe returned if no * apps can handle the share intent */ public static DialogFragment createShareBottomSheet(Context context, Intent intent, String shareTitle, boolean isGrid) { return createShareBottomSheet(context, intent, shareTitle, isGrid, null, null); }
/** * Sets the menu resource to use for the {@link BottomSheetMenuDialogFragment} * * @param sheetItems The {@link BottomSheetListener} to receive callbacks for * @return */ public Builder setSheet(@MenuRes int sheetItems) { BottomSheetMenu menu = new BottomSheetMenu(context); new MenuInflater(context).inflate(sheetItems, menu); return setMenu(menu); }
/** * Creates the {@link BottomSheetMenuDialogFragment} and shows it. * * @param manager @link FragmentManager} the {@link BottomSheetMenuDialogFragment} will be added to * @param tag Optional tag for the {@link BottomSheetDialogFragment} */ public void show(@NonNull FragmentManager manager, @Nullable String tag) { create().show(manager, tag); } }
/** * Creates the {@link BottomSheetMenuDialogFragment} and shows it. * * @param manager {@link FragmentManager} the {@link BottomSheetMenuDialogFragment} will be added to */ public void show(@NonNull FragmentManager manager) { show(manager, null); }
/** * Sets the title of the {@link BottomSheetMenuDialogFragment} * * @param title String resource for the title * @return */ public Builder setTitle(@StringRes int title) { return setTitle(resources.getString(title)); }
/** * Creates the {@link BottomSheetMenuDialogFragment} but does not show it. * * @return */ public BottomSheetMenuDialogFragment create() { return new BottomSheetMenuDialogFragment(this); }
@Override public void onDismiss(DialogInterface dialog) { if (listener != null) { listener.onSheetDismissed(BottomSheetMenuDialogFragment.this, builder.object, dismissEvent); } super.onDismiss(dialog); }
/** * Sets the number of columns that will be shown when set to a grid style * * @param columnCount Integer resource containing number of columns to show * @return */ public Builder setColumnCountResource(@IntegerRes int columnCount) { return setColumnCount(resources.getInteger(columnCount)); }
/** * Called when the {@link BottomSheetMenuDialogFragment} has been dismissed * * @param bottomSheet The {@link BottomSheetMenuDialogFragment} that was dismissed * @param object Optional {@link Object} to pass to the {@link BottomSheetMenuDialogFragment} * @param dismissEvent How the {@link BottomSheetMenuDialogFragment} was dismissed. Possible values are: <br/> * <li>{@link #DISMISS_EVENT_SWIPE}</li> * <li>{@link #DISMISS_EVENT_MANUAL}</li> * <li>{@link #DISMISS_EVENT_ITEM_SELECTED}</li> */ void onSheetDismissed(@NonNull BottomSheetMenuDialogFragment bottomSheet, @Nullable Object object, @DismissEvent int dismissEvent); }
/** * Returns a {@link BottomSheetMenuDialogFragment} to be used as a share intent like Android 5.x+ Share Intent. This will be List styled by default.<br> * If grid style is desired, use {@link #createShareBottomSheet(Context, Intent, String, boolean)}<p> * An example of an intent to pass is sharing some form of text:<br> * Intent intent = new Intent(Intent.ACTION_SEND);<br> * intent.setType("text/*");<br> * intent.putExtra(Intent.EXTRA_TEXT, "Some text to share");<br> * BottomSheet bottomSheet = BottomSheet.createShareBottomSheet(this, intent, "Share");<br> * if (bottomSheet != null) bottomSheet.show();<br> * * @param context App context * @param intent Intent to get apps for * @param shareTitle The optional title for the share intent * @return A {@link BottomSheetMenuDialogFragment} with the apps that can handle the share intent. NULL maybe returned if no * apps can handle the share intent */ @Nullable public static DialogFragment createShareBottomSheet(Context context, Intent intent, String shareTitle) { return createShareBottomSheet(context, intent, shareTitle, false, null, null); }
/** * Returns a {@link BottomSheetMenuDialogFragment} to be used as a share intent like Android 5.x+ Share Intent. This will be List styled by default.<br> * If grid style is desired, use {@link #createShareBottomSheet(Context, Intent, String, boolean)}<p> * An example of an intent to pass is sharing some form of text:<br> * Intent intent = new Intent(Intent.ACTION_SEND);<br> * intent.setType("text/*");<br> * intent.putExtra(Intent.EXTRA_TEXT, "Some text to share");<br> * BottomSheet bottomSheet = BottomSheet.createShareBottomSheet(this, intent, "Share");<br> * if (bottomSheet != null) bottomSheet.show();<br> * * @param context App context * @param intent Intent to get apps for * @param shareTitle The optional title for the share intent * @return A {@link BottomSheetMenuDialogFragment} with the apps that can handle the share intent. NULL maybe returned if no * apps can handle the share intent */ @Nullable public static DialogFragment createShareBottomSheet(Context context, Intent intent, String shareTitle) { return createShareBottomSheet(context, intent, shareTitle, false, null, null); }