├── CHANGELOG.md ├── LICENSE ├── README.md ├── framework_src ├── .gitignore ├── example │ ├── .gitignore │ ├── .idea │ │ ├── .gitignore │ │ ├── .name │ │ ├── encodings.xml │ │ ├── flexCompiler.xml │ │ ├── libraries │ │ │ ├── com_tuarua_frekotlin_1_72_1.xml │ │ │ └── com_tuarua_frekotlin_example.xml │ │ ├── misc.xml │ │ ├── modules.xml │ │ └── runConfigurations │ │ │ └── FreKotlinExample.xml │ ├── FreKotlinExample.iml │ ├── Main-app.xml │ └── src │ │ └── Main.as ├── frekotlin_native_extension │ ├── .idea │ │ ├── .name │ │ ├── encodings.xml │ │ ├── flexCompiler.xml │ │ ├── misc.xml │ │ ├── modules.xml │ │ └── workspace.xml │ ├── FreKotlin.iml │ └── src │ │ ├── avmplus │ │ └── DescribeTypeJSON.as │ │ └── com │ │ └── tuarua │ │ ├── FreKotlinANE.as │ │ └── fre │ │ ├── ANEError.as │ │ └── ANEUtils.as ├── native_extension │ ├── .gitignore │ ├── .idea │ │ ├── .name │ │ ├── encodings.xml │ │ ├── flexCompiler.xml │ │ ├── inspectionProfiles │ │ │ └── Project_Default.xml │ │ ├── misc.xml │ │ └── modules.xml │ ├── FreKotlinExampleANE.iml │ ├── ane │ │ ├── .gitignore │ │ ├── com.tuarua.frekotlin-1.72.1.ane │ │ ├── com.tuarua.frekotlin.example.ane │ │ ├── extension.xml │ │ ├── extension_frekotlin.xml │ │ ├── frekotlin-build.bat │ │ ├── frekotlin-build.sh │ │ ├── platforms │ │ │ └── android │ │ │ │ ├── com.tuarua.FreKotlinExampleANE-res │ │ │ │ └── values │ │ │ │ │ └── strings.xml │ │ │ │ ├── kotlin-stdlib-1.7.21.jar │ │ │ │ ├── kotlin-stdlib-common-1.7.21.jar │ │ │ │ ├── platform.xml │ │ │ │ └── platform_frekotlin.xml │ │ ├── project-build.bat │ │ └── project-build.sh │ ├── bin │ │ ├── FreKotlinANE.swc │ │ └── FreKotlinExampleANE.swc │ └── src │ │ ├── avmplus │ │ └── DescribeTypeJSON.as │ │ └── com │ │ └── tuarua │ │ ├── City.as │ │ ├── FreKotlinExampleANE.as │ │ ├── FreKotlinExampleANEContext.as │ │ ├── Person.as │ │ └── fre │ │ ├── ANEError.as │ │ └── ANEUtils.as └── native_library │ └── android │ └── FreKotlinExampleANE │ ├── .gitignore │ ├── .idea │ ├── .gitignore │ ├── codeStyles │ │ └── Project.xml │ ├── copyright │ │ └── Tua_Rua_Ltd___Apache.xml │ ├── gradle.xml │ ├── inspectionProfiles │ │ └── Project_Default.xml │ ├── jarRepositories.xml │ ├── misc.xml │ ├── modules.xml │ ├── modules │ │ ├── FreKotlin │ │ │ └── FreKotlinExampleANE.FreKotlin.iml │ │ └── app │ │ │ ├── FreKotlinExampleANE.app.iml │ │ │ ├── FreKotlinExampleANE.app.main.iml │ │ │ └── FreKotlinExampleANE.app.unitTest.iml │ └── runConfigurations │ │ ├── Build_AAR.xml │ │ └── Docs.xml │ ├── FreKotlinExampleANE.iml │ ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── tuarua │ │ │ ├── BitmapUtils.kt │ │ │ ├── FreKotlinExampleANE.java │ │ │ ├── FreKotlinExampleContext.java │ │ │ └── KotlinController.kt │ │ └── res │ │ ├── layout.properties │ │ └── values │ │ └── strings.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── shared │ └── libs │ ├── FlashRuntimeExtensions.jar │ └── runtimeClasses.jar └── starter_project ├── README.md ├── example ├── .gitignore ├── .idea │ ├── .name │ ├── encodings.xml │ ├── flexCompiler.xml │ ├── libraries │ │ ├── HelloWorldANE.xml │ │ └── com_tuarua_frekotlin_1_42_0.xml │ ├── misc.xml │ ├── modules.xml │ ├── runConfigurations │ │ └── HelloWorldExample.xml │ └── vcs.xml ├── HelloWorldExample.iml ├── Main-app.xml ├── android_dependencies │ ├── .gitignore │ └── README.md ├── get_android_dependencies.ps1 ├── get_android_dependencies.sh └── src │ ├── Main-app.xml │ └── Main.as ├── native_extension ├── .gitignore ├── .idea │ ├── .name │ ├── encodings.xml │ ├── flexCompiler.xml │ ├── inspectionProfiles │ │ └── Project_Default.xml │ ├── misc.xml │ └── modules.xml ├── HelloWorldANE.iml ├── ane │ ├── HelloWorldANE.ane │ ├── build-android.bat │ ├── build-android.sh │ ├── extension_android.xml │ └── platforms │ │ └── android │ │ └── platform.xml ├── bin │ └── HelloWorldANE.swc └── src │ ├── avmplus │ └── DescribeTypeJSON.as │ └── com │ ├── mycompany │ ├── CustomEvent.as │ ├── HelloWorldANE.as │ └── HelloWorldANEContext.as │ └── tuarua │ └── fre │ ├── ANEError.as │ └── ANEUtils.as └── native_library └── android └── HelloWorldANE ├── .gitignore ├── .idea ├── codeStyles │ └── Project.xml ├── gradle.xml ├── jarRepositories.xml ├── misc.xml ├── modules.xml ├── modules │ └── app │ │ ├── HelloWorldANE.app.androidTest.iml │ │ ├── HelloWorldANE.app.iml │ │ ├── HelloWorldANE.app.main.iml │ │ └── HelloWorldANE.app.unitTest.iml └── runConfigurations │ └── Build_AAR.xml ├── HelloWorldANE.iml ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── mycompany │ │ ├── HelloWorldANE.java │ │ ├── HelloWorldANEContext.java │ │ └── helloworldane │ │ └── KotlinController.kt │ └── res │ └── values │ └── strings.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ### 1.72.1 2 | - Upgraded to Kotlin 1.7.21 3 | - Upgraded to AIR 50.1.1 4 | - Upgraded to Android build tools 31.0.0 5 | 6 | ### 1.61.0 7 | - Upgraded to Kotlin 1.6.10 8 | - Upgraded to AIR 33.1.1.633 9 | 10 | ### 1.42.0 11 | - Upgraded to Kotlin 1.4.21 12 | - Upgraded to AIR 33.1.1.345 13 | 14 | ### 1.41.0 15 | - Upgraded to Kotlin 1.4.10 16 | - Upgraded to AIR 33.1.1.259 17 | - Upgraded to Android build tools 29.0.3 18 | 19 | ### 1.40.0 20 | - Upgraded to Kotlin 1.4.0 21 | 22 | 23 | ### 1.10.0 24 | - Upgraded to Kotlin 1.3.71 25 | 26 | ### 1.9.5 27 | - Upgraded to Kotlin 1.3.61 28 | - Added operator FREObject?.set for main types. Allows setting props on FREObjects without setting value to .toFREObject() eg `fre["name"] = "Bob"` 29 | - Remove `FreArgException(functionName:String)` 30 | 31 | ### 1.9.0 32 | - Upgraded to Kotlin 1.3.50 33 | - Add `FREArray.map()` 34 | - Refactor `FREArray` 35 | - add optional `items: List` param to `FREArray` 36 | - Remove stackTraceElements param from `FreException.getError()` 37 | - Remove `FreConversionException` 38 | - Remove `toFREArray` methods 39 | - Obsolete stackTraceElements param from `FreArgException(functionName)` 40 | - rename `TRStateChangeCallback` to `FreKotlinStateChangeCallback` 41 | - rename `TRActivityResultCallback` to `FreKotlinActivityResultCallback` 42 | - remove these Lifecycle overrides from java. These are now added directly in KotlinController 43 | - Upgraded to jvm target 1.8 44 | - FreKotlinMainController.TAG is now optional String 45 | - FreKotlinController.TAG is now optional String 46 | 47 | 48 | ### 1.8.0 49 | - Upgraded to Kotlin 1.3.40 50 | - Upgraded to AIR 33 51 | - Added ARM 64bit support 52 | - Obsolete stackTraceElements param from `FreException.getError()` 53 | - Obsolete `FreConversionException` 54 | - Obsolete `toFREArray` methods 55 | 56 | ### 1.7.0 57 | - Upgraded to Kotlin 1.3.30 58 | - Add `FREObject.className` 59 | - Add `FreObjectKotlin.className` 60 | - Add `FreObjectKotlin.type` 61 | - Extensions for `ShortArray` 62 | - Extensions for `FloatArray` 63 | - Deprecate `FreConversionException` 64 | - Change: `FREArray` now uses Vector. throughout 65 | 66 | ### 1.6.0 67 | - Upgraded to Kotlin 1.3.11 68 | - Upgraded to AIR 32 69 | - Refactor starter projects AS3 70 | - Deprecate stackTraceElements param from `FreException.getError()` 71 | - Add `FREArray.insert()` 72 | - Add `FREArray.remove()` 73 | - Add `FREArray.isEmpty` 74 | - Small Refactor 75 | 76 | ### 1.5.0 77 | - Upgraded to Kotlin 1.2.61 78 | - Upgraded to AIR 31 79 | - Use `android.graphics.Rect`, `RectF`, `Point` and `PointF` for `FreRect` and `FrePoint` 80 | - Added `FREObject.toStr()` 81 | - Added `FREObject.hasOwnProperty(string name)` 82 | - Added `FREArray.push()` 83 | - `FREObject.toColor(hasAlpha: Boolean = true)` hasAlpha default value is now TRUE 84 | - mark `FreKotlinHelper` as internal 85 | - Add `FreKotlinLogger` to trace any FREExceptions 86 | - Add `warning` and `info` trace methods 87 | - Remove `sendEvent` method 88 | - Improve KDocs 89 | - Refactor 90 | 91 | ### 1.4.0 92 | - Upgraded to Kotlin 1.2.51 93 | - Upgraded to AIR 30 94 | - Added Kotlin version of FREArray.newArray 95 | - Added iterator for FREArray i.e. for (fre: FREObject? in airArray) { } 96 | - Added subscript setter# for FREObject i.e. myFreObject["name"] = myFREObject 97 | - Deprecate sendEvent, use dispatchEvent instead 98 | - handle Float param in call() method 99 | 100 | ### 1.3.0 101 | - Upgraded to Kotlin 1.2.41 102 | - Upgraded to AIR 29 103 | - Extensions for LongArray 104 | - Deprecate ArgCountException 105 | - Deprecate ArgException 106 | - Deprecate NullArgsException 107 | - Added FreArgException 108 | - Added FreConversionException 109 | - Added generic catch for FREFunction calls 110 | 111 | ### 1.2.0 112 | - Upgraded to Kotlin 1.2.30 113 | - Upgraded to AIR 29 114 | 115 | ### 1.1.0 116 | - Improved performance for conversions 117 | 118 | ### 1.0.0 119 | - Added conversion from ByteArray to FreByteArrayKotlin 120 | - Added ByteArray.toFREObject() 121 | - Added Bitmap.toFREObject() 122 | - Fix bug converting to Long 123 | - Handle ARGB in toColor(hasAlpha: Boolean) method 124 | - Upgraded to Kotlin 1.2.10 125 | - Add Dokka docs 126 | 127 | ### 0.0.12 128 | - Fix bug converting null String to Kotlin String 129 | - Upgraded to Kotlin 1.1.51 130 | 131 | ### 0.0.11 132 | - Added correct conversion from Bitmap to FreBitmapKotlin 133 | - Minor corrections to FREArray 134 | - Upgraded to Kotlin 1.1.50 135 | 136 | ### 0.0.10 137 | - Extensions for conversion to ArrayList, Map 138 | - Extensions for FREObject, FREArray 139 | 140 | ### 0.0.9 141 | - Extensions for conversion to IntArray, DoubleArray, BooleanArray 142 | 143 | ### 0.0.8 144 | - Extensions for conversion to String, Int, Boolean, Double, Float, Date, Rect, Point 145 | 146 | ### 0.0.7 147 | - Upgraded to Kotlin 1.1.4-3 148 | - Improve FreKotlinController interface 149 | 150 | ### 0.0.6 151 | - Support conversion to/from Date, Long, Short 152 | - Improve FreArrayKotlin 153 | 154 | ### 0.0.5 155 | - Improve FreException 156 | 157 | ### 0.0.4 158 | - Upgraded to Kotlin 1.1.4-2 159 | - Change minimum SDK to 19 (KitKat 4.4) 160 | - Added toColor method 161 | 162 | ### 0.0.3 163 | - Upgraded to Kotlin 1.1.4 164 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FreKotlin 2 | 3 | Example Android Studio project showing how to create Air Native Extensions for Android using Kotlin. 4 | 5 | This project is used as the basis for the following ANEs 6 | [Google Maps ANE](https://github.com/tuarua/Google-Maps-ANE) 7 | [AdMob ANE](https://github.com/tuarua/AdMob-ANE) 8 | [WebViewANE](https://github.com/tuarua/WebViewANE) 9 | [FirebaseANE](https://github.com/tuarua/Firebase-ANE) 10 | [ZipANE](https://github.com/tuarua/Zip-ANE) 11 | 12 | ------------- 13 | 14 | 15 | ### Getting Started 16 | 17 | A basic Hello World [starter project](/starter_project) is included 18 | 19 | 20 | ### How to use 21 | ###### Converting from FREObject args into Kotlin types, returning FREObjects 22 | The following table shows the primitive as3 types which can easily be converted to/from Kotlin types 23 | 24 | 25 | | AS3 type | Kotlin type | AS3 param->Kotlin | return Kotlin->AS3 | 26 | |:--------:|:--------:|:--------------|:-----------| 27 | | String | String | `val s = String(argv[0])` | `return s.toFREObject()`| 28 | | int | Int | `val i = Int(argv[0])` | `return i.toFREObject()`| 29 | | Boolean | Boolean | `val b = Boolean(argv[0])` | `return b.toFREObject()`| 30 | | Number | Double | `val d = Double(argv[0])` | `return d.toFREObject()`| 31 | | Number | Float | `val fl = Float(argv[0])` | `return fl.toFREObject()`| 32 | | Date | Date | `val dt = Date(argv[0])` | `return dt.toFREObject()`| 33 | | Rectangle | Rect | `val r = Rect(argv[0])` | `return r.toFREObject()`| 34 | | Rectangle | RectF | `val r = RectF(argv[0])` | `return r.toFREObject()`| 35 | | Point | Point | `val pnt = Point(argv[0])` | `return pnt.toFREObject()`| 36 | | Point | PointF | `val pnt = PointF(argv[0])` | `return pnt.toFREObject()`| 37 | | Vector Int | IntArray | `val arr = IntArray(argv[0])` | `return arr.toFREObject()`| 38 | | Vector Boolean | BooleanArray | `val arr = BooleanArray(argv[0])` | `return arr.toFREObject()`| 39 | | Vector Number | DoubleArray | `val arr = DoubleArray(argv[0])` | `return arr.toFREObject()`| 40 | | Vector String | List | `val al = List(argv[0])` | `return al.toFREObject()`| 41 | | Object | Map? | `val dict: Map? = Map(argv[0])` | | 42 | | null | null | | return null | 43 | 44 | 45 | #### Basic Types 46 | 47 | ```kotlin 48 | val myString: String? = String(argv[0]) 49 | val myInt = Int(argv[1]) 50 | val myBool = Boolean(argv[2]) 51 | 52 | val kotlinString = "I am a string from Kotlin" 53 | return kotlinString.toFREObject() 54 | ``` 55 | 56 | #### Creating new FREObjects 57 | 58 | ```kotlin 59 | val newPerson = FREObject("com.tuarua.Person") 60 | 61 | // create a FREObject passing args 62 | // 63 | // The following param types are allowed: 64 | // String, Int, Double, Float, Long, Short, Boolean, Date, FREObject 65 | val frePerson = FREObject("com.tuarua.Person", "Bob", "Doe", 28, myFREObject) 66 | ``` 67 | 68 | #### Calling Methods 69 | 70 | ```kotlin 71 | // call a FREObject method passing args 72 | // 73 | // The following param types are allowed: 74 | // String, Int, Double, Float, Long, Short, Boolean, Date, FREObject 75 | val addition = freCalculator.call("add", 100, 31) 76 | ``` 77 | 78 | #### Getting / Setting Properties 79 | 80 | ```kotlin 81 | val oldAge = Int(person["age"]) 82 | val newAge = oldAge + 10 83 | 84 | // Set property using braces access 85 | person["age"] = newAge 86 | ``` 87 | 88 | #### Arrays 89 | 90 | ```kotlin 91 | val airArray: FREArray? = FREArray(argv[0]) 92 | // convert to a Kotlin List 93 | val airStringVector = List(argv[0]) 94 | 95 | // create a Vector. with fixed length of 5 96 | val newFreArray = FREArray("com.tuarua.Person", 5, true) 97 | val len = newFreArray.length 98 | 99 | // loop over FREArray 100 | for (fre: FREObject? in airArray) { 101 | trace(Int(fre)) 102 | } 103 | 104 | // set element 0 to 123 105 | airArray[0] = 123 106 | 107 | // append element FREArray 108 | airArray.push(456) 109 | 110 | // return Kotlin IntArray to AIR 111 | val kotArr = intArrayOf(99, 98, 92, 97, 95) 112 | return kotArr.toFREArray() 113 | ``` 114 | 115 | #### Sending Events back to AIR 116 | 117 | ```kotlin 118 | trace("Hi", "There") 119 | 120 | // with interpolation 121 | trace("My name is: $name") 122 | 123 | dispatchEvent("MY_EVENT", "this is a test") 124 | ``` 125 | 126 | #### Bitmapdata 127 | 128 | ```kotlin 129 | val icon: Bitmap? = Bitmap(argv[0]) 130 | return icon.toFREObject() 131 | ``` 132 | 133 | #### ByteArrays 134 | 135 | ```kotlin 136 | val byteArray = ByteArray(argv[0]) 137 | if (byteArray != null) { 138 | val str = String(Base64.encode(byteArray, Base64.NO_WRAP), Charset.forName("utf-8")) 139 | } 140 | ``` 141 | 142 | #### Error Handling 143 | 144 | ```kotlin 145 | FreKotlinLogger.context = this.context 146 | if (inFRE1.type != FreObjectTypeKotlin.INT) { 147 | return FreException("Oops, we expected the FREObject to be passed as an int but it's not").getError(); 148 | } 149 | ``` 150 | 151 | 152 | Advanced Example - Extending. Convert to/from LatLng 153 | ```kotlin 154 | package com.tuarua.frekotlin 155 | 156 | import com.adobe.fre.FREObject 157 | import com.google.android.gms.maps.model.LatLng 158 | 159 | fun LatLng(freObject: FREObject?): LatLng { 160 | return LatLng(Double(freObject["latitude"]) ?: 0.0, 161 | Double(freObject["longitude"]) ?: 0.0) 162 | } 163 | 164 | fun LatLng.toFREObject(): FREObject? { 165 | return FREObject("com.tuarua.googlemaps.Coordinate", this.latitude, this.longitude) 166 | } 167 | ``` 168 | 169 | ### Prerequisites 170 | 171 | You will need 172 | 173 | - Android Studio 2022+ 174 | - IntelliJ IDEA 175 | - AIR 50.1+ 176 | -------------------------------------------------------------------------------- /framework_src/.gitignore: -------------------------------------------------------------------------------- 1 | /libs -------------------------------------------------------------------------------- /framework_src/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/flashbuilder 2 | 3 | ### FlashBuilder ### 4 | # Build and Release Folders 5 | bin/ 6 | bin-debug/ 7 | bin-release/ 8 | bin-release-temp/ 9 | cache/ 10 | 11 | *.app 12 | 13 | # Other files and folders 14 | .settings/ 15 | 16 | .FlexUnitSettings 17 | .externalToolBuilders 18 | .model 19 | 20 | # textures 21 | .tps 22 | 23 | 24 | # Created by https://www.gitignore.io/api/intellij 25 | 26 | ### Intellij ### 27 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm 28 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 29 | 30 | # User-specific stuff: 31 | .idea/workspace.xml 32 | .idea/tasks.xml 33 | 34 | # Sensitive or high-churn files: 35 | .idea/dataSources/ 36 | .idea/dataSources.ids 37 | .idea/dataSources.xml 38 | .idea/dataSources.local.xml 39 | .idea/sqlDataSources.xml 40 | .idea/dynamic.xml 41 | .idea/uiDesigner.xml 42 | 43 | # Gradle: 44 | .idea/gradle.xml 45 | 46 | # Mongo Explorer plugin: 47 | .idea/mongoSettings.xml 48 | 49 | ## File-based project format: 50 | *.iws 51 | 52 | ## Plugin-specific files: 53 | 54 | # IntelliJ 55 | /out/ 56 | 57 | # mpeltonen/sbt-idea plugin 58 | .idea_modules/ 59 | 60 | # JIRA plugin 61 | atlassian-ide-plugin.xml 62 | 63 | # Crashlytics plugin (for Android Studio and IntelliJ) 64 | com_crashlytics_export_strings.xml 65 | crashlytics.properties 66 | crashlytics-build.properties 67 | fabric.properties 68 | 69 | ### Intellij Patch ### 70 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 71 | 72 | # *.iml 73 | # modules.xml 74 | # .idea/misc.xml 75 | # *.ipr -------------------------------------------------------------------------------- /framework_src/example/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /framework_src/example/.idea/.name: -------------------------------------------------------------------------------- 1 | FreKotlinExample -------------------------------------------------------------------------------- /framework_src/example/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /framework_src/example/.idea/flexCompiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /framework_src/example/.idea/libraries/com_tuarua_frekotlin_1_72_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /framework_src/example/.idea/libraries/com_tuarua_frekotlin_example.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /framework_src/example/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /framework_src/example/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /framework_src/example/.idea/runConfigurations/FreKotlinExample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 26 | 41 | -------------------------------------------------------------------------------- /framework_src/example/FreKotlinExample.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 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 | -------------------------------------------------------------------------------- /framework_src/example/Main-app.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | com.tuarua.FreKotlinExample 5 | 6 | 7 | Main 8 | 9 | 10 | Main 11 | 12 | 1.72.1 13 | 14 | 15 | 16 | com.tuarua.frekotlin 17 | com.tuarua.frekotlin.example 18 | 19 | 20 | 21 | 22 | 23 | SWF file name is set automatically at compile time 24 | true 25 | 26 | true 27 | 28 | true 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | ]]> 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /framework_src/example/src/Main.as: -------------------------------------------------------------------------------- 1 | package { 2 | import com.tuarua.FreKotlinExampleANE; 3 | import com.tuarua.Person; 4 | import com.tuarua.fre.ANEError; 5 | 6 | import flash.desktop.NativeApplication; 7 | import flash.display.Bitmap; 8 | import flash.display.Loader; 9 | import flash.display.Sprite; 10 | import flash.display.StageAlign; 11 | import flash.display.StageScaleMode; 12 | import flash.events.Event; 13 | import flash.geom.Rectangle; 14 | import flash.net.URLRequest; 15 | import flash.system.Capabilities; 16 | import flash.text.TextField; 17 | import flash.text.TextFormat; 18 | import flash.text.TextFormatAlign; 19 | import flash.utils.ByteArray; 20 | 21 | [SWF(width="640", height="640", frameRate="60", backgroundColor="#F1F1F1")] 22 | public class Main extends Sprite { 23 | private var ane:FreKotlinExampleANE; 24 | private var hasActivated:Boolean = false; 25 | private var textField:TextField = new TextField(); 26 | private static const GREEN:uint = 0x00FF00; 27 | public static const HALF_GREEN:uint = 0x8000FF00; 28 | 29 | public function Main() { 30 | super(); 31 | stage.align = StageAlign.TOP_LEFT; 32 | stage.scaleMode = StageScaleMode.NO_SCALE; 33 | 34 | ane = FreKotlinExampleANE.example; 35 | 36 | NativeApplication.nativeApplication.addEventListener(Event.EXITING, onExiting); 37 | this.addEventListener(Event.ACTIVATE, onActivated); 38 | } 39 | 40 | private function onActivated(event:Event):void { 41 | if (hasActivated) return; 42 | var tf:TextFormat = new TextFormat(); 43 | tf.size = 48; 44 | tf.color = 0x333333; 45 | tf.align = TextFormatAlign.LEFT; 46 | textField.defaultTextFormat = tf; 47 | textField.width = stage.fullScreenWidth; 48 | textField.height = 1200; 49 | textField.multiline = true; 50 | textField.wordWrap = true; 51 | 52 | textField.text += Capabilities.cpuArchitecture + "\n"; 53 | 54 | var person:Person = new Person(); 55 | person.age = 21; 56 | person.name = "Tom"; 57 | person.city.name = "Boston"; 58 | 59 | var resultString:String = ane.runStringTests("Björk Guðmundsdóttir Sinéad O’Connor 久保田 " + 60 | "利伸 Михаил Горбачёв Садриддин Айнӣ Tor Åge Bringsværd 章子怡 €"); 61 | textField.text += resultString + "\n"; 62 | 63 | var resultNumber:Number = ane.runNumberTests(31.99); 64 | textField.text += "Number: " + resultNumber + "\n"; 65 | 66 | var resultInt:int = ane.runIntTests(-54, 66); 67 | textField.text += "Int: " + resultInt + "\n"; 68 | trace("HALF_GREEN", HALF_GREEN, HALF_GREEN == ane.runColorTests(GREEN, HALF_GREEN) ? "✅" : "❌"); 69 | 70 | var resultObject:Person = ane.runObjectTests(person) as Person; 71 | if (resultObject) { 72 | textField.text += "Person.age: " + resultObject.age.toString() + "\n"; 73 | } 74 | 75 | var inRect:Rectangle = new Rectangle(50.1, 60, 70.2, 80); 76 | var resultRectangle:Rectangle = ane.runExtensibleTests(inRect) as Rectangle; 77 | trace("resultRectangle", resultRectangle); 78 | 79 | var myArray:Array = []; 80 | myArray.push(3, 1, 4, 2, 6, 5); 81 | 82 | var myVector:Vector. = new []; 83 | myVector.push("abc", "xyz"); 84 | 85 | var resultArray:Vector. = ane.runArrayTests(myArray, myVector); 86 | if (resultArray) { 87 | textField.text += "Array: " + resultArray.toString() + "\n"; 88 | } 89 | 90 | const IMAGE_URL:String = "https://upload.wikimedia.org/wikipedia/commons/thumb/d/d4/Kotlin_logo.svg/640px-Kotlin_logo.svg.png"; 91 | 92 | var ldr:Loader = new Loader(); 93 | ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, ldr_complete); 94 | ldr.load(new URLRequest(IMAGE_URL)); 95 | 96 | 97 | function ldr_complete(evt:Event):void { 98 | var bmp:Bitmap = ldr.content as Bitmap; 99 | ane.runBitmapTests(bmp.bitmapData); 100 | bmp.x = 20; 101 | bmp.y = 600; 102 | addChild(bmp); 103 | } 104 | 105 | try { 106 | ane.runErrorTests(person, "Test String"); 107 | } catch (e:ANEError) { 108 | trace("Error captured in AS"); 109 | trace("e.message:", e.message); 110 | trace("e.errorID:", e.errorID); 111 | trace("e.type:", e.type); 112 | trace("e.source:", e.source); 113 | trace("e.getStackTrace():", e.getStackTrace()); 114 | } 115 | 116 | var testDate:Date = new Date(1990, 5, 13, 8, 59, 3); 117 | trace("Date returned is same", testDate.time == ane.runDateTests(testDate).time ? "✅" : "❌"); 118 | 119 | var myByteArray:ByteArray = new ByteArray(); 120 | myByteArray.writeUTFBytes("Kotlin in an ANE. Say whaaaat!"); 121 | ane.runByteArrayTests(myByteArray); 122 | addChild(textField); 123 | hasActivated = true; 124 | } 125 | 126 | private static function onExiting(event:Event):void { 127 | FreKotlinExampleANE.dispose(); 128 | } 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /framework_src/frekotlin_native_extension/.idea/.name: -------------------------------------------------------------------------------- 1 | FreKotlinANE -------------------------------------------------------------------------------- /framework_src/frekotlin_native_extension/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /framework_src/frekotlin_native_extension/.idea/flexCompiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /framework_src/frekotlin_native_extension/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /framework_src/frekotlin_native_extension/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /framework_src/frekotlin_native_extension/FreKotlin.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /framework_src/frekotlin_native_extension/src/avmplus/DescribeTypeJSON.as: -------------------------------------------------------------------------------- 1 | // ================================================================================================= 2 | // 3 | // Modified by Rodrigo Lopez [roipeker™] on 20/01/2019. 4 | // 5 | // original class: 6 | // https://github.com/tschneidereit/SwiftSuspenders/blob/master/src/avmplus/DescribeTypeJSON.as 7 | // 8 | // Check https://jacksondunstan.com/articles/2609 for reference. 9 | // 10 | // 11 | // ================================================================================================= 12 | 13 | package avmplus { 14 | 15 | /** 16 | * -- Basic Usage: 17 | * 18 | * var desc:Object = DescribeTypeJSON.run( AnyClassOrInstance ); 19 | * trace( JSON.stringify( desc )) ; 20 | * 21 | */ 22 | 23 | /** 24 | * Makes the hidden, unofficial function describeTypeJSON available outside of the avmplus 25 | * package. 26 | * 27 | * As Adobe doen't officially support this method and it is only visible to client 28 | * code by accident, it should only ever be used with runtime-detection and automatic fallback 29 | * on describeType. 30 | * 31 | * @see http://www.tillschneidereit.de/2009/11/22/improved-reflection-support-in-flash-player-10-1/ 32 | */ 33 | public class DescribeTypeJSON { 34 | //---------------------- Public Properties ----------------------// 35 | public static var available:Boolean = describeTypeJSON != null; 36 | 37 | public static const INSTANCE_FLAGS:uint = INCLUDE_VARIABLES | USE_ITRAITS | HIDE_OBJECT; 38 | public static const CLASS_FLAGS:uint = INCLUDE_VARIABLES | INCLUDE_TRAITS | HIDE_OBJECT; 39 | 40 | 41 | private static var _instance:DescribeTypeJSON; 42 | 43 | public static function get():DescribeTypeJSON { 44 | if (!_instance) _instance = new DescribeTypeJSON(); 45 | return _instance; 46 | } 47 | 48 | public static function run(obj:Object):Object { 49 | // little hack to call Class from instance 50 | if (!(obj is Class)) obj = Object(obj).constructor; 51 | return get().describeType(obj, CLASS_FLAGS | INSTANCE_FLAGS); 52 | } 53 | 54 | //---------------------- Public Methods ----------------------// 55 | public function DescribeTypeJSON() { 56 | } 57 | 58 | public function describeType(target:Object, flags:uint):Object { 59 | return describeTypeJSON(target, flags); 60 | } 61 | 62 | public function getInstanceDescription(type:Object):Object { 63 | return describeTypeJSON(type, INSTANCE_FLAGS); 64 | } 65 | 66 | public function getClassDescription(type:Class):Object { 67 | return describeTypeJSON(type, CLASS_FLAGS); 68 | } 69 | } 70 | } -------------------------------------------------------------------------------- /framework_src/frekotlin_native_extension/src/com/tuarua/FreKotlinANE.as: -------------------------------------------------------------------------------- 1 | package com.tuarua { 2 | public class FreKotlinANE { 3 | public function FreKotlinANE() { 4 | } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /framework_src/frekotlin_native_extension/src/com/tuarua/fre/ANEError.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Eoin Landy on 29/04/2017. 3 | */ 4 | package com.tuarua.fre { 5 | import flash.system.Capabilities; 6 | 7 | [RemoteClass(alias="com.tuarua.fre.ANEError")] 8 | public class ANEError extends Error { 9 | private var _stackTrace:String; 10 | private var _source:String; 11 | private var _type:String; 12 | 13 | private static const errorTypesCSharp:Array = [ 14 | "FreSharp.Exceptions.Ok", 15 | "FreSharp.Exceptions.NoSuchNameException", 16 | "FreSharp.Exceptions.FreInvalidObjectException", 17 | "FreSharp.Exceptions.FreTypeMismatchException", 18 | "FreSharp.Exceptions.FreActionscriptErrorException", 19 | "FreSharp.Exceptions.FreInvalidArgumentException", 20 | "FreSharp.Exceptions.FreReadOnlyException", 21 | "FreSharp.Exceptions.FreWrongThreadException", 22 | "FreSharp.Exceptions.FreIllegalStateException", 23 | "FreSharp.Exceptions.FreInsufficientMemoryException" 24 | ]; 25 | 26 | private static const errorTypesKotlin:Array = [ 27 | "FreKotlin.Exceptions.Ok", 28 | "FreKotlin.Exceptions.FRENoSuchNameException", 29 | "FreKotlin.Exceptions.FREInvalidObjectException", 30 | "FreKotlin.Exceptions.FRETypeMismatchException", 31 | "FreKotlin.Exceptions.FREASErrorException", 32 | "FreKotlin.Exceptions.FreInvalidArgumentException", 33 | "FreKotlin.Exceptions.FREReadOnlyException", 34 | "FreKotlin.Exceptions.FREWrongThreadException", 35 | "FreKotlin.Exceptions.FreIllegalStateException", 36 | "FreKotlin.Exceptions.FreInsufficientMemoryException" 37 | ]; 38 | 39 | private static const errorTypesSwift:Array = [ 40 | "ok", 41 | "noSuchName", 42 | "invalidObject", 43 | "typeMismatch", 44 | "actionscriptError", 45 | "invalidArgument", 46 | "readOnly", 47 | "wrongThread", 48 | "illegalState", 49 | "insufficientMemory" 50 | ]; 51 | 52 | public function ANEError(message:String, errorID:int, type:String, source:String, stackTrace:String) { 53 | _stackTrace = stackTrace; 54 | _source = source; 55 | _type = type; 56 | super(message, getErrorID(_type)); 57 | } 58 | 59 | override public function get errorID():int { 60 | return super.errorID; 61 | } 62 | 63 | override public function getStackTrace():String { 64 | return _stackTrace; 65 | } 66 | 67 | private function getErrorID(thetype:String):int { 68 | var val:int; 69 | if (Capabilities.os.toLowerCase().indexOf("win") == 0) { 70 | val = errorTypesCSharp.indexOf(thetype); 71 | }else if (Capabilities.os.toLowerCase().indexOf("linux") == 0){ 72 | val = errorTypesKotlin.indexOf(thetype); 73 | } else { 74 | val = errorTypesSwift.indexOf(thetype); 75 | } 76 | if (val == -1) val = 10; 77 | return val; 78 | } 79 | 80 | //noinspection ReservedWordAsName 81 | public function get type():String { 82 | return _type; 83 | } 84 | 85 | public function get source():String { 86 | return _source; 87 | } 88 | 89 | } 90 | } -------------------------------------------------------------------------------- /framework_src/native_extension/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/flashbuilder 2 | 3 | ### FlashBuilder ### 4 | # Build and Release Folders 5 | bin-debug/ 6 | bin-release/ 7 | docs/ 8 | 9 | # Other files and folders 10 | .settings/ 11 | 12 | .FlexUnitSettings 13 | .externalToolBuilders 14 | .model 15 | 16 | 17 | 18 | # Created by https://www.gitignore.io/api/intellij 19 | 20 | ### Intellij ### 21 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm 22 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 23 | 24 | # User-specific stuff: 25 | .idea/workspace.xml 26 | .idea/tasks.xml 27 | 28 | # Sensitive or high-churn files: 29 | .idea/dataSources/ 30 | .idea/dataSources.ids 31 | .idea/dataSources.xml 32 | .idea/dataSources.local.xml 33 | .idea/sqlDataSources.xml 34 | .idea/dynamic.xml 35 | .idea/uiDesigner.xml 36 | 37 | # Gradle: 38 | .idea/gradle.xml 39 | .idea/libraries 40 | 41 | # Mongo Explorer plugin: 42 | .idea/mongoSettings.xml 43 | 44 | ## File-based project format: 45 | *.iws 46 | 47 | ## Plugin-specific files: 48 | 49 | # IntelliJ 50 | /out/ 51 | 52 | # mpeltonen/sbt-idea plugin 53 | .idea_modules/ 54 | 55 | # JIRA plugin 56 | atlassian-ide-plugin.xml 57 | 58 | # Crashlytics plugin (for Android Studio and IntelliJ) 59 | com_crashlytics_export_strings.xml 60 | crashlytics.properties 61 | crashlytics-build.properties 62 | fabric.properties 63 | 64 | ### Intellij Patch ### 65 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 66 | 67 | # *.iml 68 | # modules.xml 69 | # .idea/misc.xml 70 | # *.ipr -------------------------------------------------------------------------------- /framework_src/native_extension/.idea/.name: -------------------------------------------------------------------------------- 1 | FreKotlinExampleANE -------------------------------------------------------------------------------- /framework_src/native_extension/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /framework_src/native_extension/.idea/flexCompiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /framework_src/native_extension/.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /framework_src/native_extension/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /framework_src/native_extension/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /framework_src/native_extension/FreKotlinExampleANE.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /framework_src/native_extension/ane/.gitignore: -------------------------------------------------------------------------------- 1 | /bak -------------------------------------------------------------------------------- /framework_src/native_extension/ane/com.tuarua.frekotlin-1.72.1.ane: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuarua/FreKotlin-Android-ANE/2cf3e33aa9f9194b501dc7670ed32bbf5371766e/framework_src/native_extension/ane/com.tuarua.frekotlin-1.72.1.ane -------------------------------------------------------------------------------- /framework_src/native_extension/ane/com.tuarua.frekotlin.example.ane: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuarua/FreKotlin-Android-ANE/2cf3e33aa9f9194b501dc7670ed32bbf5371766e/framework_src/native_extension/ane/com.tuarua.frekotlin.example.ane -------------------------------------------------------------------------------- /framework_src/native_extension/ane/extension.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.tuarua.frekotlin.example 4 | FreKotlinExample ANE 5 | This work is licensed under Apache License, Copyright (c) 2017 Tua Rua Ltd. 6 | 1.72.1 7 | 8 | 9 | 10 | classes.jar 11 | com.tuarua.FreKotlinExampleANE 12 | com.tuarua.FreKotlinExampleANE 13 | 14 | 15 | 16 | 17 | classes.jar 18 | com.tuarua.FreKotlinExampleANE 19 | com.tuarua.FreKotlinExampleANE 20 | 21 | 22 | 23 | 24 | classes.jar 25 | com.tuarua.FreKotlinExampleANE 26 | com.tuarua.FreKotlinExampleANE 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /framework_src/native_extension/ane/extension_frekotlin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.tuarua.frekotlin 4 | FreKotlin 5 | This work is licensed under Apache License, Copyright (c) 2017 Tua Rua Ltd. 6 | 1.72.1 7 | 8 | 9 | 10 | classes.jar 11 | com.tuarua.DummyANE 12 | com.tuarua.DummyANE 13 | 14 | 15 | 16 | 17 | classes.jar 18 | com.tuarua.DummyANE 19 | com.tuarua.DummyANE 20 | 21 | 22 | 23 | 24 | classes.jar 25 | com.tuarua.DummyANE 26 | com.tuarua.DummyANE 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /framework_src/native_extension/ane/frekotlin-build.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | SET pathtome=%~dp0 3 | SET SZIP="C:\Program Files\7-Zip\7z.exe" 4 | SET AIR_PATH="D:\dev\sdks\AIR\AIRSDK_50.1.1\bin\" 5 | 6 | SET KOTLIN_VERSION="1.7.21" 7 | SET ANE_VERSION="1.72.1" 8 | SET PROJECT_NAME=FreKotlinExampleANE 9 | SET SWC_NAME=FreKotlinANE 10 | SET ANE_NAME=com.tuarua.frekotlin 11 | 12 | copy %pathtome%..\bin\%SWC_NAME%.swc %pathtome% 13 | 14 | REM contents of SWC. 15 | copy /Y %pathtome%%SWC_NAME%.swc %pathtome%%SWC_NAME%Extract.swc 16 | ren %pathtome%%SWC_NAME%Extract.swc %SWC_NAME%Extract.zip 17 | call %SZIP% e %pathtome%%SWC_NAME%Extract.zip -o%pathtome% 18 | del %pathtome%%SWC_NAME%Extract.zip 19 | 20 | 21 | REM copy library.swf to folders. 22 | copy %pathtome%library.swf %pathtome%platforms\android 23 | copy /Y %pathtome%..\..\..\..\FreKotlin\library\build\outputs\aar\library-release.aar %pathtome%platforms\android\FreKotlin-release.aar 24 | 25 | call %SZIP% x %pathtome%platforms\android\FreKotlin-release.aar -o%pathtome%platforms\android\ classes.jar 26 | 27 | echo "GENERATING ANE" 28 | call %AIR_PATH%adt.bat -package -target ane %pathtome%%ANE_NAME%-%ANE_VERSION%.ane extension_frekotlin.xml ^ 29 | -swc %SWC_NAME%.swc ^ 30 | -platform Android-x86 ^ 31 | -C platforms/android library.swf classes.jar ^ 32 | -platformoptions platforms/android/platform_frekotlin.xml ^ 33 | kotlin-stdlib-%KOTLIN_VERSION%.jar ^ 34 | kotlin-stdlib-common-%KOTLIN_VERSION%.jar ^ 35 | -platform Android-ARM ^ 36 | -C platforms/android library.swf classes.jar ^ 37 | -platformoptions platforms/android/platform_frekotlin.xml ^ 38 | kotlin-stdlib-%KOTLIN_VERSION%.jar ^ 39 | kotlin-stdlib-common-%KOTLIN_VERSION%.jar ^ 40 | -platform Android-ARM64 ^ 41 | -C platforms/android library.swf classes.jar ^ 42 | -platformoptions platforms/android/platform_frekotlin.xml ^ 43 | kotlin-stdlib-%KOTLIN_VERSION%.jar ^ 44 | kotlin-stdlib-common-%KOTLIN_VERSION%.jar ^ 45 | -platform default -C platforms/android library.swf 46 | 47 | ren %pathtome%platforms\\android\\classes.jar frekotlin-%KOTLIN_VERSION%.jar 48 | copy /Y %pathtome%platforms\\android\\frekotlin-%KOTLIN_VERSION%.jar %pathtome%..\..\libs 49 | 50 | del %pathtome%platforms\\android\\frekotlin-%KOTLIN_VERSION%.jar 51 | del %pathtome%platforms\\android\\FreKotlin-release.aar 52 | del %pathtome%platforms\\android\\library.swf 53 | 54 | call DEL /F /Q /A %pathtome%library.swf 55 | call DEL /F /Q /A %pathtome%catalog.xml 56 | call DEL /F /Q /A %pathtome%%SWC_NAME%.swc 57 | 58 | copy %pathtome%%ANE_NAME%-%ANE_VERSION%.ane %pathtome%..\..\..\starter_project\example\android_dependencies 59 | 60 | echo "DONE!" 61 | -------------------------------------------------------------------------------- /framework_src/native_extension/ane/frekotlin-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #Get the path to the script and trim to get the directory. 4 | echo "Setting path to current directory to:" 5 | pathtome=$0 6 | pathtome="${pathtome%/*}" 7 | 8 | AIR_SDK="/Users/eoinlandy/SDKs/AIRSDK_50.1.1" 9 | 10 | KOTLIN_VERSION="1.7.21" 11 | ANE_VERSION="1.72.1" 12 | PROJECTNAME=FreKotlinExampleANE 13 | SWC_NAME=FreKotlinANE 14 | ANE_NAME=com.tuarua.frekotlin 15 | 16 | #Copy SWC into place. 17 | cp "$pathtome/../bin/$SWC_NAME.swc" "$pathtome/" 18 | 19 | #Extract contents of SWC. 20 | unzip "$pathtome/$SWC_NAME.swc" "library.swf" -d "$pathtome" 21 | 22 | #Copy library.swf to folders. 23 | cp "$pathtome/library.swf" "$pathtome/platforms/android" 24 | 25 | # Copying Android aars into place 26 | cp "$pathtome/../../../../FreKotlin/library/build/outputs/aar/library-release.aar" "$pathtome/platforms/android/FreKotlin-release.aar" 27 | unzip "$pathtome/platforms/android/FreKotlin-release.aar" "classes.jar" -d "$pathtome/platforms/android" 28 | 29 | #Run the build command. 30 | echo "Building ANE." 31 | "$AIR_SDK"/bin/adt -package \ 32 | -target ane "$pathtome/$ANE_NAME-$ANE_VERSION.ane" "$pathtome/extension_frekotlin.xml" \ 33 | -swc "$pathtome/$SWC_NAME.swc" \ 34 | -platform Android-x86 \ 35 | -C "$pathtome/platforms/android" "library.swf" "classes.jar" \ 36 | com.tuarua.$PROJECTNAME-res/. \ 37 | -platformoptions "$pathtome/platforms/android/platform_frekotlin.xml" \ 38 | "kotlin-stdlib-$KOTLIN_VERSION.jar" \ 39 | "kotlin-stdlib-common-$KOTLIN_VERSION.jar" \ 40 | -platform Android-ARM \ 41 | -C "$pathtome/platforms/android" "library.swf" "classes.jar" \ 42 | com.tuarua.$PROJECTNAME-res/. \ 43 | -platformoptions "$pathtome/platforms/android/platform_frekotlin.xml" \ 44 | "kotlin-stdlib-$KOTLIN_VERSION.jar" \ 45 | "kotlin-stdlib-common-$KOTLIN_VERSION.jar" \ 46 | -platform Android-ARM64 \ 47 | -C "$pathtome/platforms/android" "library.swf" "classes.jar" \ 48 | com.tuarua.$PROJECTNAME-res/. \ 49 | -platformoptions "$pathtome/platforms/android/platform_frekotlin.xml" \ 50 | "kotlin-stdlib-$KOTLIN_VERSION.jar" \ 51 | "kotlin-stdlib-common-$KOTLIN_VERSION.jar" \ 52 | -platform default -C "$pathtome/platforms/android" "library.swf" \ 53 | 54 | if [ ! -d "$pathtome/../../libs" ]; then 55 | mkdir "$pathtome/../../libs" 56 | fi 57 | 58 | mv "$pathtome/platforms/android/classes.jar" "$pathtome/../../libs/frekotlin-$KOTLIN_VERSION.jar" 59 | rm "$pathtome/platforms/android/FreKotlin-release.aar" 60 | rm "$pathtome/platforms/android/library.swf" 61 | rm "$pathtome/$SWC_NAME.swc" 62 | rm "$pathtome/library.swf" 63 | 64 | cp "$pathtome/$ANE_NAME-$ANE_VERSION.ane" "$pathtome/../../../starter_project/example/android_dependencies" 65 | echo "DONE!" 66 | -------------------------------------------------------------------------------- /framework_src/native_extension/ane/platforms/android/com.tuarua.FreKotlinExampleANE-res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | FreKotlinExampleANE 3 | 4 | -------------------------------------------------------------------------------- /framework_src/native_extension/ane/platforms/android/kotlin-stdlib-1.7.21.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuarua/FreKotlin-Android-ANE/2cf3e33aa9f9194b501dc7670ed32bbf5371766e/framework_src/native_extension/ane/platforms/android/kotlin-stdlib-1.7.21.jar -------------------------------------------------------------------------------- /framework_src/native_extension/ane/platforms/android/kotlin-stdlib-common-1.7.21.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuarua/FreKotlin-Android-ANE/2cf3e33aa9f9194b501dc7670ed32bbf5371766e/framework_src/native_extension/ane/platforms/android/kotlin-stdlib-common-1.7.21.jar -------------------------------------------------------------------------------- /framework_src/native_extension/ane/platforms/android/platform.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.tuarua.FreKotlinExampleANE 6 | com.tuarua.FreKotlinExampleANE-res 7 | 8 | 9 | -------------------------------------------------------------------------------- /framework_src/native_extension/ane/platforms/android/platform_frekotlin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | kotlin-stdlib-1.7.21.jar 5 | kotlin-stdlib-common-1.7.21.jar 6 | 7 | 8 | -------------------------------------------------------------------------------- /framework_src/native_extension/ane/project-build.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | call frekotlin-build.bat 4 | 5 | SET pathtome=%~dp0 6 | SET SZIP="C:\Program Files\7-Zip\7z.exe" 7 | SET AIR_PATH="D:\dev\sdks\AIR\AIRSDK_50.1.1\bin\" 8 | 9 | SET projectName=FreKotlinExampleANE 10 | SET ANE_NAME=com.tuarua.frekotlin.example 11 | 12 | copy %pathtome%..\bin\%projectName%.swc %pathtome% 13 | 14 | REM contents of SWC. 15 | copy /Y %pathtome%%projectName%.swc %pathtome%%projectName%Extract.swc 16 | ren %pathtome%%projectName%Extract.swc %projectName%Extract.zip 17 | call %SZIP% e %pathtome%%projectName%Extract.zip -o%pathtome% 18 | del %pathtome%%projectName%Extract.zip 19 | 20 | REM Copy library.swf to folders. 21 | echo Copying library.swf into place. 22 | copy %pathtome%library.swf %pathtome%platforms\android 23 | 24 | echo copy the aar into place 25 | copy /Y %pathtome%..\..\native_library\android\%projectName%\app\build\outputs\aar\app-release.aar %pathtome%platforms\android\app-release.aar 26 | 27 | echo "GETTING ANDROID JAR" 28 | call %SZIP% x %pathtome%platforms\android\app-release.aar -o%pathtome%platforms\android\ classes.jar 29 | 30 | echo "GENERATING ANE" 31 | call %AIR_PATH%adt.bat -package -target ane %pathtome%%ANE_NAME%.ane extension.xml ^ 32 | -swc %projectName%.swc ^ 33 | -platform Android-x86 ^ 34 | -C platforms/android library.swf classes.jar ^ 35 | com.tuarua.%projectName%-res/. ^ 36 | -platformoptions platforms/android/platform.xml ^ 37 | -platform Android-ARM ^ 38 | -C platforms/android library.swf classes.jar ^ 39 | com.tuarua.%projectName%-res/. ^ 40 | -platformoptions platforms/android/platform.xml ^ 41 | -platform Android-ARM64 ^ 42 | -C platforms/android library.swf classes.jar ^ 43 | com.tuarua.%projectName%-res/. ^ 44 | -platformoptions platforms/android/platform.xml 45 | 46 | del %pathtome%platforms\\android\\classes.jar 47 | del %pathtome%platforms\\android\\app-release.aar 48 | del %pathtome%platforms\\android\\library.swf 49 | 50 | call DEL /F /Q /A %pathtome%library.swf 51 | call DEL /F /Q /A %pathtome%catalog.xml 52 | call DEL /F /Q /A %pathtome%%projectName%.swc 53 | 54 | echo "DONE!" 55 | -------------------------------------------------------------------------------- /framework_src/native_extension/ane/project-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #Get the path to the script and trim to get the directory. 4 | echo "Setting path to current directory to:" 5 | pathtome=$0 6 | pathtome="${pathtome%/*}" 7 | AIR_SDK="/Users/eoinlandy/SDKs/AIRSDK_50.1.1" 8 | 9 | PROJECTNAME=FreKotlinExampleANE 10 | ANENAME=com.tuarua.frekotlin.example 11 | 12 | #Copy SWC into place. 13 | echo "Copying SWC into place." 14 | cp "$pathtome/../bin/$PROJECTNAME.swc" "$pathtome/" 15 | 16 | #Extract contents of SWC. 17 | echo "Extracting files form SWC." 18 | unzip "$pathtome/$PROJECTNAME.swc" "library.swf" -d "$pathtome" 19 | 20 | #Copy library.swf to folders. 21 | echo "Copying library.swf into place." 22 | cp "$pathtome/library.swf" "$pathtome/platforms/android" 23 | 24 | echo "Copying Android aars into place" 25 | cp "$pathtome/../../native_library/android/$PROJECTNAME/app/build/outputs/aar/app-release.aar" "$pathtome/platforms/android/app-release.aar" 26 | echo "getting Android jars" 27 | unzip "$pathtome/platforms/android/app-release.aar" "classes.jar" -d "$pathtome/platforms/android" 28 | 29 | 30 | #Run the build command. 31 | echo "Building ANE." 32 | "$AIR_SDK"/bin/adt -package \ 33 | -target ane "$pathtome/$ANENAME.ane" "$pathtome/extension.xml" \ 34 | -swc "$pathtome/$PROJECTNAME.swc" \ 35 | -platform Android-x86 \ 36 | -C "$pathtome/platforms/android" "library.swf" "classes.jar" \ 37 | com.tuarua.$PROJECTNAME-res/. \ 38 | -platformoptions "$pathtome/platforms/android/platform.xml" \ 39 | -platform Android-ARM \ 40 | -C "$pathtome/platforms/android" "library.swf" "classes.jar" \ 41 | com.tuarua.$PROJECTNAME-res/. \ 42 | -platformoptions "$pathtome/platforms/android/platform.xml" \ 43 | -platform Android-ARM64 \ 44 | -C "$pathtome/platforms/android" "library.swf" "classes.jar" \ 45 | com.tuarua.$PROJECTNAME-res/. \ 46 | -platformoptions "$pathtome/platforms/android/platform.xml" 47 | 48 | rm "$pathtome/platforms/android/classes.jar" 49 | rm "$pathtome/platforms/android/app-release.aar" 50 | rm "$pathtome/platforms/android/library.swf" 51 | rm "$pathtome/$PROJECTNAME.swc" 52 | rm "$pathtome/library.swf" 53 | echo "DONE!" 54 | -------------------------------------------------------------------------------- /framework_src/native_extension/bin/FreKotlinANE.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuarua/FreKotlin-Android-ANE/2cf3e33aa9f9194b501dc7670ed32bbf5371766e/framework_src/native_extension/bin/FreKotlinANE.swc -------------------------------------------------------------------------------- /framework_src/native_extension/bin/FreKotlinExampleANE.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuarua/FreKotlin-Android-ANE/2cf3e33aa9f9194b501dc7670ed32bbf5371766e/framework_src/native_extension/bin/FreKotlinExampleANE.swc -------------------------------------------------------------------------------- /framework_src/native_extension/src/avmplus/DescribeTypeJSON.as: -------------------------------------------------------------------------------- 1 | // ================================================================================================= 2 | // 3 | // Modified by Rodrigo Lopez [roipeker™] on 20/01/2019. 4 | // 5 | // original class: 6 | // https://github.com/tschneidereit/SwiftSuspenders/blob/master/src/avmplus/DescribeTypeJSON.as 7 | // 8 | // Check https://jacksondunstan.com/articles/2609 for reference. 9 | // 10 | // 11 | // ================================================================================================= 12 | 13 | package avmplus { 14 | 15 | /** 16 | * -- Basic Usage: 17 | * 18 | * var desc:Object = DescribeTypeJSON.run( AnyClassOrInstance ); 19 | * trace( JSON.stringify( desc )) ; 20 | * 21 | */ 22 | 23 | /** 24 | * Makes the hidden, unofficial function describeTypeJSON available outside of the avmplus 25 | * package. 26 | * 27 | * As Adobe doen't officially support this method and it is only visible to client 28 | * code by accident, it should only ever be used with runtime-detection and automatic fallback 29 | * on describeType. 30 | * 31 | * @see http://www.tillschneidereit.de/2009/11/22/improved-reflection-support-in-flash-player-10-1/ 32 | */ 33 | public class DescribeTypeJSON { 34 | //---------------------- Public Properties ----------------------// 35 | public static var available:Boolean = describeTypeJSON != null; 36 | 37 | public static const INSTANCE_FLAGS:uint = INCLUDE_VARIABLES | USE_ITRAITS | HIDE_OBJECT; 38 | public static const CLASS_FLAGS:uint = INCLUDE_VARIABLES | INCLUDE_TRAITS | HIDE_OBJECT; 39 | 40 | 41 | private static var _instance:DescribeTypeJSON; 42 | 43 | public static function get():DescribeTypeJSON { 44 | if (!_instance) _instance = new DescribeTypeJSON(); 45 | return _instance; 46 | } 47 | 48 | public static function run(obj:Object):Object { 49 | // little hack to call Class from instance 50 | if (!(obj is Class)) obj = Object(obj).constructor; 51 | return get().describeType(obj, CLASS_FLAGS | INSTANCE_FLAGS); 52 | } 53 | 54 | //---------------------- Public Methods ----------------------// 55 | public function DescribeTypeJSON() { 56 | } 57 | 58 | public function describeType(target:Object, flags:uint):Object { 59 | return describeTypeJSON(target, flags); 60 | } 61 | 62 | public function getInstanceDescription(type:Object):Object { 63 | return describeTypeJSON(type, INSTANCE_FLAGS); 64 | } 65 | 66 | public function getClassDescription(type:Class):Object { 67 | return describeTypeJSON(type, CLASS_FLAGS); 68 | } 69 | } 70 | } -------------------------------------------------------------------------------- /framework_src/native_extension/src/com/tuarua/City.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by User on 26/02/2017. 3 | */ 4 | package com.tuarua { 5 | public class City { 6 | public var name:String = ""; 7 | public function City() { 8 | super(); 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /framework_src/native_extension/src/com/tuarua/FreKotlinExampleANE.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Tua Rua Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.tuarua { 18 | import com.tuarua.fre.ANEError; 19 | 20 | import flash.display.BitmapData; 21 | import flash.events.EventDispatcher; 22 | import flash.geom.Rectangle; 23 | import flash.utils.ByteArray; 24 | 25 | public class FreKotlinExampleANE extends EventDispatcher { 26 | private static var _example:FreKotlinExampleANE; 27 | 28 | public function FreKotlinExampleANE() { 29 | initiate(); 30 | } 31 | 32 | private function initiate():void { 33 | if (FreKotlinExampleANEContext.context) { 34 | var theRet:* = FreKotlinExampleANEContext.context.call("init"); 35 | if (theRet is ANEError) throw theRet as ANEError; 36 | } 37 | _example = this; 38 | } 39 | 40 | public static function get example():FreKotlinExampleANE { 41 | if (!_example) { 42 | new FreKotlinExampleANE(); 43 | } 44 | return _example; 45 | } 46 | 47 | public function runStringTests(value:String):String { 48 | FreKotlinExampleANEContext.validate(); 49 | return FreKotlinExampleANEContext.context.call("runStringTests", value) as String; 50 | } 51 | 52 | public function runNumberTests(value:Number):Number { 53 | FreKotlinExampleANEContext.validate(); 54 | return FreKotlinExampleANEContext.context.call("runNumberTests", value) as Number; 55 | } 56 | 57 | public function runIntTests(value:int, value2:uint):int { 58 | FreKotlinExampleANEContext.validate(); 59 | return FreKotlinExampleANEContext.context.call("runIntTests", value, value2) as int; 60 | } 61 | 62 | public function runColorTests(value:uint, value2:uint):uint { 63 | FreKotlinExampleANEContext.validate(); 64 | return uint(FreKotlinExampleANEContext.context.call("runColorTests", value, value2)) as uint; // important Kotlin has no uint must convert here to uint 65 | } 66 | 67 | public function runArrayTests(value:Array, value2:Vector.):Vector. { 68 | FreKotlinExampleANEContext.validate(); 69 | return FreKotlinExampleANEContext.context.call("runArrayTests", value, value2) as Vector.; 70 | } 71 | 72 | public function runObjectTests(value:Person):Person { 73 | FreKotlinExampleANEContext.validate(); 74 | return FreKotlinExampleANEContext.context.call("runObjectTests", value) as Person; 75 | } 76 | 77 | public function runExtensibleTests(value:Rectangle):Rectangle { 78 | FreKotlinExampleANEContext.validate(); 79 | return FreKotlinExampleANEContext.context.call("runExtensibleTests", value) as Rectangle; 80 | } 81 | 82 | public function runBitmapTests(bmd:BitmapData):void { 83 | FreKotlinExampleANEContext.validate(); 84 | FreKotlinExampleANEContext.context.call("runBitmapTests", bmd); 85 | } 86 | 87 | public function runByteArrayTests(byteArray:ByteArray):void { 88 | FreKotlinExampleANEContext.validate(); 89 | FreKotlinExampleANEContext.context.call("runByteArrayTests", byteArray); 90 | } 91 | 92 | public function runDataTests(value:String):String { 93 | FreKotlinExampleANEContext.validate(); 94 | return FreKotlinExampleANEContext.context.call("runDataTests", value) as String; 95 | } 96 | 97 | public function runDateTests(value:Date):Date { 98 | FreKotlinExampleANEContext.validate(); 99 | return FreKotlinExampleANEContext.context.call("runDateTests", value) as Date; 100 | } 101 | 102 | public function runErrorTests(value:Person, string:String):void { 103 | FreKotlinExampleANEContext.validate(); 104 | var theRet:* = FreKotlinExampleANEContext.context.call("runErrorTests", value, string); 105 | if (theRet is ANEError) { 106 | throw theRet as ANEError; 107 | } 108 | } 109 | 110 | public static function dispose():void { 111 | if (FreKotlinExampleANEContext.context) { 112 | FreKotlinExampleANEContext.dispose(); 113 | } 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /framework_src/native_extension/src/com/tuarua/FreKotlinExampleANEContext.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Tua Rua Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.tuarua { 18 | import flash.events.StatusEvent; 19 | import flash.external.ExtensionContext; 20 | 21 | public class FreKotlinExampleANEContext { 22 | private static var _isInited:Boolean = false; 23 | private static var _context:ExtensionContext; 24 | internal static const NAME:String = "frekotlin.example"; 25 | internal static const TRACE:String = "TRACE"; 26 | internal static const INIT_ERROR_MESSAGE:String = NAME + " not initialised... use .example"; 27 | 28 | public function FreKotlinExampleANEContext() { 29 | } 30 | 31 | public static function get context():ExtensionContext { 32 | if (_context == null) { 33 | try { 34 | _context = ExtensionContext.createExtensionContext("com.tuarua." + NAME, null); 35 | _context.addEventListener(StatusEvent.STATUS, gotEvent); 36 | _isInited = true; 37 | } catch (e:Error) { 38 | trace("[" + NAME + "] ANE Not loaded properly. Future calls will fail."); 39 | } 40 | } 41 | return _context; 42 | } 43 | 44 | private static function gotEvent(event:StatusEvent):void { 45 | switch (event.level) { 46 | case "TRACE": 47 | trace("[" + NAME + "]", event.code); 48 | break; 49 | } 50 | } 51 | 52 | public static function validate():void { 53 | if (!_isInited) throw new Error(INIT_ERROR_MESSAGE); 54 | } 55 | 56 | public static function dispose():void { 57 | if (!_context) { 58 | return; 59 | } 60 | trace("[" + NAME + "] Unloading ANE..."); 61 | _context.removeEventListener(StatusEvent.STATUS, gotEvent); 62 | _context.dispose(); 63 | _context = null; 64 | _isInited = false; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /framework_src/native_extension/src/com/tuarua/Person.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by User on 08/12/2016. 3 | */ 4 | package com.tuarua { 5 | [RemoteClass(alias="com.tuarua.Person")] 6 | public class Person { 7 | public var name:String = ""; //must init with empty string otherwise comes through as FRE_TYPE_NULL 8 | public var age:int; 9 | public var opt:String; 10 | public var isMan:Boolean = false; 11 | public var height:Number = 1.80; 12 | public var city:City = new City(); 13 | 14 | public function Person() { 15 | super(); 16 | } 17 | 18 | public function add(x:int, y:int):int { 19 | return x + y; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /framework_src/native_extension/src/com/tuarua/fre/ANEError.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Tua Rua Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tuarua.fre { 19 | import flash.system.Capabilities; 20 | 21 | [RemoteClass(alias="com.tuarua.fre.ANEError")] 22 | public class ANEError extends Error { 23 | private var _stackTrace:String; 24 | private var _source:String; 25 | private var _type:String; 26 | 27 | private static const errorTypesCSharp:Array = [ 28 | "FreSharp.Exceptions.Ok", 29 | "FreSharp.Exceptions.NoSuchNameException", 30 | "FreSharp.Exceptions.FreInvalidObjectException", 31 | "FreSharp.Exceptions.FreTypeMismatchException", 32 | "FreSharp.Exceptions.FreActionscriptErrorException", 33 | "FreSharp.Exceptions.FreInvalidArgumentException", 34 | "FreSharp.Exceptions.FreReadOnlyException", 35 | "FreSharp.Exceptions.FreWrongThreadException", 36 | "FreSharp.Exceptions.FreIllegalStateException", 37 | "FreSharp.Exceptions.FreInsufficientMemoryException" 38 | ]; 39 | 40 | private static const errorTypesKotlin:Array = [ 41 | "FreKotlin.Exceptions.Ok", 42 | "FreKotlin.Exceptions.FRENoSuchNameException", 43 | "FreKotlin.Exceptions.FREInvalidObjectException", 44 | "FreKotlin.Exceptions.FRETypeMismatchException", 45 | "FreKotlin.Exceptions.FREASErrorException", 46 | "FreKotlin.Exceptions.FreInvalidArgumentException", 47 | "FreKotlin.Exceptions.FREReadOnlyException", 48 | "FreKotlin.Exceptions.FREWrongThreadException", 49 | "FreKotlin.Exceptions.FreIllegalStateException", 50 | "FreKotlin.Exceptions.FreInsufficientMemoryException" 51 | ]; 52 | 53 | private static const errorTypesSwift:Array = [ 54 | "ok", 55 | "noSuchName", 56 | "invalidObject", 57 | "typeMismatch", 58 | "actionscriptError", 59 | "invalidArgument", 60 | "readOnly", 61 | "wrongThread", 62 | "illegalState", 63 | "insufficientMemory" 64 | ]; 65 | 66 | /** @private */ 67 | public function ANEError(message:String, errorID:int, type:String, source:String, stackTrace:String) { 68 | _stackTrace = stackTrace; 69 | _source = source; 70 | _type = type; 71 | super(message, getErrorID(_type)); 72 | } 73 | 74 | override public function get errorID():int { 75 | return super.errorID; 76 | } 77 | 78 | override public function getStackTrace():String { 79 | return _stackTrace; 80 | } 81 | 82 | private function getErrorID(thetype:String):int { 83 | var val:int; 84 | if (Capabilities.os.toLowerCase().indexOf("win") == 0) { 85 | val = errorTypesCSharp.indexOf(thetype); 86 | } else if (Capabilities.os.toLowerCase().indexOf("linux") == 0) { 87 | val = errorTypesKotlin.indexOf(thetype); 88 | } else { 89 | val = errorTypesSwift.indexOf(thetype); 90 | } 91 | if (val == -1) val = 10; 92 | return val; 93 | } 94 | 95 | public function get type():String { 96 | return _type; 97 | } 98 | 99 | public function get source():String { 100 | return _source; 101 | } 102 | 103 | } 104 | } -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/androidstudio 2 | 3 | ### AndroidStudio ### 4 | # Covers files to be ignored for android development using Android Studio. 5 | 6 | # Built application files 7 | *.apk 8 | *.ap_ 9 | 10 | # Files for the ART/Dalvik VM 11 | *.dex 12 | 13 | # Java class files 14 | *.class 15 | 16 | # Generated files 17 | bin/ 18 | gen/ 19 | out/ 20 | 21 | # Gradle files 22 | .gradle 23 | .gradle/ 24 | build/ 25 | 26 | # Signing files 27 | .signing/ 28 | 29 | # Local configuration file (sdk path, etc) 30 | local.properties 31 | 32 | # Proguard folder generated by Eclipse 33 | proguard/ 34 | 35 | # Log Files 36 | *.log 37 | 38 | # Android Studio 39 | /*/build/ 40 | /*/local.properties 41 | /*/out 42 | /*/*/build 43 | /*/*/production 44 | captures/ 45 | .navigation/ 46 | # *.ipr 47 | *~ 48 | *.swp 49 | 50 | # Android Patch 51 | gen-external-apklibs 52 | 53 | # External native build folder generated in Android Studio 2.2 and later 54 | .externalNativeBuild 55 | 56 | # NDK 57 | obj/ 58 | 59 | # IntelliJ IDEA 60 | # *.iml 61 | *.iws 62 | /out/ 63 | 64 | # User-specific configurations 65 | .idea/caches/ 66 | .idea/libraries/ 67 | .idea/shelf/ 68 | .idea/workspace.xml 69 | .idea/tasks.xml 70 | .idea/.name 71 | .idea/compiler.xml 72 | .idea/copyright/profiles_settings.xml 73 | .idea/encodings.xml 74 | # .idea/misc.xml 75 | # modules.xml 76 | .idea/scopes/scope_settings.xml 77 | .idea/dictionaries 78 | .idea/vcs.xml 79 | .idea/jsLibraryMappings.xml 80 | .idea/datasources.xml 81 | .idea/dataSources.ids 82 | .idea/sqlDataSources.xml 83 | .idea/dynamic.xml 84 | .idea/uiDesigner.xml 85 | 86 | # OS-specific files 87 | .DS_Store 88 | .DS_Store? 89 | ._* 90 | .Spotlight-V100 91 | .Trashes 92 | ehthumbs.db 93 | Thumbs.db 94 | 95 | # Legacy Eclipse project files 96 | .classpath 97 | .project 98 | 99 | # Mobile Tools for Java (J2ME) 100 | .mtj.tmp/ 101 | 102 | # Package Files # 103 | *.war 104 | *.ear 105 | 106 | # virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml) 107 | hs_err_pid* 108 | 109 | ## Plugin-specific files: 110 | 111 | # mpeltonen/sbt-idea plugin 112 | .idea_modules/ 113 | 114 | # JIRA plugin 115 | atlassian-ide-plugin.xml 116 | 117 | # Mongo Explorer plugin 118 | .idea/mongoSettings.xml 119 | 120 | # Crashlytics plugin (for Android Studio and IntelliJ) 121 | com_crashlytics_export_strings.xml 122 | crashlytics.properties 123 | crashlytics-build.properties 124 | fabric.properties 125 | 126 | ### AndroidStudio Patch ### 127 | 128 | !/gradle/wrapper/gradle-wrapper.jar 129 | 130 | # End of https://www.gitignore.io/api/androidstudio -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 20 | 21 | 22 | 23 | 25 | 26 | 27 |
28 | 29 | 30 | 31 | xmlns:android 32 | 33 | ^$ 34 | 35 | 36 | 37 |
38 |
39 | 40 | 41 | 42 | xmlns:.* 43 | 44 | ^$ 45 | 46 | 47 | BY_NAME 48 | 49 |
50 |
51 | 52 | 53 | 54 | .*:id 55 | 56 | http://schemas.android.com/apk/res/android 57 | 58 | 59 | 60 |
61 |
62 | 63 | 64 | 65 | .*:name 66 | 67 | http://schemas.android.com/apk/res/android 68 | 69 | 70 | 71 |
72 |
73 | 74 | 75 | 76 | name 77 | 78 | ^$ 79 | 80 | 81 | 82 |
83 |
84 | 85 | 86 | 87 | style 88 | 89 | ^$ 90 | 91 | 92 | 93 |
94 |
95 | 96 | 97 | 98 | .* 99 | 100 | ^$ 101 | 102 | 103 | BY_NAME 104 | 105 |
106 |
107 | 108 | 109 | 110 | .* 111 | 112 | http://schemas.android.com/apk/res/android 113 | 114 | 115 | ANDROID_ATTRIBUTE_ORDER 116 | 117 |
118 |
119 | 120 | 121 | 122 | .* 123 | 124 | .* 125 | 126 | 127 | BY_NAME 128 | 129 |
130 |
131 |
132 |
133 |
134 |
-------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/.idea/copyright/Tua_Rua_Ltd___Apache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 20 | 21 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | 34 | 35 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 21 | 22 | 40 | 55 | 56 | 57 | 58 | 59 | 60 | 62 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/.idea/modules/FreKotlin/FreKotlinExampleANE.FreKotlin.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 12 | 13 | 27 | 28 | 29 | 30 | 31 | 33 | 34 | 43 | 46 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/.idea/modules/app/FreKotlinExampleANE.app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 12 | 13 | 22 | 23 | 24 | 25 | 26 | 28 | 29 | 39 | 42 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/.idea/modules/app/FreKotlinExampleANE.app.main.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | $MODULE_DIR$/../../../shared/libs/FlashRuntimeExtensions.jar 30 | $MODULE_DIR$/../../../shared/libs/runtimeClasses.jar 31 | $USER_HOME$/.gradle/caches/transforms-3/6bd8226c42c2927d0c8118d7ee78fc4f/transformed/FreKotlin-1.72.1-api.jar 32 | $USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.7.21/1a2eaf898a0dda83037034b10a42053cf8a7caf8/kotlin-stdlib-1.7.21.jar 33 | $USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.21/cb02257de8e13e8498f8e2f69f742f2d438e794d/kotlin-stdlib-common-1.7.21.jar 34 | $USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar 35 | $USER_HOME$/Library/Android/sdk/platforms/android-31/android.jar 36 | $USER_HOME$/Library/Android/sdk/build-tools/31.0.0/core-lambda-stubs.jar 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 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/.idea/modules/app/FreKotlinExampleANE.app.unitTest.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | $MODULE_DIR$/../../../shared/libs/FlashRuntimeExtensions.jar 18 | $MODULE_DIR$/../../../shared/libs/runtimeClasses.jar 19 | $USER_HOME$/.gradle/caches/transforms-3/6bd8226c42c2927d0c8118d7ee78fc4f/transformed/FreKotlin-1.72.1-api.jar 20 | $USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.7.21/1a2eaf898a0dda83037034b10a42053cf8a7caf8/kotlin-stdlib-1.7.21.jar 21 | $USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.21/cb02257de8e13e8498f8e2f69f742f2d438e794d/kotlin-stdlib-common-1.7.21.jar 22 | $USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar 23 | $USER_HOME$/Library/Android/sdk/platforms/android-31/android.jar 24 | $USER_HOME$/Library/Android/sdk/build-tools/31.0.0/core-lambda-stubs.jar 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | $MODULE_DIR$/../../../app/build/tmp/kotlin-classes/release 37 | $MODULE_DIR$/../../../app/build/intermediates/javac/release/classes 38 | $MODULE_DIR$/../../../app/build/intermediates/compile_library_classes_jar/release/classes.jar 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/.idea/runConfigurations/Build_AAR.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 16 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/.idea/runConfigurations/Docs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 16 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/FreKotlinExampleANE.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | 4 | android { 5 | compileSdkVersion rootProject.ext.compileSdkVersion 6 | buildToolsVersion rootProject.ext.buildToolsVersion 7 | defaultConfig { 8 | minSdkVersion rootProject.ext.minSdkVersion 9 | targetSdkVersion rootProject.ext.targetSdkVersion 10 | versionCode rootProject.ext.libVersionCode 11 | versionName rootProject.ext.libVersionName 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | compileOptions { 20 | sourceCompatibility = '1.8' 21 | targetCompatibility = '1.8' 22 | } 23 | kotlinOptions { 24 | jvmTarget = "1.8" 25 | } 26 | } 27 | 28 | dependencies { 29 | implementation "com.github.tuarua:FreKotlin:$frekotlin_version" 30 | implementation files('../shared/libs/FlashRuntimeExtensions.jar') 31 | implementation files('../shared/libs/runtimeClasses.jar') 32 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 33 | } 34 | repositories { 35 | mavenCentral() 36 | } 37 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | 27 | # Add *one* of the following rules to your Proguard configuration file. 28 | # Alternatively, you can annotate classes and class members with @android.support.annotation.Keep -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/app/src/main/java/com/tuarua/BitmapUtils.kt: -------------------------------------------------------------------------------- 1 | package com.tuarua 2 | import android.graphics.* 3 | // Credit https://github.com/anthonyjburch/final_project/blob/807f4a294ca8c50ff65f6269e1118fde2b6eda9c/Swipe_Fragments/src/com/project/utils/Filters.java 4 | object BitmapUtils { 5 | fun sepiaFilter(image: Bitmap): Bitmap { 6 | // Values for a sepia tone 7 | val sepiaValues = floatArrayOf(0.393f, 0.769f, 0.189f, 0f, 0f, 0.349f, 0.686f, 0.168f, 0f, 0f, 0.272f, 0.534f, 0.131f, 0f, 0f, 0f, 0f, 0f, 1f, 0f) 8 | val filteredImage = image.copy(image.config, true) 9 | val canvas = Canvas(filteredImage) 10 | val paint = Paint() 11 | val sepiaMatrix = ColorMatrix() 12 | sepiaMatrix.set(sepiaValues) 13 | val sepiaFilter = ColorMatrixColorFilter(sepiaMatrix) 14 | paint.colorFilter = sepiaFilter 15 | canvas.drawBitmap(image, 0f, 0f, paint) 16 | return filteredImage 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/app/src/main/java/com/tuarua/FreKotlinExampleANE.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Tua Rua Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.tuarua; 17 | 18 | import com.adobe.fre.FREContext; 19 | import com.adobe.fre.FREExtension; 20 | 21 | @SuppressWarnings({"WeakerAccess", "FieldCanBeLocal"}) 22 | public class FreKotlinExampleANE implements FREExtension { 23 | private final String NAME = "com.tuarua.FreKotlinExampleANE"; 24 | public static final String[] FUNCTIONS = { 25 | "init" 26 | ,"runStringTests" 27 | ,"runNumberTests" 28 | ,"runIntTests" 29 | ,"runObjectTests" 30 | ,"runArrayTests" 31 | ,"runBitmapTests" 32 | ,"runExtensibleTests" 33 | ,"runByteArrayTests" 34 | ,"runErrorTests" 35 | ,"runDataTests" 36 | ,"runDateTests" 37 | ,"runColorTests" 38 | }; 39 | public static FreKotlinExampleContext extensionContext; 40 | 41 | @Override 42 | public void initialize() { 43 | } 44 | 45 | @Override 46 | public FREContext createContext(String s) { 47 | return extensionContext = new FreKotlinExampleContext(NAME, new KotlinController(), FUNCTIONS); 48 | } 49 | 50 | @Override 51 | public void dispose() { 52 | extensionContext.dispose(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/app/src/main/java/com/tuarua/FreKotlinExampleContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Tua Rua Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.tuarua; 18 | 19 | import com.adobe.air.AndroidActivityWrapper; 20 | import com.tuarua.frekotlin.FreKotlinContext; 21 | import com.tuarua.frekotlin.FreKotlinMainController; 22 | 23 | //This file must remain as Java 24 | @SuppressWarnings({"WeakerAccess"}) 25 | public class FreKotlinExampleContext extends FreKotlinContext { 26 | private AndroidActivityWrapper aaw; 27 | private final KotlinController kc; 28 | 29 | public FreKotlinExampleContext(String name, FreKotlinMainController controller, String[] functions) { 30 | super(name, controller, functions); 31 | kc = (KotlinController) this.controller; 32 | aaw = AndroidActivityWrapper.GetAndroidActivityWrapper(); 33 | aaw.addActivityResultListener(kc); 34 | aaw.addActivityStateChangeListner(kc); 35 | } 36 | 37 | @Override 38 | public void dispose() { 39 | super.dispose(); 40 | if (aaw != null) { 41 | aaw.removeActivityResultListener(kc); 42 | aaw.removeActivityStateChangeListner(kc); 43 | aaw = null; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/app/src/main/res/layout.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuarua/FreKotlin-Android-ANE/2cf3e33aa9f9194b501dc7670ed32bbf5371766e/framework_src/native_library/android/FreKotlinExampleANE/app/src/main/res/layout.properties -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | FreKotlinExampleANE 3 | 4 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext.kotlin_version = '1.7.21' 5 | ext.frekotlin_version = '1.72.1' 6 | repositories { 7 | google() 8 | mavenCentral() 9 | } 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:7.1.3' 12 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 13 | 14 | // NOTE: Do not place your application dependencies here; they belong 15 | // in the individual module build.gradle files 16 | } 17 | } 18 | 19 | allprojects { 20 | repositories { 21 | google() 22 | maven { url 'https://jitpack.io' } 23 | mavenCentral() 24 | } 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | 31 | ext { 32 | targetSdkVersion = 31 33 | minSdkVersion = 19 34 | compileSdkVersion = targetSdkVersion 35 | buildToolsVersion = '31.0.0' 36 | libVersionCode = 1 37 | libVersionName = '1.72.1' 38 | } 39 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuarua/FreKotlin-Android-ANE/2cf3e33aa9f9194b501dc7670ed32bbf5371766e/framework_src/native_library/android/FreKotlinExampleANE/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/shared/libs/FlashRuntimeExtensions.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuarua/FreKotlin-Android-ANE/2cf3e33aa9f9194b501dc7670ed32bbf5371766e/framework_src/native_library/android/FreKotlinExampleANE/shared/libs/FlashRuntimeExtensions.jar -------------------------------------------------------------------------------- /framework_src/native_library/android/FreKotlinExampleANE/shared/libs/runtimeClasses.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuarua/FreKotlin-Android-ANE/2cf3e33aa9f9194b501dc7670ed32bbf5371766e/framework_src/native_library/android/FreKotlinExampleANE/shared/libs/runtimeClasses.jar -------------------------------------------------------------------------------- /starter_project/README.md: -------------------------------------------------------------------------------- 1 | # Android Kotlin ANE 2 | 3 | Example Android Studio project showing how to create Air Native Extensions for Android using Kotlin. 4 | 5 | 6 | 7 | ------------- 8 | 9 | https://kotlinlang.org/docs/reference/ 10 | 11 | HelloWorldANE.java is the entry point of the ANE. It acts as a thin layered API to your Kotlin controller. 12 | Add the number of methods here 13 | 14 | ```` Java 15 | public static final String[] FUNCTIONS = { 16 | "sayHello", 17 | "isKotlinGreat" 18 | }; 19 | ````` 20 | 21 | 22 | KotlinController.kt 23 | Add Kotlin function(s) here 24 | 25 | ```` Kotlin 26 | fun sayHello(ctx: FREContext, argv: FREArgv): FREObject? { 27 | //your code here 28 | return null 29 | } 30 | 31 | fun isKotlinGreat(ctx: FREContext, argv: FREArgv): FREObject? { 32 | //your code here 33 | return null 34 | } 35 | ````` 36 | 37 | ---------- 38 | 39 | 40 | ### Prerequisites 41 | 42 | You will need 43 | 44 | - Android Studio 3.0 45 | - IntelliJ IDEA 46 | - AIR 27+ 47 | -------------------------------------------------------------------------------- /starter_project/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/flashbuilder 2 | 3 | ### FlashBuilder ### 4 | # Build and Release Folders 5 | bin/ 6 | bin-debug/ 7 | bin-release/ 8 | bin-release-temp/ 9 | cache/ 10 | 11 | *.app 12 | 13 | # Other files and folders 14 | .settings/ 15 | 16 | .FlexUnitSettings 17 | .externalToolBuilders 18 | .model 19 | 20 | # textures 21 | .tps 22 | 23 | 24 | # Created by https://www.gitignore.io/api/intellij 25 | 26 | ### Intellij ### 27 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm 28 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 29 | 30 | # User-specific stuff: 31 | .idea/workspace.xml 32 | .idea/tasks.xml 33 | 34 | # Sensitive or high-churn files: 35 | .idea/dataSources/ 36 | .idea/dataSources.ids 37 | .idea/dataSources.xml 38 | .idea/dataSources.local.xml 39 | .idea/sqlDataSources.xml 40 | .idea/dynamic.xml 41 | .idea/uiDesigner.xml 42 | 43 | # Gradle: 44 | .idea/gradle.xml 45 | 46 | # Mongo Explorer plugin: 47 | .idea/mongoSettings.xml 48 | 49 | ## File-based project format: 50 | *.iws 51 | 52 | ## Plugin-specific files: 53 | 54 | # IntelliJ 55 | /out/ 56 | 57 | # mpeltonen/sbt-idea plugin 58 | .idea_modules/ 59 | 60 | # JIRA plugin 61 | atlassian-ide-plugin.xml 62 | 63 | # Crashlytics plugin (for Android Studio and IntelliJ) 64 | com_crashlytics_export_strings.xml 65 | crashlytics.properties 66 | crashlytics-build.properties 67 | fabric.properties 68 | 69 | ### Intellij Patch ### 70 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 71 | 72 | # *.iml 73 | # modules.xml 74 | # .idea/misc.xml 75 | # *.ipr -------------------------------------------------------------------------------- /starter_project/example/.idea/.name: -------------------------------------------------------------------------------- 1 | HelloWorldExample -------------------------------------------------------------------------------- /starter_project/example/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /starter_project/example/.idea/flexCompiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /starter_project/example/.idea/libraries/HelloWorldANE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /starter_project/example/.idea/libraries/com_tuarua_frekotlin_1_42_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /starter_project/example/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /starter_project/example/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /starter_project/example/.idea/runConfigurations/HelloWorldExample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 26 | 41 | -------------------------------------------------------------------------------- /starter_project/example/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /starter_project/example/HelloWorldExample.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /starter_project/example/Main-app.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Main 4 | Main 5 | Main 6 | 0.0.1 7 | 8 | com.tuarua.frekotlin 9 | com.mycompany.HelloWorldANE 10 | 11 | 12 | 13 | SWF file name is set automatically at compile time 14 | true 15 | true 16 | true 17 | 18 | 19 | 20 | 21 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | ]]> 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /starter_project/example/android_dependencies/.gitignore: -------------------------------------------------------------------------------- 1 | *.ane 2 | 3 | -------------------------------------------------------------------------------- /starter_project/example/android_dependencies/README.md: -------------------------------------------------------------------------------- 1 | This folder will contain downloaded Android anes 2 | -------------------------------------------------------------------------------- /starter_project/example/get_android_dependencies.ps1: -------------------------------------------------------------------------------- 1 | $currentDir = (Get-Item -Path ".\" -Verbose).FullName 2 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 3 | Invoke-WebRequest -OutFile "$currentDir\android_dependencies\com.tuarua.frekotlin-1.72.1.ane" -Uri https://github.com/tuarua/Android-ANE-Dependencies/blob/master/anes/kotlin/com.tuarua.frekotlin-1.72.1.ane?raw=true 4 | -------------------------------------------------------------------------------- /starter_project/example/get_android_dependencies.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | wget -O android_dependencies/com.tuarua.frekotlin-1.72.1.ane https://github.com/tuarua/Android-ANE-Dependencies/blob/master/anes/kotlin/com.tuarua.frekotlin-1.72.1.ane?raw=true 3 | -------------------------------------------------------------------------------- /starter_project/example/src/Main.as: -------------------------------------------------------------------------------- 1 | package { 2 | 3 | import com.mycompany.CustomEvent; 4 | import com.mycompany.HelloWorldANE; 5 | 6 | import flash.desktop.NativeApplication; 7 | import flash.display.Sprite; 8 | import flash.events.Event; 9 | import flash.text.TextField; 10 | 11 | public class Main extends Sprite { 12 | private var ane:HelloWorldANE; 13 | public function Main() { 14 | NativeApplication.nativeApplication.addEventListener(Event.EXITING, onExiting); 15 | ane = HelloWorldANE.helloWorld; 16 | ane.addEventListener("MY_EVENT", onANEEvent); 17 | 18 | var myString:String = ane.sayHello("Hey there", true, 5); 19 | 20 | var textField:TextField = new TextField(); 21 | textField.text = myString; 22 | addChild(textField); 23 | } 24 | 25 | private static function onANEEvent(event:CustomEvent):void { 26 | trace(event); 27 | } 28 | 29 | private static function onExiting(event:Event):void { 30 | HelloWorldANE.dispose(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /starter_project/native_extension/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/flashbuilder 2 | 3 | ### FlashBuilder ### 4 | # Build and Release Folders 5 | bin-debug/ 6 | bin-release/ 7 | 8 | # Other files and folders 9 | .settings/ 10 | 11 | .FlexUnitSettings 12 | .externalToolBuilders 13 | .model 14 | 15 | 16 | 17 | # Created by https://www.gitignore.io/api/intellij 18 | 19 | ### Intellij ### 20 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm 21 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 22 | 23 | # User-specific stuff: 24 | .idea/workspace.xml 25 | .idea/tasks.xml 26 | 27 | # Sensitive or high-churn files: 28 | .idea/dataSources/ 29 | .idea/dataSources.ids 30 | .idea/dataSources.xml 31 | .idea/dataSources.local.xml 32 | .idea/sqlDataSources.xml 33 | .idea/dynamic.xml 34 | .idea/uiDesigner.xml 35 | 36 | # Gradle: 37 | .idea/gradle.xml 38 | .idea/libraries 39 | 40 | # Mongo Explorer plugin: 41 | .idea/mongoSettings.xml 42 | 43 | ## File-based project format: 44 | *.iws 45 | 46 | ## Plugin-specific files: 47 | 48 | # IntelliJ 49 | /out/ 50 | 51 | # mpeltonen/sbt-idea plugin 52 | .idea_modules/ 53 | 54 | # JIRA plugin 55 | atlassian-ide-plugin.xml 56 | 57 | # Crashlytics plugin (for Android Studio and IntelliJ) 58 | com_crashlytics_export_strings.xml 59 | crashlytics.properties 60 | crashlytics-build.properties 61 | fabric.properties 62 | 63 | ### Intellij Patch ### 64 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 65 | 66 | # *.iml 67 | # modules.xml 68 | # .idea/misc.xml 69 | # *.ipr -------------------------------------------------------------------------------- /starter_project/native_extension/.idea/.name: -------------------------------------------------------------------------------- 1 | HelloWorldANE -------------------------------------------------------------------------------- /starter_project/native_extension/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /starter_project/native_extension/.idea/flexCompiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /starter_project/native_extension/.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /starter_project/native_extension/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /starter_project/native_extension/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /starter_project/native_extension/HelloWorldANE.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /starter_project/native_extension/ane/HelloWorldANE.ane: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuarua/FreKotlin-Android-ANE/2cf3e33aa9f9194b501dc7670ed32bbf5371766e/starter_project/native_extension/ane/HelloWorldANE.ane -------------------------------------------------------------------------------- /starter_project/native_extension/ane/build-android.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | SET pathtome=%~dp0 3 | SET SZIP="C:\Program Files\7-Zip\7z.exe" 4 | SET AIR_PATH="D:\dev\sdks\AIR\AIRSDK_50.1.1\bin\" 5 | 6 | SET projectName=HelloWorldANE 7 | 8 | REM Copy SWC into place. 9 | copy %pathtome%..\bin\%projectName%.swc %pathtome% 10 | 11 | REM Extract contents of SWC. 12 | copy /Y %pathtome%%projectName%.swc %pathtome%%projectName%Extract.swc 13 | ren %pathtome%%projectName%Extract.swc %projectName%Extract.zip 14 | call %SZIP% e %pathtome%%projectName%Extract.zip -o%pathtome% 15 | del %pathtome%%projectName%Extract.zip 16 | 17 | REM Copy library.swf to folders. 18 | copy %pathtome%library.swf %pathtome%platforms\android 19 | 20 | REM Copying Android aars into place 21 | copy /Y %pathtome%..\..\native_library\android\%projectName%\app\build\outputs\aar\app-release.aar %pathtome%platforms\android\app-release.aar 22 | 23 | 24 | REM Getting Android jars 25 | call %SZIP% x %pathtome%platforms\android\app-release.aar -o%pathtome%platforms\android\ classes.jar 26 | call %SZIP% x %pathtome%platforms\android\app-release.aar -o%pathtome%platforms\android\ res 27 | ren %pathtome%platforms\android\res com.mycompany.%projectName%-res 28 | 29 | REM Building ANE. 30 | call %AIR_PATH%adt.bat -package -target ane %pathtome%%projectName%.ane extension_android.xml ^ 31 | -swc %projectName%.swc ^ 32 | -platform Android-x86 ^ 33 | -C platforms/android library.swf classes.jar ^ 34 | com.mycompany.%projectName%-res/. ^ 35 | -platformoptions platforms/android/platform.xml ^ 36 | -platform Android-ARM ^ 37 | -C platforms/android library.swf classes.jar ^ 38 | com.mycompany.%projectName%-res/. ^ 39 | -platformoptions platforms/android/platform.xml ^ 40 | -platform Android-ARM64 ^ 41 | -C platforms/android library.swf classes.jar ^ 42 | com.mycompany.%projectName%-res/. ^ 43 | -platformoptions platforms/android/platform.xml ^ 44 | -platform default -C platforms/android library.swf 45 | 46 | REM Clean up. 47 | del %pathtome%platforms\\android\\classes.jar 48 | del %pathtome%platforms\\android\\app-release.aar 49 | del %pathtome%platforms\\android\\library.swf 50 | call DEL /F /Q /A %pathtome%library.swf 51 | call DEL /F /Q /A %pathtome%catalog.xml 52 | call DEL /F /Q /A %pathtome%%projectName%.swc 53 | call rmdir /Q /S %pathtome%platforms\android\com.mycompany.%projectName%-res 54 | 55 | echo "DONE!" 56 | -------------------------------------------------------------------------------- /starter_project/native_extension/ane/build-android.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #Get the path to the script and trim to get the directory. 4 | pathtome=$0 5 | pathtome="${pathtome%/*}" 6 | AIR_SDK="/Users/eoinlandy/SDKs/AIRSDK_50.1.1" 7 | 8 | PROJECTNAME=HelloWorldANE 9 | 10 | # Copy SWC into place. 11 | cp "$pathtome/../bin/$PROJECTNAME.swc" "$pathtome/" 12 | 13 | # Extract contents of SWC. 14 | unzip "$pathtome/$PROJECTNAME.swc" "library.swf" -d "$pathtome" 15 | 16 | # Copy library.swf to folders. 17 | cp "$pathtome/library.swf" "$pathtome/platforms/android" 18 | 19 | # Copying Android aars into place. 20 | cp "$pathtome/../../native_library/android/$PROJECTNAME/app/build/outputs/aar/app-release.aar" "$pathtome/platforms/android/app-release.aar" 21 | 22 | # Getting Android jars. 23 | unzip "$pathtome/platforms/android/app-release.aar" "classes.jar" -d "$pathtome/platforms/android" 24 | unzip "$pathtome/platforms/android/app-release.aar" "res/*" -d "$pathtome/platforms/android" 25 | mv "$pathtome/platforms/android/res" "$pathtome/platforms/android/com.mycompany.$PROJECTNAME-res" 26 | 27 | #Run the build command. 28 | "$AIR_SDK"/bin/adt -package \ 29 | -target ane "$pathtome/$PROJECTNAME.ane" "$pathtome/extension_android.xml" \ 30 | -swc "$pathtome/$PROJECTNAME.swc" \ 31 | -platform Android-x86 \ 32 | -C "$pathtome/platforms/android" "library.swf" "classes.jar" \ 33 | com.mycompany.$PROJECTNAME-res/. \ 34 | -platformoptions "$pathtome/platforms/android/platform.xml" \ 35 | -platform Android-ARM \ 36 | -C "$pathtome/platforms/android" "library.swf" "classes.jar" \ 37 | com.mycompany.$PROJECTNAME-res/. \ 38 | -platformoptions "$pathtome/platforms/android/platform.xml" \ 39 | -platform Android-ARM64 \ 40 | -C "$pathtome/platforms/android" "library.swf" "classes.jar" \ 41 | com.mycompany.$PROJECTNAME-res/. \ 42 | -platformoptions "$pathtome/platforms/android/platform.xml" \ 43 | -platform default -C "$pathtome/platforms/android" "library.swf" 44 | 45 | #Clean up. 46 | rm "$pathtome/platforms/android/classes.jar" 47 | rm "$pathtome/platforms/android/app-release.aar" 48 | rm "$pathtome/platforms/android/library.swf" 49 | rm "$pathtome/$PROJECTNAME.swc" 50 | rm "$pathtome/library.swf" 51 | rm -r "$pathtome/platforms/android/com.mycompany.$PROJECTNAME-res" 52 | 53 | echo "DONE!" 54 | -------------------------------------------------------------------------------- /starter_project/native_extension/ane/extension_android.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.mycompany.HelloWorldANE 4 | Hello World ANE 5 | This work is licensed under Apache License, Copyright (c) 2017 Tua Rua Ltd. 6 | 0.0.2 7 | 8 | 9 | 10 | classes.jar 11 | com.mycompany.HelloWorldANE 12 | com.mycompany.HelloWorldANE 13 | 14 | 15 | 16 | 17 | classes.jar 18 | com.mycompany.HelloWorldANE 19 | com.mycompany.HelloWorldANE 20 | 21 | 22 | 23 | 24 | classes.jar 25 | com.mycompany.HelloWorldANE 26 | com.mycompany.HelloWorldANE 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /starter_project/native_extension/ane/platforms/android/platform.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.mycompany.helloworldane 6 | com.mycompany.HelloWorldANE-res 7 | 8 | 9 | -------------------------------------------------------------------------------- /starter_project/native_extension/bin/HelloWorldANE.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuarua/FreKotlin-Android-ANE/2cf3e33aa9f9194b501dc7670ed32bbf5371766e/starter_project/native_extension/bin/HelloWorldANE.swc -------------------------------------------------------------------------------- /starter_project/native_extension/src/avmplus/DescribeTypeJSON.as: -------------------------------------------------------------------------------- 1 | // ================================================================================================= 2 | // 3 | // Modified by Rodrigo Lopez [roipeker™] on 20/01/2019. 4 | // 5 | // original class: 6 | // https://github.com/tschneidereit/SwiftSuspenders/blob/master/src/avmplus/DescribeTypeJSON.as 7 | // 8 | // Check https://jacksondunstan.com/articles/2609 for reference. 9 | // 10 | // 11 | // ================================================================================================= 12 | 13 | package avmplus { 14 | 15 | /** 16 | * -- Basic Usage: 17 | * 18 | * var desc:Object = DescribeTypeJSON.run( AnyClassOrInstance ); 19 | * trace( JSON.stringify( desc )) ; 20 | * 21 | */ 22 | 23 | /** 24 | * Makes the hidden, unofficial function describeTypeJSON available outside of the avmplus 25 | * package. 26 | * 27 | * As Adobe doen't officially support this method and it is only visible to client 28 | * code by accident, it should only ever be used with runtime-detection and automatic fallback 29 | * on describeType. 30 | * 31 | * @see http://www.tillschneidereit.de/2009/11/22/improved-reflection-support-in-flash-player-10-1/ 32 | */ 33 | public class DescribeTypeJSON { 34 | //---------------------- Public Properties ----------------------// 35 | public static var available:Boolean = describeTypeJSON != null; 36 | 37 | public static const INSTANCE_FLAGS:uint = INCLUDE_VARIABLES | USE_ITRAITS | HIDE_OBJECT; 38 | public static const CLASS_FLAGS:uint = INCLUDE_VARIABLES | INCLUDE_TRAITS | HIDE_OBJECT; 39 | 40 | 41 | private static var _instance:DescribeTypeJSON; 42 | 43 | public static function get():DescribeTypeJSON { 44 | if (!_instance) _instance = new DescribeTypeJSON(); 45 | return _instance; 46 | } 47 | 48 | public static function run(obj:Object):Object { 49 | // little hack to call Class from instance 50 | if (!(obj is Class)) obj = Object(obj).constructor; 51 | return get().describeType(obj, CLASS_FLAGS | INSTANCE_FLAGS); 52 | } 53 | 54 | //---------------------- Public Methods ----------------------// 55 | public function DescribeTypeJSON() { 56 | } 57 | 58 | public function describeType(target:Object, flags:uint):Object { 59 | return describeTypeJSON(target, flags); 60 | } 61 | 62 | public function getInstanceDescription(type:Object):Object { 63 | return describeTypeJSON(type, INSTANCE_FLAGS); 64 | } 65 | 66 | public function getClassDescription(type:Class):Object { 67 | return describeTypeJSON(type, CLASS_FLAGS); 68 | } 69 | } 70 | } -------------------------------------------------------------------------------- /starter_project/native_extension/src/com/mycompany/CustomEvent.as: -------------------------------------------------------------------------------- 1 | package com.mycompany { 2 | import flash.events.Event; 3 | 4 | public class CustomEvent extends Event { 5 | public var params:*; 6 | public function CustomEvent(type:String, params:* = null, bubbles:Boolean = false, cancelable:Boolean = false) { 7 | super(type, bubbles, cancelable); 8 | this.params = params; 9 | } 10 | public override function clone():Event { 11 | return new CustomEvent(type, this.params, bubbles, cancelable); 12 | } 13 | 14 | public override function toString():String { 15 | return formatToString("CustomEvent", "params", "type", "bubbles", "cancelable"); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /starter_project/native_extension/src/com/mycompany/HelloWorldANE.as: -------------------------------------------------------------------------------- 1 | package com.mycompany { 2 | import com.tuarua.fre.ANEError; 3 | import flash.events.EventDispatcher; 4 | 5 | public class HelloWorldANE extends EventDispatcher { 6 | private static var _helloWorld:HelloWorldANE; 7 | 8 | public function HelloWorldANE() { 9 | if (HelloWorldANEContext.context) { 10 | var theRet:* = HelloWorldANEContext.context.call("init"); 11 | if (theRet is ANEError) throw theRet as ANEError; 12 | } 13 | _helloWorld = this; 14 | } 15 | 16 | public static function get helloWorld():HelloWorldANE { 17 | if (!_helloWorld) { 18 | new HelloWorldANE(); 19 | } 20 | return _helloWorld; 21 | } 22 | 23 | public function sayHello(myString:String, uppercase:Boolean, numRepeats:int):String { 24 | HelloWorldANEContext.validate(); 25 | var theRet:* = HelloWorldANEContext.context.call("sayHello", myString, uppercase, numRepeats); 26 | if (theRet is ANEError) throw theRet as ANEError; 27 | return theRet as String; 28 | } 29 | 30 | public static function dispose():void { 31 | if (HelloWorldANEContext.context) { 32 | HelloWorldANEContext.dispose(); 33 | } 34 | } 35 | 36 | 37 | } 38 | } -------------------------------------------------------------------------------- /starter_project/native_extension/src/com/mycompany/HelloWorldANEContext.as: -------------------------------------------------------------------------------- 1 | package com.mycompany { 2 | import flash.events.StatusEvent; 3 | import flash.external.ExtensionContext; 4 | 5 | public class HelloWorldANEContext { 6 | private static var _isInited:Boolean = false; 7 | private static var _context:ExtensionContext; 8 | internal static const NAME:String = "HelloWorldANE"; 9 | internal static const TRACE:String = "TRACE"; 10 | internal static const INIT_ERROR_MESSAGE:String = NAME + " not initialised... use .helloWorld"; 11 | public function HelloWorldANEContext() { 12 | } 13 | 14 | public static function get context():ExtensionContext { 15 | if (_context == null) { 16 | try { 17 | _context = ExtensionContext.createExtensionContext("com.mycompany." + NAME, null); 18 | _context.addEventListener(StatusEvent.STATUS, gotEvent); 19 | _isInited = true; 20 | } catch (e:Error) { 21 | trace("[" + NAME + "] ANE Not loaded properly. Future calls will fail."); 22 | } 23 | } 24 | return _context; 25 | } 26 | 27 | private static function gotEvent(event:StatusEvent):void { 28 | switch (event.level) { 29 | case "TRACE": 30 | trace("[" + NAME + "]", event.code); 31 | break; 32 | case "MY_EVENT": 33 | HelloWorldANE.helloWorld.dispatchEvent(new CustomEvent("MY_EVENT", event.code)); 34 | break; 35 | } 36 | } 37 | 38 | public static function validate():void { 39 | if (!_isInited) throw new Error(INIT_ERROR_MESSAGE); 40 | } 41 | 42 | public static function dispose():void { 43 | if (!_context) { 44 | return; 45 | } 46 | trace("[" + NAME + "] Unloading ANE..."); 47 | _context.removeEventListener(StatusEvent.STATUS, gotEvent); 48 | _context.dispose(); 49 | _context = null; 50 | _isInited = false; 51 | } 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /starter_project/native_extension/src/com/tuarua/fre/ANEError.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Tua Rua Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tuarua.fre { 19 | import flash.system.Capabilities; 20 | 21 | [RemoteClass(alias="com.tuarua.fre.ANEError")] 22 | public class ANEError extends Error { 23 | private var _stackTrace:String; 24 | private var _source:String; 25 | private var _type:String; 26 | 27 | private static const errorTypesCSharp:Array = [ 28 | "FreSharp.Exceptions.Ok", 29 | "FreSharp.Exceptions.NoSuchNameException", 30 | "FreSharp.Exceptions.FreInvalidObjectException", 31 | "FreSharp.Exceptions.FreTypeMismatchException", 32 | "FreSharp.Exceptions.FreActionscriptErrorException", 33 | "FreSharp.Exceptions.FreInvalidArgumentException", 34 | "FreSharp.Exceptions.FreReadOnlyException", 35 | "FreSharp.Exceptions.FreWrongThreadException", 36 | "FreSharp.Exceptions.FreIllegalStateException", 37 | "FreSharp.Exceptions.FreInsufficientMemoryException" 38 | ]; 39 | 40 | private static const errorTypesKotlin:Array = [ 41 | "FreKotlin.Exceptions.Ok", 42 | "FreKotlin.Exceptions.FRENoSuchNameException", 43 | "FreKotlin.Exceptions.FREInvalidObjectException", 44 | "FreKotlin.Exceptions.FRETypeMismatchException", 45 | "FreKotlin.Exceptions.FREASErrorException", 46 | "FreKotlin.Exceptions.FreInvalidArgumentException", 47 | "FreKotlin.Exceptions.FREReadOnlyException", 48 | "FreKotlin.Exceptions.FREWrongThreadException", 49 | "FreKotlin.Exceptions.FreIllegalStateException", 50 | "FreKotlin.Exceptions.FreInsufficientMemoryException" 51 | ]; 52 | 53 | private static const errorTypesSwift:Array = [ 54 | "ok", 55 | "noSuchName", 56 | "invalidObject", 57 | "typeMismatch", 58 | "actionscriptError", 59 | "invalidArgument", 60 | "readOnly", 61 | "wrongThread", 62 | "illegalState", 63 | "insufficientMemory" 64 | ]; 65 | 66 | /** @private */ 67 | public function ANEError(message:String, errorID:int, type:String, source:String, stackTrace:String) { 68 | _stackTrace = stackTrace; 69 | _source = source; 70 | _type = type; 71 | super(message, getErrorID(_type)); 72 | } 73 | 74 | override public function get errorID():int { 75 | return super.errorID; 76 | } 77 | 78 | override public function getStackTrace():String { 79 | return _stackTrace; 80 | } 81 | 82 | private function getErrorID(thetype:String):int { 83 | var val:int; 84 | if (Capabilities.os.toLowerCase().indexOf("win") == 0) { 85 | val = errorTypesCSharp.indexOf(thetype); 86 | } else if (Capabilities.os.toLowerCase().indexOf("linux") == 0) { 87 | val = errorTypesKotlin.indexOf(thetype); 88 | } else { 89 | val = errorTypesSwift.indexOf(thetype); 90 | } 91 | if (val == -1) val = 10; 92 | return val; 93 | } 94 | 95 | public function get type():String { 96 | return _type; 97 | } 98 | 99 | public function get source():String { 100 | return _source; 101 | } 102 | 103 | } 104 | } -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/androidstudio 2 | 3 | ### AndroidStudio ### 4 | # Covers files to be ignored for android development using Android Studio. 5 | 6 | # Built application files 7 | *.apk 8 | *.ap_ 9 | 10 | # Files for the ART/Dalvik VM 11 | *.dex 12 | 13 | # Java class files 14 | *.class 15 | 16 | # Generated files 17 | bin/ 18 | gen/ 19 | out/ 20 | 21 | # Gradle files 22 | .gradle 23 | .gradle/ 24 | build/ 25 | 26 | # Signing files 27 | .signing/ 28 | 29 | # Local configuration file (sdk path, etc) 30 | local.properties 31 | 32 | # Proguard folder generated by Eclipse 33 | proguard/ 34 | 35 | # Log Files 36 | *.log 37 | 38 | # Android Studio 39 | /*/build/ 40 | /*/local.properties 41 | /*/out 42 | /*/*/build 43 | /*/*/production 44 | captures/ 45 | .navigation/ 46 | # *.ipr 47 | *~ 48 | *.swp 49 | 50 | # Android Patch 51 | gen-external-apklibs 52 | 53 | # External native build folder generated in Android Studio 2.2 and later 54 | .externalNativeBuild 55 | 56 | # NDK 57 | obj/ 58 | 59 | # IntelliJ IDEA 60 | # *.iml 61 | *.iws 62 | /out/ 63 | 64 | # User-specific configurations 65 | .idea/caches/ 66 | .idea/libraries/ 67 | .idea/shelf/ 68 | .idea/workspace.xml 69 | .idea/tasks.xml 70 | .idea/.name 71 | .idea/compiler.xml 72 | .idea/copyright/profiles_settings.xml 73 | .idea/encodings.xml 74 | # .idea/misc.xml 75 | # modules.xml 76 | .idea/scopes/scope_settings.xml 77 | .idea/dictionaries 78 | .idea/vcs.xml 79 | .idea/jsLibraryMappings.xml 80 | .idea/datasources.xml 81 | .idea/dataSources.ids 82 | .idea/sqlDataSources.xml 83 | .idea/dynamic.xml 84 | .idea/uiDesigner.xml 85 | 86 | # OS-specific files 87 | .DS_Store 88 | .DS_Store? 89 | ._* 90 | .Spotlight-V100 91 | .Trashes 92 | ehthumbs.db 93 | Thumbs.db 94 | 95 | # Legacy Eclipse project files 96 | .classpath 97 | .project 98 | 99 | # Mobile Tools for Java (J2ME) 100 | .mtj.tmp/ 101 | 102 | # Package Files # 103 | *.war 104 | *.ear 105 | 106 | # virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml) 107 | hs_err_pid* 108 | 109 | ## Plugin-specific files: 110 | 111 | # mpeltonen/sbt-idea plugin 112 | .idea_modules/ 113 | 114 | # JIRA plugin 115 | atlassian-ide-plugin.xml 116 | 117 | # Mongo Explorer plugin 118 | .idea/mongoSettings.xml 119 | 120 | # Crashlytics plugin (for Android Studio and IntelliJ) 121 | com_crashlytics_export_strings.xml 122 | crashlytics.properties 123 | crashlytics-build.properties 124 | fabric.properties 125 | 126 | ### AndroidStudio Patch ### 127 | 128 | !/gradle/wrapper/gradle-wrapper.jar 129 | 130 | # End of https://www.gitignore.io/api/androidstudio -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 20 | 21 | 22 | 23 | 25 | 26 | 27 |
28 | 29 | 30 | 31 | xmlns:android 32 | 33 | ^$ 34 | 35 | 36 | 37 |
38 |
39 | 40 | 41 | 42 | xmlns:.* 43 | 44 | ^$ 45 | 46 | 47 | BY_NAME 48 | 49 |
50 |
51 | 52 | 53 | 54 | .*:id 55 | 56 | http://schemas.android.com/apk/res/android 57 | 58 | 59 | 60 |
61 |
62 | 63 | 64 | 65 | .*:name 66 | 67 | http://schemas.android.com/apk/res/android 68 | 69 | 70 | 71 |
72 |
73 | 74 | 75 | 76 | name 77 | 78 | ^$ 79 | 80 | 81 | 82 |
83 |
84 | 85 | 86 | 87 | style 88 | 89 | ^$ 90 | 91 | 92 | 93 |
94 |
95 | 96 | 97 | 98 | .* 99 | 100 | ^$ 101 | 102 | 103 | BY_NAME 104 | 105 |
106 |
107 | 108 | 109 | 110 | .* 111 | 112 | http://schemas.android.com/apk/res/android 113 | 114 | 115 | ANDROID_ATTRIBUTE_ORDER 116 | 117 |
118 |
119 | 120 | 121 | 122 | .* 123 | 124 | .* 125 | 126 | 127 | BY_NAME 128 | 129 |
130 |
131 |
132 |
133 |
134 |
-------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 20 | 21 | -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | 34 | 35 | 39 | 40 | -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 37 | 38 | 39 | 40 | 41 | 42 | 44 | -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/.idea/modules/app/HelloWorldANE.app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 12 | 13 | 22 | 23 | 24 | 25 | 26 | 28 | 29 | 39 | 42 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/.idea/modules/app/HelloWorldANE.app.unitTest.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | $USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.7.21/5407c3593c58860cec5ee3f66c468396b42f4c2b/kotlin-stdlib-jdk8-1.7.21.jar 18 | $USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.7.21/a0ba09615c2213d580315e234b3febfea25b757e/kotlin-stdlib-jdk7-1.7.21.jar 19 | $USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.7.21/1a2eaf898a0dda83037034b10a42053cf8a7caf8/kotlin-stdlib-1.7.21.jar 20 | $USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.21/cb02257de8e13e8498f8e2f69f742f2d438e794d/kotlin-stdlib-common-1.7.21.jar 21 | $USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar 22 | $USER_HOME$/.gradle/caches/transforms-3/6bd8226c42c2927d0c8118d7ee78fc4f/transformed/FreKotlin-1.72.1-api.jar 23 | $USER_HOME$/Library/Android/sdk/platforms/android-31/android.jar 24 | $USER_HOME$/Library/Android/sdk/build-tools/31.0.0/core-lambda-stubs.jar 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | $MODULE_DIR$/../../../app/build/tmp/kotlin-classes/debug 37 | $MODULE_DIR$/../../../app/build/intermediates/javac/debug/classes 38 | $MODULE_DIR$/../../../app/build/intermediates/compile_library_classes_jar/debug/classes.jar 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/.idea/runConfigurations/Build_AAR.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 16 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/HelloWorldANE.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | 4 | android { 5 | compileSdkVersion 31 6 | buildToolsVersion "31.0.0" 7 | defaultConfig { 8 | minSdkVersion 19 9 | targetSdkVersion compileSdkVersion 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | compileOptions { 20 | sourceCompatibility = '1.8' 21 | targetCompatibility = '1.8' 22 | } 23 | kotlinOptions { 24 | jvmTarget = "1.8" 25 | } 26 | } 27 | 28 | dependencies { 29 | implementation "com.github.tuarua:FreKotlin:$frekotlin_version" 30 | } 31 | repositories { 32 | mavenCentral() 33 | maven { url 'https://jitpack.io' } 34 | } -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/app/src/main/java/com/mycompany/HelloWorldANE.java: -------------------------------------------------------------------------------- 1 | package com.mycompany; 2 | 3 | import com.adobe.fre.FREContext; 4 | import com.adobe.fre.FREExtension; 5 | import com.mycompany.helloworldane.KotlinController; 6 | 7 | @SuppressWarnings({"unused", "WeakerAccess", "FieldCanBeLocal"}) 8 | public class HelloWorldANE implements FREExtension { 9 | private String NAME = "com.mycompany.HelloWorldANE"; 10 | private static final String[] FUNCTIONS = { 11 | "init" 12 | ,"sayHello" 13 | }; 14 | 15 | public static HelloWorldANEContext extensionContext; 16 | 17 | @Override 18 | public void initialize() { 19 | 20 | } 21 | 22 | @Override 23 | public FREContext createContext(String s) { 24 | return extensionContext = new HelloWorldANEContext(NAME, new KotlinController(), FUNCTIONS); 25 | } 26 | 27 | @Override 28 | public void dispose() { 29 | extensionContext.dispose(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/app/src/main/java/com/mycompany/HelloWorldANEContext.java: -------------------------------------------------------------------------------- 1 | package com.mycompany; 2 | 3 | import com.adobe.air.AndroidActivityWrapper; 4 | import com.mycompany.helloworldane.KotlinController; 5 | import com.tuarua.frekotlin.FreKotlinContext; 6 | import com.tuarua.frekotlin.FreKotlinMainController; 7 | 8 | 9 | public class HelloWorldANEContext extends FreKotlinContext { 10 | private AndroidActivityWrapper aaw; 11 | private KotlinController kc; 12 | 13 | @SuppressWarnings("WeakerAccess") 14 | public HelloWorldANEContext(String name, FreKotlinMainController controller, String[] functions) { 15 | super(name, controller, functions); 16 | kc = (KotlinController) this.controller; 17 | aaw = AndroidActivityWrapper.GetAndroidActivityWrapper(); 18 | aaw.addActivityResultListener(kc); 19 | aaw.addActivityStateChangeListner(kc); 20 | } 21 | 22 | @Override 23 | public void dispose() { 24 | super.dispose(); 25 | if (aaw != null) { 26 | aaw.removeActivityResultListener(kc); 27 | aaw.removeActivityStateChangeListner(kc); 28 | aaw = null; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/app/src/main/java/com/mycompany/helloworldane/KotlinController.kt: -------------------------------------------------------------------------------- 1 | package com.mycompany.helloworldane 2 | 3 | import android.content.Intent 4 | import android.content.res.Configuration 5 | import com.adobe.air.AndroidActivityWrapper.ActivityState 6 | import com.adobe.air.AndroidActivityWrapper.ActivityState.* 7 | import com.adobe.air.FreKotlinActivityResultCallback 8 | import com.adobe.air.FreKotlinStateChangeCallback 9 | import com.adobe.fre.FREContext 10 | import com.adobe.fre.FREObject 11 | import com.tuarua.frekotlin.* 12 | import java.util.* 13 | 14 | @Suppress("unused", "UNUSED_PARAMETER", "UNCHECKED_CAST") 15 | class KotlinController : FreKotlinMainController, FreKotlinStateChangeCallback, FreKotlinActivityResultCallback { 16 | fun init(ctx: FREContext, argv: FREArgv): FREObject? { 17 | return null 18 | } 19 | 20 | fun sayHello(ctx: FREContext, argv: FREArgv): FREObject? { 21 | argv.takeIf { argv.size > 2 } ?: return FreArgException() 22 | val myString = String(argv[0]) ?: return FreArgException() 23 | val uppercase = Boolean(argv[1]) ?: return FreArgException() 24 | val numRepeats = Int(argv[2]) ?: return FreArgException() 25 | 26 | dispatchEvent("MY_EVENT", "ok") 27 | 28 | for (i in 0 until numRepeats) { 29 | trace("hello $i") 30 | // or 31 | // trace("Hello", i) 32 | } 33 | var ret = myString 34 | if (uppercase) { 35 | ret = ret.uppercase(Locale.getDefault()) 36 | } 37 | return ret.toFREObject() 38 | } 39 | 40 | override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) { 41 | } 42 | 43 | override fun onConfigurationChanged(configuration: Configuration?) { 44 | } 45 | 46 | override fun onActivityStateChanged(activityState: ActivityState?) { 47 | when (activityState) { 48 | STARTED -> return 49 | RESTARTED -> return 50 | RESUMED -> return 51 | PAUSED -> return 52 | STOPPED -> return 53 | DESTROYED -> return 54 | else -> return 55 | } 56 | } 57 | 58 | override val TAG: String? 59 | get() = this::class.java.simpleName 60 | private var _context: FREContext? = null 61 | override var context: FREContext? 62 | get() = _context 63 | set(value) { 64 | _context = value 65 | } 66 | } -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | HelloWorldANE 3 | 4 | -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext.kotlin_version = '1.7.21' 5 | ext.frekotlin_version = '1.72.1' 6 | repositories { 7 | google() 8 | mavenCentral() 9 | } 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:7.1.3' 12 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 13 | 14 | // NOTE: Do not place your application dependencies here; they belong 15 | // in the individual module build.gradle files 16 | } 17 | } 18 | 19 | allprojects { 20 | repositories { 21 | google() 22 | mavenCentral() 23 | } 24 | } 25 | 26 | task clean(type: Delete) { 27 | delete rootProject.buildDir 28 | } 29 | -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuarua/FreKotlin-Android-ANE/2cf3e33aa9f9194b501dc7670ed32bbf5371766e/starter_project/native_library/android/HelloWorldANE/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /starter_project/native_library/android/HelloWorldANE/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------