-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactors API, adds battery information for iOS
- Loading branch information
Showing
42 changed files
with
1,373 additions
and
184 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,19 +2,22 @@ | |
<module type="Flex" version="4"> | ||
<component name="FlexBuildConfigurationManager" active="deviceinfo-debug"> | ||
<configurations> | ||
<configuration name="deviceinfo-debug" target-platform="Mobile" pure-as="true" main-class="DeviceInfoDebug" output-file="DeviceInfoDebug.swf" output-folder="$MODULE_DIR$/bin-debug"> | ||
<dependencies target-player="11.6"> | ||
<configuration name="deviceinfo-debug" target-platform="Mobile" main-class="DeviceInfoDebug" output-file="DeviceInfoDebug.swf" output-folder="$MODULE_DIR$/bin-debug"> | ||
<dependencies> | ||
<entries> | ||
<entry library-id="c31ee848-4372-498b-b644-a67e612b0d60"> | ||
<dependency linkage="Merged" /> | ||
</entry> | ||
</entries> | ||
<sdk name="4.0.0" /> | ||
<sdk name="4.13.0" /> | ||
</dependencies> | ||
<compiler-options /> | ||
<packaging-air-desktop /> | ||
<packaging-android enabled="true" use-generated-descriptor="false" custom-descriptor-path="$MODULE_DIR$/DeviceInfoDebug-app.xml" package-file-name="DeviceInfoDebug" /> | ||
<packaging-ios enabled="true" use-generated-descriptor="false" custom-descriptor-path="$MODULE_DIR$/DeviceInfoDebug-app.xml" package-file-name="DeviceInfoDebug"> | ||
<files-to-package> | ||
<FilePathAndPathInPackage file-path="$MODULE_DIR$/[email protected]" path-in-package="[email protected]" /> | ||
</files-to-package> | ||
<AirSigningOptions keystore-path="$USER_HOME$/ios/certificate/ios_air_development.p12" provisioning-profile-path="$USER_HOME$/ios/provisioning/Generic_Profile.mobileprovision" /> | ||
</packaging-ios> | ||
</configuration> | ||
|
@@ -26,7 +29,7 @@ | |
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="jdk" jdkName="4.0.0" jdkType="Flex SDK Type (new)" /> | ||
<orderEntry type="jdk" jdkName="4.13.0" jdkType="Flex SDK Type (new)" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="module-library" exported=""> | ||
<library type="flex"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
Created by max on 10/23/14. | ||
--> | ||
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" | ||
xmlns:s="library://ns.adobe.com/flex/spark" backgroundColor="#00AAAA"> | ||
|
||
<fx:Script> | ||
<![CDATA[ | ||
import com.github.airext.DeviceInfo; | ||
import com.github.airext.data.DeviceInfoGeneral; | ||
import spark.components.Alert; | ||
private function imei_clickHandler(event:MouseEvent):void | ||
{ | ||
Alert.show(String(DeviceInfo.sharedInstance().getIMEI())); | ||
} | ||
private function general_clickHandler(event:MouseEvent):void | ||
{ | ||
var general:DeviceInfoGeneral = DeviceInfo.sharedInstance().general; | ||
Alert.show(String(general)); | ||
} | ||
private function iosVendorIdentifier_clickHandler(event:MouseEvent):void | ||
{ | ||
var general:DeviceInfoGeneral = DeviceInfo.sharedInstance().general; | ||
Alert.show(String(general.ios.getVendorIdentifier())); | ||
} | ||
]]> | ||
</fx:Script> | ||
|
||
<s:layout> | ||
<s:VerticalLayout horizontalAlign="justify" gap="30" paddingTop="30" /> | ||
</s:layout> | ||
|
||
<s:Button label="IMEI" click="imei_clickHandler(event)" /> | ||
|
||
<s:Button label="General" click="general_clickHandler(event)" /> | ||
|
||
<s:SkinnableContainer backgroundColor="#FFFFFF"> | ||
<s:layout><s:HorizontalLayout paddingLeft="10" paddingTop="10" paddingBottom="10" /></s:layout> | ||
<s:Label text="Battery State:{DeviceInfo.sharedInstance().battery.state}" /> | ||
<s:Label text="Battery Level:{DeviceInfo.sharedInstance().battery.level}" /> | ||
</s:SkinnableContainer> | ||
|
||
<s:Label text="IOS SPECIFIC" /> | ||
|
||
<s:Button label="Vendor Identifier" click="iosVendorIdentifier_clickHandler(event)" /> | ||
|
||
</s:Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
deviceinfo-air/deviceinfo-default/src/com/github/airext/data/DeviceInfoBattery.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
/** | ||
* Created by mobitile on 10/22/14. | ||
*/ | ||
package com.github.airext.data | ||
{ | ||
import flash.events.Event; | ||
import flash.events.EventDispatcher; | ||
import flash.system.Capabilities; | ||
|
||
public class DeviceInfoBattery extends EventDispatcher | ||
{ | ||
//-------------------------------------------------------------------------- | ||
// | ||
// Constructor | ||
// | ||
//-------------------------------------------------------------------------- | ||
|
||
public function DeviceInfoBattery() | ||
{ | ||
super(); | ||
} | ||
|
||
//-------------------------------------------------------------------------- | ||
// | ||
// Properties | ||
// | ||
//-------------------------------------------------------------------------- | ||
|
||
//------------------------------------ | ||
// level | ||
//------------------------------------ | ||
|
||
private var _level:Number; | ||
|
||
[Bindable(event="levelChanged")] | ||
public function get level():Number | ||
{ | ||
if (isNaN(_level)) | ||
{ | ||
_level = getLevel(); | ||
} | ||
|
||
return _level; | ||
} | ||
|
||
private function setLevel(value:Number):void | ||
{ | ||
if (value == _level) return; | ||
_level = value; | ||
dispatchEvent(new Event("levelChanged")); | ||
} | ||
|
||
//------------------------------------ | ||
// state | ||
//------------------------------------ | ||
|
||
private var _state:String; | ||
|
||
[Bindable(event="stateChanged")] | ||
public function get state():String | ||
{ | ||
if (_state == null) | ||
{ | ||
_state = getState(); | ||
} | ||
|
||
return _state; | ||
} | ||
|
||
private function setState(value:String):void | ||
{ | ||
if (value == _state) return; | ||
_state = value; | ||
dispatchEvent(new Event("stateChanged")); | ||
} | ||
|
||
//-------------------------------------------------------------------------- | ||
// | ||
// Methods | ||
// | ||
//-------------------------------------------------------------------------- | ||
|
||
public function getLevel():Number | ||
{ | ||
trace("DeviceInfo is not supported for " + Capabilities.os); | ||
|
||
return null; | ||
} | ||
|
||
public function getState():String | ||
{ | ||
trace("DeviceInfo is not supported for " + Capabilities.os); | ||
|
||
return null; | ||
} | ||
|
||
public function startMonitoring():void | ||
{ | ||
trace("DeviceInfo is not supported for " + Capabilities.os); | ||
} | ||
|
||
public function stopMonitoring():void | ||
{ | ||
trace("DeviceInfo is not supported for " + Capabilities.os); | ||
} | ||
|
||
//-------------------------------------------------------------------------- | ||
// | ||
// Overridden methods | ||
// | ||
//-------------------------------------------------------------------------- | ||
|
||
override public function toString():String | ||
{ | ||
return '[DeviceInfoBattery level="'+_level+'", state="'+_state+'"]'; | ||
} | ||
} | ||
} |
109 changes: 109 additions & 0 deletions
109
deviceinfo-air/deviceinfo-default/src/com/github/airext/data/DeviceInfoGeneral.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/** | ||
* Created by mobitile on 10/22/14. | ||
*/ | ||
package com.github.airext.data | ||
{ | ||
|
||
public class DeviceInfoGeneral | ||
{ | ||
//-------------------------------------------------------------------------- | ||
// | ||
// Constructor | ||
// | ||
//-------------------------------------------------------------------------- | ||
|
||
public function DeviceInfoGeneral() | ||
{ | ||
super(); | ||
} | ||
|
||
//-------------------------------------------------------------------------- | ||
// | ||
// Properties | ||
// | ||
//-------------------------------------------------------------------------- | ||
|
||
//------------------------------------- | ||
// name | ||
//------------------------------------- | ||
|
||
public var name:String; | ||
|
||
//------------------------------------- | ||
// model | ||
//------------------------------------- | ||
|
||
public var model:String; | ||
|
||
//------------------------------------- | ||
// manufacturer | ||
//------------------------------------- | ||
|
||
public var manufacturer:String; | ||
|
||
//------------------------------------- | ||
// systemName | ||
//------------------------------------- | ||
|
||
public var systemName:String; | ||
|
||
//------------------------------------- | ||
// systemVersion | ||
//------------------------------------- | ||
|
||
public var systemVersion:String; | ||
|
||
//------------------------------------- | ||
// platform | ||
//------------------------------------- | ||
|
||
public var platform:String; | ||
|
||
//-------------------------------------------------------------------------- | ||
// | ||
// Platform-specific properties | ||
// | ||
//-------------------------------------------------------------------------- | ||
|
||
//------------------------------------- | ||
// ios | ||
//------------------------------------- | ||
|
||
private var _ios:DeviceInfoGeneralIOS; | ||
|
||
public function get ios():DeviceInfoGeneralIOS | ||
{ | ||
if (_ios == null) | ||
{ | ||
_ios = new DeviceInfoGeneralIOS(); | ||
} | ||
|
||
return _ios; | ||
} | ||
|
||
//------------------------------------- | ||
// osx | ||
//------------------------------------- | ||
|
||
//------------------------------------- | ||
// win | ||
//------------------------------------- | ||
|
||
//-------------------------------------------------------------------------- | ||
// | ||
// Methods | ||
// | ||
//-------------------------------------------------------------------------- | ||
|
||
public function toString():String | ||
{ | ||
return '[DeviceInfoGeneral ' + | ||
'name="'+name+'", ' + | ||
'model="'+model+'", ' + | ||
'manufacturer="'+manufacturer+', ' + | ||
'systemName="'+systemName+'", ' + | ||
'systemVersion="'+systemVersion+'", ' + | ||
'ios="'+ios+'"]'; | ||
} | ||
} | ||
} |
Oops, something went wrong.