open class SecureFragment(@LayoutRes contentLayoutId: Int) : Fragment(contentLayoutId) { constructor() : this(0) { Fragment() } override fun onCreate(savedInstanceState: Bundle?) { this.secure() super.onCreate(savedInstanceState) } override fun onDestroy() { this.removeSecure() super.onDestroy() } }
A [Fragment] implementation that can be used to secure screens displaying sensitive information by not allowing taking screenshots of their content. Fragments displaying such screens should extend [SecureFragment] instead of [Fragment] class.