@preeternal/react-native-godot 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/LICENSE +22 -0
  2. package/Package.swift +106 -0
  3. package/README.md +631 -2
  4. package/android/build.gradle +289 -0
  5. package/android/consumer-rules.pro +19 -0
  6. package/android/fix-prefab.gradle +54 -0
  7. package/android/src/main/AndroidManifest.xml +2 -0
  8. package/android/src/main/cpp/CMakeLists.txt +74 -0
  9. package/android/src/main/cpp/GodotModule.cpp +718 -0
  10. package/android/src/main/cpp/OnLoad.cpp +66 -0
  11. package/android/src/main/cpp/libgodot_android.h +79 -0
  12. package/android/src/main/cpp/libgodot_jni.cpp +585 -0
  13. package/android/src/main/cpp/libgodot_jni.h +130 -0
  14. package/android/src/main/cpp/native_godot_module_jni.cpp +86 -0
  15. package/android/src/main/cpp/native_godot_module_jni.h +58 -0
  16. package/android/src/main/java/com/preeternal/reactnativegodot/NativeGodotModuleModule.kt +83 -0
  17. package/android/src/main/java/com/preeternal/reactnativegodot/NativeGodotModulePackage.kt +41 -0
  18. package/android/src/main/java/com/preeternal/reactnativegodot/NativeLibraryLoader.kt +5 -0
  19. package/android/src/main/java/com/preeternal/reactnativegodot/RTNGodotView.kt +81 -0
  20. package/android/src/main/java/com/preeternal/reactnativegodot/RTNGodotViewManager.kt +34 -0
  21. package/android/src/main/java/com/preeternal/reactnativegodot/RTNLibGodot.kt +350 -0
  22. package/android/src/main/res/layout/downloading_expansion.xml +165 -0
  23. package/android/src/main/res/layout/godot_app_layout.xml +5 -0
  24. package/android/src/main/res/layout/snackbar.xml +27 -0
  25. package/android/src/main/res/layout/status_bar_ongoing_event_progress_bar.xml +108 -0
  26. package/android/src/main/res/mipmap/icon.png +0 -0
  27. package/android/src/main/res/mipmap/icon_background.png +0 -0
  28. package/android/src/main/res/mipmap/icon_foreground.png +0 -0
  29. package/android/src/main/res/mipmap/icon_monochrome.png +0 -0
  30. package/android/src/main/res/mipmap-anydpi-v26/icon.xml +8 -0
  31. package/android/src/main/res/mipmap-anydpi-v26/themed_icon.xml +11 -0
  32. package/android/src/main/res/mipmap-hdpi/icon.png +0 -0
  33. package/android/src/main/res/mipmap-hdpi/icon_background.png +0 -0
  34. package/android/src/main/res/mipmap-hdpi/icon_foreground.png +0 -0
  35. package/android/src/main/res/mipmap-hdpi/icon_monochrome.png +0 -0
  36. package/android/src/main/res/mipmap-mdpi/icon.png +0 -0
  37. package/android/src/main/res/mipmap-mdpi/icon_background.png +0 -0
  38. package/android/src/main/res/mipmap-mdpi/icon_foreground.png +0 -0
  39. package/android/src/main/res/mipmap-mdpi/icon_monochrome.png +0 -0
  40. package/android/src/main/res/mipmap-xhdpi/icon.png +0 -0
  41. package/android/src/main/res/mipmap-xhdpi/icon_background.png +0 -0
  42. package/android/src/main/res/mipmap-xhdpi/icon_foreground.png +0 -0
  43. package/android/src/main/res/mipmap-xhdpi/icon_monochrome.png +0 -0
  44. package/android/src/main/res/mipmap-xxhdpi/icon.png +0 -0
  45. package/android/src/main/res/mipmap-xxhdpi/icon_background.png +0 -0
  46. package/android/src/main/res/mipmap-xxhdpi/icon_foreground.png +0 -0
  47. package/android/src/main/res/mipmap-xxhdpi/icon_monochrome.png +0 -0
  48. package/android/src/main/res/mipmap-xxxhdpi/icon.png +0 -0
  49. package/android/src/main/res/mipmap-xxxhdpi/icon_background.png +0 -0
  50. package/android/src/main/res/mipmap-xxxhdpi/icon_foreground.png +0 -0
  51. package/android/src/main/res/mipmap-xxxhdpi/icon_monochrome.png +0 -0
  52. package/android/src/main/res/values/dimens.xml +9 -0
  53. package/android/src/main/res/values/strings.xml +61 -0
  54. package/android/src/main/res/values/styles.xml +25 -0
  55. package/android/src/main/res/values-fa/strings.xml +14 -0
  56. package/android/src/main/res/values-ko/strings.xml +54 -0
  57. package/android/src/main/res/xml/godot_provider_paths.xml +15 -0
  58. package/android/src/test/java/com/preeternal/reactnativegodot/NativeGodotModulePackageTest.kt +26 -0
  59. package/app.plugin.js +173 -0
  60. package/cpp/GodotModule.h +103 -0
  61. package/cpp/NativeGodotModule.cpp +825 -0
  62. package/cpp/NativeGodotModule.h +45 -0
  63. package/cpp/godot-log.h +64 -0
  64. package/ios/GodotModule.mm +661 -0
  65. package/ios/NativeGodotModuleProvider.h +35 -0
  66. package/ios/NativeGodotModuleProvider.mm +42 -0
  67. package/ios/RTNGodotView.h +42 -0
  68. package/ios/RTNGodotView.mm +711 -0
  69. package/ios/log.mm +38 -0
  70. package/lib/module/NativeNativeGodotModule.js +59 -0
  71. package/lib/module/NativeNativeGodotModule.js.map +1 -0
  72. package/lib/module/RTNGodotView.js +6 -0
  73. package/lib/module/RTNGodotView.js.map +1 -0
  74. package/lib/module/RTNGodotView.native.js +5 -0
  75. package/lib/module/RTNGodotView.native.js.map +1 -0
  76. package/lib/module/RTNGodotViewNativeComponent.ts +37 -0
  77. package/lib/module/index.js +30 -0
  78. package/lib/module/index.js.map +1 -0
  79. package/lib/module/package.json +1 -0
  80. package/lib/typescript/package.json +1 -0
  81. package/lib/typescript/src/NativeNativeGodotModule.d.ts +26 -0
  82. package/lib/typescript/src/NativeNativeGodotModule.d.ts.map +1 -0
  83. package/lib/typescript/src/RTNGodotView.d.ts +7 -0
  84. package/lib/typescript/src/RTNGodotView.d.ts.map +1 -0
  85. package/lib/typescript/src/RTNGodotView.native.d.ts +3 -0
  86. package/lib/typescript/src/RTNGodotView.native.d.ts.map +1 -0
  87. package/lib/typescript/src/RTNGodotViewNativeComponent.d.ts +11 -0
  88. package/lib/typescript/src/RTNGodotViewNativeComponent.d.ts.map +1 -0
  89. package/lib/typescript/src/index.d.ts +6 -0
  90. package/lib/typescript/src/index.d.ts.map +1 -0
  91. package/package.json +262 -4
  92. package/prebuilt-utils.rb +36 -0
  93. package/react-native-godot.podspec +41 -0
  94. package/react-native.config.js +15 -0
  95. package/scripts/check-16kb.sh +136 -0
  96. package/scripts/check-packaged-artifacts.sh +154 -0
  97. package/scripts/ci/verify-prebuilt-install.cjs +39 -0
  98. package/scripts/download-prebuilt.js +274 -0
  99. package/src/NativeNativeGodotModule.ts +90 -0
  100. package/src/RTNGodotView.native.tsx +2 -0
  101. package/src/RTNGodotView.tsx +12 -0
  102. package/src/RTNGodotViewNativeComponent.ts +37 -0
  103. package/src/index.tsx +28 -0
@@ -0,0 +1,350 @@
1
+ package com.preeternal.reactnativegodot
2
+
3
+ import android.app.Activity
4
+ import android.content.res.AssetManager
5
+ import android.graphics.PixelFormat
6
+ import android.util.DisplayMetrics
7
+ import android.util.Log
8
+ import android.view.Surface
9
+ import android.view.SurfaceControl
10
+ import android.view.SurfaceHolder
11
+ import android.view.SurfaceView
12
+ import org.godotengine.godot.Godot
13
+ import org.godotengine.godot.GodotHost
14
+ import org.godotengine.godot.GodotIO
15
+ import org.godotengine.godot.GodotLib
16
+ import org.godotengine.godot.GodotRenderView
17
+ import org.godotengine.godot.IGodotLib
18
+ import org.godotengine.godot.input.GodotInputHandler
19
+ import org.godotengine.godot.io.directory.DirectoryAccessHandler
20
+ import org.godotengine.godot.io.file.FileAccessHandler
21
+ import org.godotengine.godot.plugin.AndroidRuntimePlugin
22
+ import org.godotengine.godot.plugin.GodotPlugin
23
+ import org.godotengine.godot.tts.GodotTTS
24
+ import org.godotengine.godot.utils.GodotNetUtils
25
+
26
+ class RTNLibGodot private constructor() : IGodotLib, GodotHost, GodotRenderView {
27
+ private var godot: Godot? = null
28
+ private var inputHandler: GodotInputHandler? = null
29
+ private val hostPlugins = HashSet<GodotPlugin>()
30
+
31
+ override fun initialize(
32
+ godot: Godot,
33
+ assetManager: AssetManager,
34
+ godotIO: GodotIO,
35
+ godotNetUtils: GodotNetUtils,
36
+ directoryAccessHandler: DirectoryAccessHandler,
37
+ fileAccessHandler: FileAccessHandler,
38
+ unused: Boolean,
39
+ ): Boolean {
40
+ val mainWindow = windowData[""]
41
+ if (mainWindow?.surface == null) {
42
+ Log.e(TAG, "Main window surface is unavailable; call init() before initialize()")
43
+ return false
44
+ }
45
+
46
+ initialize(
47
+ assetManager,
48
+ godotNetUtils,
49
+ directoryAccessHandler,
50
+ fileAccessHandler,
51
+ godotIO,
52
+ mainWindow.surface,
53
+ mainWindow.width,
54
+ mainWindow.height,
55
+ godot,
56
+ hostActivity,
57
+ RTNLibGodot::class.java.classLoader,
58
+ )
59
+ return true
60
+ }
61
+
62
+ override fun ondestroy() = Unit
63
+
64
+ override fun setup(strings: Array<String>, godotTTS: GodotTTS): Boolean = true
65
+
66
+ override fun resize(surface: Surface, width: Int, height: Int) {
67
+ Log.i(TAG, "Resize")
68
+ }
69
+
70
+ override fun newcontext(surface: Surface) = Unit
71
+ override fun back() = Unit
72
+ override fun step(): Boolean = false
73
+ override fun ttsCallback(a: Int, b: Int, c: Int) = Unit
74
+
75
+ override fun dispatchTouchEvent(
76
+ event: Int,
77
+ pointer: Int,
78
+ pointerCount: Int,
79
+ positions: FloatArray,
80
+ doubleTap: Boolean,
81
+ ) {
82
+ dispatchTouchEvent("", event, pointer, pointerCount, positions, doubleTap)
83
+ }
84
+
85
+ override fun dispatchMouseEvent(
86
+ event: Int,
87
+ buttonMask: Int,
88
+ x: Float,
89
+ y: Float,
90
+ deltaX: Float,
91
+ deltaY: Float,
92
+ doubleClick: Boolean,
93
+ sourceMouseRelative: Boolean,
94
+ pressure: Float,
95
+ tiltX: Float,
96
+ tiltY: Float,
97
+ ) = Unit
98
+
99
+ override fun magnify(a: Float, b: Float, c: Float) = Unit
100
+ override fun pan(a: Float, b: Float, c: Float, d: Float) = Unit
101
+ override fun accelerometer(a: Float, b: Float, c: Float) = Unit
102
+ override fun gravity(a: Float, b: Float, c: Float) = Unit
103
+ override fun magnetometer(a: Float, b: Float, c: Float) = Unit
104
+ override fun gyroscope(a: Float, b: Float, c: Float) = Unit
105
+ override fun key(a: Int, b: Int, c: Int, d: Boolean, e: Boolean) = Unit
106
+ override fun joybutton(a: Int, b: Int, c: Boolean) = Unit
107
+ override fun joyaxis(a: Int, b: Int, c: Float) = Unit
108
+ override fun joyhat(a: Int, b: Int, c: Int) = Unit
109
+ override fun joyconnectionchanged(a: Int, b: Boolean, c: String) = Unit
110
+ override fun focusin() = Unit
111
+ override fun focusout() = Unit
112
+
113
+ override external fun getGlobal(path: String): String
114
+ override external fun getRendererInfo(): Array<String>
115
+
116
+ override fun getEditorSetting(path: String): String = ""
117
+ override fun setEditorSetting(path: String, value: Any?) = Unit
118
+ override fun getEditorProjectMetadata(path: String, key: String, defaultValue: Any?): Any? = null
119
+ override fun setEditorProjectMetadata(path: String, key: String, value: Any?) = Unit
120
+ override fun requestPermissionResult(permission: String, granted: Boolean) = Unit
121
+ override fun onNightModeChanged() = Unit
122
+ override fun hardwareKeyboardConnected(connected: Boolean) = Unit
123
+ override fun filePickerCallback(success: Boolean, files: Array<String>) = Unit
124
+ override fun setVirtualKeyboardHeight(height: Int) = Unit
125
+ override fun onRendererResumed() = Unit
126
+ override fun onRendererPaused() = Unit
127
+ override fun shouldDispatchInputToRenderThread(): Boolean = false
128
+ override fun getProjectResourceDir(): String = ""
129
+ override fun isEditorHint(): Boolean = false
130
+ override fun isProjectManagerHint(): Boolean = false
131
+ override fun providesRenderView(): Boolean = true
132
+ override fun getRenderView(): GodotRenderView = this
133
+ override fun getActivity(): Activity? = hostActivity
134
+ override fun getGodot(): Godot? = godot
135
+ override fun getView(): SurfaceView? = null
136
+ override fun startRenderer() = Unit
137
+ override fun queueOnRenderThread(runnable: Runnable) = Unit
138
+ override fun onActivityPaused() = Unit
139
+ override fun onActivityStopped() = Unit
140
+ override fun onActivityResumed() = Unit
141
+ override fun onActivityStarted() = Unit
142
+ override fun onActivityDestroyed() = Unit
143
+ override fun getInputHandler(): GodotInputHandler? = inputHandler
144
+ override fun configurePointerIcon(a: Int, b: String, c: Float, d: Float) = Unit
145
+ override fun setPointerIcon(pointer: Int) = Unit
146
+
147
+ private class WindowSurfaceData(
148
+ val control: SurfaceControl,
149
+ width: Int,
150
+ height: Int,
151
+ val persistent: Boolean,
152
+ ) {
153
+ var attachedControl: SurfaceControl? = null
154
+ var attachedSurface: Surface? = null
155
+ val surface: Surface = Surface(control)
156
+ var width: Int = width
157
+ var height: Int = height
158
+ }
159
+
160
+ fun updateWindow(
161
+ name: String,
162
+ control: SurfaceControl,
163
+ holder: SurfaceHolder,
164
+ format: Int,
165
+ width: Int,
166
+ height: Int,
167
+ ) {
168
+ if (name.isNotEmpty()) {
169
+ updateWindowNative(name, holder.surface, width, height)
170
+ return
171
+ }
172
+
173
+ val window = getOrCreateWindowSurface(name, width, height)
174
+ val holderSurface = holder.surface
175
+ val surfaceChanged = window.attachedControl != control || window.attachedSurface != holderSurface
176
+
177
+ if (surfaceChanged) {
178
+ window.attachedControl = null
179
+ window.attachedSurface = null
180
+ Log.i(TAG, "Attaching and resizing surface to: $width $height")
181
+ SurfaceControl.Transaction().use { transaction ->
182
+ transaction.reparent(window.control, control)
183
+ transaction.setLayer(window.control, 1)
184
+ transaction.setVisibility(window.control, true)
185
+ if (window.width != width || window.height != height) {
186
+ transaction.setBufferSize(window.control, width, height)
187
+ window.width = width
188
+ window.height = height
189
+ }
190
+ transaction.apply()
191
+ }
192
+ window.attachedControl = control
193
+ window.attachedSurface = holderSurface
194
+ } else if (window.width != width || window.height != height) {
195
+ Log.i(TAG, "Resizing surface to: $width $height")
196
+ SurfaceControl.Transaction().use { transaction ->
197
+ transaction.setBufferSize(window.control, width, height)
198
+ window.width = width
199
+ window.height = height
200
+ transaction.apply()
201
+ }
202
+ }
203
+
204
+ updateWindowNative(name, window.surface, width, height)
205
+ }
206
+
207
+ fun removeWindow(name: String) {
208
+ val window = windowData[name]
209
+ if (window == null) {
210
+ removeWindowNative(name)
211
+ return
212
+ }
213
+
214
+ SurfaceControl.Transaction().use { transaction ->
215
+ transaction.reparent(window.control, null)
216
+ transaction.setVisibility(window.control, false)
217
+ transaction.apply()
218
+ }
219
+ window.attachedControl = null
220
+ window.attachedSurface = null
221
+ removeWindowNative(name)
222
+ if (!window.persistent) windowData.remove(name)
223
+ }
224
+
225
+ @Synchronized
226
+ fun init(newActivity: Activity?) {
227
+ if (inited) return
228
+ hostActivity = newActivity
229
+ val currentActivity = hostActivity
230
+ if (currentActivity == null) {
231
+ Log.e(TAG, "Activity not set, abort init")
232
+ return
233
+ }
234
+
235
+ val metrics = DisplayMetrics()
236
+ @Suppress("DEPRECATION")
237
+ currentActivity.windowManager.defaultDisplay.getMetrics(metrics)
238
+ getOrCreateWindowSurface("", metrics.widthPixels, metrics.heightPixels)
239
+
240
+ GodotLib.setGodotLibImpl(this)
241
+ godot = Godot.getInstance(currentActivity).also { it.setActivity(currentActivity) }
242
+ val currentGodot = godot ?: return
243
+ val runtimePlugins = HashSet<GodotPlugin>().apply {
244
+ add(AndroidRuntimePlugin(currentGodot))
245
+ addAll(hostPlugins)
246
+ }
247
+
248
+ if (!currentGodot.initEngine(this, ArrayList(), runtimePlugins)) {
249
+ Log.e(TAG, "Unable to initialize Godot engine layer")
250
+ return
251
+ }
252
+
253
+ inputHandler = GodotInputHandler(currentActivity, currentGodot)
254
+ inited = true
255
+ }
256
+
257
+ fun shutdown() {
258
+ if (inited) {
259
+ cleanup()
260
+ inited = false
261
+ }
262
+ }
263
+
264
+ fun addHostPlugin(plugin: GodotPlugin) {
265
+ hostPlugins.add(plugin)
266
+ }
267
+
268
+ fun getHostPlugins(): Set<GodotPlugin> = hostPlugins
269
+
270
+ private external fun updateWindowNative(name: String, surface: Surface, width: Int, height: Int)
271
+ private external fun removeWindowNative(name: String)
272
+
273
+ private external fun cleanup()
274
+
275
+ external fun dispatchTouchEvent(
276
+ windowName: String,
277
+ event: Int,
278
+ pointer: Int,
279
+ pointerCount: Int,
280
+ positions: FloatArray,
281
+ doubleTap: Boolean,
282
+ )
283
+
284
+ external fun dispatchMouseEvent(
285
+ windowName: String,
286
+ event: Int,
287
+ buttonMask: Int,
288
+ x: Float,
289
+ y: Float,
290
+ deltaX: Float,
291
+ deltaY: Float,
292
+ doubleClick: Boolean,
293
+ sourceMouseRelative: Boolean,
294
+ pressure: Float,
295
+ tiltX: Float,
296
+ tiltY: Float,
297
+ )
298
+
299
+ companion object {
300
+ private const val TAG = "LibGodot"
301
+ private var inited = false
302
+ private var hostActivity: Activity? = null
303
+
304
+ private val INSTANCE = RTNLibGodot()
305
+ private val windowData = HashMap<String, WindowSurfaceData>()
306
+
307
+ @JvmStatic
308
+ fun getInstance(): RTNLibGodot = INSTANCE
309
+
310
+ private fun createWindowSurface(name: String, width: Int, height: Int) {
311
+ val control = SurfaceControl.Builder()
312
+ .setBufferSize(width, height)
313
+ .setFormat(PixelFormat.RGBA_8888)
314
+ .setName(name)
315
+ .build()
316
+ windowData[name] = WindowSurfaceData(control, width, height, name.isEmpty())
317
+ }
318
+
319
+ private fun getOrCreateWindowSurface(name: String, width: Int, height: Int): WindowSurfaceData =
320
+ windowData[name] ?: run {
321
+ createWindowSurface(name, width, height)
322
+ checkNotNull(windowData[name])
323
+ }
324
+
325
+ @JvmStatic
326
+ private external fun initialize(
327
+ assetManager: AssetManager,
328
+ netUtils: GodotNetUtils,
329
+ directoryAccessHandler: DirectoryAccessHandler,
330
+ fileAccessHandler: FileAccessHandler,
331
+ io: GodotIO,
332
+ mainSurface: Surface,
333
+ width: Int,
334
+ height: Int,
335
+ godot: Godot,
336
+ hostActivity: Activity?,
337
+ appClassLoader: ClassLoader?,
338
+ )
339
+
340
+ @JvmStatic
341
+ private external fun registerWindowUpdateCallbackNative(
342
+ name: String,
343
+ handle: Any,
344
+ runnable: Runnable,
345
+ )
346
+
347
+ @JvmStatic
348
+ private external fun unregisterWindowUpdateCallbackNative(handle: Any)
349
+ }
350
+ }
@@ -0,0 +1,165 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:layout_width="match_parent"
4
+ android:layout_height="match_parent"
5
+ android:orientation="vertical" >
6
+
7
+ <LinearLayout
8
+ android:layout_width="match_parent"
9
+ android:layout_height="wrap_content"
10
+ android:layout_weight="0"
11
+ android:orientation="vertical" >
12
+
13
+ <TextView
14
+ android:id="@+id/statusText"
15
+ android:layout_width="match_parent"
16
+ android:layout_height="wrap_content"
17
+ android:layout_marginBottom="10dp"
18
+ android:layout_marginStart="5dp"
19
+ android:layout_marginTop="10dp"
20
+ android:textStyle="bold" />
21
+
22
+ <LinearLayout
23
+ android:id="@+id/downloaderDashboard"
24
+ android:layout_width="fill_parent"
25
+ android:layout_height="wrap_content"
26
+ android:orientation="vertical" >
27
+
28
+ <RelativeLayout
29
+ android:layout_width="match_parent"
30
+ android:layout_height="0dp"
31
+ android:layout_weight="1" >
32
+
33
+ <TextView
34
+ android:id="@+id/progressAsFraction"
35
+ style="@android:style/TextAppearance.Small"
36
+ android:layout_width="wrap_content"
37
+ android:layout_height="wrap_content"
38
+ android:layout_alignParentStart="true"
39
+ android:layout_marginStart="5dp" />
40
+
41
+ <TextView
42
+ android:id="@+id/progressAsPercentage"
43
+ style="@android:style/TextAppearance.Small"
44
+ android:layout_width="wrap_content"
45
+ android:layout_height="wrap_content"
46
+ android:layout_alignEnd="@+id/progressBar" />
47
+
48
+ <ProgressBar
49
+ android:id="@+id/progressBar"
50
+ style="?android:attr/progressBarStyleHorizontal"
51
+ android:layout_width="match_parent"
52
+ android:layout_height="wrap_content"
53
+ android:layout_below="@+id/progressAsFraction"
54
+ android:layout_marginBottom="10dp"
55
+ android:layout_marginLeft="10dp"
56
+ android:layout_marginRight="10dp"
57
+ android:layout_marginTop="10dp" />
58
+
59
+ <TextView
60
+ android:id="@+id/progressAverageSpeed"
61
+ style="@android:style/TextAppearance.Small"
62
+ android:layout_width="wrap_content"
63
+ android:layout_height="wrap_content"
64
+ android:layout_alignParentStart="true"
65
+ android:layout_below="@+id/progressBar"
66
+ android:layout_marginStart="5dp" />
67
+
68
+ <TextView
69
+ android:id="@+id/progressTimeRemaining"
70
+ style="@android:style/TextAppearance.Small"
71
+ android:layout_width="wrap_content"
72
+ android:layout_height="wrap_content"
73
+ android:layout_alignEnd="@+id/progressBar"
74
+ android:layout_below="@+id/progressBar" />
75
+ </RelativeLayout>
76
+
77
+ <LinearLayout
78
+ android:id="@+id/downloadButton"
79
+ android:layout_width="fill_parent"
80
+ android:layout_height="wrap_content"
81
+ android:orientation="horizontal" >
82
+
83
+ <Button
84
+ android:id="@+id/cancelButton"
85
+ android:layout_width="wrap_content"
86
+ android:layout_height="wrap_content"
87
+ android:layout_gravity="center_vertical"
88
+ android:layout_marginBottom="10dp"
89
+ android:layout_marginLeft="5dp"
90
+ android:layout_marginRight="5dp"
91
+ android:layout_marginTop="10dp"
92
+ android:layout_weight="0"
93
+ android:minHeight="40dp"
94
+ android:minWidth="94dp"
95
+ android:text="@string/text_button_cancel"
96
+ android:visibility="gone"
97
+ style="?android:attr/buttonBarButtonStyle" />
98
+
99
+ <Button
100
+ android:id="@+id/pauseButton"
101
+ android:layout_width="wrap_content"
102
+ android:layout_height="wrap_content"
103
+ android:layout_gravity="center_vertical"
104
+ android:layout_marginBottom="10dp"
105
+ android:layout_marginStart="10dp"
106
+ android:layout_marginEnd="5dp"
107
+ android:layout_marginTop="10dp"
108
+ android:layout_weight="0"
109
+ android:minHeight="40dp"
110
+ android:minWidth="94dp"
111
+ android:text="@string/text_button_pause"
112
+ style="?android:attr/buttonBarButtonStyle" />
113
+ </LinearLayout>
114
+ </LinearLayout>
115
+ </LinearLayout>
116
+
117
+ <LinearLayout
118
+ android:id="@+id/approveCellular"
119
+ android:layout_width="match_parent"
120
+ android:layout_height="match_parent"
121
+ android:layout_weight="1"
122
+ android:orientation="vertical"
123
+ android:visibility="gone" >
124
+
125
+ <TextView
126
+ android:layout_width="match_parent"
127
+ android:layout_height="wrap_content"
128
+ android:layout_margin="10dp"
129
+ android:id="@+id/textPausedParagraph1"
130
+ android:text="@string/text_paused_cellular" />
131
+
132
+ <TextView
133
+ android:layout_width="match_parent"
134
+ android:layout_height="wrap_content"
135
+ android:layout_margin="10dp"
136
+ android:id="@+id/textPausedParagraph2"
137
+ android:text="@string/text_paused_cellular_2" />
138
+
139
+ <LinearLayout
140
+ android:id="@+id/buttonRow"
141
+ android:layout_width="match_parent"
142
+ android:layout_height="wrap_content"
143
+ android:orientation="horizontal" >
144
+
145
+ <Button
146
+ android:id="@+id/resumeOverCellular"
147
+ android:layout_width="wrap_content"
148
+ android:layout_height="wrap_content"
149
+ android:layout_gravity="center"
150
+ android:layout_margin="10dp"
151
+ android:text="@string/text_button_resume_cellular"
152
+ style="?android:attr/buttonBarButtonStyle" />
153
+
154
+ <Button
155
+ android:id="@+id/wifiSettingsButton"
156
+ android:layout_width="wrap_content"
157
+ android:layout_height="wrap_content"
158
+ android:layout_gravity="center"
159
+ android:layout_margin="10dp"
160
+ android:text="@string/text_button_wifi_settings"
161
+ style="?android:attr/buttonBarButtonStyle" />
162
+ </LinearLayout>
163
+ </LinearLayout>
164
+
165
+ </LinearLayout>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:id="@+id/godot_fragment_container"
4
+ android:layout_width="match_parent"
5
+ android:layout_height="match_parent" />
@@ -0,0 +1,27 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:layout_width="match_parent"
4
+ android:layout_height="wrap_content"
5
+ android:background="@android:drawable/dialog_holo_dark_frame"
6
+ android:gravity="center_vertical"
7
+ android:orientation="horizontal">
8
+
9
+ <TextView
10
+ android:id="@+id/snackbar_text"
11
+ android:layout_width="0dp"
12
+ android:layout_height="wrap_content"
13
+ android:layout_weight="1"
14
+ android:text=""
15
+ android:textColor="@android:color/white"
16
+ android:textSize="14sp"
17
+ android:padding="8dp"/>
18
+
19
+ <Button
20
+ android:id="@+id/snackbar_action"
21
+ android:layout_width="wrap_content"
22
+ android:layout_height="wrap_content"
23
+ android:background="#00FFFFFF"
24
+ android:text="Action"
25
+ android:textColor="#61B7FC"
26
+ android:paddingHorizontal="8dp"/>
27
+ </LinearLayout>
@@ -0,0 +1,108 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ /*
4
+ ** Copyright 2008, The Android Open Source Project
5
+ **
6
+ ** Licensed under the Apache License, Version 2.0 (the "License");
7
+ ** you may not use this file except in compliance with the License.
8
+ ** You may obtain a copy of the License at
9
+ **
10
+ ** http://www.apache.org/licenses/LICENSE-2.0
11
+ **
12
+ ** Unless required by applicable law or agreed to in writing, software
13
+ ** distributed under the License is distributed on an "AS IS" BASIS,
14
+ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ ** See the License for the specific language governing permissions and
16
+ ** limitations under the License.
17
+ */
18
+ -->
19
+
20
+ <LinearLayout xmlns:tools="http://schemas.android.com/tools"
21
+ android:layout_width="match_parent"
22
+ android:layout_height="match_parent"
23
+ android:baselineAligned="false"
24
+ android:orientation="horizontal" android:id="@+id/notificationLayout" xmlns:android="http://schemas.android.com/apk/res/android">
25
+
26
+ <RelativeLayout
27
+ android:layout_width="35dp"
28
+ android:layout_height="fill_parent"
29
+ android:paddingTop="10dp"
30
+ android:paddingBottom="8dp" >
31
+
32
+ <ImageView
33
+ android:id="@+id/appIcon"
34
+ android:layout_width="fill_parent"
35
+ android:layout_height="25dp"
36
+ android:scaleType="centerInside"
37
+ android:layout_alignParentStart="true"
38
+ android:layout_alignParentTop="true"
39
+ android:src="@android:drawable/stat_sys_download"
40
+ android:contentDescription="@string/godot_project_name_string" />
41
+
42
+ <TextView
43
+ android:id="@+id/progress_text"
44
+ style="@style/NotificationText"
45
+ android:layout_width="fill_parent"
46
+ android:layout_height="wrap_content"
47
+ android:layout_alignParentStart="true"
48
+ android:layout_alignParentBottom="true"
49
+ android:layout_gravity="center_horizontal"
50
+ android:singleLine="true"
51
+ android:gravity="center" />
52
+ </RelativeLayout>
53
+
54
+ <RelativeLayout
55
+ android:layout_width="0dip"
56
+ android:layout_height="match_parent"
57
+ android:layout_weight="1.0"
58
+ android:clickable="true"
59
+ android:focusable="true"
60
+ android:paddingTop="10dp"
61
+ android:paddingEnd="8dp"
62
+ android:paddingBottom="8dp"
63
+ tools:ignore="RtlSymmetry">
64
+
65
+ <TextView
66
+ android:id="@+id/title"
67
+ style="@style/NotificationTitle"
68
+ android:layout_width="wrap_content"
69
+ android:layout_height="wrap_content"
70
+ android:layout_alignParentStart="true"
71
+ android:singleLine="true"/>
72
+
73
+ <TextView
74
+ android:id="@+id/time_remaining"
75
+ style="@style/NotificationText"
76
+ android:layout_width="wrap_content"
77
+ android:layout_height="wrap_content"
78
+ android:layout_alignParentEnd="true"
79
+ android:singleLine="true"
80
+ tools:ignore="RelativeOverlap" />
81
+ <!-- Only one of progress_bar and paused_text will be visible. -->
82
+
83
+ <FrameLayout
84
+ android:id="@+id/progress_bar_frame"
85
+ android:layout_width="fill_parent"
86
+ android:layout_height="wrap_content"
87
+ android:layout_alignParentBottom="true" >
88
+
89
+ <ProgressBar
90
+ android:id="@+id/progress_bar"
91
+ style="?android:attr/progressBarStyleHorizontal"
92
+ android:layout_width="fill_parent"
93
+ android:layout_height="wrap_content"
94
+ android:paddingEnd="25dp" />
95
+
96
+ <TextView
97
+ android:id="@+id/description"
98
+ style="@style/NotificationTextShadow"
99
+ android:layout_width="wrap_content"
100
+ android:layout_height="wrap_content"
101
+ android:layout_gravity="center"
102
+ android:paddingEnd="25dp"
103
+ android:singleLine="true" />
104
+ </FrameLayout>
105
+
106
+ </RelativeLayout>
107
+
108
+ </LinearLayout>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ WARNING: The content of this file must always match the constant 'platform/android/export/export_plugin.cpp#ICON_XML_TEMPLATE'.
4
+ -->
5
+ <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
6
+ <background android:drawable="@mipmap/icon_background"/>
7
+ <foreground android:drawable="@mipmap/icon_foreground"/>
8
+ </adaptive-icon>
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ This file is created to work alongside the icon.xml file.
4
+ If the user provides a Monochrome icon in the export settings, its data will be used to overwrite the icon.xml file.
5
+ We needed to create this file to get a reference for icon_monochrome.
6
+ -->
7
+ <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
8
+ <background android:drawable="@mipmap/icon_background"/>
9
+ <foreground android:drawable="@mipmap/icon_foreground"/>
10
+ <monochrome android:drawable="@mipmap/icon_monochrome"/>
11
+ </adaptive-icon>