SingleActivityFactory


abstract class SingleActivityFactory<T : Activity?> : InterceptingActivityFactory


Abstract implementation of InterceptingActivityFactory which allows to intercept only one activity at a time. Child classes are responsible for creating activity object.

Summary

Public constructors

SingleActivityFactory(activityClassToIntercept: Class<T!>!)

Public functions

Activity!
create(classLoader: ClassLoader!, className: String!, intent: Intent!)

This method can be used to provide activity instance while intercepting activity creation for a particular activity in response to a given intent.

Boolean
shouldIntercept(
    classLoader: ClassLoader!,
    className: String!,
    intent: Intent!
)

This method can be used to know whether activity instance creation should be intercepted or not for a particular activity in response to a given intent.

Protected functions

abstract T!
create(intent: Intent!)

This method needs to be implemented by child class to create activity object for the given intent that specified the activity class being instantiated.

Public properties

Class<T!>!

Public constructors

SingleActivityFactory

SingleActivityFactory(activityClassToIntercept: Class<T!>!)

Public functions

create

fun create(classLoader: ClassLoader!, className: String!, intent: Intent!): Activity!

This method can be used to provide activity instance while intercepting activity creation for a particular activity in response to a given intent.

Parameters
classLoader: ClassLoader!

The ClassLoader with which to instantiate the object

className: String!

The name of the class implementing the Activity object

intent: Intent!

The Intent object that specified the activity class being instantiated.

Returns
Activity!

The newly instantiated Activity object.

shouldIntercept

fun shouldIntercept(
    classLoader: ClassLoader!,
    className: String!,
    intent: Intent!
): Boolean

This method can be used to know whether activity instance creation should be intercepted or not for a particular activity in response to a given intent.

Parameters
classLoader: ClassLoader!

The ClassLoader with which to instantiate the object

className: String!

The name of the class implementing the Activity object

intent: Intent!

The Intent object that specified the activity class being instantiated.

Returns
Boolean

true if activity with className should be intercepted, otherwise false.

Protected functions

create

protected abstract fun create(intent: Intent!): T!

This method needs to be implemented by child class to create activity object for the given intent that specified the activity class being instantiated.

Parameters
intent: Intent!

The Intent object that specified the activity class being instantiated.

Returns
T!

The newly instantiated Activity object.

Public properties

activityClassToIntercept

val activityClassToInterceptClass<T!>!