val Fragment.defaultSharedPreferences: SharedPreferences?
Returns default SharedPreferences instance by calling PreferenceManager.getDefaultSharedPreferences on the container activity. |
|
fun Fragment.getStringSafe(resId: Int): String?
Returns string with specified resource identifier, or null if the fragment isn't attached to an activity. fun Fragment.getStringSafe(resId: Int, vararg args: Any?): String?
Returns string with specified resource identifier and format arguments, or null if the fragment isn't attached to an activity. |
|
val Fragment.resourcesSafe: Resources?
Returns container activity's Resources object, or null if the fragment isn't attached to an activity. |
|
fun Fragment.showAlertDialog(message: String? = null, title: String? = null, block: AlertDialogBuilder.() -> Unit = {}): Dialog?
Displays an alert dialog by creating a new AlertDialogBuilder using the title and message provided, then passing it to block with the builder as receiver. fun Fragment.showAlertDialog(messageResId: Int, titleResId: Int = 0, block: AlertDialogBuilder.() -> Unit = {}): Dialog?
Displays an alert dialog by creating a new AlertDialogBuilder using the title and message string resource ids provided, then passing it to block with the builder as receiver. |
|
fun Fragment.showSnackbar(message: CharSequence?, duration: Int = SNACKBAR_DEFAULT_DURATION, block: Snackbar.() -> Unit = {}): Unit
Creates a new Snackbar with specified message and duration, then calls optional block with Snackbar as receiver before displaying. fun Fragment.showSnackbar(messageResId: Int, duration: Int = SNACKBAR_DEFAULT_DURATION, block: Snackbar.() -> Unit = {}): Unit
Creates a new Snackbar with specified message and duration, then calls optional block with Snackbar as receiver before displaying. |
|
fun Fragment.showToast(messageResId: Int, duration: Int = TOAST_DEFAULT_DURATION): Unit
Creates and displays a new Toast with specified message and duration (which defaults to TOAST_DEFAULT_DURATION). fun Fragment.showToast(message: String?, duration: Int = TOAST_DEFAULT_DURATION): Unit
Creates and displays a new Toast with specified message and duration (which defaults to TOAST_DEFAULT_DURATION). |
|
fun <T : Activity> Fragment.startActivity(block: Intent.() -> Unit = {}): Unit
Starts a new activity by creating a new Intent, calling block with the new instance, then passing the intent to Context.startActivity. |