-
Notifications
You must be signed in to change notification settings - Fork 0
/
ioBrowser.b4a
165 lines (146 loc) · 4.96 KB
/
ioBrowser.b4a
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
Build1=Default,wal.waze.de
File1=1.bal
File2=2.bal
File3=MainPage.bal
FileGroup1=Default Group
FileGroup2=Default Group
FileGroup3=Default Group
Group=Default Group
Library1=b4xpages
Library10=tts
Library11=ultimatewebview
Library12=xui
Library13=viewsex
Library2=broadcastreceiver
Library3=core
Library4=gps
Library5=ime
Library6=jmqtt
Library7=phone
Library8=preferenceactivity
Library9=runtimepermissions
ManifestCode='This code will be applied to the manifest file during compilation.~\n~'You do not need to modify it in most cases.~\n~'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136~\n~AddManifestText(~\n~<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="30"/>~\n~<supports-screens android:largeScreens="true" ~\n~ android:normalScreens="true" ~\n~ android:smallScreens="true" ~\n~ android:anyDensity="true"/>~\n~ )~\n~SetApplicationAttribute(android:icon, "@drawable/icon")~\n~SetApplicationAttribute(android:label, "$LABEL$")~\n~CreateResourceFromFile(Macro, Themes.LightTheme)~\n~'End of default text.~\n~CreateResourceFromFile(Macro, Core.NetworkClearText)~\n~AddApplicationText(<activity android:name="anywheresoftware.b4a.objects.preferenceactivity"/>)~\n~SetServiceAttribute(Tracker, android:foregroundServiceType, "location")~\n~AddManifestText(<uses-permission android:name="android.permission.WRITE_SETTINGS" />)
Module1=B4XDrawer
Module2=B4XMainPage
Module3=Starter
Module4=Tracker
NumberOfFiles=3
NumberOfLibraries=13
NumberOfModules=4
Version=11.16
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: ioBrowser
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
#BridgeLogger: True
Sub Process_Globals
Public ActionBarHomeClicked As Boolean
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity_WindowFocusChanged(True)
Dim lv As LayoutValues = GetRealSize
Dim jo As JavaObject = Activity
jo.RunMethod("setBottom", Array(lv.Height))
jo.RunMethod("setRight", Array(lv.Width))
Activity.Height = lv.Height
Activity.Width = lv.Width
Dim pm As B4XPagesManager
pm.Initialize(Activity)
If CanWriteToSystemSettings = False Then
Dim in As Intent
in.Initialize("android.settings.action.MANAGE_WRITE_SETTINGS", "package:" & Application.PackageName)
StartActivity(in)
Wait For Activity_Resume
If CanWriteToSystemSettings = False Then
Log("no permission...")
Return
End If
End If
End Sub
Sub GetRealSize As LayoutValues
Dim lv As LayoutValues
Dim p As Phone
If p.SdkVersion >= 17 Then
Dim ctxt As JavaObject
ctxt.InitializeContext
Dim display As JavaObject = ctxt.RunMethodJO("getSystemService", Array("window")).RunMethod("getDefaultDisplay", Null)
Dim point As JavaObject
point.InitializeNewInstance("android.graphics.Point", Null)
display.RunMethod("getRealSize", Array(point))
lv.Width = point.GetField("x")
lv.Height = point.GetField("y")
Else
lv.Width = 100%x
lv.Height = 100%y
End If
lv.Scale = 100dip / 100
Return lv
End Sub
Sub Activity_WindowFocusChanged(HasFocus As Boolean)
If HasFocus Then
Try
Dim jo As JavaObject = Activity
Sleep(300)
jo.RunMethod("setSystemUiVisibility", Array As Object(5894)) '3846 - non-sticky
Catch
'Log(LastException) 'This can cause another error
End Try 'ignore
End If
End Sub
#Region Delegates
Sub Activity_ActionBarHomeClick
ActionBarHomeClicked = True
B4XPages.Delegate.Activity_ActionBarHomeClick
ActionBarHomeClicked = False
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean
Return B4XPages.Delegate.Activity_KeyPress(KeyCode)
End Sub
Sub Activity_Resume
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result Then
StartService(Tracker)
Else
ToastMessageShow("No permission...", True)
End If
B4XPages.Delegate.Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
B4XPages.Delegate.Activity_Pause
End Sub
Sub Activity_PermissionResult (Permission As String, Result As Boolean)
B4XPages.Delegate.Activity_PermissionResult(Permission, Result)
End Sub
Sub Create_Menu (Menu As Object)
B4XPages.Delegate.Create_Menu(Menu)
End Sub
Sub CanWriteToSystemSettings As Boolean
Dim p As Phone
If p.SdkVersion >= 23 Then
Dim ctxt As JavaObject
ctxt.InitializeContext
Dim settings As JavaObject
settings.InitializeStatic("android.provider.Settings.System")
Return settings.RunMethod("canWrite", Array(ctxt))
End If
Return True
End Sub
#if Java
public boolean _onCreateOptionsMenu(android.view.Menu menu) {
processBA.raiseEvent(null, "create_menu", menu);
return true;
}
#End If
#End Region