#Region Service Attributes
#StartAtBoot: False
#ExcludeFromLibrary: True
' #StartCommandReturnValue: android.app.Service.START_STICKY
#End Region
Sub Process_Globals
Type ClassNote(text As String)
Type fact(sort As Long, id As String, date As String, fact As String, data As String, sex As String)
Type KeyValue(key As String,value As String)
Type KeyNumber(key As Int, value() As String)
Type record(c1 As Int, c2, c3, parent, clas As String)
Type ClassSubmitter(addr, name, phon, fax, email, www As String)
Dim pm As PackageManager
Public Provider As FileProvider
Public loc As Localizator
Dim availableLang As List
Dim tf As Typeface=Typeface.DEFAULT
Dim MainPerson, LanguageI, gedFileName, myFolder, ProgVersion, DateFormat="dd.MM.yyyy", _
SelectedEvents="BIRT,MARR,DEAT", ProgName, Religious="orthodox", SelectedReligious="Пасха,Троица,Вознесение" As String
Dim scale, TextSize, TextSizeMin As Float
Dim lbHeight, MySize(), TextColor=Colors.Black, myWidth As Int
Dim LoadLastFile, IsChanged, OneClick, UnknowTag, hint, Notificat As Boolean
Dim mapSettings, options As Map
Public NextTime=9 As Double
End Sub
Sub Service_Create
Provider.Initialize
End Sub
Sub Service_Start (StartingIntent As Intent)
ProgVersion=pm.GetVersionName("sv.bystrovzorov")
' VersionCode=pm.GetVersionCode("sv.bystrovzorov")
ProgName=pm.GetApplicationLabel("sv.bystrovzorov")
myWidth=GetDeviceLayoutValues.Width
scale=GetDeviceLayoutValues.Scale
Select Case scale
Case 1 'GetDeviceLayoutValues.height=432 w=320 240x320
TextSizeMin=12
Case 1.5 'HTC Desire 310 4,5″ 480x854
TextSizeMin=13
Case 2 'GetDeviceLayoutValues.height=1184 w=720 4,7″ 720x1280 HTC ONE X TextSize: 13-15-17
TextSizeMin=14
Case 3 'GetDeviceLayoutValues.height=2560 w=1440 5,1″ 1440x2560 Samsung Galaxy S7 (G930F) TextSize: 14-16-18
TextSizeMin=15
Case 4
TextSizeMin=16
Case Else
TextSizeMin=17 'GetDeviceLayoutValues
End Select
mapSettings.Initialize
availableLang.Initialize
SetOptions
If File.Exists(File.DirInternal, ProgName & ".ini")Then
ReadIni
Else
File.WriteMap(File.DirInternal, ProgName & ".ini", options)
ReadIni
End If
Dim t As Int=TextSize-TextSizeMin
Dim w As Int=65dip+(t)*8* scale '169-3*ts*Main.scale)
Dim h As Int=40dip+(t)*4* scale
MySize= Array As Int(w,h)
End Sub
Sub SetOptions
options.Initialize
options.Put("TextSize", TextSizeMin)
options.Put("LoadLastFile", LoadLastFile)
options.Put("gedFileName", gedFileName)
options.Put("LanguageI", LanguageI)
options.Put("DateFormat", DateFormat)
options.Put("hint", hint)
options.Put("OneClick", OneClick)
options.Put("UnknowTag", UnknowTag)
options.Put("SelectedEvents", SelectedEvents)
options.Put("SelectedReligious", SelectedReligious)
options.Put("SelectedTime", NextTime)
options.Put("Religious", Religious)
End Sub
Sub ReadIni
mapSettings = File.ReadMap(File.DirInternal, ProgName & ".ini")
For Each key As String In options.Keys
If mapSettings.ContainsKey(key) Then
options.Put(key,mapSettings.Get(key))
End If
Next
mapSettings=options
TextSize=mapSettings.Get("TextSize")
LoadLastFile=mapSettings.Get("LoadLastFile")
gedFileName=mapSettings.Get("gedFileName")
hint=mapSettings.Get("hint")
OneClick=mapSettings.Get("OneClick")
UnknowTag=mapSettings.Get("UnknowTag")
LanguageI=mapSettings.Get("LanguageI")
Religious=mapSettings.Get("Religious")
Dim s As String=mapSettings.Get("SelectedEvents")
SelectedEvents=s
Dim r As String=mapSettings.Get("SelectedReligious")
SelectedReligious=r
If s.Length+r.Length>0 Then Notificat=True
NextTime=mapSettings.Get("SelectedTime")
loc.Initialize(File.DirAssets, "strings.db")
function.setPrefix
End Sub
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Sub Service_Destroy
End Sub