Fragment Compat

abstract class FragmentCompat : Fragment, FormDelegate, NavigationDelegate, DevView

Author

Jimly A.

Since

01-Dec-21

Constructors

Link copied to clipboard
fun FragmentCompat()

Functions

Link copied to clipboard
open override fun finishActivity()

Method to finish activity where the fragment attached

Link copied to clipboard
fun hasPermission(permission: String): Boolean

Method to check if application has permission

Link copied to clipboard
fun hasPermissions(permissions: Array<String>): Boolean

Method to check if the application has permissions

Link copied to clipboard
open fun initAction()

method to group action like click, gesture, from View

Link copied to clipboard
open fun initData()

method to group data initialization either from arguments, bundle, or intent

Link copied to clipboard
open fun initObserver()

method to group any kind of observer, either it MutableLiveData, RXEventBus, or else

Link copied to clipboard
open fun initUI()

method to group view initialization and configuration

Link copied to clipboard
open override fun onAttach(context: Context)

Method to set currentActivity's value and call attachListener

Link copied to clipboard
open override fun onViewCreated(view: View, savedInstanceState: Bundle?)
Link copied to clipboard
fun pickImageFromCamera(uri: Uri, action: (Uri) -> Unit)

Method to start picking image from camera

Link copied to clipboard
fun pickImageFromGallery(action: (Uri) -> Unit)

Method to start picking image from gallery

Link copied to clipboard
fun requestPermissionsSafely(    permissions: Array<String>,     onPermissionGranted: () -> Unit? = null,     onPermissionNotGranted: () -> Unit? = null)

Method to request permission to user

Link copied to clipboard
open override fun setupToolbar(    toolbar: Toolbar?,     title: String?,     isChild: Boolean,     menu: Int?,     onMenuListener: (Int) -> Boolean?)

Method to set activity's toolbar from fragment

Properties

Link copied to clipboard
lateinit var currentActivity: ActivityCompat

the activity where the fragment inflated

Inheritors

Link copied to clipboard

Sources

Link copied to clipboard