google-research / CVD-paper-mobile-camera-example

Apache License 2.0
6 stars 4 forks source link

Use singletons in sensing #61

Closed MJ1998 closed 4 months ago

MJ1998 commented 6 months ago

Fixes #60 #12

Created singletons as per : https://www.baeldung.com/kotlin/singleton-classes#1-companion-object

For easy integration, the configuration is now provided from SensingEngineConfiguration.Provider interface. This interface is implemented by the Application class which can be accessed via the applicationContext variable.

Small change so that the application works even when no local.properties file is provided.

The interfaces and singleton instances are public whereas the implementations are private.

TESTED:- Uploaded data once. Closed app. Opened and uploaded again. Works as intended!

MJ1998 commented 6 months ago

Wondering if all singletons should be in one place, for example, SensingEngineProvider ? @chandrashekar-s

chandrashekar-s commented 6 months ago

Wondering if all singletons should be in one place, for example, SensingEngineProvider ? @chandrashekar-s

Should be fine to have in individual classes, probably to have a better context.