apply To Activities If Available
open fun applyToActivitiesIfAvailable(@NonNull application: Application, @NonNull colorContrastOptions: ColorContrastOptions)
Applies contrast to all activities by registering a ActivityLifecycleCallbacks to your application.
A normal usage of this method should happen only once in onCreate or any methods that run before any of your activities are created. For example:
public class YourApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
ColorContrast.applyToActivitiesIfAvailable(this);
}
}
Content copied to clipboard
This method will try to apply a theme overlay in every activity's onActivityPreCreated callback.
Parameters
application
The target application.
color Contrast Options
The color contrast options object that specifies the theme overlay resource IDs for medium and high contrast mode.