-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainApplication.kt
47 lines (40 loc) · 1.05 KB
/
MainApplication.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.cube.arc.cie
import android.app.Application
import android.os.Environment
import com.cube.arc.dmsdk.manager.DirectoryManager
import com.cube.arc.workflow.manager.SearchManager
import com.cube.lib.helper.AnalyticsHelper
import java.io.File
import java.io.FileInputStream
/**
* Application singleton for instantiating application configuration and data files
*/
class MainApplication : Application()
{
companion object
{
public lateinit var BASE_PATH: File
// module visibility to persist throughout lifecycle
public val visibilityMap = HashMap<String, Boolean>()
}
override fun onCreate()
{
super.onCreate()
AnalyticsHelper.initialise(this)
// initialise directory manager
BASE_PATH = File(Environment.getExternalStorageDirectory().absoluteFile, "CIE-Documents")
initManagers()
}
/**
* Initialises the manager classes
*/
fun initManagers()
{
val cacheModules = File(filesDir, "structure.json")
if (cacheModules.exists())
{
DirectoryManager.init(FileInputStream(cacheModules))
SearchManager.init(this)
}
}
}