Skip to content

Commit

Permalink
Initial commit with components
Browse files Browse the repository at this point in the history
Signed-off-by: John Olson <john@yapiodesign.com>
  • Loading branch information
olsonjj committed May 14, 2011
0 parents commit ca8dc60
Show file tree
Hide file tree
Showing 29 changed files with 2,488 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .actionScriptProperties
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<actionScriptProperties analytics="false" mainApplicationPath="SparkAndroidComponents.as" projectUUID="63548317-3c7f-4df2-872d-786e59f31a79" version="10">
<compiler additionalCompilerArguments="-locale en_US" autoRSLOrdering="true" copyDependentFiles="false" fteInMXComponents="false" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin" removeUnusedRSL="true" sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="true" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
<compilerSourcePath/>
<libraryPath defaultLinkType="0">
<libraryPathEntry kind="4" path="">
<excludedEntries>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/air/servicemonitor.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/qtp.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_air.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/air/airspark.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/netmon.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/mx/mx.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/air/applicationupdater.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/utilities.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/flex.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/sparkskins.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/qtp_air.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/datavisualization.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/spark_dmv.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_dmv.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_flashflexkit.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/air/applicationupdater_ui.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/air/airframework.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_agent.swc" useDefaultLinkType="false"/>
</excludedEntries>
</libraryPathEntry>
<libraryPathEntry kind="1" linkType="1" path="libs"/>
</libraryPath>
<sourceAttachmentPath/>
</compiler>
<applications>
<application path="SparkAndroidComponents.as"/>
</applications>
<modules/>
<buildCSSFiles/>
<flashCatalyst validateFlashCatalystCompatibility="false"/>
</actionScriptProperties>
21 changes: 21 additions & 0 deletions .flexLibProperties
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flexLibProperties includeAllClasses="true" useMultiPlatformConfig="true" version="3">
<includeClasses>
<classEntry path="com.yapiodesign.components.android.skins.AndroidButtonSkin"/>
<classEntry path="com.yapiodesign.components.android.skins.AndroidCheckBoxSkin"/>
<classEntry path="com.yapiodesign.components.android.assets.AlertIconBD"/>
<classEntry path="com.yapiodesign.components.android.assets.ClockIconBD"/>
<classEntry path="com.yapiodesign.components.android.button.AndroidButton"/>
<classEntry path="com.yapiodesign.components.android.events.AndroidButtonEvent"/>
<classEntry path="com.yapiodesign.components.android.assets.OptionMenu_IconBD"/>
<classEntry path="com.yapiodesign.components.android.timepicker.TimePicker"/>
<classEntry path="com.yapiodesign.components.android.skins.TimePickerSkin"/>
</includeClasses>
<includeResources>
<resourceEntry destPath="com/yapiodesign/components/android/assets/plus_icon.png" sourcePath="com/yapiodesign/components/android/assets/plus_icon.png"/>
<resourceEntry destPath="com/yapiodesign/components/android/assets/alert_icon.png" sourcePath="com/yapiodesign/components/android/assets/alert_icon.png"/>
<resourceEntry destPath="com/yapiodesign/components/android/assets/minus_icon.png" sourcePath="com/yapiodesign/components/android/assets/minus_icon.png"/>
<resourceEntry destPath="com/yapiodesign/components/android/assets/clock_icon.png" sourcePath="com/yapiodesign/components/android/assets/clock_icon.png"/>
</includeResources>
<namespaceManifests/>
</flexLibProperties>
18 changes: 18 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>SparkAndroidComponents</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.adobe.flexbuilder.project.flexbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.adobe.flexbuilder.project.flexlibnature</nature>
<nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
</natures>
</projectDescription>
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Flex 4.5 Android UI Components

Collection of Android UI components for Flex 4.5 mobile development.

# Whats included

All the skins were built to best mimic the Droid 2 (the device I have)

Skins
-----

- Button
- CheckBox

Components
----------

- AndroidButton: supports mouse down and hold
- VerticalStepper
- AlertPopUp
- DatePicker PopUp
- TimerPicker PopUp
- OptionMenu PopUp
Binary file added libs/FlexOOPUtilities.swc
Binary file not shown.
148 changes: 148 additions & 0 deletions src/com/yapiodesign/components/android/alert/AlertDialog.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
package com.yapiodesign.components.android.alert
{
import com.yapiodesign.components.android.skins.AlertDialogSkin;

import flash.events.Event;
import flash.events.MouseEvent;

import mx.states.OverrideBase;
import mx.styles.CSSStyleDeclaration;

import spark.components.Button;
import spark.components.Image;
import spark.components.Label;
import spark.components.SkinnablePopUpContainer;
import spark.primitives.BitmapImage;
import com.yapiodesign.components.android.skins.AlertDialogSkin;

public class AlertDialog extends SkinnablePopUpContainer
{

[SkinPart(required="true")]
public var _titleLabel:Label;

[SkinPart(required="true")]
public var _messageLabel:Label;

[SkinPart(required="true")]
public var _okButton:Button;

[SkinPart(required="true")]
public var _cancelButton:Button;

[SkinPart(required="true")]
public var _icon:BitmapImage;

private var _title:String;
private var _message:String;
private var _itemId:int;

public function AlertDialog()
{
super();

setStyle("skinClass", AlertDialogSkin);

addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}



protected function onAddedToStage(event:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);

this.width = stage.stageWidth;
this.height = stage.stageHeight;
}


protected function onButtonClick(event:MouseEvent):void
{
switch (event.target)
{
case _okButton:
close(true);
break;

case _cancelButton:
close(false);
break;
}
}

public function get title():String
{
return _title;
}

public function set title(value:String):void
{
_title = value;
}

public function get message():String
{
return _message;
}

public function set message(value:String):void
{
_message = value;
}

public function get itemId():int
{
return _itemId;
}

public function set itemId(value:int):void
{
_itemId = value;
}

override protected function commitProperties():void
{
super.commitProperties();
_titleLabel.text = title;
_messageLabel.text = message;
}


protected override function partAdded(partName:String, instance:Object):void
{
//TODO Auto-generated method stub
super.partAdded(partName, instance);

if (instance == _okButton)
{
_okButton.addEventListener(MouseEvent.CLICK, onButtonClick);
}

if (instance == _cancelButton)
{
_cancelButton.addEventListener(MouseEvent.CLICK, onButtonClick);
}

}


protected override function partRemoved(partName:String, instance:Object):void
{
//TODO Auto-generated method stub
super.partRemoved(partName, instance);

if (instance == _okButton)
{
_okButton.removeEventListener(MouseEvent.CLICK, onButtonClick);
}

if (instance == _cancelButton)
{
_cancelButton.removeEventListener(MouseEvent.CLICK, onButtonClick);
}
}


}
}
13 changes: 13 additions & 0 deletions src/com/yapiodesign/components/android/assets/AlertIconBD.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.yapiodesign.components.android.assets
{
import flash.display.BitmapData;

[Embed(source="/com/yapiodesign/components/android/assets/alert_icon.png")]
public class AlertIconBD extends BitmapData
{
public function AlertIconBD(width:int, height:int, transparent:Boolean = true, fillColor:uint = 4.294967295E9)
{
super(width, height, transparent, fillColor);
}
}
}
13 changes: 13 additions & 0 deletions src/com/yapiodesign/components/android/assets/ClockIconBD.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.yapiodesign.components.android.assets
{
import flash.display.BitmapData;

[Embed(source="/com/yapiodesign/components/android/assets/clock_icon.png")]
public class ClockIconBD extends BitmapData
{
public function ClockIconBD(width:int, height:int, transparent:Boolean = true, fillColor:uint = 4.294967295E9)
{
super(width, height, transparent, fillColor);
}
}
}
13 changes: 13 additions & 0 deletions src/com/yapiodesign/components/android/assets/OptionMenu_IconBD.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.yapiodesign.components.android.assets
{
import flash.display.BitmapData;

[Embed(source="/com/yapiodesign/components/android/assets/optionsmenu_icon.png")]
public class OptionMenu_IconBD extends BitmapData
{
public function OptionMenu_IconBD(width:int, height:int, transparent:Boolean = true, fillColor:uint = 4.294967295E9)
{
super(width, height, transparent, fillColor);
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions src/com/yapiodesign/components/android/button/AndroidButton.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.yapiodesign.components.android.button
{
import com.yapiodesign.components.android.events.AndroidButtonEvent;
import com.yapiodesign.components.android.skins.AndroidButtonSkin;

import flash.events.Event;
import flash.events.MouseEvent;

import spark.components.Button;

[Event(name="mouseDownAndHold", type="com.yapiodesign.components.android.events.AndroidButtonEvent")]

public class AndroidButton extends Button
{

private var _mouseDownCount:int = 0;

public function AndroidButton()
{
super();
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);

}

protected function onAddedToStage(event:Event):void
{
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
}

protected function onMouseDown(event:MouseEvent):void
{
removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);

addEventListener(Event.ENTER_FRAME, onTick);

stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
}

protected function onTick(event:Event):void
{
_mouseDownCount++;
if (_mouseDownCount % 8 == 0)
dispatchEvent(new AndroidButtonEvent(AndroidButtonEvent.MOUSE_DOWN_AND_HOLD));
}

protected function onMouseUp(event:MouseEvent):void
{
_mouseDownCount = 0;
removeEventListener(Event.ENTER_FRAME, onTick);
stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
}
}
}
Loading

0 comments on commit ca8dc60

Please sign in to comment.