Skip to content

Commit b642e68

Browse files
committed
Initial commit
0 parents  commit b642e68

26 files changed

+2084
-0
lines changed

.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
actionscript/.idea
2+
Main.iml
3+
project.properties
4+
build/temp
5+
demo_app
6+
.DS_STORE
7+
UserInterfaceState.xcuserstate
8+
bin
9+
ios/DeferSystemGestures.xcodeproj/project.xcworkspace/xcuserdata
10+
ios/DeferSystemGestures.xcodeproj/xcuserdata
11+
ios/NativeLetterbox.xcodeproj/project.xcworkspace/xcuserdata
12+
ios/NativeLetterbox.xcodeproj/xcuserdata

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2019 Digital Strawberry LLC
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# ANE-NativeLetterbox
2+
3+
A simple extension to display native letterbox layer on iOS, useful for limiting content size on devices with a "notch" like the iPhone X.
4+
5+
## Getting started
6+
7+
Download the ANE from the [releases](../../releases/) page and add it to your app's descriptor:
8+
9+
```xml
10+
<extensions>
11+
<extensionID>com.digitalstrawberry.ane.letterbox</extensionID>
12+
</extensions>
13+
```
14+
15+
## API Overview
16+
17+
The extenstion is supported on iOS only. Use the `isSupported` getter to check for device support:
18+
19+
```as3
20+
if(NativeLetterbox.instance.isSupported)
21+
{
22+
...
23+
}
24+
```
25+
26+
If the API is supported, use the `setHorizontalLetterbox` and/or `setVerticalLetterbox` method to create the letterbox. You can customize the letterbox's size (in pixels), color and alpha:
27+
28+
```as3
29+
NativeLetterbox.instance.setHorizontalLetterbox(90, 0x000000, 1);
30+
NativeLetterbox.instance.setVerticalLetterbox(30, 0xFF0000, 1);
31+
```
32+
33+
The letterbox can be brought to front if it ends up covered by other native views:
34+
35+
```as3
36+
NativeLetterbox.instance.bringToFront();
37+
```
38+
39+
### Changelog
40+
41+
#### January 13, 2019 (v1.0.0)
42+
43+
* Public release

actionscript/common/common.iml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="Flex" version="4">
3+
<component name="FlexBuildConfigurationManager" active="common">
4+
<configurations>
5+
<configuration name="common" target-platform="Mobile" pure-as="true" output-type="Library" output-file="common.swc">
6+
<dependencies target-player="27.0">
7+
<sdk name="27.0.0.128" />
8+
</dependencies>
9+
<compiler-options />
10+
<packaging-air-desktop />
11+
<packaging-android />
12+
<packaging-ios />
13+
</configuration>
14+
</configurations>
15+
<compiler-options />
16+
</component>
17+
<component name="NewModuleRootManager" inherit-compiler-output="true">
18+
<exclude-output />
19+
<content url="file://$MODULE_DIR$">
20+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
21+
</content>
22+
<orderEntry type="jdk" jdkName="27.0.0.128" jdkType="Flex SDK Type (new)" />
23+
<orderEntry type="sourceFolder" forTests="false" />
24+
</component>
25+
</module>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2019 Digital Strawberry LLC
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
package com.digitalstrawberry.ane.letterbox {
26+
27+
public interface INativeLetterbox {
28+
29+
function setHorizontalLetterbox(size:Number, color:int, alpha:Number = 1):void;
30+
31+
function setVerticalLetterbox(size:Number, color:int, alpha:Number = 1):void;
32+
33+
function bringToFront():void;
34+
35+
function dispose():void;
36+
37+
function get isSupported():Boolean;
38+
39+
}
40+
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2019 Digital Strawberry LLC
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
package com.digitalstrawberry.ane.letterbox
26+
{
27+
28+
public const NATIVE_LETTERBOX_VERSION:String = "1.0.0";
29+
30+
}

actionscript/default/default.iml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="Flex" version="4">
3+
<component name="FlexBuildConfigurationManager" active="default">
4+
<configurations>
5+
<configuration name="default" target-platform="Mobile" pure-as="true" output-type="Library" output-file="default.swc">
6+
<dependencies target-player="27.0">
7+
<entries>
8+
<entry module-name="common" build-configuration-name="common">
9+
<dependency linkage="Merged" />
10+
</entry>
11+
</entries>
12+
<sdk name="27.0.0.128" />
13+
</dependencies>
14+
<compiler-options />
15+
<packaging-air-desktop />
16+
<packaging-android />
17+
<packaging-ios />
18+
</configuration>
19+
</configurations>
20+
<compiler-options />
21+
</component>
22+
<component name="NewModuleRootManager" inherit-compiler-output="true">
23+
<exclude-output />
24+
<content url="file://$MODULE_DIR$">
25+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
26+
</content>
27+
<orderEntry type="jdk" jdkName="27.0.0.128" jdkType="Flex SDK Type (new)" />
28+
<orderEntry type="sourceFolder" forTests="false" />
29+
<orderEntry type="module" module-name="common" exported="" />
30+
</component>
31+
</module>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2019 Digital Strawberry LLC
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
package com.digitalstrawberry.ane.letterbox
26+
{
27+
28+
public class NativeLetterbox implements INativeLetterbox
29+
{
30+
31+
// Singleton stuff
32+
private static var _canInitialize:Boolean;
33+
private static var _instance:INativeLetterbox;
34+
35+
36+
/**
37+
* @private
38+
*/
39+
public function NativeLetterbox()
40+
{
41+
if(!_canInitialize)
42+
{
43+
throw new Error("NativeLetterbox is a singleton, use instance getter.");
44+
}
45+
}
46+
47+
48+
public static function get instance():INativeLetterbox
49+
{
50+
if(!_instance)
51+
{
52+
_canInitialize = true;
53+
_instance = new NativeLetterbox();
54+
_canInitialize = false;
55+
}
56+
return _instance;
57+
}
58+
59+
60+
public static function get VERSION():String
61+
{
62+
return NATIVE_LETTERBOX_VERSION;
63+
}
64+
65+
66+
public function dispose():void
67+
{
68+
}
69+
70+
71+
public function get isSupported():Boolean
72+
{
73+
return false;
74+
}
75+
76+
77+
public function setHorizontalLetterbox(size:Number, color:int, alpha:Number = 1):void
78+
{
79+
}
80+
81+
82+
public function setVerticalLetterbox(size:Number, color:int, alpha:Number = 1):void
83+
{
84+
}
85+
86+
87+
public function bringToFront():void
88+
{
89+
}
90+
}
91+
}

actionscript/ios/ios.iml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="Flex" version="4">
3+
<component name="FlexBuildConfigurationManager" active="ios">
4+
<configurations>
5+
<configuration name="ios" target-platform="Mobile" pure-as="true" output-type="Library" output-file="ios.swc">
6+
<dependencies>
7+
<entries>
8+
<entry module-name="common" build-configuration-name="common">
9+
<dependency linkage="Merged" />
10+
</entry>
11+
</entries>
12+
<sdk name="27.0.0.128" />
13+
</dependencies>
14+
<compiler-options />
15+
<packaging-air-desktop />
16+
<packaging-android />
17+
<packaging-ios />
18+
</configuration>
19+
</configurations>
20+
<compiler-options />
21+
</component>
22+
<component name="NewModuleRootManager" inherit-compiler-output="true">
23+
<exclude-output />
24+
<content url="file://$MODULE_DIR$">
25+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
26+
</content>
27+
<orderEntry type="jdk" jdkName="27.0.0.128" jdkType="Flex SDK Type (new)" />
28+
<orderEntry type="sourceFolder" forTests="false" />
29+
<orderEntry type="module" module-name="common" exported="" />
30+
</component>
31+
</module>

0 commit comments

Comments
 (0)