You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by bi...@apache.org on 2014/12/20 00:35:33 UTC
[1/6] git commit: [flex-examples] [refs/heads/develop] - Remove
redundant Android skins (it now comes with the 4.14 SDK)
Repository: flex-examples
Updated Branches:
refs/heads/develop eb3b97acb -> dad386f5b
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/ViewMenuItemSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/ViewMenuItemSkin.as b/tourdeflexmobile/src/spark/skins/android4/ViewMenuItemSkin.as
deleted file mode 100644
index ae9a68e..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/ViewMenuItemSkin.as
+++ /dev/null
@@ -1,238 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package spark.skins.android4
-{
- import flash.display.GradientType;
- import flash.display.Graphics;
-
- import mx.core.DPIClassification;
- import mx.core.mx_internal;
-
- import spark.components.IconPlacement;
- import spark.skins.mobile.assets.ViewMenuItem_down;
- import spark.skins.mobile.assets.ViewMenuItem_showsCaret;
- import spark.skins.mobile.assets.ViewMenuItem_up;
- import spark.skins.mobile.supportClasses.ButtonSkinBase;
- import spark.skins.mobile120.assets.ViewMenuItem_down;
- import spark.skins.mobile120.assets.ViewMenuItem_showsCaret;
- import spark.skins.mobile120.assets.ViewMenuItem_up;
- import spark.skins.mobile320.assets.ViewMenuItem_down;
- import spark.skins.mobile320.assets.ViewMenuItem_showsCaret;
- import spark.skins.mobile320.assets.ViewMenuItem_up;
-// import spark.skins.mobile480.assets.ViewMenuItem_down;
- //import spark.skins.mobile480.assets.ViewMenuItem_showsCaret;
- //import spark.skins.mobile480.assets.ViewMenuItem_up;
- import spark.skins.mobile640.assets.ViewMenuItem_down;
- import spark.skins.mobile640.assets.ViewMenuItem_showsCaret;
- import spark.skins.mobile640.assets.ViewMenuItem_up;
-
-
- use namespace mx_internal;
-
- /**
- * Default skin for ViewMenuItem. Supports a label, icon and iconPlacement and draws a background.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public class ViewMenuItemSkin extends ButtonSkin
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public function ViewMenuItemSkin()
- {
- super();
-
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
-
- upBorderSkin = spark.skins.mobile640.assets.ViewMenuItem_up;
- downBorderSkin = spark.skins.mobile640.assets.ViewMenuItem_down;
- showsCaretBorderSkin = spark.skins.mobile640.assets.ViewMenuItem_showsCaret;
-
- layoutGap = 24;
- layoutPaddingLeft = 24;
- layoutPaddingRight = 24;
- layoutPaddingTop = 24;
- layoutPaddingBottom = 24;
- layoutBorderSize = 3;
-
- break;
- }
- case DPIClassification.DPI_480:
- {
- // Note provisional may need changes
- upBorderSkin = spark.skins.mobile.assets.ViewMenuItem_up;
- downBorderSkin = spark.skins.mobile.assets.ViewMenuItem_down;
- showsCaretBorderSkin = spark.skins.mobile.assets.ViewMenuItem_showsCaret;
-
- layoutGap = 16;
- layoutPaddingLeft = 16;
- layoutPaddingRight = 16;
- layoutPaddingTop = 16;
- layoutPaddingBottom = 16;
- layoutBorderSize = 2;
-
- break;
-
- }
- case DPIClassification.DPI_320:
- {
-
- upBorderSkin = spark.skins.mobile320.assets.ViewMenuItem_up;
- downBorderSkin = spark.skins.mobile320.assets.ViewMenuItem_down;
- showsCaretBorderSkin = spark.skins.mobile320.assets.ViewMenuItem_showsCaret;
-
- layoutGap = 12;
- layoutPaddingLeft = 12;
- layoutPaddingRight = 12;
- layoutPaddingTop = 12;
- layoutPaddingBottom = 12;
- layoutBorderSize = 2;
-
-
- break;
- }
- case DPIClassification.DPI_240:
- {
- upBorderSkin = spark.skins.mobile.assets.ViewMenuItem_up;
- downBorderSkin = spark.skins.mobile.assets.ViewMenuItem_down;
- showsCaretBorderSkin = spark.skins.mobile.assets.ViewMenuItem_showsCaret;
-
- layoutGap = 8;
- layoutPaddingLeft = 8;
- layoutPaddingRight = 8;
- layoutPaddingTop = 8;
- layoutPaddingBottom = 8;
- layoutBorderSize = 1;
-
- break;
-
- }
- case DPIClassification.DPI_120:
- {
- upBorderSkin = spark.skins.mobile120.assets.ViewMenuItem_up;
- downBorderSkin = spark.skins.mobile120.assets.ViewMenuItem_down;
- showsCaretBorderSkin = spark.skins.mobile120.assets.ViewMenuItem_showsCaret;
-
- layoutGap = 4;
- layoutPaddingLeft = 4;
- layoutPaddingRight = 4;
- layoutPaddingTop = 4;
- layoutPaddingBottom = 4;
- layoutBorderSize = 1;
-
- break;
-
- }
- default:
- {
- upBorderSkin = spark.skins.mobile.assets.ViewMenuItem_up;
- downBorderSkin = spark.skins.mobile.assets.ViewMenuItem_down;
- showsCaretBorderSkin = spark.skins.mobile.assets.ViewMenuItem_showsCaret;
-
- layoutGap = 6;
- layoutPaddingLeft = 6;
- layoutPaddingRight = 6;
- layoutPaddingTop = 6;
- layoutPaddingBottom = 6;
- layoutBorderSize = 1;
- }
- }
-
- }
-
- /**
- * Class to use for the border in the showsCaret state.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- *
- * @default Button_down
- */
- protected var showsCaretBorderSkin:Class;
-
- /**
- * @private
- */
- override protected function getBorderClassForCurrentState():Class
- {
- var borderClass:Class = super.getBorderClassForCurrentState();
-
- if (currentState == "showsCaret")
- borderClass = showsCaretBorderSkin;
-
- return borderClass;
- }
-
- /**
- * @private
- */
- override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
- {
- var iconPlacement:String = getStyle("iconPlacement");
- useCenterAlignment = (iconPlacement == IconPlacement.LEFT)
- || (iconPlacement == IconPlacement.RIGHT);
-
- super.layoutContents(unscaledWidth, unscaledHeight);
- }
-
- /**
- * @private
- */
- override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
- {
- // omit call to super.drawBackground(), drawRect instead
-
- if (currentState == "showsCaret" || currentState == "down")
- {
- graphics.beginFill(getStyle("focusColor"));
- }
- else
- {
- colorMatrix.createGradientBox(unscaledWidth,
- unscaledHeight,
- Math.PI / 2, 0, 0);
- var chromeColor:uint = getStyle("chromeColor");
-
- graphics.beginGradientFill(GradientType.LINEAR,
- [chromeColor, chromeColor],
- [1.0, 1.0],
- [0, 255],
- colorMatrix);
- }
- graphics.drawRect(0,0,unscaledWidth,unscaledHeight);
- graphics.lineStyle(0.5,0,0.2);
- graphics.drawRect(0,unscaledHeight,unscaledWidth,0.5);
- graphics.endFill();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/ViewMenuSkin.mxml
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/ViewMenuSkin.mxml b/tourdeflexmobile/src/spark/skins/android4/ViewMenuSkin.mxml
deleted file mode 100644
index 36feed6..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/ViewMenuSkin.mxml
+++ /dev/null
@@ -1,184 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
--->
-
-
-<!--- The default skin class for a Spark ViewMenu in a mobile application.
-
-@see spark.components.ViewMenu
-
-@langversion 3.0
-@playerversion Flash 10
-@playerversion AIR 1.5
-@productversion Flex 4
--->
-<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:fb="http://ns.adobe.com/flashbuilder/2009" alpha.disabled="0.5">
-
- <fx:Metadata>
- <![CDATA[
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- */
- [HostComponent("spark.components.ViewMenu")]
- ]]>
- </fx:Metadata>
-
- <fx:Script fb:purpose="styling">
- <![CDATA[
- import mx.core.DPIClassification;
- import mx.core.FlexGlobals;
- import spark.effects.easing.Power;
-
-
- /**
- * @private
- */
- override protected function initializationComplete():void
- {
- useChromeColor = false;
- super.initializationComplete();
- }
-
- /**
- * @copy spark.skins.mobile.supportClasses.MobileSkin#applicationDPI
- */
- public function get applicationDPI():int
- {
- return FlexGlobals.topLevelApplication.applicationDPI;
- }
-
- /**
- * @private
- */
- override protected function measure():void
- {
- super.measure();
-
- // not actually used in normal situations, but
- // is here to prevent bug 28950 if ViewMenu is misused
- measuredHeight = 200;
- }
-
- /**
- * @private
- */
- override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.updateDisplayList(unscaledWidth, unscaledHeight);
-
- var strokeWeight:Number = (applicationDPI == DPIClassification.DPI_640 || applicationDPI == DPIClassification.DPI_480 || applicationDPI == DPIClassification.DPI_320) ? 2 : 1;
- var separatorWeight:Number = 1;
-
- if (applicationDPI == DPIClassification.DPI_640)
- separatorWeight = 6;
- else if (applicationDPI == DPIClassification.DPI_480)
- separatorWeight = 4;
- else if (applicationDPI == DPIClassification.DPI_320)
- separatorWeight = 3;
- else if (applicationDPI == DPIClassification.DPI_240)
- separatorWeight = 2;
- else if (applicationDPI == DPIClassification.DPI_120)
- separatorWeight = 1;
-
- contentGroup.top = strokeWeight + separatorWeight;
- contentGroup.bottom = separatorWeight;
- contentGroupLayout.gap = separatorWeight;
- }
-
- ]]>
- </fx:Script>
-
- <s:states>
- <s:State name="normal" stateGroups="openedGroup"/>
- <s:State name="closed" stateGroups="closedGroup"/>
- <s:State name="disabled" stateGroups="openedGroup"/>
- <s:State name="normalAndLandscape" stateGroups="openedGroup, landscapeGroup"/>
- <s:State name="closedAndLandscape" stateGroups="closedGroup, landscapeGroup"/>
- <s:State name="disabledAndLandscape" stateGroups="openedGroup, landscapeGroup" />
- </s:states>
-
- <s:transitions>
- <s:Transition fromState="closed" toState="normal" autoReverse="true">
- <s:Parallel>
- <s:Fade target="{chromeGroup}" duration="150" easer="{new Power(0.5, 3)}" />
- <s:Move target="{chromeGroup}" duration="150" disableLayout="true" easer="{new Power(0, 5)}"/>
- </s:Parallel>
- </s:Transition>
-
- <s:Transition fromState="closedAndLandscape" toState="normalAndLandscape" autoReverse="true">
- <s:Parallel>
- <s:Fade target="{chromeGroup}" duration="150" easer="{new Power(0.5, 3)}" />
- <s:Move target="{chromeGroup}" duration="150" disableLayout="true" easer="{new Power(0, 5)}"/>
- </s:Parallel>
- </s:Transition>
-
- <s:Transition fromState="normal" toState="closed" autoReverse="true">
- <s:Parallel>
- <s:Fade target="{chromeGroup}" duration="100"/>
- <s:Move target="{chromeGroup}" duration="100" disableLayout="true"/>
- </s:Parallel>
- </s:Transition>
-
- <s:Transition fromState="normalAndLandscape" toState="closedAndLandscape" autoReverse="true">
- <s:Parallel>
- <s:Fade target="{chromeGroup}" duration="100"/>
- <s:Move target="{chromeGroup}" duration="100" disableLayout="true"/>
- </s:Parallel>
- </s:Transition>
- </s:transitions>
-
- <!-- The ViewMenu and its skin are sized to the application.
- The menu chrome is a separate group that is anchored to the bottom of the skin. -->
-
-
- <s:Group id="chromeGroup"
- left="0"
- right="0"
- top.closedGroup="{hostComponent.height - chromeGroup.height / 2}"
- bottom.openedGroup="0"
- visible.closedGroup="false">
-
- <s:Rect id="backgroundRect" left="18" right="18" top="1" bottom="0">
- <s:fill>
- <s:SolidColor color="#FFFFFF" />
- </s:fill>
- <s:stroke>
- <s:SolidColorStroke weight="0.5" alpha="0.2" />
- </s:stroke>
- <s:filters>
- <s:DropShadowFilter alpha="0.5" />
- </s:filters>
- </s:Rect>
-
- <!--
- Note: setting the minimum size to 0 here so that changes to the host component's
- size will not be thwarted by this skin part's minimum size. This is a compromise,
- more about it here: http://bugs.adobe.com/jira/browse/SDK-21143
- -->
- <!--- @copy spark.components.SkinnableContainer#contentGroup -->
- <s:Group id="contentGroup" left="20" right="20" top="3" bottom="2" minWidth="0" minHeight="0">
- <s:layout>
- <s:VerticalLayout gap="-1" id="contentGroupLayout" horizontalAlign="contentJustify" >
- </s:VerticalLayout>
- </s:layout>
- </s:Group>
- </s:Group>
-</s:SparkSkin>
-
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/supportClasses/CalloutArrow.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/supportClasses/CalloutArrow.as b/tourdeflexmobile/src/spark/skins/android4/supportClasses/CalloutArrow.as
deleted file mode 100644
index cf30796..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/supportClasses/CalloutArrow.as
+++ /dev/null
@@ -1,457 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4.supportClasses
-{
- import flash.display.BlendMode;
- import flash.display.GradientType;
- import flash.display.Graphics;
- import flash.display.GraphicsPathCommand;
- import flash.display.Sprite;
-
- import mx.core.DPIClassification;
- import mx.core.FlexGlobals;
- import mx.core.IVisualElement;
- import mx.core.UIComponent;
- import mx.core.mx_internal;
- import mx.utils.ColorUtil;
-
- import spark.components.Application;
- import spark.components.ArrowDirection;
- import spark.components.Callout;
- import spark.skins.android4.CalloutSkin;
- import spark.skins.mobile.supportClasses.MobileSkin;
-
- use namespace mx_internal;
-
- /**
- * The arrow skin part for CalloutSkin.
- *
- * @see spark.skin.mobile.CalloutSkin
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- public class CalloutArrow extends UIComponent
- {
- public function CalloutArrow()
- {
- super();
-
- useBackgroundGradient = true;
-
- var applicationDPI:Number = DPIClassification.DPI_160;
- if (FlexGlobals.topLevelApplication is Application)
- {
- applicationDPI = Application(FlexGlobals.topLevelApplication).applicationDPI;
- }
-
- // Copy DPI-specific values from CalloutSkin
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
- // Note provisional may need changes
- gap = 32;
- backgroundGradientHeight = 440;
- highlightWeight = 4;
-
- break;
- }
- case DPIClassification.DPI_480:
- {
- // Note provisional may need changes
- gap = 24;
- backgroundGradientHeight = 330;
- highlightWeight = 3;
-
- break;
- }
- case DPIClassification.DPI_320:
- {
- gap = 16;
- backgroundGradientHeight = 220;
- highlightWeight = 2;
-
- break;
- }
- case DPIClassification.DPI_240:
- {
- gap = 12;
- backgroundGradientHeight = 165;
- highlightWeight = 1;
-
- break;
- }
- case DPIClassification.DPI_120:
- {
- // Note provisional may need changes
- gap = 6;
- backgroundGradientHeight = 83;
- highlightWeight = 1;
-
- break;
- }
- default:
- {
- // default DPI_160
- gap = 8;
- backgroundGradientHeight = 110;
- highlightWeight = 1;
-
- break;
- }
- }
- }
-
- /**
- * A gap on the frame-adjacent side of the arrow graphic to avoid
- * drawing past the CalloutSkin backgroundCornerRadius.
- *
- * <p>The default implementation matches the gap value with the
- * <code>backgroundCornerRadius</code> value in <code>CalloutSkin</code>.</p>
- *
- * @see spark.skins.mobile.CalloutSkin#backgroundCornerRadius
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var gap:Number;
-
- /**
- * @copy spark.skins.mobile.CalloutSkin#backgroundGradientHeight
- */
- protected var backgroundGradientHeight:Number;
-
- /**
- * @copy spark.skins.mobile.CalloutSkin#highlightWeight
- */
- private var highlightWeight:Number;
-
- /**
- * @copy spark.skins.mobile.CalloutSkin#useBackgroundGradient
- */
- protected var useBackgroundGradient:Boolean;
-
- /**
- * @copy spark.skins.mobile.CalloutSkin#borderColor
- */
- protected var borderColor:Number = -1; // if not set
-
- /**
- * @copy spark.skins.mobile.CalloutSkin#borderThickness
- */
- protected var borderThickness:Number = -1 ; // marker that borderThickness was not set directly
-
- /**
- * @private
- * A sibling of the arrow used to erase the drop shadow in CalloutSkin
- */
- private var eraseFill:Sprite;
-
- /* helper private accessors */
-
- /* returns borderThickness from style if member is -1, or borderThickness. Returns 0 if NaN */
- private function get actualBorderThickness():Number
- {
- return calloutSkin.actualBorderThickness;
- }
-
- private function get actualBorderColor():uint
- {
- return calloutSkin.actualBorderColor;
- }
-
- protected function get calloutSkin():CalloutSkin
- {
- return parent as CalloutSkin ;
- }
-
- protected function get calloutHostComponent():Callout {
- return calloutSkin.hostComponent;
- }
-
- /**
- * @private
- */
-
- override protected function createChildren():void
- {
- super.createChildren();
-
- // eraseFill has the same position and arrow shape in order to erase
- // the drop shadow under the arrow when backgroundAlpha < 1
- eraseFill = new Sprite();
- eraseFill.blendMode = BlendMode.ERASE;
-
- // layer eraseFill below the arrow
- parent.addChildAt(eraseFill, parent.getChildIndex(this));
- }
-
- /**
- * @private
- */
- override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.updateDisplayList(unscaledWidth, unscaledHeight);
-
- graphics.clear();
- eraseFill.graphics.clear();
- var hostComponent: Callout = calloutHostComponent;
- var arrowDirection:String = hostComponent.arrowDirection;
-
- if (arrowDirection == ArrowDirection.NONE)
- return;
-
- // when drawing the arrow, compensate for cornerRadius via padding
- var arrowGraphics:Graphics = this.graphics;
- var eraseGraphics:Graphics = eraseFill.graphics;
- var arrowWidth:Number = unscaledWidth;
- var arrowHeight:Number = unscaledHeight;
- var arrowX:Number = 0;
- var arrowY:Number = 0;
- var arrowTipX:Number = 0;
- var arrowTipY:Number = 0;
- var arrowEndX:Number = 0;
- var arrowEndY:Number = 0;
-
- var borderWeight:Number = actualBorderThickness;
- var showBorder:Boolean = borderWeight > 0;
-
- var borderHalf:Number = borderWeight / 2;
- var isHorizontal:Boolean = false;
-
- if ((arrowDirection == ArrowDirection.LEFT) ||
- (arrowDirection == ArrowDirection.RIGHT))
- {
- isHorizontal = true;
-
- arrowX = -borderHalf;
- arrowY = gap;
- arrowHeight = arrowHeight - (gap * 2);
-
- arrowTipX = arrowWidth - borderHalf;
- arrowTipY = arrowY + (arrowHeight / 2);
-
- arrowEndX = arrowX;
- arrowEndY = arrowY + arrowHeight;
-
- // flip coordinates to point left
- if (arrowDirection == ArrowDirection.LEFT)
- {
- arrowX = arrowWidth - arrowX;
- arrowTipX = arrowWidth - arrowTipX;
- arrowEndX = arrowWidth - arrowEndX;
- }
- }
- else
- {
- arrowX = gap;
- arrowY = -borderHalf;
- arrowWidth = arrowWidth - (gap * 2);
-
- arrowTipX = arrowX + (arrowWidth / 2);
- arrowTipY = arrowHeight - borderHalf;
-
- arrowEndX = arrowX + arrowWidth;
- arrowEndY = arrowY;
-
- // flip coordinates to point up
- if (hostComponent.arrowDirection == ArrowDirection.UP)
- {
- arrowY = arrowHeight - arrowY;
- arrowTipY = arrowHeight - arrowTipY;
- arrowEndY = arrowHeight - arrowEndY;
- }
- }
-
- var commands:Vector.<int> = new Vector.<int>(3, true);
- commands[0] = GraphicsPathCommand.MOVE_TO;
- commands[1] = GraphicsPathCommand.LINE_TO;
- commands[2] = GraphicsPathCommand.LINE_TO;
-
- var coords:Vector.<Number> = new Vector.<Number>(6, true);
- coords[0] = arrowX;
- coords[1] = arrowY;
- coords[2] = arrowTipX
- coords[3] = arrowTipY;
- coords[4] = arrowEndX
- coords[5] = arrowEndY;
-
- var backgroundColor:Number = getStyle("backgroundColor");
- var backgroundAlpha:Number = getStyle("backgroundAlpha");
-
- if (useBackgroundGradient)
- {
- var backgroundColorTop:Number = ColorUtil.adjustBrightness2(backgroundColor,
- CalloutSkin.BACKGROUND_GRADIENT_BRIGHTNESS_TOP);
- var backgroundColorBottom:Number = ColorUtil.adjustBrightness2(backgroundColor,
- CalloutSkin.BACKGROUND_GRADIENT_BRIGHTNESS_BOTTOM);
-
- // translate the gradient based on the arrow position
- MobileSkin.colorMatrix.createGradientBox(unscaledWidth,
- backgroundGradientHeight, Math.PI / 2, 0, -getLayoutBoundsY());
-
- arrowGraphics.beginGradientFill(GradientType.LINEAR,
- [backgroundColorTop, backgroundColorBottom],
- [backgroundAlpha, backgroundAlpha],
- [0, 255],
- MobileSkin.colorMatrix);
- }
- else
- {
- arrowGraphics.beginFill(backgroundColor, backgroundAlpha);
- }
-
- // cover the adjacent border from the callout frame
- if (showBorder)
- {
- var coverX:Number = 0;
- var coverY:Number = 0;
- var coverWidth:Number = 0;
- var coverHeight:Number = 0;
-
- switch (arrowDirection)
- {
- case ArrowDirection.UP:
- {
- coverX = arrowX;
- coverY = arrowY;
- coverWidth = arrowWidth;
- coverHeight = borderWeight;
- break;
- }
- case ArrowDirection.DOWN:
- {
- coverX = arrowX;
- coverY = -borderWeight;
- coverWidth = arrowWidth;
- coverHeight = borderWeight;
- break;
- }
- case ArrowDirection.LEFT:
- {
- coverX = arrowX;
- coverY = arrowY;
- coverWidth = borderWeight;
- coverHeight = arrowHeight;
- break;
- }
- case ArrowDirection.RIGHT:
- {
- coverX = -borderWeight;
- coverY = arrowY;
- coverWidth = borderWeight;
- coverHeight = arrowHeight;
- break;
- }
- }
-
- arrowGraphics.drawRect(coverX, coverY, coverWidth, coverHeight);
- }
-
- // erase the drop shadow from the CalloutSkin
- if (backgroundAlpha < 1)
- {
- // move eraseFill to the same position as the arrow
- eraseFill.x = getLayoutBoundsX()
- eraseFill.y = getLayoutBoundsY();
-
- // draw the arrow shape
- eraseGraphics.beginFill(0, 1);
- eraseGraphics.drawPath(commands, coords);
- eraseGraphics.endFill();
- }
-
- // draw arrow path
- if (showBorder)
- arrowGraphics.lineStyle(borderWeight, actualBorderColor, 1, true);
-
- arrowGraphics.drawPath(commands, coords);
- arrowGraphics.endFill();
-
- // adjust the highlight position to the origin of the callout
- var isArrowUp:Boolean = (arrowDirection == ArrowDirection.UP);
- var offsetY:Number = (isArrowUp) ? unscaledHeight : -getLayoutBoundsY();
-
- // highlight starts after the backgroundCornerRadius
- var highlightX:Number = gap - getLayoutBoundsX();
-
- // highlight Y position is based on the stroke weight
- var highlightOffset:Number = (highlightWeight * 1.5);
- var highlightY:Number = highlightOffset + offsetY;
-
- // highlight width spans the callout width minus the corner radius
- var highlightWidth:Number = IVisualElement(calloutSkin).getLayoutBoundsWidth() - (gap * 2);
-
- if (isHorizontal)
- {
- highlightWidth -= arrowWidth;
-
- if (arrowDirection == ArrowDirection.LEFT)
- highlightX += arrowWidth;
- }
-
- // highlight on the top edge is drawn in the arrow only in the UP direction
- if (useBackgroundGradient)
- {
- if (isArrowUp)
- {
- // highlight follows the top edge, including the arrow
- var rightWidth:Number = highlightWidth - arrowWidth;
-
- // highlight style
- arrowGraphics.lineStyle(highlightWeight, 0xFFFFFF, 0.2 * backgroundAlpha);
-
- // in the arrow coordinate space, the highlightX must be less than 0
- if (highlightX < 0)
- {
- arrowGraphics.moveTo(highlightX, highlightY);
- arrowGraphics.lineTo(arrowX, highlightY);
-
- // compute the remaining highlight
- rightWidth -= (arrowX - highlightX);
- }
-
- // arrow highlight (adjust Y downward)
- coords[1] = arrowY + highlightOffset;
- coords[3] = arrowTipY + highlightOffset;
- coords[5] = arrowEndY + highlightOffset;
- arrowGraphics.drawPath(commands, coords);
-
- // right side
- if (rightWidth > 0)
- {
- arrowGraphics.moveTo(arrowEndX, highlightY);
- arrowGraphics.lineTo(arrowEndX + rightWidth, highlightY);
- }
- }
- else
- {
- // straight line across the top
- arrowGraphics.lineStyle(highlightWeight, 0xFFFFFF, 0.2 * backgroundAlpha);
- arrowGraphics.moveTo(highlightX, highlightY);
- arrowGraphics.lineTo(highlightX + highlightWidth, highlightY);
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/supportClasses/StageTextSkinBase.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/supportClasses/StageTextSkinBase.as b/tourdeflexmobile/src/spark/skins/android4/supportClasses/StageTextSkinBase.as
deleted file mode 100644
index bef04b5..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/supportClasses/StageTextSkinBase.as
+++ /dev/null
@@ -1,402 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package spark.skins.android4.supportClasses
-{
- import flash.display.DisplayObject;
- import flash.events.FocusEvent;
-
- import mx.core.DPIClassification;
- import mx.core.mx_internal;
-
- import spark.components.supportClasses.IStyleableEditableText;
- import spark.components.supportClasses.SkinnableTextBase;
- import spark.components.supportClasses.StyleableStageText;
- import spark.components.supportClasses.StyleableTextField;
- import spark.core.IDisplayText;
- import spark.skins.mobile.supportClasses.MobileSkin;
-
- use namespace mx_internal;
-
- /**
- * ActionScript-based skin for text input controls in mobile applications.
- *
- * @langversion 3.0
- * @playerversion AIR 3.0
- * @productversion Flex 4.6
- */
- public class StageTextSkinBase extends MobileSkin
- {
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion AIR 3.0
- * @productversion Flex 4.6
- *
- */
- public function StageTextSkinBase()
- {
- super();
-
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
- measuredDefaultWidth = 1200;
- measuredDefaultHeight = 132;
- layoutBorderSize = 4;
- flatheight = 9;
- break;
- }
- case DPIClassification.DPI_480:
- {
- measuredDefaultWidth = 880;
- measuredDefaultHeight = 100;
- layoutBorderSize = 3;
- flatheight = 7;
- break;
- }
- case DPIClassification.DPI_320:
- {
- measuredDefaultWidth = 600;
- measuredDefaultHeight = 66;
- layoutBorderSize = 2;
- flatheight = 6;
- break;
- }
- case DPIClassification.DPI_240:
- {
- measuredDefaultWidth = 440;
- measuredDefaultHeight = 50;
- layoutBorderSize = 2;
- flatheight = 5;
- break;
- }
- case DPIClassification.DPI_120:
- {
- measuredDefaultWidth = 220;
- measuredDefaultHeight = 25;
- layoutBorderSize = 1;
- flatheight = 2;
- break;
- }
- default:
- {
- measuredDefaultWidth = 300;
- measuredDefaultHeight = 33;
- layoutBorderSize = 1;
- flatheight = 3;
- break;
- }
-
- }
- addEventListener(FocusEvent.FOCUS_IN, focusChangeHandler);
- addEventListener(FocusEvent.FOCUS_OUT, focusChangeHandler);
- }
-
- //--------------------------------------------------------------------------
- //
- // Graphics variables
- //
- //--------------------------------------------------------------------------
-
-
- //--------------------------------------------------------------------------
- //
- // Layout variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * Defines the border's thickness.
- *
- * @langversion 3.0
- * @playerversion AIR 3.0
- * @productversion Flex 4.6
- */
- protected var layoutBorderSize:uint;
-
- protected var flatheight:uint;
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
-
- protected var isFocused:Boolean = false;
-
- /**
- * @private
- *
- * Instance of the border graphics.
- */
- protected var border:DisplayObject;
-
- private var borderVisibleChanged:Boolean = false;
-
- /**
- * @private
- *
- * Multiline flag.
- */
- protected var multiline:Boolean = false;
-
- //--------------------------------------------------------------------------
- //
- // Skin parts
- //
- //--------------------------------------------------------------------------
-
- /**
- * textDisplay skin part.
- *
- * @langversion 3.0
- * @playerversion AIR 3.0
- * @productversion Flex 4.6
- */
- public var textDisplay:IStyleableEditableText;
-
- [Bindable]
- /**
- * Bindable promptDisplay skin part. Bindings fire when promptDisplay is
- * removed and added for proper updating by the SkinnableTextBase.
- *
- * @langversion 3.0
- * @playerversion AIR 3.0
- * @productversion Flex 4.6
- */
- public var promptDisplay:IDisplayText;
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- override protected function createChildren():void
- {
- super.createChildren();
-
- if (!textDisplay)
- {
- textDisplay = createTextDisplay();
- textDisplay.editable = true;
- textDisplay.styleName = this;
- this.addChild(DisplayObject(textDisplay));
- }
- }
-
- /** Could be overridden by subclasses
- *
- * @return instance of IStyleableEditableText
- */
- protected function createTextDisplay():IStyleableEditableText
- {
- return new StyleableStageText(multiline);
- }
-
- /**
- * @private
- */
- override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.drawBackground(unscaledWidth, unscaledHeight);
-
- var contentBackgroundColor:uint = getStyle("contentBackgroundColor");
- var contentBackgroundAlpha:Number = getStyle("contentBackgroundAlpha");
- //change border color and thickness when in focus
- var borderColor:uint = isFocused ? getStyle("focusColor") : getStyle("borderColor");
- var selectWidth:uint = isFocused ? layoutBorderSize + 1 : layoutBorderSize;
- if (isNaN(contentBackgroundAlpha))
- {
- contentBackgroundAlpha = 1;
- }
- var halfGap:int = flatheight * 2;
- // change the border type
- if (getStyle("contentBackgroundBorder") == "flat")
- {
- //background
- graphics.beginFill(contentBackgroundColor, contentBackgroundAlpha);
- graphics.drawRect(0, 0, unscaledWidth, unscaledHeight - flatheight);
- graphics.endFill();
- //begin flat border
- graphics.beginFill(borderColor, 1);
- //left half border
- graphics.drawRect(0, unscaledHeight - halfGap, selectWidth, flatheight );
- //bottom border
- graphics.drawRect(0, unscaledHeight - flatheight, unscaledWidth, selectWidth);
- //right border
- graphics.drawRect(unscaledWidth - selectWidth, unscaledHeight - halfGap, selectWidth, flatheight);
- graphics.endFill();
- }
- else if (getStyle("contentBackgroundBorder") == "rectangle")
- {
- var borderWidth:uint = layoutBorderSize * 2;
- //rectangle border and background
- graphics.lineStyle(selectWidth, borderColor, 1);
- graphics.beginFill(contentBackgroundColor, contentBackgroundAlpha);
- graphics.drawRect(layoutBorderSize, layoutBorderSize, unscaledWidth - borderWidth, unscaledHeight - borderWidth);
- graphics.endFill();
- }
- }
-
- /**
- * @private
- */
- override public function styleChanged(styleProp:String):void
- {
- var allStyles:Boolean = !styleProp || styleProp == "styleName";
-
- if (allStyles || styleProp == "borderVisible")
- {
- borderVisibleChanged = true;
- invalidateProperties();
- }
-
- if (allStyles || styleProp.indexOf("padding") == 0)
- {
- invalidateDisplayList();
- }
- super.styleChanged(styleProp);
- }
-
- /**
- * @private
- */
- override protected function commitCurrentState():void
- {
- super.commitCurrentState();
-
- alpha = currentState.indexOf("disabled") == -1 ? 1 : 0.5;
-
- var showPrompt:Boolean = currentState.indexOf("WithPrompt") != -1;
-
- if (showPrompt && !promptDisplay)
- {
- promptDisplay = createPromptDisplay();
- promptDisplay.addEventListener(FocusEvent.FOCUS_IN, promptDisplay_focusInHandler);
- }
- else if (!showPrompt && promptDisplay)
- {
- promptDisplay.removeEventListener(FocusEvent.FOCUS_IN, promptDisplay_focusInHandler);
- removeChild(promptDisplay as DisplayObject);
- promptDisplay = null;
- }
- super.commitCurrentState();
-
- invalidateDisplayList();
- }
-
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- * Create a control appropriate for displaying the prompt text in a mobile
- * input field.
- */
- protected function createPromptDisplay():IDisplayText
- {
- var prompt:StyleableTextField = StyleableTextField(createInFontContext(StyleableTextField));
- prompt.styleName = this;
- prompt.editable = false;
- prompt.mouseEnabled = false;
- prompt.useTightTextBounds = false;
- // StageText objects appear in their own layer on top of the display
- // list. So, even though this prompt may be created after the StageText
- // for textDisplay, textDisplay will still be on top.
- addChild(prompt);
-
- return prompt;
- }
-
- /**
- * @private
- * Utility function used by subclasses' measure functions to measure their
- * text host components.
- */
- protected function measureTextComponent(hostComponent:SkinnableTextBase):void
- {
- var paddingLeft:Number = getStyle("paddingLeft");
- var paddingRight:Number = getStyle("paddingRight");
- var paddingTop:Number = getStyle("paddingTop");
- var paddingBottom:Number = getStyle("paddingBottom");
- var textHeight:Number = getStyle("fontSize");
-
- if (textDisplay)
- {
- textHeight = getElementPreferredHeight(textDisplay);
- }
- // width is based on maxChars (if set)
- if (hostComponent && hostComponent.maxChars)
- {
- // Grab the fontSize and subtract 2 as the pixel value for each character.
- // This is just an approximation, but it appears to be a reasonable one
- // for most input and most font.
- var characterWidth:int = Math.max(1, (textHeight - 2));
- measuredWidth = (characterWidth * hostComponent.maxChars) + paddingLeft + paddingRight;
- }
-
- measuredHeight = paddingTop + textHeight + paddingBottom;
- }
-
- //--------------------------------------------------------------------------
- //
- // Event handlers
- //
- //--------------------------------------------------------------------------
-
- /**
- * Listen to see if the component gains focus then change the style to selected
- */
- private function focusChangeHandler(event:FocusEvent):void
- {
- isFocused = event.type == FocusEvent.FOCUS_IN;
- invalidateDisplayList();
- }
-
- /**
- * If the prompt is focused, we need to move focus to the textDisplay
- * StageText. This needs to happen outside of the process of setting focus
- * to the prompt, so we use callLater to do that.
- */
- private function focusTextDisplay():void
- {
- textDisplay.setFocus();
- }
-
- private function promptDisplay_focusInHandler(event:FocusEvent):void
- {
- callLater(focusTextDisplay);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/supportClasses/TextSkinBase.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/supportClasses/TextSkinBase.as b/tourdeflexmobile/src/spark/skins/android4/supportClasses/TextSkinBase.as
deleted file mode 100644
index 70e0294..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/supportClasses/TextSkinBase.as
+++ /dev/null
@@ -1,213 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4.supportClasses
-{
-
- import flash.display.DisplayObject;
-
- import mx.core.mx_internal;
-
- import spark.components.supportClasses.StyleableTextField;
- import spark.skins.mobile.supportClasses.MobileSkin;
-
- use namespace mx_internal;
-
- /**
- * ActionScript-based skin for text input controls in mobile applications that
- * uses a StyleableTextField class for the text display.
- *
- * @see spark.components.supportClasses.StyleableTextField
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public class TextSkinBase extends MobileSkin
- {
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- *
- */
- public function TextSkinBase()
- {
- super();
- }
-
- //--------------------------------------------------------------------------
- //
- // Graphics variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * Defines the border.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
-
- //--------------------------------------------------------------------------
- //
- // Layout variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * Defines the corner radius.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
-
- protected var layoutBorderSize:uint;
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- *
- * Instance of the border graphics.
- */
- protected var border:DisplayObject;
-
- private var borderVisibleChanged:Boolean = false;
-
- //--------------------------------------------------------------------------
- //
- // Skin parts
- //
- //--------------------------------------------------------------------------
-
- /**
- * textDisplay skin part.
- */
- public var textDisplay:StyleableTextField;
-
- [Bindable]
- /**
- * Bindable promptDisplay skin part. Bindings fire when promptDisplay is
- * removed and added for proper updating by the SkinnableTextBase.
- */
- public var promptDisplay:StyleableTextField;
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- override protected function createChildren():void
- {
- super.createChildren();
-
- if (!textDisplay)
- {
- textDisplay = StyleableTextField(createInFontContext(StyleableTextField));
- textDisplay.styleName = this;
- textDisplay.editable = true;
- textDisplay.useTightTextBounds = false;
- addChild(textDisplay);
- }
- }
-
- /**
- * @private
- */
- protected function createPromptDisplay():StyleableTextField
- {
- var prompt:StyleableTextField = StyleableTextField(createInFontContext(StyleableTextField));
- prompt.styleName = this;
- prompt.editable = false;
- prompt.mouseEnabled = false;
- prompt.useTightTextBounds = false;
- prompt.focusEnabled = false;
- return prompt;
- }
-
- /**
- * @private
- */
-
- override public function styleChanged(styleProp:String):void
- {
- var allStyles:Boolean = !styleProp || styleProp == "styleName";
-
- if (allStyles || styleProp == "borderVisible")
- {
- borderVisibleChanged = true;
- invalidateProperties();
- }
-
- if (allStyles || styleProp.indexOf("padding") == 0)
- {
- invalidateDisplayList();
- }
-
- super.styleChanged(styleProp);
- }
-
- /**
- * @private
- */
- override protected function commitCurrentState():void
- {
- super.commitCurrentState();
-
- alpha = currentState.indexOf("disabled") == -1 ? 1 : 0.5;
-
- var showPrompt:Boolean = currentState.indexOf("WithPrompt") >= 0;
-
- if (showPrompt && !promptDisplay)
- {
- promptDisplay = createPromptDisplay();
- addChild(promptDisplay);
- }
- else if (!showPrompt && promptDisplay)
- {
- removeChild(promptDisplay);
- promptDisplay = null;
- }
-
- invalidateDisplayList();
- }
- }
-}
[4/6] git commit: [flex-examples] [refs/heads/develop] - Remove
redundant Android skins (it now comes with the 4.14 SDK)
Posted by bi...@apache.org.
Remove redundant Android skins (it now comes with the 4.14 SDK)
Project: http://git-wip-us.apache.org/repos/asf/flex-examples/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-examples/commit/8ccec1f5
Tree: http://git-wip-us.apache.org/repos/asf/flex-examples/tree/8ccec1f5
Diff: http://git-wip-us.apache.org/repos/asf/flex-examples/diff/8ccec1f5
Branch: refs/heads/develop
Commit: 8ccec1f59b749e246aa509e1cd5013ed9a1f2ce1
Parents: eb3b97a
Author: OmPrakash Muppirala <bi...@gmail.com>
Authored: Fri Dec 19 15:32:23 2014 -0800
Committer: OmPrakash Muppirala <bi...@gmail.com>
Committed: Fri Dec 19 15:32:23 2014 -0800
----------------------------------------------------------------------
.../src/spark/skins/android4/ActionBarSkin.as | 725 ---------------
.../skins/android4/ButtonBarFirstButtonSkin.as | 93 --
.../skins/android4/ButtonBarMiddleButtonSkin.as | 95 --
.../src/spark/skins/android4/ButtonBarSkin.as | 166 ----
.../src/spark/skins/android4/ButtonSkin.as | 397 ---------
.../src/spark/skins/android4/CalloutSkin.as | 825 -----------------
.../src/spark/skins/android4/CheckBoxSkin.as | 268 ------
.../src/spark/skins/android4/DateSpinnerSkin.as | 153 ----
.../src/spark/skins/android4/HScrollBarSkin.as | 205 -----
.../spark/skins/android4/HScrollBarThumbSkin.as | 169 ----
.../src/spark/skins/android4/HSliderSkin.as | 293 ------
.../spark/skins/android4/HSliderThumbSkin.as | 333 -------
.../spark/skins/android4/HSliderTrackSkin.as | 227 -----
.../src/spark/skins/android4/ListSkin.as | 204 -----
.../src/spark/skins/android4/RadioButtonSkin.as | 253 ------
.../skins/android4/SpinnerListContainerSkin.as | 327 -------
.../skins/android4/SpinnerListScrollerSkin.mxml | 94 --
.../src/spark/skins/android4/SpinnerListSkin.as | 293 ------
.../skins/android4/SplitViewNavigatorSkin.as | 157 ----
.../android4/TabbedViewNavigatorTabBarSkin.as | 122 ---
.../skins/android4/TextAreaHScrollBarSkin.as | 105 ---
.../android4/TextAreaHScrollBarThumbSkin.as | 116 ---
.../src/spark/skins/android4/TextAreaSkin.as | 892 -------------------
.../skins/android4/TextAreaVScrollBarSkin.as | 105 ---
.../android4/TextAreaVScrollBarThumbSkin.as | 117 ---
.../src/spark/skins/android4/TextInputSkin.as | 375 --------
.../spark/skins/android4/ToggleSwitchSkin.as | 506 -----------
.../android4/TransparentNavigationButtonSkin.as | 109 ---
.../src/spark/skins/android4/VScrollBarSkin.as | 207 -----
.../spark/skins/android4/VScrollBarThumbSkin.as | 178 ----
.../spark/skins/android4/ViewMenuItemSkin.as | 238 -----
.../src/spark/skins/android4/ViewMenuSkin.mxml | 184 ----
.../android4/supportClasses/CalloutArrow.as | 457 ----------
.../supportClasses/StageTextSkinBase.as | 402 ---------
.../android4/supportClasses/TextSkinBase.as | 213 -----
35 files changed, 9603 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/ActionBarSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/ActionBarSkin.as b/tourdeflexmobile/src/spark/skins/android4/ActionBarSkin.as
deleted file mode 100644
index f1ef220..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/ActionBarSkin.as
+++ /dev/null
@@ -1,725 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
- import flash.display.GradientType;
- import flash.events.Event;
- import flash.text.TextFormatAlign;
-
- import mx.core.DPIClassification;
- import mx.core.mx_internal;
- import mx.utils.ColorUtil;
-
- import spark.components.ActionBar;
- import spark.components.Group;
- import spark.components.supportClasses.StyleableTextField;
- import spark.core.SpriteVisualElement;
- import spark.layouts.HorizontalAlign;
- import spark.layouts.HorizontalLayout;
- import spark.layouts.VerticalAlign;
- import spark.skins.android4.assets.ActionBarBackground;
- import spark.skins.mobile.supportClasses.MobileSkin;
-
- use namespace mx_internal;
-
- /**
- * The default skin class for the Spark ActionBar component in mobile
- * applications.
- *
- * @see spark.components.ActionBar
- * @see spark.skins.mobile.TransparentNavigationButtonSkin
- * @see spark.skins.mobile.BeveledBackButtonSkin
- * @see spark.skins.mobile.TransparentActionButtonSkin
- * @see spark.skins.mobile.BeveledActionButtonSkin
- *
- * @langversion 3.0
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public class ActionBarSkin extends MobileSkin
- {
- //--------------------------------------------------------------------------
- //
- // Class constants
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- mx_internal static const ACTIONBAR_CHROME_COLOR_RATIOS:Array = [0, 80];
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public function ActionBarSkin()
- {
- super();
-
- borderClass = spark.skins.android4.assets.ActionBarBackground;
-
- switch (applicationDPI)
- {
-
- case DPIClassification.DPI_640:
- {
- borderSize = 2;
- layoutContentGroupHeight = 172;
- layoutTitleGroupHorizontalPadding = 52;
-
- break;
- }
- case DPIClassification.DPI_480:
- {
- borderSize = 2;
- layoutContentGroupHeight = 130;
- layoutTitleGroupHorizontalPadding = 40;
-
-
- break;
- }
- case DPIClassification.DPI_320:
- {
- borderSize = 2;
- layoutContentGroupHeight = 86;
- layoutTitleGroupHorizontalPadding = 26;
-
- break;
- }
- case DPIClassification.DPI_240:
- {
- borderSize = 1;
- layoutContentGroupHeight = 65;
- layoutTitleGroupHorizontalPadding = 20;
-
- break;
- }
- case DPIClassification.DPI_120:
- {
- borderSize = 1;
- layoutContentGroupHeight = 32;
- layoutTitleGroupHorizontalPadding = 10;
-
- break;
- }
- default:
- {
- // default DPI_160
- borderSize = 1;
- layoutContentGroupHeight = 43;
- layoutTitleGroupHorizontalPadding = 13;
-
- break;
- }
- }
- }
-
- //--------------------------------------------------------------------------
- //
- // Graphics variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * FXG Class reference for the ActionBar background border graphic.
- *
- * @langversion 3.0
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var borderClass:Class;
-
- //--------------------------------------------------------------------------
- //
- // Layout variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- private var borderSize:uint;
-
- /**
- * Default height for navigationGroup, titleGroup and actionGroup.
- *
- * @langversion 3.0
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var layoutContentGroupHeight:uint;
-
- /**
- * Default horizontal padding for the titleGroup and titleDisplay.
- *
- * @langversion 3.0
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var layoutTitleGroupHorizontalPadding:uint;
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- */
- public var hostComponent:ActionBar;
-
- /**
- * @private
- */
- private var _navigationVisible:Boolean = false;
-
- /**
- * @private
- */
- private var _titleContentVisible:Boolean = false;
-
- /**
- * @private
- */
- private var _actionVisible:Boolean = false;
-
- /**
- * @private
- */
- private var border:SpriteVisualElement;
-
- //--------------------------------------------------------------------------
- //
- // Skin parts
- //
- //--------------------------------------------------------------------------
-
- /**
- * @copy spark.components.ActionBar#navigationGroup
- */
- public var navigationGroup:Group;
-
- /**
- * @copy spark.components.ActionBar#titleGroup
- */
- public var titleGroup:Group;
-
- /**
- * @copy spark.components.ActionBar#actionGroup
- */
- public var actionGroup:Group;
-
- /**
- * @copy spark.components.ActionBar#titleDisplay
- *
- * @private
- * Wraps a StyleableTextField in a UIComponent to be compatible with
- * ViewTransition effects.
- */
- public var titleDisplay:TitleDisplayComponent;
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- override protected function createChildren():void
- {
- if (borderClass)
- {
- border = new borderClass();
- addChild(border);
- }
-
- navigationGroup = new Group();
- var hLayout:HorizontalLayout = new HorizontalLayout();
- hLayout.horizontalAlign = HorizontalAlign.LEFT;
- hLayout.verticalAlign = VerticalAlign.MIDDLE;
- hLayout.gap = 0;
- hLayout.paddingLeft = hLayout.paddingTop = hLayout.paddingRight = hLayout.paddingBottom = 0;
- navigationGroup.layout = hLayout;
- navigationGroup.id = "navigationGroup";
-
- titleGroup = new Group();
- hLayout = new HorizontalLayout();
- hLayout.horizontalAlign = HorizontalAlign.LEFT;
- hLayout.verticalAlign = VerticalAlign.MIDDLE;
- hLayout.gap = 0;
- hLayout.paddingLeft = hLayout.paddingRight = layoutTitleGroupHorizontalPadding;
- hLayout.paddingTop = hLayout.paddingBottom = 0;
- titleGroup.layout = hLayout;
- titleGroup.id = "titleGroup";
-
- actionGroup = new Group();
- hLayout = new HorizontalLayout();
- hLayout.horizontalAlign = HorizontalAlign.RIGHT;
- hLayout.verticalAlign = VerticalAlign.MIDDLE;
- hLayout.gap = 0;
- hLayout.paddingLeft = hLayout.paddingTop = hLayout.paddingRight = hLayout.paddingBottom = 0;
- actionGroup.layout = hLayout;
- actionGroup.id = "actionGroup";
-
- titleDisplay = new TitleDisplayComponent();
- titleDisplay.id = "titleDisplay";
-
- // initialize titleAlign style (center is managed explicitly in layoutContents)
- var titleAlign:String = getStyle("titleAlign");
- titleAlign = (titleAlign == "center") ? TextFormatAlign.LEFT : titleAlign;
- titleDisplay.setStyle("textAlign", titleAlign);
-
- addChild(navigationGroup);
- addChild(titleGroup);
- addChild(actionGroup);
- addChild(titleDisplay);
- }
-
- /**
- * @private
- */
- override protected function measure():void
- {
- var titleWidth:Number = 0;
- var titleHeight:Number = 0;
-
- if (_titleContentVisible)
- {
- titleWidth = titleGroup.getPreferredBoundsWidth();
- titleHeight = titleGroup.getPreferredBoundsHeight();
- }
- else
- {
- // use titleLayout for paddingLeft and paddingRight
- var layoutObject:Object = hostComponent.titleLayout;
- titleWidth = ((layoutObject.paddingLeft) ? Number(layoutObject.paddingLeft) : 0)
- + ((layoutObject.paddingRight) ? Number(layoutObject.paddingRight) : 0)
- + titleDisplay.getPreferredBoundsWidth();
-
- titleHeight = titleDisplay.getPreferredBoundsHeight();
- }
-
- measuredWidth =
- getStyle("paddingLeft")
- + navigationGroup.getPreferredBoundsWidth()
- + titleWidth
- + actionGroup.getPreferredBoundsWidth()
- + getStyle("paddingRight");
-
- // measuredHeight is contentGroupHeight, 2x border on top and bottom
- measuredHeight =
- getStyle("paddingTop")
- + Math.max(layoutContentGroupHeight,
- navigationGroup.getPreferredBoundsHeight(),
- actionGroup.getPreferredBoundsHeight(),
- titleHeight)
- + getStyle("paddingBottom");
- }
-
- /**
- * @private
- */
- override protected function commitCurrentState():void
- {
- super.commitCurrentState();
-
- _titleContentVisible = currentState.indexOf("titleContent") >= 0;
- _navigationVisible = currentState.indexOf("Navigation") >= 0;
- _actionVisible = currentState.indexOf("Action") >= 0;
-
- invalidateSize();
- invalidateDisplayList();
- }
-
- /**
- * @private
- */
- override public function styleChanged(styleProp:String):void
- {
- if (titleDisplay)
- {
- var allStyles:Boolean = !styleProp || styleProp == "styleName";
-
- if (allStyles || (styleProp == "titleAlign"))
- {
- var titleAlign:String = getStyle("titleAlign");
-
- if (titleAlign == "center")
- {
- // If the title align is set to center, the alignment is set to LEFT
- // so that the skin can manually center the component in layoutContents
- titleDisplay.setStyle("textAlign", TextFormatAlign.LEFT);
- }
- else
- {
- titleDisplay.setStyle("textAlign", titleAlign);
- }
- }
- }
-
- super.styleChanged(styleProp);
- }
-
- /**
- * @private
- */
- override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.layoutContents(unscaledWidth, unscaledHeight);
-
- var navigationGroupWidth:Number = 0;
-
- var paddingLeft:Number = getStyle("paddingLeft");
- var paddingRight:Number = getStyle("paddingRight");
- var paddingTop:Number = getStyle("paddingTop");
- var paddingBottom:Number = getStyle("paddingBottom");
-
- var titleCompX:Number = paddingLeft;
- var titleCompWidth:Number = 0;
-
- var actionGroupX:Number = unscaledWidth;
- var actionGroupWidth:Number = 0;
-
- // remove top and bottom padding from content group height
- var contentGroupsHeight:Number = Math.max(0, unscaledHeight - paddingTop - paddingBottom);
-
- if (border)
- {
- // FXG uses scale-9, drop shadow is drawn outside the bounds
- setElementSize(border, unscaledWidth, unscaledHeight);
- }
-
- // position groups, overlap of navigation and action groups is allowed
- // when overlap occurs, titleDisplay/titleGroup is not visible
- if (_navigationVisible)
- {
- navigationGroupWidth = navigationGroup.getPreferredBoundsWidth();
- titleCompX += navigationGroupWidth;
-
- setElementSize(navigationGroup, navigationGroupWidth, contentGroupsHeight);
- setElementPosition(navigationGroup, paddingLeft, paddingTop);
- }
-
- if (_actionVisible)
- {
- // actionGroup x position can be negative
- actionGroupWidth = actionGroup.getPreferredBoundsWidth();
- actionGroupX = unscaledWidth - actionGroupWidth - paddingRight;
-
- setElementSize(actionGroup, actionGroupWidth, contentGroupsHeight);
- setElementPosition(actionGroup, actionGroupX, paddingTop);
- }
-
- // titleGroup or titleDisplay is given remaining width after navigation
- // and action groups preferred widths
- titleCompWidth = unscaledWidth - navigationGroupWidth - actionGroupWidth
- - paddingLeft - paddingRight;
-
- if (titleCompWidth <= 0)
- {
- titleDisplay.visible = false;
- titleGroup.visible = false;
- }
- else if (_titleContentVisible)
- {
- titleDisplay.visible = false;
- titleGroup.visible = true;
-
- // use titleGroup for titleContent
- setElementSize(titleGroup, titleCompWidth, contentGroupsHeight);
- setElementPosition(titleGroup, titleCompX, paddingTop);
- }
- else
- {
- // use titleDisplay for title text label
- titleGroup.visible = false;
-
- // use titleLayout for paddingLeft and paddingRight
- var layoutObject:Object = hostComponent.titleLayout;
- var titlePaddingLeft:Number = (layoutObject.paddingLeft) ? Number(layoutObject.paddingLeft) : 0;
- var titlePaddingRight:Number = (layoutObject.paddingRight) ? Number(layoutObject.paddingRight) : 0;
-
- // align titleDisplay to the absolute center
- var titleAlign:String = getStyle("titleAlign");
-
- // check for available width after padding
- if ((titleCompWidth - titlePaddingLeft - titlePaddingRight) <= 0)
- {
- titleCompX = 0;
- titleCompWidth = 0;
- }
- else if (titleAlign == "center")
- {
- // use LEFT instead of CENTER
- titleCompWidth = titleDisplay.getExplicitOrMeasuredWidth();
-
- // use x position of titleDisplay to implement CENTER
- titleCompX = Math.round((unscaledWidth - titleCompWidth) / 2);
-
- var navigationOverlap:Number = navigationGroupWidth + titlePaddingLeft - titleCompX;
- var actionOverlap:Number = (titleCompX + titleCompWidth + titlePaddingRight) - actionGroupX;
-
- // shrink and/or move titleDisplay width if there is any
- // overlap after centering
- if ((navigationOverlap > 0) && (actionOverlap > 0))
- {
- // remaining width
- titleCompX = navigationGroupWidth + titlePaddingLeft;
- titleCompWidth = unscaledWidth - navigationGroupWidth - actionGroupWidth - titlePaddingLeft - titlePaddingRight;
- }
- else if ((navigationOverlap > 0) || (actionOverlap > 0))
- {
- if (navigationOverlap > 0)
- {
- // nudge to the right
- titleCompX += navigationOverlap;
- }
- else if (actionOverlap > 0)
- {
- // nudge to the left
- titleCompX -= actionOverlap;
-
- // force left padding
- if (titleCompX < (navigationGroupWidth + titlePaddingLeft))
- titleCompX = navigationGroupWidth + titlePaddingLeft;
- }
-
- // recompute action overlap and force right padding
- actionOverlap = (titleCompX + titleCompWidth + titlePaddingRight) - actionGroupX;
-
- if (actionOverlap > 0)
- titleCompWidth -= actionOverlap;
- }
- }
- else
- {
- // implement padding by adjusting width and position
- titleCompX += titlePaddingLeft;
- titleCompWidth = titleCompWidth - titlePaddingLeft - titlePaddingRight;
- }
-
- // check for negative width
- titleCompWidth = (titleCompWidth < 0) ? 0 : titleCompWidth;
-
- setElementSize(titleDisplay, titleCompWidth, contentGroupsHeight);
- setElementPosition(titleDisplay, titleCompX, paddingTop);
-
- titleDisplay.visible = true;
- }
- }
-
- /**
- * @private
- */
- override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.drawBackground(unscaledWidth, unscaledHeight);
-
- var chromeColor:uint = getStyle("chromeColor");
- var backgroundAlphaValue:Number = getStyle("backgroundAlpha");
- var colors:Array = [];
-
- // apply alpha to chromeColor fill only
- var backgroundAlphas:Array = [backgroundAlphaValue, backgroundAlphaValue];
-
- // exclude top and bottom 1px borders
- colorMatrix.createGradientBox(unscaledWidth, unscaledHeight - (borderSize * 2), Math.PI / 2, 0, 0);
-
- colors[0] = ColorUtil.adjustBrightness2(chromeColor, 20);
- colors[1] = chromeColor;
-
- graphics.beginGradientFill(GradientType.LINEAR, colors, backgroundAlphas, ACTIONBAR_CHROME_COLOR_RATIOS, colorMatrix);
- graphics.drawRect(0, borderSize, unscaledWidth, unscaledHeight - (borderSize * 2));
- graphics.endFill();
- }
-
- }
-}
-import flash.events.Event;
-
-import mx.core.UIComponent;
-import mx.core.mx_internal;
-import mx.events.FlexEvent;
-
-import spark.components.supportClasses.StyleableTextField;
-import spark.core.IDisplayText;
-
-use namespace mx_internal;
-
-/**
- * @private
- * Component that holds StyleableTextFields to produce a drop shadow effect.
- * Combines label and shadow into a single component to allow transitions to
- * target them both.
- */
-class TitleDisplayComponent extends UIComponent implements IDisplayText
-{
- private var titleDisplay:StyleableTextField;
- private var titleDisplayShadow:StyleableTextField;
- private var title:String;
- private var titleChanged:Boolean;
-
- public function TitleDisplayComponent()
- {
- super();
- title = "";
- }
-
- override public function get baselinePosition():Number
- {
- return titleDisplay.baselinePosition;
- }
-
- /**
- * @private
- */
- override protected function createChildren():void
- {
- super.createChildren();
-
- titleDisplay = StyleableTextField(createInFontContext(StyleableTextField));
- titleDisplay.styleName = this;
- titleDisplay.editable = false;
- titleDisplay.selectable = false;
- titleDisplay.multiline = false;
- titleDisplay.wordWrap = false;
- titleDisplay.addEventListener(FlexEvent.VALUE_COMMIT,
- titleDisplay_valueCommitHandler);
-
- titleDisplayShadow =
- StyleableTextField(createInFontContext(StyleableTextField));
- titleDisplayShadow.styleName = this;
- titleDisplayShadow.colorName = "textShadowColor";
- titleDisplayShadow.editable = false;
- titleDisplayShadow.selectable = false;
- titleDisplayShadow.multiline = false;
- titleDisplayShadow.wordWrap = false;
-
- addChild(titleDisplayShadow);
- addChild(titleDisplay);
- }
-
- /**
- * @private
- */
- override protected function commitProperties():void
- {
- super.commitProperties();
-
- if (titleChanged)
- {
- titleDisplay.text = title;
-
- invalidateSize();
- invalidateDisplayList();
-
- titleChanged = false;
- }
- }
-
- /**
- * @private
- */
- override protected function measure():void
- {
- // reset text if it was truncated before.
- if (titleDisplay.isTruncated)
- titleDisplay.text = title;
-
- measuredWidth = titleDisplay.getPreferredBoundsWidth();
-
- // tightTextHeight
- measuredHeight = titleDisplay.getPreferredBoundsHeight();
- }
-
- /**
- * @private
- */
- override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.updateDisplayList(unscaledWidth, unscaledHeight);
-
- // reset text if it was truncated before.
- if (titleDisplay.isTruncated)
- titleDisplay.text = title;
- titleDisplay.commitStyles();
-
- // use preferred height, setLayoutBoundsSize will accommodate for tight
- // text adjustment
- var tightHeight:Number = titleDisplay.getPreferredBoundsHeight();
- var tightY:Number = (unscaledHeight - tightHeight) / 2;
-
- titleDisplay.setLayoutBoundsSize(unscaledWidth, tightHeight);
- titleDisplay.setLayoutBoundsPosition(0, (unscaledHeight - tightHeight) / 2);
-
- // now truncate the text
- titleDisplay.truncateToFit();
-
- titleDisplayShadow.commitStyles();
- titleDisplayShadow.setLayoutBoundsSize(unscaledWidth, tightHeight);
- titleDisplayShadow.setLayoutBoundsPosition(0, tightY + 1);
-
- titleDisplayShadow.alpha = getStyle("textShadowAlpha");
-
- // if labelDisplay is truncated, then push it down here as well.
- // otherwise, it would have gotten pushed in the labelDisplay_valueCommitHandler()
- if (titleDisplay.isTruncated)
- titleDisplayShadow.text = titleDisplay.text;
- }
-
- /**
- * @private
- */
- private function titleDisplay_valueCommitHandler(event:Event):void
- {
- titleDisplayShadow.text = titleDisplay.text;
- }
-
- public function get text():String
- {
- return title;
- }
-
- public function set text(value:String):void
- {
- title = value;
- titleChanged = true;
-
- invalidateProperties();
- }
-
- public function get isTruncated():Boolean
- {
- return titleDisplay.isTruncated;
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/ButtonBarFirstButtonSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/ButtonBarFirstButtonSkin.as b/tourdeflexmobile/src/spark/skins/android4/ButtonBarFirstButtonSkin.as
deleted file mode 100644
index 4b8cbba..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/ButtonBarFirstButtonSkin.as
+++ /dev/null
@@ -1,93 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
- import spark.skins.android4.assets.ButtonBarFirstButton_selectedDown;
- import spark.skins.android4.assets.ButtonBarFirstButton_selectedUp;
- import spark.skins.mobile.supportClasses.ButtonBarButtonSkinBase;
-
- /**
- * Android 4.x specific Button skin for the first Button in a ButtonBar.
- *
- * @see spark.components.ButtonBar#firstButton
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public class ButtonBarFirstButtonSkin extends ButtonBarButtonSkinBase
- {
-
- /**
- * Class to use for the border in the selected and down state.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var selectedDownBorderSkin:Class;
-
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public function ButtonBarFirstButtonSkin()
- {
- super();
-
- upBorderSkin = spark.skins.android4.assets.ButtonBarFirstButton_up;
- downBorderSkin = spark.skins.android4.assets.ButtonBarFirstButton_down;
- selectedBorderSkin = spark.skins.android4.assets.ButtonBarFirstButton_selectedUp;
- selectedDownBorderSkin = spark.skins.android4.assets.ButtonBarFirstButton_selectedDown;
- }
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods
- //
- //--------------------------------------------------------------------------
-
- override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
- {
- //Dont draw background
- }
-
- override protected function getBorderClassForCurrentState():Class
- {
- var isSelected:Boolean = currentState.indexOf("Selected") >= 0;
- var isDown:Boolean = currentState.indexOf("down") >= 0;
-
- if (isSelected && !isDown )
- return selectedBorderSkin;
- else if (isSelected && isDown)
- return selectedDownBorderSkin;
- else if (!isSelected && !isDown)
- return upBorderSkin;
- else
- return downBorderSkin;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/ButtonBarMiddleButtonSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/ButtonBarMiddleButtonSkin.as b/tourdeflexmobile/src/spark/skins/android4/ButtonBarMiddleButtonSkin.as
deleted file mode 100644
index c6206d0..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/ButtonBarMiddleButtonSkin.as
+++ /dev/null
@@ -1,95 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
-
- import spark.skins.android4.assets.ButtonBarMiddleButton_selectedDown;
- import spark.skins.android4.assets.ButtonBarMiddleButton_selectedUp;
- import spark.skins.android4.assets.ButtonBarMiddleButton_up;
- import spark.skins.mobile.supportClasses.ButtonBarButtonSkinBase;
-
- /**
- * Android 4.x specific Button skin for middle Buttons in a ButtonBar.
- *
- * @see spark.components.ButtonBar#middleButton
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public class ButtonBarMiddleButtonSkin extends ButtonBarButtonSkinBase
- {
-
- /**
- * Class to use for the border in the selected and down state.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var selectedDownBorderSkin:Class;
-
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public function ButtonBarMiddleButtonSkin()
- {
- super();
-
- upBorderSkin = spark.skins.android4.assets.ButtonBarMiddleButton_up;
- downBorderSkin = spark.skins.android4.assets.ButtonBarMiddleButton_down;
- selectedBorderSkin = spark.skins.android4.assets.ButtonBarMiddleButton_selectedUp;
- selectedDownBorderSkin = spark.skins.android4.assets.ButtonBarMiddleButton_selectedDown;
- }
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods
- //
- //--------------------------------------------------------------------------
-
- override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
- {
- //Dont draw background
- }
-
- override protected function getBorderClassForCurrentState():Class
- {
- var isSelected:Boolean = currentState.indexOf("Selected") >= 0;
- var isDown:Boolean = currentState.indexOf("down") >= 0;
-
- if (isSelected && !isDown )
- return selectedBorderSkin;
- else if (isSelected && isDown)
- return selectedDownBorderSkin;
- else if (!isSelected && !isDown)
- return upBorderSkin;
- else
- return downBorderSkin;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/ButtonBarSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/ButtonBarSkin.as b/tourdeflexmobile/src/spark/skins/android4/ButtonBarSkin.as
deleted file mode 100644
index 4b194fd..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/ButtonBarSkin.as
+++ /dev/null
@@ -1,166 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
-import spark.components.ButtonBar;
-import spark.components.ButtonBarButton;
-import spark.components.DataGroup;
-import spark.components.supportClasses.ButtonBarHorizontalLayout;
-import spark.skins.android4.ButtonBarFirstButtonSkin;
-import spark.skins.mobile.ButtonBarLastButtonSkin;
-import spark.skins.mobile.supportClasses.ButtonBarButtonClassFactory;
-import spark.skins.mobile.supportClasses.MobileSkin;
-
-/**
- * The Android 4.x specific skin class for the Spark ButtonBar component.
- *
- * @see spark.components.ButtonBar
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
-public class ButtonBarSkin extends MobileSkin
-{
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- *
- */
- public function ButtonBarSkin()
- {
- super();
- }
-
- //--------------------------------------------------------------------------
- //
- // Skin parts
- //
- //--------------------------------------------------------------------------
-
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- */
- public var hostComponent:ButtonBar;
-
- /**
- * @copy spark.components.ButtonBar#firstButton
- */
- public var firstButton:ButtonBarButtonClassFactory;
-
- /**
- * @copy spark.components.ButtonBar#lastButton
- */
- public var lastButton:ButtonBarButtonClassFactory;
-
- /**
- * @copy spark.components.ButtonBar#middleButton
- */
- public var middleButton:ButtonBarButtonClassFactory;
-
- /**
- * @copy spark.components.SkinnableDataContainer#dataGroup
- */
- public var dataGroup:DataGroup;
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- override protected function createChildren():void
- {
- // Set up the class factories for the buttons
- if (!firstButton)
- {
- firstButton = new ButtonBarButtonClassFactory(ButtonBarButton);
- firstButton.skinClass = spark.skins.android4.ButtonBarFirstButtonSkin;
- }
-
- if (!lastButton)
- {
- lastButton = new ButtonBarButtonClassFactory(ButtonBarButton);
- lastButton.skinClass = spark.skins.android4.ButtonBarFirstButtonSkin;
- }
-
- if (!middleButton)
- {
- middleButton = new ButtonBarButtonClassFactory(ButtonBarButton);
- middleButton.skinClass = spark.skins.android4.ButtonBarMiddleButtonSkin;
- }
-
- // create the data group to house the buttons
- if (!dataGroup)
- {
- dataGroup = new DataGroup();
- var hLayout:ButtonBarHorizontalLayout = new ButtonBarHorizontalLayout();
- hLayout.gap = 0;
- dataGroup.layout = hLayout;
- addChild(dataGroup);
- }
- }
-
- /**
- * @private
- */
- override protected function commitCurrentState():void
- {
- alpha = (currentState == "disabled") ? 0.5 : 1;
- }
-
- /**
- * @private
- */
- override protected function measure():void
- {
- measuredWidth = dataGroup.measuredWidth;
- measuredHeight = dataGroup.measuredHeight;
-
- measuredMinWidth = dataGroup.measuredMinWidth;
- measuredMinHeight = dataGroup.measuredMinHeight;
- }
-
- /**
- * @private
- */
- override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.layoutContents(unscaledWidth, unscaledHeight);
-
- setElementPosition(dataGroup, 0, 0);
- setElementSize(dataGroup, unscaledWidth, unscaledHeight);
- }
-}
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/ButtonSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/ButtonSkin.as b/tourdeflexmobile/src/spark/skins/android4/ButtonSkin.as
deleted file mode 100644
index 43fb108..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/ButtonSkin.as
+++ /dev/null
@@ -1,397 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
-
-import flash.display.DisplayObject;
-
-import mx.core.DPIClassification;
-import mx.core.mx_internal;
-import mx.events.FlexEvent;
-
-import spark.components.supportClasses.StyleableTextField;
-import spark.skins.android4.assets.Button_down;
-import spark.skins.android4.assets.Button_up;
-import spark.skins.mobile.supportClasses.ButtonSkinBase;
-
-
-use namespace mx_internal;
-
-/**
- * ActionScript-based skin for Button controls in mobile applications. The skin supports
- * iconClass and labelPlacement. It uses FXG classes to
- * implement the vector drawing.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
-public class ButtonSkin extends ButtonSkinBase
-{
- //--------------------------------------------------------------------------
- //
- // Class constants
- //
- //--------------------------------------------------------------------------
-
- /**
- * An array of color distribution ratios.
- * This is used in the chrome color fill.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- mx_internal static const CHROME_COLOR_RATIOS:Array = [0, 127.5];
-
- /**
- * An array of alpha values for the corresponding colors in the colors array.
- * This is used in the chrome color fill.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- mx_internal static const CHROME_COLOR_ALPHAS:Array = [1, 1];
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public function ButtonSkin()
- {
- super();
- upBorderSkin = spark.skins.android4.assets.Button_up;
- downBorderSkin = spark.skins.android4.assets.Button_down;
- layoutCornerEllipseSize = 0;
-
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
-
- layoutGap = 20;
- layoutPaddingLeft = 40;
- layoutPaddingRight = 40;
- layoutPaddingTop = 40;
- layoutPaddingBottom = 40;
- layoutBorderSize = 2;
- measuredDefaultWidth = 128;
- measuredDefaultHeight = 172;
-
- break;
- }
- case DPIClassification.DPI_480:
- {
-
- layoutGap = 14;
- layoutPaddingLeft = 30;
- layoutPaddingRight = 30;
- layoutPaddingTop = 30;
- layoutPaddingBottom = 30;
- layoutBorderSize = 2;
- measuredDefaultWidth = 96;
- measuredDefaultHeight = 130;
-
- break;
- }
- case DPIClassification.DPI_320:
- {
-
- layoutGap = 10;
- layoutPaddingLeft = 20;
- layoutPaddingRight = 20;
- layoutPaddingTop = 20;
- layoutPaddingBottom = 20;
- layoutBorderSize = 2;
- measuredDefaultWidth = 64;
- measuredDefaultHeight = 86;
-
- break;
- }
- case DPIClassification.DPI_240:
- {
-
- layoutGap = 7;
- layoutPaddingLeft = 15;
- layoutPaddingRight = 15;
- layoutPaddingTop = 15;
- layoutPaddingBottom = 15;
- layoutBorderSize = 1;
- measuredDefaultWidth = 48;
- measuredDefaultHeight = 65;
-
- break;
- }
- case DPIClassification.DPI_120:
- {
-
- layoutGap = 4;
- layoutPaddingLeft = 8;
- layoutPaddingRight = 8;
- layoutPaddingTop = 8;
- layoutPaddingBottom = 8;
- layoutBorderSize = 1;
- measuredDefaultWidth = 24;
- measuredDefaultHeight = 33;
-
- break;
- }
- default:
- {
-
- layoutGap = 5;
- layoutPaddingLeft = 10;
- layoutPaddingRight = 10;
- layoutPaddingTop = 10;
- layoutPaddingBottom = 10;
- layoutBorderSize = 1;
- measuredDefaultWidth = 32;
- measuredDefaultHeight = 43;
-
- break;
- }
- }
- }
-
- //--------------------------------------------------------------------------
- //
- // Layout variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * Defines the corner radius.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var layoutCornerEllipseSize:uint;
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
- private var _border:DisplayObject;
-
- private var changeFXGSkin:Boolean = false;
-
- private var borderClass:Class;
-
- mx_internal var fillColorStyleName:String = "chromeColor";
-
- /**
- * Defines the shadow for the Button control's label.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public var labelDisplayShadow:StyleableTextField;
-
- /**
- * Read-only button border graphic. Use getBorderClassForCurrentState()
- * to specify a graphic per-state.
- *
- * @see #getBorderClassForCurrentState()
- */
- protected function get border():DisplayObject
- {
- return _border;
- }
-
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
-
- /**
- * Class to use for the border in the up state.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- *
- * @default Button_up
- */
- protected var upBorderSkin:Class;
-
- /**
- * Class to use for the border in the down state.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- *
- * @default Button_down
- */
- protected var downBorderSkin:Class;
-
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- override protected function createChildren():void
- {
- super.createChildren();
-
- if (!labelDisplayShadow && labelDisplay)
- {
- labelDisplayShadow = StyleableTextField(createInFontContext(StyleableTextField));
- labelDisplayShadow.styleName = this;
- labelDisplayShadow.colorName = "textShadowColor";
- labelDisplayShadow.useTightTextBounds = false;
-
- // add shadow before display
- addChildAt(labelDisplayShadow, getChildIndex(labelDisplay));
- }
-
- setStyle("textAlign", "center");
- }
-
- /**
- * @private
- */
- override protected function commitCurrentState():void
- {
- super.commitCurrentState();
-
- borderClass = getBorderClassForCurrentState();
-
- if (!(_border is borderClass))
- changeFXGSkin = true;
-
- // update borderClass and background
- invalidateDisplayList();
- }
-
- /**
- * @private
- */
- override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.layoutContents(unscaledWidth, unscaledHeight);
-
- // size the FXG background
- if (changeFXGSkin)
- {
- changeFXGSkin = false;
-
- if (_border)
- {
- removeChild(_border);
- _border = null;
- }
-
- if (borderClass)
- {
- _border = new borderClass();
- addChildAt(_border, 0);
- }
- }
-
- layoutBorder(unscaledWidth, unscaledHeight);
-
- // update label shadow
- labelDisplayShadow.alpha = getStyle("textShadowAlpha");
- labelDisplayShadow.commitStyles();
-
- // don't use tightText positioning on shadow
- setElementPosition(labelDisplayShadow, labelDisplay.x, labelDisplay.y + 1);
- setElementSize(labelDisplayShadow, labelDisplay.width, labelDisplay.height);
-
- // if labelDisplay is truncated, then push it down here as well.
- // otherwise, it would have gotten pushed in the labelDisplay_valueCommitHandler()
- if (labelDisplay.isTruncated)
- labelDisplayShadow.text = labelDisplay.text;
- }
-
- /**
- * Position the background of the skin. Override this function to re-position the background.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- mx_internal function layoutBorder(unscaledWidth:Number, unscaledHeight:Number):void
- {
- setElementSize(border, unscaledWidth, unscaledHeight);
- setElementPosition(border, 0, 0);
- }
-
- /**
- * Returns the borderClass to use based on the currentState.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected function getBorderClassForCurrentState():Class
- {
- if (currentState == "down")
- return downBorderSkin;
- else
- return upBorderSkin;
- }
-
- //--------------------------------------------------------------------------
- //
- // Event Handlers
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- override protected function labelDisplay_valueCommitHandler(event:FlexEvent):void
- {
- super.labelDisplay_valueCommitHandler(event);
- labelDisplayShadow.text = labelDisplay.text;
- }
-
-}
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/CalloutSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/CalloutSkin.as b/tourdeflexmobile/src/spark/skins/android4/CalloutSkin.as
deleted file mode 100644
index 22f04f5..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/CalloutSkin.as
+++ /dev/null
@@ -1,825 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
- import flash.display.BlendMode;
- import flash.display.GradientType;
- import flash.display.Graphics;
- import flash.display.Sprite;
- import flash.events.Event;
-
- import mx.core.DPIClassification;
- import mx.core.UIComponent;
- import mx.core.mx_internal;
- import mx.events.EffectEvent;
- import mx.events.FlexEvent;
- import mx.utils.ColorUtil;
-
- import spark.components.ArrowDirection;
- import spark.components.Callout;
- import spark.components.ContentBackgroundAppearance;
- import spark.components.Group;
- import spark.core.SpriteVisualElement;
- import spark.effects.Fade;
- import spark.primitives.RectangularDropShadow;
- import spark.skins.android4.assets.CalloutContentBackground;
- import spark.skins.android4.supportClasses.CalloutArrow;
- import spark.skins.mobile.supportClasses.MobileSkin;
-
- use namespace mx_internal;
-
- /**
- * The default skin class for the Spark Callout component in mobile
- * applications.
- *
- * <p>The <code>contentGroup</code> lies above a <code>backgroundColor</code> fill
- * which frames the <code>contentGroup</code>. The position and size of the frame
- * adjust based on the host component <code>arrowDirection</code>, leaving
- * space for the <code>arrow</code> to appear on the outside edge of the
- * frame.</p>
- *
- * <p>The <code>arrow</code> skin part is not positioned by the skin. Instead,
- * the Callout component positions the arrow relative to the owner in
- * <code>updateSkinDisplayList()</code>. This method assumes that Callout skin
- * and the <code>arrow</code> use the same coordinate space.</p>
- *
- * @see spark.components.Callout
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- public class CalloutSkin extends MobileSkin
- {
- mx_internal static const BACKGROUND_GRADIENT_BRIGHTNESS_TOP:int = 15;
-
- mx_internal static const BACKGROUND_GRADIENT_BRIGHTNESS_BOTTOM:int = -15;
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- public function CalloutSkin()
- {
- super();
-
- dropShadowAlpha = 0.7;
- contentBackgroundInsetClass = spark.skins.android4.assets.CalloutContentBackground;
-
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
-
- backgroundCornerRadius = 24;
- backgroundGradientHeight = 440;
- frameThickness = 12;
- arrowWidth = 160;
- arrowHeight = 80;
- contentCornerRadius = 40;
- dropShadowBlurX = 64;
- dropShadowBlurY = 64;
- dropShadowDistance = 12;
- highlightWeight = 4;
-
- break;
- }
- case DPIClassification.DPI_480:
- {
- backgroundCornerRadius = 16;
- backgroundGradientHeight = 330;
- frameThickness = 8;
- arrowWidth = 120;
- arrowHeight = 60;
- contentCornerRadius = 28;
- dropShadowBlurX = 48;
- dropShadowBlurY = 48;
- dropShadowDistance = 8;
- highlightWeight = 2;
-
- break;
- }
- case DPIClassification.DPI_320:
- {
-
- backgroundCornerRadius = 12;
- backgroundGradientHeight = 220;
- frameThickness = 6;
- arrowWidth = 80;
- arrowHeight = 40;
- contentCornerRadius = 20;
- dropShadowBlurX = 32;
- dropShadowBlurY = 32;
- dropShadowDistance = 6;
- highlightWeight = 2;
-
- break;
- }
- case DPIClassification.DPI_240:
- {
- backgroundCornerRadius = 8;
- backgroundGradientHeight = 165;
- frameThickness = 4;
- arrowWidth = 60;
- arrowHeight = 30;
- contentCornerRadius = 14;
- dropShadowBlurX = 24;
- dropShadowBlurY = 24;
- dropShadowDistance = 4;
- highlightWeight = 1;
-
- break;
- }
- case DPIClassification.DPI_120:
- {
- backgroundCornerRadius = 4;
- backgroundGradientHeight = 83;
- frameThickness = 2;
- arrowWidth = 30;
- arrowHeight = 15;
- contentCornerRadius = 7;
- dropShadowBlurX = 12;
- dropShadowBlurY = 12;
- dropShadowDistance = 2;
- highlightWeight = 0.5;
-
- break;
- }
- default:
- {
- // default DPI_160
- backgroundCornerRadius = 6;
- backgroundGradientHeight = 110;
- frameThickness = 3;
- arrowWidth = 40;
- arrowHeight = 20;
- contentCornerRadius = 10;
- dropShadowBlurX = 16;
- dropShadowBlurY = 16;
- dropShadowDistance = 3;
- highlightWeight = 1;
-
- break;
- }
- }
- }
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- */
- public var hostComponent:Callout;
-
- /**
- * Enables a RectangularDropShadow behind the <code>backgroundColor</code> frame.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var dropShadowVisible:Boolean = true;
-
- /**
- * Enables a vertical linear gradient in the <code>backgroundColor</code> frame. This
- * gradient fill is drawn across both the arrow and the frame. By default,
- * the gradient brightens the background color by 15% and darkens it by 60%.
- *
- * @default true
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var useBackgroundGradient:Boolean = true;
-
- /**
- * Corner radius used for the <code>contentBackgroundColor</code> fill.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var contentCornerRadius:uint;
-
- /**
- * A class reference to an FXG class that is layered underneath the
- * <code>contentGroup</code>. The instance of this class is sized to match the
- * <code>contentGroup</code>.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var contentBackgroundInsetClass:Class;
-
- /**
- * Corner radius of the <code>backgroundColor</code> "frame".
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var backgroundCornerRadius:Number;
-
- /**
- * The thickness of the <code>backgroundColor</code> "frame" that surrounds the
- * <code>contentGroup</code>.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var frameThickness:Number;
-
- /**
- * Color of the border stroke around the <code>backgroundColor</code> "frame".
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var borderColor:Number = -1; // not set
-
- /**
- * Thickness of the border stroke around the <code>backgroundColor</code>
- * "frame".
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var borderThickness:Number = -1 ; // marker that borderThickness was not set directly
-
- /**
- * Width of the arrow in vertical directions. This property also controls
- * the height of the arrow in horizontal directions.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var arrowWidth:Number;
-
- /**
- * Height of the arrow in vertical directions. This property also controls
- * the width of the arrow in horizontal directions.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var arrowHeight:Number;
-
- /**
- * @private
- * Instance of the contentBackgroundClass
- */
- mx_internal var contentBackgroundGraphic:SpriteVisualElement;
-
- /**
- * @private
- * Tracks changes to the skin state to support the fade out tranisition
- * when closed;
- */
- mx_internal var isOpen:Boolean;
-
- private var backgroundGradientHeight:Number;
-
- private var contentMask:Sprite;
-
- private var backgroundFill:SpriteVisualElement;
-
- private var dropShadow:RectangularDropShadow;
-
- private var dropShadowBlurX:Number;
-
- private var dropShadowBlurY:Number;
-
- private var dropShadowDistance:Number;
-
- private var dropShadowAlpha:Number;
-
- private var fade:Fade;
-
- private var highlightWeight:Number;
-
- //--------------------------------------------------------------------------
- //
- // Skin parts
- //
- //--------------------------------------------------------------------------
-
- /**
- * @copy spark.components.SkinnableContainer#contentGroup
- */
- public var contentGroup:Group;
-
- /**
- * @copy spark.components.Callout#arrow
- */
- public var arrow:UIComponent;
-
- /* helper private accessors */
-
- /* returns borderThickness from style if member is -1, or borderThickness. Returns 0 if NaN */
- mx_internal function get actualBorderThickness():Number
- {
- var border: Number = borderThickness != -1 ? borderThickness : getStyle('borderThickness');
- return isNaN(border)? 0: border;
- }
-
- mx_internal function get actualBorderColor():uint
- {
- return borderColor != -1 ? borderColor: getStyle('borderColor');
- }
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- override protected function createChildren():void
- {
- super.createChildren();
-
- if (dropShadowVisible)
- {
- dropShadow = new RectangularDropShadow();
- dropShadow.angle = 90;
- dropShadow.distance = dropShadowDistance;
- dropShadow.blurX = dropShadowBlurX;
- dropShadow.blurY = dropShadowBlurY;
- dropShadow.tlRadius = dropShadow.trRadius = dropShadow.blRadius =
- dropShadow.brRadius = backgroundCornerRadius ;
- dropShadow.mouseEnabled = false;
- dropShadow.alpha = dropShadowAlpha;
- addChild(dropShadow);
- }
-
- // background fill placed above the drop shadow
- backgroundFill = new SpriteVisualElement();
- addChild(backgroundFill);
-
- // arrow
- if (!arrow)
- {
- arrow = new CalloutArrow();
- arrow.id = "arrow";
- arrow.styleName = this;
- addChild(arrow);
- }
-
- // contentGroup
- if (!contentGroup)
- {
- contentGroup = new Group();
- contentGroup.id = "contentGroup";
- addChild(contentGroup);
- }
-
-
- }
-
- /**
- * @private
- */
- override protected function commitProperties():void
- {
- super.commitProperties();
-
- // add or remove the contentBackgroundGraphic
- var contentBackgroundAppearance:String = getStyle("contentBackgroundAppearance");
-
- if (contentBackgroundAppearance == ContentBackgroundAppearance.INSET)
- {
- // create the contentBackgroundGraphic
- if (!contentBackgroundGraphic && contentBackgroundInsetClass)
- {
- contentBackgroundGraphic = new contentBackgroundInsetClass() as SpriteVisualElement;
-
- // with the current skin structure, contentBackgroundGraphic is
- // always the last child
- addChild(contentBackgroundGraphic);
- }
- }
- else if (contentBackgroundGraphic)
- {
- // if already created, remove the graphic for "flat" and "none"
- removeChild(contentBackgroundGraphic);
- contentBackgroundGraphic = null;
- }
-
- // always invalidate to accomodate arrow direction changes
- invalidateSize();
- invalidateDisplayList();
- }
-
-
- /**
- * @private
- */
- override protected function measure():void
- {
- super.measure();
-
- var borderWeight:Number =actualBorderThickness;
- var frameAdjustment:Number = (frameThickness + borderWeight) * 2;
-
- var arrowMeasuredWidth:Number;
- var arrowMeasuredHeight:Number;
-
- // pad the arrow so that the edges are within the background corner radius
- if (isArrowHorizontal)
- {
- arrowMeasuredWidth = arrowHeight;
- arrowMeasuredHeight = arrowWidth + (backgroundCornerRadius * 2);
- }
- else if (isArrowVertical)
- {
- arrowMeasuredWidth = arrowWidth + (backgroundCornerRadius * 2);
- arrowMeasuredHeight = arrowHeight;
- }
-
- // count the contentGroup size and frame size
- measuredMinWidth = contentGroup.measuredMinWidth + frameAdjustment;
- measuredMinHeight = contentGroup.measuredMinHeight + frameAdjustment;
-
- measuredWidth = contentGroup.getPreferredBoundsWidth() + frameAdjustment;
- measuredHeight = contentGroup.getPreferredBoundsHeight() + frameAdjustment;
-
- // add the arrow size based on the arrowDirection
- if (isArrowHorizontal)
- {
- measuredMinWidth += arrowMeasuredWidth;
- measuredMinHeight = Math.max(measuredMinHeight, arrowMeasuredHeight);
-
- measuredWidth += arrowMeasuredWidth;
- measuredHeight = Math.max(measuredHeight, arrowMeasuredHeight);
- }
- else if (isArrowVertical)
- {
- measuredMinWidth += Math.max(measuredMinWidth, arrowMeasuredWidth);
- measuredMinHeight += arrowMeasuredHeight;
-
- measuredWidth = Math.max(measuredWidth, arrowMeasuredWidth);
- measuredHeight += arrowMeasuredHeight;
- }
- }
-
- /**
- * @private
- * SkinnaablePopUpContainer skins must dispatch a
- * FlexEvent.STATE_CHANGE_COMPLETE event for the component to properly
- * update the skin state.
- */
- override protected function commitCurrentState():void
- {
- super.commitCurrentState();
-
- var isNormal:Boolean = (currentState == "normal");
- var isDisabled:Boolean = (currentState == "disabled")
-
- // play a fade out if the callout was previously open
- if (!(isNormal || isDisabled) && isOpen)
- {
- if (!fade)
- {
- fade = new Fade();
- fade.target = this;
- fade.duration = 200;
- fade.alphaTo = 0;
- }
-
- // BlendMode.LAYER while fading out
- blendMode = BlendMode.LAYER;
-
- // play a short fade effect
- fade.addEventListener(EffectEvent.EFFECT_END, stateChangeComplete);
- fade.play();
-
- isOpen = false;
- }
- else
- {
- isOpen = isNormal || isDisabled;
-
- // handle re-opening the Callout while fading out
- if (fade && fade.isPlaying)
- {
- // Do not dispatch a state change complete.
- // SkinnablePopUpContainer handles state interruptions.
- fade.removeEventListener(EffectEvent.EFFECT_END, stateChangeComplete);
- fade.stop();
- }
-
- if (isDisabled)
- {
- // BlendMode.LAYER to allow CalloutArrow BlendMode.ERASE
- blendMode = BlendMode.LAYER;
-
- alpha = 0.5;
- }
- else
- {
- // BlendMode.NORMAL for non-animated state transitions
- blendMode = BlendMode.NORMAL;
-
- if (isNormal)
- alpha = 1;
- else
- alpha = 0;
- }
-
- stateChangeComplete();
- }
- }
-
- /**
- * @private
- */
- override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.drawBackground(unscaledWidth, unscaledHeight);
-
- var frameEllipseSize:Number = backgroundCornerRadius * 2;
-
- // account for borderThickness center stroke alignment
- var borderWeight:Number =actualBorderThickness;
- var showBorder:Boolean = borderWeight > 0 ;
-
-
- // contentBackgroundGraphic already accounts for the arrow position
- // use it's positioning instead of recalculating based on unscaledWidth
- // and unscaledHeight
- var frameX:Number = Math.floor(contentGroup.getLayoutBoundsX() - frameThickness) - (borderWeight / 2);
- var frameY:Number = Math.floor(contentGroup.getLayoutBoundsY() - frameThickness) - (borderWeight / 2);
- var frameWidth:Number = contentGroup.getLayoutBoundsWidth() + (frameThickness * 2) + borderWeight;
- var frameHeight:Number = contentGroup.getLayoutBoundsHeight() + (frameThickness * 2) + borderWeight;
-
- var backgroundColor:Number = getStyle("primaryAccentColor");
- var backgroundAlpha:Number = getStyle("backgroundAlpha");
-
- var bgFill:Graphics = backgroundFill.graphics;
- bgFill.clear();
-
- if (showBorder)
- bgFill.lineStyle(borderWeight, actualBorderColor, 1, true);
-
- if (useBackgroundGradient)
- {
- // top color is brighter if arrowDirection == ArrowDirection.UP
- var backgroundColorTop:Number = ColorUtil.adjustBrightness2(backgroundColor,
- BACKGROUND_GRADIENT_BRIGHTNESS_TOP);
- var backgroundColorBottom:Number = ColorUtil.adjustBrightness2(backgroundColor,
- BACKGROUND_GRADIENT_BRIGHTNESS_BOTTOM);
-
- // max gradient height = backgroundGradientHeight
- colorMatrix.createGradientBox(unscaledWidth, backgroundGradientHeight,
- Math.PI / 2, 0, 0);
-
- bgFill.beginGradientFill(GradientType.LINEAR,
- [backgroundColorTop, backgroundColorBottom],
- [backgroundAlpha, backgroundAlpha],
- [0, 255],
- colorMatrix);
- }
- else
- {
- bgFill.beginFill(backgroundColor, backgroundAlpha);
- }
-
- bgFill.drawRoundRect(frameX, frameY, frameWidth,
- frameHeight, frameEllipseSize, frameEllipseSize);
- bgFill.endFill();
-
- // draw content background styles
- var contentBackgroundAppearance:String = getStyle("contentBackgroundAppearance");
-
- if (contentBackgroundAppearance != ContentBackgroundAppearance.NONE)
- {
- var contentEllipseSize:Number = contentCornerRadius * 2;
- var contentBackgroundAlpha:Number = getStyle("contentBackgroundAlpha");
- var contentWidth:Number = contentGroup.getLayoutBoundsWidth();
- var contentHeight:Number = contentGroup.getLayoutBoundsHeight();
-
- // all appearance values except for "none" use a mask
- if (!contentMask)
- contentMask = new SpriteVisualElement();
-
- contentGroup.mask = contentMask;
-
- // draw contentMask in contentGroup coordinate space
- var maskGraphics:Graphics = contentMask.graphics;
- maskGraphics.clear();
- maskGraphics.beginFill(0, 1);
- maskGraphics.drawRoundRect(0, 0, contentWidth, contentHeight,
- contentEllipseSize, contentEllipseSize);
- maskGraphics.endFill();
-
- // reset line style to none
- if (showBorder)
- bgFill.lineStyle(NaN);
-
- // draw the contentBackgroundColor
- bgFill.beginFill(getStyle("contentBackgroundColor"),
- contentBackgroundAlpha);
- bgFill.drawRoundRect(contentGroup.getLayoutBoundsX(),
- contentGroup.getLayoutBoundsY(),
- contentWidth, contentHeight, contentEllipseSize, contentEllipseSize);
- bgFill.endFill();
-
- if (contentBackgroundGraphic)
- contentBackgroundGraphic.alpha = contentBackgroundAlpha;
- }
- else // if (contentBackgroundAppearance == CalloutContentBackgroundAppearance.NONE))
- {
- // remove the mask
- if (contentMask)
- {
- contentGroup.mask = null;
- contentMask = null;
- }
- }
-
- // draw highlight in the callout when the arrow is hidden
- if (useBackgroundGradient && !isArrowHorizontal && !isArrowVertical)
- {
- // highlight width spans the callout width minus the corner radius
- var highlightWidth:Number = frameWidth - frameEllipseSize;
- var highlightX:Number = frameX + backgroundCornerRadius;
- var highlightOffset:Number = (highlightWeight * 1.5);
-
- // straight line across the top
- bgFill.lineStyle(highlightWeight, 0xFFFFFF, 0.2 * backgroundAlpha);
- bgFill.moveTo(highlightX, highlightOffset);
- bgFill.lineTo(highlightX + highlightWidth, highlightOffset);
- }
- }
-
- /**
- * @private
- */
- override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.layoutContents(unscaledWidth, unscaledHeight);
-
- // pad the arrow so that the edges are within the background corner radius
- if (isArrowHorizontal)
- {
- arrow.width = arrowHeight;
- arrow.height = arrowWidth + (backgroundCornerRadius * 2);
- }
- else if (isArrowVertical)
- {
- arrow.width = arrowWidth + (backgroundCornerRadius * 2);
- arrow.height = arrowHeight;
- }
-
- setElementSize(backgroundFill, unscaledWidth, unscaledHeight);
- setElementPosition(backgroundFill, 0, 0);
-
- var frameX:Number = 0;
- var frameY:Number = 0;
- var frameWidth:Number = unscaledWidth;
- var frameHeight:Number = unscaledHeight;
-
- switch (hostComponent.arrowDirection)
- {
- case ArrowDirection.UP:
- frameY = arrow.height;
- frameHeight -= arrow.height;
- break;
- case ArrowDirection.DOWN:
- frameHeight -= arrow.height;
- break;
- case ArrowDirection.LEFT:
- frameX = arrow.width;
- frameWidth -= arrow.width;
- break;
- case ArrowDirection.RIGHT:
- frameWidth -= arrow.width;
- break;
- default:
- // no arrow, content takes all available space
- break;
- }
-
- if (dropShadow)
- {
- setElementSize(dropShadow, frameWidth, frameHeight);
- setElementPosition(dropShadow, frameX, frameY);
- }
-
- // Show frameThickness by inset of contentGroup
- var borderWeight:Number = actualBorderThickness;
- var contentBackgroundAdjustment:Number = frameThickness + borderWeight;
-
- var contentBackgroundX:Number = frameX + contentBackgroundAdjustment;
- var contentBackgroundY:Number = frameY + contentBackgroundAdjustment;
-
- contentBackgroundAdjustment = contentBackgroundAdjustment * 2;
- var contentBackgroundWidth:Number = frameWidth - contentBackgroundAdjustment;
- var contentBackgroundHeight:Number = frameHeight - contentBackgroundAdjustment;
-
- if (contentBackgroundGraphic)
- {
- setElementSize(contentBackgroundGraphic, contentBackgroundWidth, contentBackgroundHeight);
- setElementPosition(contentBackgroundGraphic, contentBackgroundX, contentBackgroundY);
- }
-
- setElementSize(contentGroup, contentBackgroundWidth, contentBackgroundHeight);
- setElementPosition(contentGroup, contentBackgroundX, contentBackgroundY);
-
- // mask position is in the contentGroup coordinate space
- if (contentMask)
- setElementSize(contentMask, contentBackgroundWidth, contentBackgroundHeight);
- }
-
- override public function styleChanged(styleProp:String):void
- {
- super.styleChanged(styleProp);
-
- var allStyles:Boolean = !styleProp || styleProp == "styleName";
-
- if (allStyles || (styleProp == "contentBackgroundAppearance"))
- invalidateProperties();
-
- if (allStyles || (styleProp == "backgroundAlpha"))
- {
- var backgroundAlpha:Number = getStyle("backgroundAlpha");
-
- // Use BlendMode.LAYER to allow CalloutArrow to erase the dropShadow
- // when the Callout background is transparent
- blendMode = (backgroundAlpha < 1) ? BlendMode.LAYER : BlendMode.NORMAL;
- }
- }
-
- /**
- * @private
- */
- mx_internal function get isArrowHorizontal():Boolean
- {
- return (hostComponent.arrowDirection == ArrowDirection.LEFT
- || hostComponent.arrowDirection == ArrowDirection.RIGHT);
- }
-
- /**
- * @private
- */
- mx_internal function get isArrowVertical():Boolean
- {
- return (hostComponent.arrowDirection == ArrowDirection.UP
- || hostComponent.arrowDirection == ArrowDirection.DOWN);
- }
-
- //--------------------------------------------------------------------------
- //
- // Event handlers
- //
- //--------------------------------------------------------------------------
-
- private function stateChangeComplete(event:Event=null):void
- {
- if (fade && event)
- fade.removeEventListener(EffectEvent.EFFECT_END, stateChangeComplete);
-
- // SkinnablePopUpContainer relies on state changes for open and close
- dispatchEvent(new FlexEvent(FlexEvent.STATE_CHANGE_COMPLETE));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/CheckBoxSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/CheckBoxSkin.as b/tourdeflexmobile/src/spark/skins/android4/CheckBoxSkin.as
deleted file mode 100644
index f091205..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/CheckBoxSkin.as
+++ /dev/null
@@ -1,268 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
- import flash.display.DisplayObject;
-
- import mx.core.DPIClassification;
-
- import spark.skins.android4.assets.CheckBox_up;
- import spark.skins.mobile.supportClasses.SelectableButtonSkinBase;
-
- /**
- * ActionScript-based skin for CheckBox components in mobile applications.
- *
- * @see spark.components.CheckBox
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public class CheckBoxSkin extends SelectableButtonSkinBase
- {
- //--------------------------------------------------------------------------
- //
- // Class constants
- //
- //--------------------------------------------------------------------------
-
- private static const exclusions:Array = ["labelDisplay", "labelDisplayShadow"];
-
- //--------------------------------------------------------------------------
- //
- // Member variables
- //
- //--------------------------------------------------------------------------
-
- protected var symbolOffsetX:Number;
- protected var symbolOffsetY:Number;
- protected var iconWidth:Number;
- protected var iconHeight:Number;
- protected var symbolWidth:Number;
- protected var symbolHeight:Number;
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public function CheckBoxSkin()
- {
- super();
-
- layoutPaddingLeft = 0;
- layoutPaddingRight = 0;
- layoutPaddingTop = 0;
- layoutPaddingBottom = 0;
-
- upIconClass = spark.skins.android4.assets.CheckBox_up;
- upSelectedIconClass = spark.skins.android4.assets.CheckBox_upSelected;
- downIconClass = spark.skins.android4.assets.CheckBox_down;
- downSelectedIconClass = spark.skins.android4.assets.CheckBox_downSelected;
- upSymbolIconClass = null;
- upSymbolIconSelectedClass = spark.skins.android4.assets.CheckBox_upSymbolSelected;
- downSymbolIconSelectedClass = spark.skins.android4.assets.CheckBox_downSymbolSelected;
- downSymbolIconClass = null;
-
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
-
- layoutGap = 16;
- minWidth = 128;
- minHeight = 128;
- layoutBorderSize = 6;
- iconWidth = 128;
- iconHeight = 128;
- symbolWidth = 64;
- symbolHeight = 64;
- symbolOffsetX = 32;
- symbolOffsetY = 32;
-
- break;
- }
- case DPIClassification.DPI_480:
- {
-
- layoutGap = 12;
- minWidth = 96;
- minHeight = 96;
- layoutBorderSize = 4;
- iconWidth = 96;
- iconHeight = 96;
- symbolWidth = 48;
- symbolHeight = 48;
- symbolOffsetX = 24;
- symbolOffsetY = 24;
-
- break;
- }
- case DPIClassification.DPI_320:
- {
-
- layoutGap = 8;
- minWidth = 64;
- minHeight = 64;
- layoutBorderSize = 3;
- iconWidth = 64;
- iconHeight = 64;
- symbolWidth = 32;
- symbolHeight = 32;
- symbolOffsetX = 16;
- symbolOffsetY = 16;
-
- break;
- }
- case DPIClassification.DPI_240:
- {
-
- layoutGap = 6;
- minWidth = 48;
- minHeight = 48;
- layoutBorderSize = 2;
- iconWidth = 48;
- iconHeight = 48;
- symbolWidth = 24;
- symbolHeight = 24;
- symbolOffsetX = 12;
- symbolOffsetY = 12;
-
- break;
- }
- case DPIClassification.DPI_120:
- {
-
- layoutGap = 3;
- minWidth = 24;
- minHeight = 24;
- layoutBorderSize = 1;
- iconWidth = 24;
- iconHeight = 24;
- symbolWidth = 12;
- symbolHeight = 12;
- symbolOffsetX = 6;
- symbolOffsetY = 6;
-
- break;
- }
- default:
- {
- // default DPI_160
-
- layoutGap = 4;
- minWidth = 32;
- minHeight = 32;
- layoutBorderSize = 2;
- iconWidth = 32;
- iconHeight = 32;
- symbolWidth = 16;
- symbolHeight = 16;
- symbolOffsetX = 8;
- symbolOffsetY = 8;
-
-
- break;
- }
- }
- }
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- * CheckBox <code>chromeColor</code> is drawn to match the FXG rectangle
- * shape and position.
- */
- override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
- {
- // super draws a transparent hit zone
- super.drawBackground(unscaledWidth, unscaledHeight);
-
- // get the size and position of iconDisplay
- var currentIcon:DisplayObject = getIconDisplay();
- var widthAdjustment:Number = layoutBorderSize * 2;
-
- graphics.beginFill(getStyle("chromeColor"));
- graphics.drawRoundRect(currentIcon.x + layoutBorderSize,
- currentIcon.y + layoutBorderSize,
- currentIcon.width - widthAdjustment,
- currentIcon.height - widthAdjustment, layoutBorderSize, layoutBorderSize);
- graphics.endFill();
- }
-
- /**
- * List of IDs of items that should be excluded when rendering the focus ring.
- * Only items of type DisplayObject or GraphicElement should be excluded. Items
- * of other types are ignored.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- override protected function get focusSkinExclusions():Array
- {
- return exclusions;
- }
-
- override protected function commitCurrentState():void
- {
- super.commitCurrentState();
- if(symbolIcon != null)
- {
- symbolIcon.width = symbolWidth;
- symbolIcon.height = symbolHeight;
- }
- var iconDisplay:DisplayObject = getIconDisplay();
- if(iconDisplay != null)
- {
- iconDisplay.width = iconWidth;
- iconDisplay.height = iconHeight;
- }
- }
-
- override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.layoutContents(unscaledWidth, unscaledHeight);
- // position the symbols to align with the background "icon"
- if (symbolIcon)
- {
- var currentIcon:DisplayObject = getIconDisplay();
- setElementPosition(symbolIcon, symbolOffsetX, symbolOffsetY);
- }
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/DateSpinnerSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/DateSpinnerSkin.as b/tourdeflexmobile/src/spark/skins/android4/DateSpinnerSkin.as
deleted file mode 100644
index d45e039..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/DateSpinnerSkin.as
+++ /dev/null
@@ -1,153 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package spark.skins.android4
-{
- import mx.core.ClassFactory;
- import mx.core.IFactory;
- import mx.core.IVisualElementContainer;
-
- import spark.components.DateSpinner;
- import spark.components.SpinnerList;
- import spark.components.SpinnerListContainer;
- import spark.components.calendarClasses.DateSpinnerItemRenderer;
- import spark.skins.mobile.supportClasses.MobileSkin;
-
- /**
- * ActionScript-based skin for the DateSpinner in mobile applications.
- *
- * @see spark.components.DateSpinner
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- *
- */
- public class DateSpinnerSkin extends MobileSkin
- {
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- public function DateSpinnerSkin()
- {
- super();
- }
-
- //--------------------------------------------------------------------------
- //
- // Skin parts
- //
- //--------------------------------------------------------------------------
-
- /**
- * Factory for creating dateItem list parts.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- public var dateItemList:IFactory;
-
- /**
- * Skin part; container of dateItem list(s).
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- public var listContainer:IVisualElementContainer;
-
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- */
- public var hostComponent:DateSpinner;
-
- //--------------------------------------------------------------------------
- //
- // Overridden Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @inheritDoc
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- override protected function createChildren():void
- {
- listContainer = new SpinnerListContainer();
-
- addChild(SpinnerListContainer(listContainer));
-
- dateItemList = new ClassFactory(SpinnerList);
- (dateItemList as ClassFactory).properties = { itemRenderer: new ClassFactory(spark.components.calendarClasses.DateSpinnerItemRenderer), percentHeight : 100 };
- }
-
- /**
- * @inheritDoc
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- override protected function measure():void
- {
- measuredWidth = SpinnerListContainer(listContainer).getPreferredBoundsWidth();
- measuredHeight = SpinnerListContainer(listContainer).getPreferredBoundsHeight();
- measuredMinWidth = SpinnerListContainer(listContainer).getMinBoundsWidth();
- measuredMinHeight = SpinnerListContainer(listContainer).getMinBoundsHeight();
- }
-
- /**
- * @inheritDoc
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.layoutContents(unscaledWidth, unscaledHeight);
-
- // Always set the SpinnerListContainer to its measured width, regardless of our size
- var containerWidth:Number = SpinnerListContainer(listContainer).getPreferredBoundsWidth();
- var containerHeight:Number = unscaledHeight;
-
- setElementSize(listContainer, containerWidth, containerHeight);
- // if width is greater than necessary, center the component
- setElementPosition(listContainer, Math.max((unscaledWidth - containerWidth)/2, 0), 0);
- }
-
- }
-}
[5/6] git commit: [flex-examples] [refs/heads/develop] - Update
-app.xml to use AIR 16
Posted by bi...@apache.org.
Update -app.xml to use AIR 16
Project: http://git-wip-us.apache.org/repos/asf/flex-examples/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-examples/commit/fde34a89
Tree: http://git-wip-us.apache.org/repos/asf/flex-examples/tree/fde34a89
Diff: http://git-wip-us.apache.org/repos/asf/flex-examples/diff/fde34a89
Branch: refs/heads/develop
Commit: fde34a89262c6fb43e1a3eced8728da82cc2626f
Parents: 8ccec1f
Author: OmPrakash Muppirala <bi...@gmail.com>
Authored: Fri Dec 19 15:34:23 2014 -0800
Committer: OmPrakash Muppirala <bi...@gmail.com>
Committed: Fri Dec 19 15:34:23 2014 -0800
----------------------------------------------------------------------
tourdeflexmobile/src/TourDeFlexMobile-app.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/fde34a89/tourdeflexmobile/src/TourDeFlexMobile-app.xml
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/TourDeFlexMobile-app.xml b/tourdeflexmobile/src/TourDeFlexMobile-app.xml
index 2d1e6a4..506b9af 100644
--- a/tourdeflexmobile/src/TourDeFlexMobile-app.xml
+++ b/tourdeflexmobile/src/TourDeFlexMobile-app.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
-<application xmlns="http://ns.adobe.com/air/application/15.0">
+<application xmlns="http://ns.adobe.com/air/application/16.0">
<!-- Adobe AIR Application Descriptor File Template.
[3/6] git commit: [flex-examples] [refs/heads/develop] - Remove
redundant Android skins (it now comes with the 4.14 SDK)
Posted by bi...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/HScrollBarSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/HScrollBarSkin.as b/tourdeflexmobile/src/spark/skins/android4/HScrollBarSkin.as
deleted file mode 100644
index d2cb3dd..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/HScrollBarSkin.as
+++ /dev/null
@@ -1,205 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
-
- import mx.core.DPIClassification;
- import mx.core.mx_internal;
-
- import spark.components.Button;
- import spark.components.HScrollBar;
- import spark.skins.mobile.supportClasses.MobileSkin;
-
- use namespace mx_internal;
-
- /**
- * ActionScript-based skin for HScrollBar components in mobile applications.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public class HScrollBarSkin extends MobileSkin
- {
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public function HScrollBarSkin()
- {
- super();
-
- minWidth = 20;
- thumbSkinClass = HScrollBarThumbSkin;
- var paddingBottom:int;
- var paddingHorizontal:int;
-
- // Depending on density set our measured height
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
- minHeight = 24;
- paddingBottom = HScrollBarThumbSkin.PADDING_BOTTOM_640DPI;
- paddingHorizontal = HScrollBarThumbSkin.PADDING_HORIZONTAL_640DPI;
- break;
- }
- case DPIClassification.DPI_480:
- {
- minHeight = 18;
- paddingBottom = HScrollBarThumbSkin.PADDING_BOTTOM_480DPI;
- paddingHorizontal = HScrollBarThumbSkin.PADDING_HORIZONTAL_480DPI;
- break;
- }
- case DPIClassification.DPI_320:
- {
- minHeight = 12;
- paddingBottom = HScrollBarThumbSkin.PADDING_BOTTOM_320DPI;
- paddingHorizontal = HScrollBarThumbSkin.PADDING_HORIZONTAL_320DPI;
- break;
- }
- case DPIClassification.DPI_240:
- {
- minHeight = 9;
- paddingBottom = HScrollBarThumbSkin.PADDING_BOTTOM_240DPI;
- paddingHorizontal = HScrollBarThumbSkin.PADDING_HORIZONTAL_240DPI;
- break;
- }
- case DPIClassification.DPI_120:
- {
- minHeight = 5;
- paddingBottom = HScrollBarThumbSkin.PADDING_BOTTOM_120DPI;
- paddingHorizontal = HScrollBarThumbSkin.PADDING_HORIZONTAL_120DPI;
- break;
- }
- default:
- {
- // default DPI_160
- minHeight = 6;
- paddingBottom = HScrollBarThumbSkin.PADDING_BOTTOM_DEFAULTDPI;
- paddingHorizontal = HScrollBarThumbSkin.PADDING_HORIZONTAL_DEFAULTDPI;
- break;
- }
- }
-
- // The minimum width is set such that, at it's smallest size, the thumb appears
- // as wide as it is high.
- minThumbWidth = (minHeight - paddingBottom) + (paddingHorizontal * 2);
- }
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- */
- public var hostComponent:HScrollBar;
-
- /**
- * Minimum width for the thumb
- */
- protected var minThumbWidth:Number;
-
- /**
- * Skin to use for the thumb Button skin part
- */
- protected var thumbSkinClass:Class;
-
- //--------------------------------------------------------------------------
- //
- // Skin parts
- //
- //--------------------------------------------------------------------------
- /**
- * HScrollbar track skin part.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public var track:Button;
-
- /**
- * HScrollbar thumb skin part.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public var thumb:Button;
-
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods
- //
- //--------------------------------------------------------------------------
- /**
- * @private
- */
- override protected function createChildren():void
- {
- // Create our skin parts if necessary: track and thumb.
- if (!track)
- {
- // We don't want a visible track so we set the skin to MobileSkin
- track = new Button();
- track.setStyle("skinClass", spark.skins.mobile.supportClasses.MobileSkin);
- track.width = minWidth;
- track.height = minHeight;
- addChild(track);
- }
-
- if (!thumb)
- {
- thumb = new Button();
- thumb.minWidth = minThumbWidth;
- thumb.setStyle("skinClass", thumbSkinClass);
- thumb.width = minHeight;
- thumb.height = minHeight;
- addChild(thumb);
- }
- }
-
- /**
- * @private
- */
- override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.layoutContents(unscaledWidth, unscaledHeight);
-
- setElementSize(track, unscaledWidth, unscaledHeight);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/HScrollBarThumbSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/HScrollBarThumbSkin.as b/tourdeflexmobile/src/spark/skins/android4/HScrollBarThumbSkin.as
deleted file mode 100644
index 5c63d15..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/HScrollBarThumbSkin.as
+++ /dev/null
@@ -1,169 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
-
- import flash.display.CapsStyle;
- import flash.display.JointStyle;
- import flash.display.LineScaleMode;
-
- import mx.core.DPIClassification;
- import mx.core.mx_internal;
-
- import spark.components.Button;
- import spark.skins.mobile.supportClasses.MobileSkin;
-
- use namespace mx_internal;
-
- /**
- * ActionScript-based skin for the HScrollBar thumb skin part in mobile applications.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public class HScrollBarThumbSkin extends MobileSkin
- {
- //--------------------------------------------------------------------------
- //
- // Class constants
- //
- //--------------------------------------------------------------------------
-
- // These constants are also accessed from HScrollBarSkin
- mx_internal static const PADDING_BOTTOM_640DPI:int = 10;
- mx_internal static const PADDING_HORIZONTAL_640DPI:int = 8;
- mx_internal static const PADDING_BOTTOM_480DPI:int = 8;
- mx_internal static const PADDING_HORIZONTAL_480DPI:int = 6;
- mx_internal static const PADDING_BOTTOM_320DPI:int = 5;
- mx_internal static const PADDING_HORIZONTAL_320DPI:int = 4;
- mx_internal static const PADDING_BOTTOM_240DPI:int = 4;
- mx_internal static const PADDING_HORIZONTAL_240DPI:int = 3;
- mx_internal static const PADDING_BOTTOM_120DPI:int = 2;
- mx_internal static const PADDING_HORIZONTAL_120DPI:int = 2;
- mx_internal static const PADDING_BOTTOM_DEFAULTDPI:int = 3;
- mx_internal static const PADDING_HORIZONTAL_DEFAULTDPI:int = 2;
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public function HScrollBarThumbSkin()
- {
- super();
-
- // Depending on density set padding
- switch (applicationDPI)
- {
- case DPIClassification.DPI_480:
- {
- paddingBottom = PADDING_BOTTOM_480DPI;
- paddingHorizontal = PADDING_HORIZONTAL_480DPI;
- break;
- }
- case DPIClassification.DPI_320:
- {
- paddingBottom = PADDING_BOTTOM_320DPI;
- paddingHorizontal = PADDING_HORIZONTAL_320DPI;
- break;
- }
- case DPIClassification.DPI_240:
- {
- paddingBottom = PADDING_BOTTOM_240DPI;
- paddingHorizontal = PADDING_HORIZONTAL_240DPI;
- break;
- }
- default:
- {
- paddingBottom = PADDING_BOTTOM_DEFAULTDPI;
- paddingHorizontal = PADDING_HORIZONTAL_DEFAULTDPI;
- break;
- }
- }
- }
-
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- */
- public var hostComponent:Button;
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
- /**
- * Padding from bottom.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var paddingBottom:int;
-
- /**
- * Horizontal padding from left and right.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var paddingHorizontal:int;
-
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.drawBackground(unscaledWidth, unscaledHeight);
-
- var thumbHeight:Number = unscaledHeight - paddingBottom;
-
- graphics.beginFill(getStyle("thumbColor"), 1);
- graphics.drawRect(paddingHorizontal + .5, 0.5, unscaledWidth - 2 * paddingHorizontal, thumbHeight);
-
- graphics.endFill();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/HSliderSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/HSliderSkin.as b/tourdeflexmobile/src/spark/skins/android4/HSliderSkin.as
deleted file mode 100644
index f89d3b9..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/HSliderSkin.as
+++ /dev/null
@@ -1,293 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
- import flash.display.BlendMode;
- import flash.display.DisplayObject;
- import flash.events.Event;
-
- import mx.core.ClassFactory;
- import mx.core.IFactory;
-
- import spark.components.Button;
- import spark.components.HSlider;
- import spark.skins.android4.assets.HSliderTrack_filled;
- import spark.skins.mobile.supportClasses.HSliderDataTip;
- import spark.skins.mobile.supportClasses.MobileSkin;
-
- /**
- * Android 4.x specific ActionScript-based skin for HSlider controls in mobile applications.
- *
- * <p>The base Flex implementation creates an HSlider with fixed height
- * and variable width with a fixed-size thumb. As the height of the
- * HSlider component increases, the vertical dimensions of the visible HSlider remain
- * the same, and the HSlider stays vertically centered.</p>
- *
- * <p>The thumb and track implementations can be customized by subclassing
- * this skin class and overriding the thumbSkinClass, trackSkinClass,
- * and/or dataTipClass variables as necessary.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public class HSliderSkin extends MobileSkin
- {
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- *
- */
- public function HSliderSkin()
- {
- super();
-
- thumbSkinClass = spark.skins.android4.HSliderThumbSkin;
- trackSkinClass = spark.skins.android4.HSliderTrackSkin;
- filledTrackSkinClass = spark.skins.android4.assets.HSliderTrack_filled;
- dataTipClass = spark.skins.mobile.supportClasses.HSliderDataTip;
-
- blendMode = BlendMode.LAYER;
- }
-
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
-
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- */
- private var _hostComponent:HSlider;
-
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- */
- public function get hostComponent():HSlider
- {
- return _hostComponent;
- }
-
- public function set hostComponent(value:HSlider):void
- {
- if (_hostComponent)
- _hostComponent.removeEventListener(Event.CHANGE, thumbPositionChanged_handler);
- _hostComponent = value;
- if (_hostComponent)
- _hostComponent.addEventListener(Event.CHANGE, thumbPositionChanged_handler);
- }
-
- //--------------------------------------------------------------------------
- //
- // Skin parts
- //
- //--------------------------------------------------------------------------
-
- /**
- * HSlider track skin part
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public var track:Button;
-
- /**
- * HSlider track skin part that
- * depicts area that is filled
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public var filledTrack:DisplayObject;
-
- /**
- * HSlider thumb skin part
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public var thumb:Button;
-
- /**
- * HSlider dataTip class factory
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public var dataTip:IFactory;
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * Specifies the skin class that will be used for the HSlider thumb.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var thumbSkinClass:Class;
-
- /**
- * Specifies the skin class that will be used for the HSlider track.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var trackSkinClass:Class;
- /**
- * Specifies the skin class that will be used for the HSlider track's
- * filled area.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var filledTrackSkinClass:Class;
-
- /**
- * Specifies the class that will be used for the HSlider datatip.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var dataTipClass:Class;
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- override protected function commitCurrentState():void
- {
- if (currentState == "disabled")
- alpha = 0.5;
- else if (currentState == "normal")
- alpha = 1;
- }
-
- /**
- * @private
- */
- override protected function createChildren():void
- {
- // Create our skin parts: track and thumb
- track = new Button();
- track.setStyle("skinClass", trackSkinClass);
- addChild(track);
-
- filledTrack = new filledTrackSkinClass();
- addChild(filledTrack);
-
- thumb = new Button();
- thumb.setStyle("skinClass", thumbSkinClass);
- addChild(thumb);
-
- // Set up the class factory for the dataTip
- dataTip = new ClassFactory();
- ClassFactory(dataTip).generator = dataTipClass;
- }
-
- /**
- * @private
- * The HSliderSkin width will be no less than the width of the thumb skin.
- * The HSliderSkin height will be no less than the greater of the heights of
- * the thumb and track skins.
- */
- override protected function measure():void
- {
- measuredWidth = track.getPreferredBoundsWidth();
- measuredHeight = Math.max(track.getPreferredBoundsHeight(), thumb.getPreferredBoundsHeight());
-
- measuredMinHeight = Math.max(track.getPreferredBoundsHeight(), thumb.getPreferredBoundsHeight());
- measuredMinWidth = thumb.getPreferredBoundsWidth();
- }
-
- /**
- * @private
- */
- override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.layoutContents(unscaledWidth, unscaledHeight);
-
- // minimum height is no smaller than the larger of the thumb or track
- var calculatedSkinHeight:int = Math.max(Math.max(thumb.getPreferredBoundsHeight(), track.getPreferredBoundsHeight()),
- unscaledHeight);
-
- // minimum width is no smaller than the thumb
- var calculatedSkinWidth:int = Math.max(thumb.getPreferredBoundsWidth(),
- unscaledWidth);
-
- // once we know the skin height, center the thumb and track
- thumb.y = Math.max(Math.round((calculatedSkinHeight - thumb.getPreferredBoundsHeight()) / 2), 0);
- var calculatedTrackY:int = Math.max(Math.round((calculatedSkinHeight - track.getPreferredBoundsHeight()) / 2), 0);
-
- // size and position
- setElementSize(thumb, thumb.getPreferredBoundsWidth(), thumb.getPreferredBoundsHeight()); // thumb does NOT scale
- setElementSize(track, calculatedSkinWidth, track.getPreferredBoundsHeight()); // note track is NOT scaled vertically
- setElementPosition(track, 0, calculatedTrackY);
-
- //Set size and position of filled area based on thumb's current location
- var filledTrackWidth:Number = thumb.getLayoutBoundsX();
- setElementSize(filledTrack, filledTrackWidth, track.getPreferredBoundsHeight()); // note track is NOT scaled vertically
- setElementPosition(filledTrack, track.x + HSliderTrackSkin(track.skin).visibleTrackOffset , calculatedTrackY);
- }
-
- private function thumbPositionChanged_handler(event:Event):void
- {
- //Just trigger a redraw so that the filled area of the track updates itself
- invalidateDisplayList();
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/HSliderThumbSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/HSliderThumbSkin.as b/tourdeflexmobile/src/spark/skins/android4/HSliderThumbSkin.as
deleted file mode 100644
index 517ff93..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/HSliderThumbSkin.as
+++ /dev/null
@@ -1,333 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
-import flash.display.DisplayObject;
-
-import mx.core.DPIClassification;
-
-import spark.components.Button;
-import spark.skins.android4.assets.HSliderThumb_normal;
-import spark.skins.mobile.supportClasses.MobileSkin;
-
-/**
- * Android 4.x specific ActionScript-based skin for the HSlider thumb skin part in mobile applications.
- *
- * <p>Note that this particular implementation defines a hit zone which is larger than
- * the visible thumb for better usability on mobile screens.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
-public class HSliderThumbSkin extends MobileSkin
-{
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- *
- */
- public function HSliderThumbSkin()
- {
- super();
-
- thumbNormalClass = spark.skins.android4.assets.HSliderThumb_normal;
- thumbPressedClass = spark.skins.android4.assets.HSliderThumb_pressed;
-
- // set the dimensions to use based on the screen density
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
- thumbImageWidth = 116;
- thumbImageHeight = 116;
-
- hitZoneOffset = 20;
- hitZoneSideLength = 160;
-
- break;
- }
- case DPIClassification.DPI_480:
- {
- // Note provisional may need changes
- thumbImageWidth = 88;
- thumbImageHeight = 88;
-
- hitZoneOffset = 20;
- hitZoneSideLength = 130;
-
- break;
- }
- case DPIClassification.DPI_320:
- {
- thumbImageWidth = 58;
- thumbImageHeight = 58;
-
- hitZoneOffset = 10;
- hitZoneSideLength = 80;
-
- break;
- }
- case DPIClassification.DPI_240:
- {
- thumbImageWidth = 44;
- thumbImageHeight = 44;
-
- hitZoneOffset = 10;
- hitZoneSideLength = 65;
-
- break;
- }
- case DPIClassification.DPI_120:
- {
- thumbImageWidth = 22;
- thumbImageHeight = 22;
-
- hitZoneOffset = 5;
- hitZoneSideLength = 33;
-
- break;
- }
- default:
- {
- // default DPI_160
- thumbImageWidth = 29;
- thumbImageHeight = 29;
-
- hitZoneOffset = 5;
- hitZoneSideLength = 40;
-
- break;
- }
-
- }
- }
-
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
-
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- */
- public var hostComponent:Button;
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
-
- // FXG thumb classes
- /**
- * Specifies the FXG class to use when the thumb is in the normal state
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var thumbNormalClass:Class;
-
- /**
- * Specifies the FXG class to use when the thumb is in the pressed state
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var thumbPressedClass:Class;
-
- /**
- * Specifies the DisplayObject to use when the thumb is in the normal state
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var thumbSkin_normal:DisplayObject;
-
- /**
- * Specifies the DisplayObject to use when the thumb is in the pressed state
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var thumbSkin_pressed:DisplayObject;
-
- /**
- * Specifies the current DisplayObject that should be shown
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var currentThumbSkin:DisplayObject;
-
- /**
- * Width of the overall thumb image
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var thumbImageWidth:int;
-
- /**
- * Height of the overall thumb image
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var thumbImageHeight:int;
-
- /**
- * Length of the sizes of the hitzone (assumed to be square)
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var hitZoneSideLength:int;
-
- /**
- * Distance between the left edge of the hitzone and the left edge
- * of the thumb
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var hitZoneOffset:int;
-
- /**
- * @private
- * Remember which state is currently being displayed
- */
- private var displayedState:String;
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- override protected function commitCurrentState():void
- {
- if (currentState == "up")
- {
- // show the normal button
- if (!thumbSkin_normal)
- {
- thumbSkin_normal = new thumbNormalClass();
- addChild(thumbSkin_normal);
- }
- else
- {
- thumbSkin_normal.visible = true;
- }
- currentThumbSkin = thumbSkin_normal;
-
- // hide the pressed button
- if (thumbSkin_pressed)
- thumbSkin_pressed.visible = false;
- }
- else if (currentState == "down")
- {
- // show the pressed button
- if (!thumbSkin_pressed)
- {
- thumbSkin_pressed = new thumbPressedClass();
- addChild(thumbSkin_pressed);
- }
- else
- {
- thumbSkin_pressed.visible = true;
- }
- currentThumbSkin = thumbSkin_pressed;
-
- // hide the normal button
- if (thumbSkin_normal)
- thumbSkin_normal.visible = false;
- }
-
- displayedState = currentState;
-
- invalidateDisplayList();
- }
-
- /**
- * @private
- */
- override protected function measure():void
- {
- measuredWidth = thumbImageWidth;
- measuredHeight = thumbImageHeight;
- }
-
- /**
- * @private
- */
- override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.layoutContents(unscaledWidth, unscaledHeight);
-
- setElementSize(currentThumbSkin, unscaledWidth, unscaledHeight);
- setElementPosition(currentThumbSkin, 0, 0)
- }
-
- /**
- * @private
- */
- override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
- {
- // put in a larger hit zone than the thumb
- graphics.beginFill(0xffffff, 0);
- graphics.drawRect(-hitZoneOffset, -hitZoneOffset, hitZoneSideLength, hitZoneSideLength);
- graphics.endFill();
- }
-}
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/HSliderTrackSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/HSliderTrackSkin.as b/tourdeflexmobile/src/spark/skins/android4/HSliderTrackSkin.as
deleted file mode 100644
index 57dc8f3..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/HSliderTrackSkin.as
+++ /dev/null
@@ -1,227 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
- import flash.display.DisplayObject;
-
- import mx.core.DPIClassification;
-
- import spark.components.Button;
- import spark.skins.android4.assets.HSliderTrack;
- import spark.skins.mobile.supportClasses.MobileSkin;
-
- /**
- * ActionScript-based skin for the HSlider track skin part in mobile applications.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public class HSliderTrackSkin extends MobileSkin
- {
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- *
- */
- public function HSliderTrackSkin()
- {
- super();
-
- trackClass = spark.skins.android4.assets.HSliderTrack;
-
- // set the right dimensions to use based on the screen density
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
- trackWidth = 1200;
- trackHeight = 8;
-
- visibleTrackOffset = 48;
-
- break;
- }
- case DPIClassification.DPI_480:
- {
- trackWidth = 900;
- trackHeight = 6;
-
- visibleTrackOffset = 38;
-
- break;
- }
- case DPIClassification.DPI_320:
- {
- trackWidth = 600;
- trackHeight = 4;
-
- visibleTrackOffset = 24;
-
- break;
- }
- case DPIClassification.DPI_240:
- {
- trackWidth = 450;
- trackHeight = 3;
-
- visibleTrackOffset = 18;
-
- break;
- }
- case DPIClassification.DPI_120:
- {
- trackWidth = 225;
- trackHeight = 2;
-
- visibleTrackOffset = 9;
-
- break;
- }
- default:
- {
- // default DPI_160
- trackWidth = 300;
- trackHeight = 2;
-
- visibleTrackOffset = 12;
-
- break;
- }
- }
- }
-
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
-
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- */
- public var hostComponent:Button;
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * Specifies the FXG class to use for the track image
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var trackClass:Class;
-
- /**
- * Specifies the DisplayObject for the track image
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var trackSkin:DisplayObject;
-
- /**
- * Specifies the track image width
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var trackWidth:int;
-
- /**
- * Specifies the track image height
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var trackHeight:int;
-
- /**
- * Specifies the offset from the left and right edge to where
- * the visible track begins. This should match the offset in the FXG assets.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public var visibleTrackOffset:int;
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- override protected function createChildren():void
- {
- trackSkin = new trackClass();
- addChild(trackSkin);
- }
-
- /**
- * @private
- */
- override protected function measure():void
- {
- measuredWidth = trackWidth;
- measuredHeight = trackHeight;
- }
-
- /**
- * @private
- */
- override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.layoutContents(unscaledWidth, unscaledHeight);
-
- var unscaledTrackWidth:int = unscaledWidth - (2 * visibleTrackOffset);
- setElementSize(trackSkin, unscaledTrackWidth, unscaledHeight);
- setElementPosition(trackSkin, visibleTrackOffset, 0);
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/ListSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/ListSkin.as b/tourdeflexmobile/src/spark/skins/android4/ListSkin.as
deleted file mode 100644
index c78a212..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/ListSkin.as
+++ /dev/null
@@ -1,204 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
- import flash.display.BlendMode;
- import flash.display.DisplayObject;
- import flash.display.Sprite;
-
- import mx.core.ClassFactory;
- import mx.core.mx_internal;
-
- import spark.components.DataGroup;
- import spark.components.List;
- import spark.components.Scroller;
- import spark.layouts.HorizontalAlign;
- import spark.layouts.VerticalLayout;
- import spark.skins.mobile.supportClasses.MobileSkin;
- //import skins.Scrollers;
-
- //import skins.Scroller;
-
- use namespace mx_internal;
-
- /**
- * ActionScript-based skin for the List components in mobile applications.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public class ListSkin extends MobileSkin
- {
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- *
- */
- public function ListSkin()
- {
- super();
-
- minWidth = 112;
- blendMode = BlendMode.NORMAL;
- }
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- */
- public var hostComponent:List;
-
-
- //--------------------------------------------------------------------------
- //
- // Skin parts
- //
- //--------------------------------------------------------------------------
- /**
- * Scroller skin part.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public var scroller:Scroller;
-
- /**
- * DataGroup skin part.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public var dataGroup:DataGroup;
-
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods
- //
- //--------------------------------------------------------------------------
- /**
- * @private
- */
- override protected function commitCurrentState():void
- {
- super.commitCurrentState();
-
- alpha = currentState.indexOf("disabled") == -1 ? 1 : 0.5;
- }
-
-
- /**
- * @private
- */
- override protected function createChildren():void
- {
- if (!dataGroup)
- {
- // Create data group layout
- var layout:VerticalLayout = new VerticalLayout();
- layout.requestedMinRowCount = 5;
- layout.horizontalAlign = HorizontalAlign.JUSTIFY;
- layout.gap = 0;
-
- // Create data group
- dataGroup = new DataGroup();
- dataGroup.layout = layout;
- dataGroup.itemRenderer = new ClassFactory(spark.components.LabelItemRenderer);
- }
- if (!scroller)
- {
- // Create scroller
- scroller = new Scroller();
- scroller.minViewportInset = 0;
- scroller.hasFocusableChildren = false;
-
- // scroller.pullEnabled = false;
- // scroller.bounceEnabled = false;
- // scroller.scrollSnappingMode = "center";
-
- addChild(scroller);
- }
-
- // Associate scroller with data group
- if (!scroller.viewport)
- {
- scroller.viewport = dataGroup;
-
- }
- }
-
- /**
- * @private
- */
- override protected function measure():void
- {
- measuredWidth = scroller.getPreferredBoundsWidth();
- measuredHeight = scroller.getPreferredBoundsHeight();
-
- }
-
- /**
- * @private
- */
- override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.updateDisplayList(unscaledWidth, unscaledHeight);
-
- var borderWidth:int = getStyle("borderVisible") ? 1 : 0;
-
- // Background
- graphics.beginFill(getStyle("contentBackgroundColor"), getStyle("contentBackgroundAlpha"));
- graphics.drawRect(borderWidth, borderWidth, unscaledWidth - 2 * borderWidth, unscaledHeight - 2 * borderWidth);
- graphics.endFill();
-
- // Border
- if (getStyle("borderVisible"))
- {
- graphics.lineStyle(.5, getStyle("borderColor"), getStyle("borderAlpha"), true);
- graphics.drawRect(0, 0, unscaledWidth - 1, unscaledHeight - 1);
- }
- // Scroller
- //scroller.minViewportInset = borderWidth;
- setElementSize(scroller, unscaledWidth, unscaledHeight);
- setElementPosition(scroller, 0, 0);
-
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/RadioButtonSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/RadioButtonSkin.as b/tourdeflexmobile/src/spark/skins/android4/RadioButtonSkin.as
deleted file mode 100644
index fd74645..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/RadioButtonSkin.as
+++ /dev/null
@@ -1,253 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
-
-import flash.display.DisplayObject;
-
-import mx.core.DPIClassification;
-
-import spark.skins.android4.assets.RadioButton_up;
-import spark.skins.mobile.supportClasses.SelectableButtonSkinBase;
-
-/**
- * ActionScript-based skin for RadioButton controls in mobile applications.
- *
- * @see spark.components.RadioButton
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
-public class RadioButtonSkin extends SelectableButtonSkinBase
-{
- //--------------------------------------------------------------------------
- //
- // Class constants
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- static private const exclusions:Array = ["labelDisplay", "labelDisplayShadow"];
-
- //--------------------------------------------------------------------------
- //
- // Member variables
- //
- //--------------------------------------------------------------------------
-
- protected var symbolOffsetX:Number;
- protected var symbolOffsetY:Number;
- protected var iconWidth:Number;
- protected var iconHeight:Number;
- protected var symbolWidth:Number;
- protected var symbolHeight:Number;
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- *
- */
- public function RadioButtonSkin()
- {
- super();
-
- layoutPaddingLeft = 0;
- layoutPaddingRight = 0;
- layoutPaddingTop = 0;
- layoutPaddingBottom = 0;
-
- upIconClass = spark.skins.android4.assets.RadioButton_up;
- upSelectedIconClass = spark.skins.android4.assets.RadioButton_up;
- downIconClass = spark.skins.android4.assets.RadioButton_down;
- downSelectedIconClass = spark.skins.android4.assets.RadioButton_down;
- upSymbolIconClass = null;
- downSymbolIconClass = null;
- upSymbolIconSelectedClass = spark.skins.android4.assets.RadioButton_upSymbolSelected;
- downSymbolIconSelectedClass = spark.skins.android4.assets.RadioButton_downSymbolSelected;
-
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
-
- layoutGap = 16;
- minWidth = 128;
- minHeight = 128;
- iconWidth = 128;
- iconHeight = 128;
- symbolWidth = 44;
- symbolHeight = 44;
- symbolOffsetX = 44;
- symbolOffsetY = 44;
-
- break;
- }
- case DPIClassification.DPI_480:
- {
-
- layoutGap = 12;
- minWidth = 96;
- minHeight = 96;
- iconWidth = 96;
- iconHeight = 96;
- symbolWidth = 33;
- symbolHeight = 33;
- symbolOffsetX = 33;
- symbolOffsetY = 33;
-
- break;
- }
- case DPIClassification.DPI_320:
- {
-
- layoutGap = 8;
- minWidth = 64;
- minHeight = 64;
- iconWidth = 64;
- iconHeight = 64;
- symbolWidth = 22;
- symbolHeight = 22;
- symbolOffsetX = 22;
- symbolOffsetY = 22;
-
- break;
- }
- case DPIClassification.DPI_240:
- {
-
- layoutGap = 6;
- minWidth = 48;
- minHeight = 48;
- iconWidth = 48;
- iconHeight = 48;
- symbolWidth = 16.5;
- symbolHeight = 16.5;
- symbolOffsetX = 16.5;
- symbolOffsetY = 16.5;
-
- break;
- }
- case DPIClassification.DPI_120:
- {
-
- layoutGap = 3;
- minWidth = 24;
- minHeight = 24;
- iconWidth = 24;
- iconHeight = 24;
- symbolWidth = 8.25;
- symbolHeight = 8.25;
- symbolOffsetX = 8.25;
- symbolOffsetY = 8.25;
-
- break;
- }
- default:
- {
-
- layoutGap = 4;
- minWidth = 32;
- minHeight = 32;
- iconWidth = 32;
- iconHeight = 32;
- symbolWidth = 11;
- symbolHeight = 11;
- symbolOffsetX = 11;
- symbolOffsetY = 11;
-
- break;
- }
- }
- }
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- * RadioButton <code>chromeColor</code> is drawn to match the FXG ellipse
- * shape and position.
- */
- override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
- {
- // super draws a transparent hit zone
- super.drawBackground(unscaledWidth, unscaledHeight);
-
- // get the size and position of iconDisplay
- var currentIcon:DisplayObject = getIconDisplay();
-
- graphics.beginFill(getStyle("chromeColor"));
- graphics.drawEllipse(currentIcon.x + 1, currentIcon.y + 1, currentIcon.width - 2, currentIcon.height - 2);
- graphics.endFill();
- }
-
- /**
- * @private
- */
- override protected function get focusSkinExclusions():Array
- {
- return exclusions;
- }
-
- override protected function commitCurrentState():void
- {
- super.commitCurrentState();
- if(symbolIcon != null)
- {
- symbolIcon.width = symbolWidth;
- symbolIcon.height = symbolHeight;
- }
- var iconDisplay:DisplayObject = getIconDisplay();
- if(iconDisplay != null)
- {
- iconDisplay.width = iconWidth;
- iconDisplay.height = iconHeight;
- }
- }
-
- override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.layoutContents(unscaledWidth, unscaledHeight);
- // position the symbols to align with the background "icon"
- if (symbolIcon)
- {
- var currentIcon:DisplayObject = getIconDisplay();
- setElementPosition(symbolIcon, symbolOffsetX, symbolOffsetY);
- }
- }
-}
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/SpinnerListContainerSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/SpinnerListContainerSkin.as b/tourdeflexmobile/src/spark/skins/android4/SpinnerListContainerSkin.as
deleted file mode 100644
index a626c49..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/SpinnerListContainerSkin.as
+++ /dev/null
@@ -1,327 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package spark.skins.android4
-{
- import flash.display.Graphics;
- import flash.display.InteractiveObject;
- import flash.display.Sprite;
-
- import mx.core.DPIClassification;
- import mx.core.mx_internal;
-
- import spark.components.Group;
- import spark.components.SpinnerListContainer;
- import spark.layouts.HorizontalLayout;
- import spark.skins.android4.assets.SpinnerListContainerBackground;
- import spark.skins.android4.assets.SpinnerListContainerSelectionIndicator;
- import spark.skins.android4.assets.SpinnerListContainerShadow;
- import spark.skins.mobile.supportClasses.MobileSkin;
-
- use namespace mx_internal;
- /**
- * ActionScript-based skin for the SpinnerListContainer in mobile applications.
- *
- * @see spark.components.SpinnerListContainer
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- public class SpinnerListContainerSkin extends MobileSkin
- {
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- *
- */
- public function SpinnerListContainerSkin()
- {
- super();
-
- borderClass = spark.skins.android4.assets.SpinnerListContainerBackground;
- selectionIndicatorClass = spark.skins.android4.assets.SpinnerListContainerSelectionIndicator;
- shadowClass = spark.skins.android4.assets.SpinnerListContainerShadow;
- cornerRadius = 0;
- borderThickness = 0;
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
- selectionIndicatorHeight = 182;
- break;
- }
- case DPIClassification.DPI_480:
- {
- selectionIndicatorHeight = 144;
- break;
- }
- case DPIClassification.DPI_320:
- {
- selectionIndicatorHeight = 96;
- break;
- }
- case DPIClassification.DPI_240:
- {
- selectionIndicatorHeight = 72;
- break;
- }
- case DPIClassification.DPI_120:
- {
- selectionIndicatorHeight = 36;
- break;
- }
- default: // default DPI_160
- {
- selectionIndicatorHeight = 48;
-
- break;
- }
- }
-
- minWidth = 30;
- }
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
- /**
- * Pixel thickness of the border.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var borderThickness:Number;
-
- /**
- * Radius of the border corners.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var cornerRadius:Number;
-
- /**
- * Height of the selection indicator.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var selectionIndicatorHeight:Number;
-
- /**
- * Class for the border part.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var borderClass:Class;
-
- /**
- * Class for the selection indicator skin part.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var selectionIndicatorClass:Class;
-
- /**
- * Class for the shadow skin part.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var shadowClass:Class;
-
- /**
- * Border skin part which includes the background.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var border:InteractiveObject;
-
- /**
- * Selection indicator skin part.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var selectionIndicator:InteractiveObject;
-
- /**
- * Shadow skin part.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var shadow:InteractiveObject;
-
- /**
- * Mask for the content group.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var contentGroupMask:Sprite;
-
- //--------------------------------------------------------------------------
- //
- // Skin parts
- //
- //--------------------------------------------------------------------------
-
- /**
- * An optional skin part that defines the Group where the content
- * children are pushed into and laid out.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- public var contentGroup:Group;
-
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- public var hostComponent:SpinnerListContainer;
-
- //--------------------------------------------------------------------------
- //
- // Overridden Methods
- //
- //--------------------------------------------------------------------------
- /**
- * @private
- */
- override protected function createChildren():void
- {
- super.createChildren();
-
- if (!border)
- {
- // Border and background
- border = new borderClass();
- border.mouseEnabled = false;
- addChild(border);
- }
-
- if (!contentGroup)
- {
- // Contains the child elements
- contentGroup = new Group();
- var hLayout:HorizontalLayout = new HorizontalLayout();
- hLayout.gap = 0;
- hLayout.verticalAlign = "middle";
- contentGroup.layout = hLayout;
- contentGroup.id = "contentGroup";
- addChild(contentGroup);
- }
-
- if (!shadow)
- {
- // Shadowing sits on top of the content
- shadow = new shadowClass();
- shadow.mouseEnabled = false;
- addChild(shadow);
- }
-
-
- if (!contentGroupMask)
- {
- // Create a mask for the content
- contentGroupMask = new Sprite();
- addChild(contentGroupMask);
- }
- }
-
- /**
- * @private
- */
- override protected function measure():void
- {
- super.measure();
-
- var contentW:Number = contentGroup.getPreferredBoundsWidth();
- var contentH:Number = contentGroup.getPreferredBoundsHeight();
-
- measuredWidth = measuredMinWidth = contentW + borderThickness * 2;
- measuredHeight = contentH + borderThickness * 2;
-
- }
-
- /**
- * @private
- */
- override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.layoutContents(unscaledWidth, unscaledHeight);
-
- setElementSize(contentGroup, unscaledWidth - borderThickness * 2, unscaledHeight - borderThickness * 2);
- setElementPosition(contentGroup, borderThickness, borderThickness);
-
- // Inset by the borderThickness horizontally because the selectionIndicator starts at 0
- setElementSize(border, unscaledWidth - borderThickness * 2, unscaledHeight);
- setElementPosition(border, borderThickness, 0);
-
- setElementSize(shadow, unscaledWidth - borderThickness * 4, measuredHeight - borderThickness * 2);
- setElementPosition(shadow, borderThickness * 2, unscaledHeight/2 - measuredHeight/2);
-
- // The SpinnerLists contain a left and right border. We don't want to show the leftmost
- // SpinnerLists's left border nor the rightmost one's right border.
- // We inset the mask on the left and right sides to accomplish this.
- var g:Graphics = contentGroupMask.graphics;
- g.clear();
- g.beginFill(0x00FF00);
- g.drawRoundRect(borderThickness * 2, borderThickness, unscaledWidth - borderThickness * 4, unscaledHeight - borderThickness * 2, cornerRadius, cornerRadius);
- g.endFill();
-
- contentGroup.mask = contentGroupMask;
- }
- }
-}
-
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/SpinnerListScrollerSkin.mxml
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/SpinnerListScrollerSkin.mxml b/tourdeflexmobile/src/spark/skins/android4/SpinnerListScrollerSkin.mxml
deleted file mode 100644
index 270818e..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/SpinnerListScrollerSkin.mxml
+++ /dev/null
@@ -1,94 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
--->
-
-
-<!--
-
-Scroller unconditionally sets its skin's layout to private layout
-implementation that handles the scroll policies. Scroller skins can
-only provide replacement scrollbars. The skin's layout and
-constraints or dimensions set on skin parts will not be honored. To
-gain more control over the layout of a viewport and its scrollbars,
-instead of using Scroller, add them to a Group and use the ScrollBar component's
-viewport property to link them together.
-
--->
-
-<!--- The default skin class for the Spark Scroller that is used by the SpinnerList component.
-
-@see spark.components.SpinnerList
-@see spark.components.Scroller
-
-@langversion 3.0
-@playerversion AIR 3
-@productversion Flex 4.6
--->
-<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark">
-
- <fx:Metadata>
- <![CDATA[
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- [HostComponent("spark.components.Scroller")]
- ]]>
- </fx:Metadata>
-
- <fx:Script>
- <![CDATA[
- /**
- * @private
- */
- override public function beginHighlightBitmapCapture() : Boolean
- {
- var needUpdate:Boolean = super.beginHighlightBitmapCapture();
-
- // Draw an opaque rect that fill our entire skin. Our background
- // is transparent, but we don't want focus/error skins to
- // poke through. This is safe to do since we don't have any
- // graphic elements as direct children.
- graphics.beginFill(0);
- graphics.drawRect(0, 0, width, height);
- graphics.endFill();
-
- return needUpdate;
- }
-
- /**
- * @private
- */
- override public function endHighlightBitmapCapture() : Boolean
- {
- var needUpdate:Boolean = super.endHighlightBitmapCapture();
-
- // Clear the rect we drew in beginBitmapCapture();
- graphics.clear();
-
- return needUpdate;
- }
- ]]>
- </fx:Script>
-
-</s:SparkSkin>
-
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/SpinnerListSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/SpinnerListSkin.as b/tourdeflexmobile/src/spark/skins/android4/SpinnerListSkin.as
deleted file mode 100644
index 006fddb..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/SpinnerListSkin.as
+++ /dev/null
@@ -1,293 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package spark.skins.android4
-{
- import flash.display.InteractiveObject;
-
- import mx.core.ClassFactory;
- import mx.core.DPIClassification;
- import mx.core.mx_internal;
-
- import spark.components.DataGroup;
- import spark.components.Scroller;
- import spark.components.SpinnerList;
- import spark.components.SpinnerListItemRenderer;
- import spark.layouts.VerticalSpinnerLayout;
- import spark.skins.android4.assets.SpinnerListContainerSelectionIndicator;
- import spark.skins.mobile.supportClasses.MobileSkin;
-
-
- use namespace mx_internal;
- /**
- * ActionScript-based skin for the SpinnerList in mobile applications.
- *
- * @see spark.components.SpinnerList
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- public class SpinnerListSkin extends MobileSkin
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- public function SpinnerListSkin()
- {
- super();
-
- selectionIndicatorClass = spark.skins.android4.assets.SpinnerListContainerSelectionIndicator;
- borderThickness = 1;
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
- selectionIndicatorHeight = 182;
- minWidth = 64;
- borderThickness = 3;
- break;
- }
- case DPIClassification.DPI_480:
- {
- selectionIndicatorHeight = 144;
- minWidth = 48;
- borderThickness = 2;
- break;
- }
- case DPIClassification.DPI_320:
- {
- selectionIndicatorHeight = 96;
- minWidth = 32;
- borderThickness = 2;
- break;
- }
- case DPIClassification.DPI_240:
- {
- selectionIndicatorHeight = 72;
- minWidth = 24;
- borderThickness = 1;
- break;
- }
- case DPIClassification.DPI_120:
- {
- selectionIndicatorHeight = 36;
- minWidth = 12;
- borderThickness = 0;
- break;
- }
- default:
- {
- selectionIndicatorHeight = 48;
- minWidth = 16;
- borderThickness = 1;
- }
- }
-
- }
-
- //--------------------------------------------------------------------------
- //
- // Skin parts
- //
- //--------------------------------------------------------------------------
-
- /**
- * Scroller skin part.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- public var scroller:Scroller;
-
- /**
- * DataGroup skin part.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- public var dataGroup:DataGroup;
-
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- public var hostComponent:SpinnerList;
-
- /**
- * Pixel size of the border.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var borderThickness:int;
-
- /**
- * Class for the selection indicator skin part.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var selectionIndicatorClass:Class;
-
- /**
- * Selection indicator skin part.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var selectionIndicator:InteractiveObject;
-
- /**
- * Height of the selection indicator.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected var selectionIndicatorHeight:Number;
-
- //--------------------------------------------------------------------------
- //
- // Overridden Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- override protected function commitCurrentState():void
- {
- super.commitCurrentState();
-
- alpha = currentState.indexOf("disabled") == -1 ? 1 : 0.5;
- }
-
- /**
- * @private
- */
- override protected function createChildren():void
- {
- super.createChildren();
-
- if (!dataGroup)
- {
- // Create data group layout
- var layout:VerticalSpinnerLayout = new VerticalSpinnerLayout();
- layout.requestedRowCount = 5;
- // Create data group
- dataGroup = new DataGroup();
- dataGroup.id = "dataGroup";
- dataGroup.layout = layout;
-
- dataGroup.itemRenderer = new ClassFactory(spark.components.SpinnerListItemRenderer);
- }
-
- if (!scroller)
- {
- // Create scroller
- scroller = new Scroller();
- scroller.id = "scroller";
- scroller.hasFocusableChildren = false;
- scroller.ensureElementIsVisibleForSoftKeyboard = false;
- // Only support vertical scrolling
- scroller.setStyle("verticalScrollPolicy","on");
- scroller.setStyle("horizontalScrollPolicy", "off");
- scroller.setStyle("skinClass", spark.skins.android4.SpinnerListScrollerSkin);
-
- addChild(scroller);
- }
-
- if (!selectionIndicator)
- {
- // Selection indicator is on top
- selectionIndicator = new selectionIndicatorClass();
- selectionIndicator.mouseEnabled = false;
- addChild(selectionIndicator);
- }
-
- // Associate scroller with data group
- if (!scroller.viewport)
- scroller.viewport = dataGroup;
- }
-
- /**
- * @private
- */
- override protected function measure():void
- {
- measuredWidth = scroller.getPreferredBoundsWidth() + borderThickness * 2;
- measuredHeight = scroller.getPreferredBoundsHeight();
- //add in for selection indicator
- measuredMinHeight = selectionIndicatorHeight + borderThickness * 4;
- minHeight = measuredMinHeight;
- }
-
- /**
- * @private
- */
- override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.layoutContents(unscaledWidth, unscaledHeight);
-
- // Scroller
- setElementSize(scroller, unscaledWidth - borderThickness * 2, unscaledHeight);
- setElementPosition(scroller, borderThickness, 0);
- //selection indicator
- unscaledHeight = Math.max(unscaledHeight, selectionIndicatorHeight + borderThickness * 4);
-
- setElementSize(selectionIndicator, unscaledWidth, selectionIndicatorHeight);
- setElementPosition(selectionIndicator, 0, Math.floor((unscaledHeight - selectionIndicatorHeight) / 2));
- }
-
- /**
- * @private
- */
- override public function styleChanged(styleProp:String):void
- {
- // Reinitialize the typical element so it picks up the latest styles
- // Font styles might impact the size of the SpinnerList
- if (styleProp != "color" && styleProp != "accentColor")
- {
- if (dataGroup)
- dataGroup.invalidateTypicalItemRenderer();
- }
-
- super.styleChanged(styleProp);
- }
-
- }
-}
-
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/SplitViewNavigatorSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/SplitViewNavigatorSkin.as b/tourdeflexmobile/src/spark/skins/android4/SplitViewNavigatorSkin.as
deleted file mode 100644
index ee06eea..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/SplitViewNavigatorSkin.as
+++ /dev/null
@@ -1,157 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
- import mx.core.mx_internal;
-
- import spark.components.Callout;
- import spark.components.Group;
- import spark.components.SkinnablePopUpContainer;
- import spark.components.SplitViewNavigator;
- import spark.layouts.HorizontalLayout;
- import spark.skins.mobile.supportClasses.MobileSkin;
-
- use namespace mx_internal;
-
- /**
- * The default skin for the SplitViewNavigator component. This skin is
- * chromeless and doesn't draw a background, border or separator.
- * It only contains a single content group with a horizontal layout to hold
- * the navigators, and a Callout component.
- * The Callout component uses the default values for its layout properties.
- *
- * @see spark.components.Callout
- * @see spark.components.SplitViewNavigator
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- public class SplitViewNavigatorSkin extends MobileSkin
- {
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- public function SplitViewNavigatorSkin()
- {
- super();
- }
-
- //--------------------------------------------------------------------------
- //
- // SkinParts
- //
- //--------------------------------------------------------------------------
-
- /**
- * @copy spark.components.SkinnableContainer#contentGroup
- */
- public var contentGroup:Group;
-
- /**
- * @copy spark.components.SplitViewNavigator#viewNavigatorPopUp
- */
- public var viewNavigatorPopUp:SkinnablePopUpContainer;
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- */
- public var hostComponent:SplitViewNavigator;
-
- //--------------------------------------------------------------------------
- //
- // Overridden Methods
- //
- //--------------------------------------------------------------------------
- /**
- * @private
- */
- override protected function createChildren():void
- {
- // Create the layout for the content group
- var hLayout:HorizontalLayout = new HorizontalLayout();
-
- // A gap of 1 is used to reveal a thin line of the background between
- // each child navigator. This serves as a divider. To change the look
- // of the divider, change the backgroundColor style.
- hLayout.gap = 1;
-
- // Create the contentGroup
- contentGroup = new Group();
- contentGroup.id = "contentGroup";
- contentGroup.layout = hLayout;
- addChild(contentGroup);
-
- // Create the callout but don't add it to display list
- viewNavigatorPopUp = new Callout();
- viewNavigatorPopUp.id = "viewNavigatorPopUp";
- }
-
- /**
- * @private
- */
- override protected function measure():void
- {
- super.measure();
-
- measuredWidth = contentGroup.getPreferredBoundsWidth();
- measuredHeight = contentGroup.getPreferredBoundsHeight();
- }
-
- /**
- * @private
- */
- override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.layoutContents(unscaledWidth, unscaledHeight);
-
- contentGroup.setLayoutBoundsSize(unscaledWidth, unscaledHeight);
- contentGroup.setLayoutBoundsPosition(0, 0);
- }
-
- /**
- * @private
- */
- override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
- {
- // Background is used to draw the divider between each navigator
- var color:uint = getStyle("backgroundColor");
- graphics.beginFill(color);
- graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
- graphics.endFill();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/TabbedViewNavigatorTabBarSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/TabbedViewNavigatorTabBarSkin.as b/tourdeflexmobile/src/spark/skins/android4/TabbedViewNavigatorTabBarSkin.as
deleted file mode 100644
index eea5948..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/TabbedViewNavigatorTabBarSkin.as
+++ /dev/null
@@ -1,122 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
-import spark.components.ButtonBarButton;
-import spark.components.DataGroup;
-import spark.skins.mobile.supportClasses.ButtonBarButtonClassFactory;
-import spark.skins.mobile.supportClasses.TabbedViewNavigatorTabBarHorizontalLayout;
-
-/**
- * The Android 4.x specific skin class for the Spark TabbedViewNavigator tabBar skin part.
- * It uses the ButtonBarFirstButtonSkin and ButtonBarMiddleButtonSkin as skins for first
- * middle buttons
- *
- * @see spark.components.TabbedViewNavigator#tabBar
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
-public class TabbedViewNavigatorTabBarSkin extends ButtonBarSkin
-{
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- *
- */
- public function TabbedViewNavigatorTabBarSkin()
- {
- super();
- }
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- override protected function createChildren():void
- {
- if (!firstButton)
- {
- firstButton = new ButtonBarButtonClassFactory(ButtonBarButton);
- firstButton.skinClass = spark.skins.android4.ButtonBarFirstButtonSkin;
- }
-
- if (!lastButton)
- {
- lastButton = new ButtonBarButtonClassFactory(ButtonBarButton);
- lastButton.skinClass = spark.skins.android4.ButtonBarFirstButtonSkin;
- }
-
- if (!middleButton)
- {
- middleButton = new ButtonBarButtonClassFactory(ButtonBarButton);
- middleButton.skinClass = spark.skins.android4.ButtonBarMiddleButtonSkin;
- }
-
- if (!dataGroup)
- {
- // TabbedViewNavigatorButtonBarHorizontalLayout for even percent layout
- var tabLayout:TabbedViewNavigatorTabBarHorizontalLayout =
- new TabbedViewNavigatorTabBarHorizontalLayout();
- tabLayout.useVirtualLayout = false;
-
- dataGroup = new DataGroup();
- dataGroup.layout = tabLayout;
- addChild(dataGroup);
- }
- }
-
- /**
- * @private
- */
- override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.drawBackground(unscaledWidth, unscaledHeight);
-
- // backgroundAlpha style is not supported by ButtonBar
- // TabbedViewNavigatorSkin sets a hard-coded value to support
- // overlayControls
- var backgroundAlphaValue:* = getStyle("backgroundAlpha");
- var backgroundAlpha:Number = (backgroundAlphaValue === undefined)
- ? 1 : getStyle("backgroundAlpha");
-
- graphics.beginFill(getStyle("chromeColor"), backgroundAlpha);
- graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
- graphics.endFill();
- }
-}
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/TextAreaHScrollBarSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/TextAreaHScrollBarSkin.as b/tourdeflexmobile/src/spark/skins/android4/TextAreaHScrollBarSkin.as
deleted file mode 100644
index 540318e..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/TextAreaHScrollBarSkin.as
+++ /dev/null
@@ -1,105 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package spark.skins.android4
-{
-import mx.core.DPIClassification;
-import mx.core.mx_internal;
-
-use namespace mx_internal;
-
- /**
- * The default skin class for the Spark TextAreaHScrollBar component in mobile
- * applications.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
-public class TextAreaHScrollBarSkin extends HScrollBarSkin
-{
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public function TextAreaHScrollBarSkin()
- {
- super();
-
- thumbSkinClass = TextAreaHScrollBarThumbSkin;
- var paddingBottom:int;
- var paddingHorizontal:int;
-
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
- minHeight = 30;
- paddingBottom = TextAreaHScrollBarThumbSkin.PADDING_BOTTOM_320DPI;
- paddingHorizontal = TextAreaHScrollBarThumbSkin.PADDING_HORIZONTAL_320DPI;
- break;
- }
- case DPIClassification.DPI_480:
- {
- minHeight = 22;
- paddingBottom = TextAreaHScrollBarThumbSkin.PADDING_BOTTOM_480DPI;
- paddingHorizontal = TextAreaHScrollBarThumbSkin.PADDING_HORIZONTAL_480DPI;
- break;
- }
- case DPIClassification.DPI_320:
- {
- minHeight = 15;
- paddingBottom = TextAreaHScrollBarThumbSkin.PADDING_BOTTOM_320DPI;
- paddingHorizontal = TextAreaHScrollBarThumbSkin.PADDING_HORIZONTAL_320DPI;
- break;
- }
- case DPIClassification.DPI_240:
- {
- minHeight = 11;
- paddingBottom = TextAreaHScrollBarThumbSkin.PADDING_BOTTOM_240DPI;
- paddingHorizontal = TextAreaHScrollBarThumbSkin.PADDING_HORIZONTAL_240DPI;
- break;
- }
- case DPIClassification.DPI_120:
- {
- minHeight = 11;
- paddingBottom = TextAreaHScrollBarThumbSkin.PADDING_BOTTOM_120DPI;
- paddingHorizontal = TextAreaHScrollBarThumbSkin.PADDING_HORIZONTAL_120DPI;
- break;
- }
- default:
- {
- // default DPI_160
- minHeight = 9;
- paddingBottom = TextAreaHScrollBarThumbSkin.PADDING_BOTTOM_DEFAULTDPI;
- paddingHorizontal = TextAreaHScrollBarThumbSkin.PADDING_HORIZONTAL_DEFAULTDPI;
- break;
- }
- }
-
- // The minimum width is set such that, at it's smallest size, the thumb appears
- // as wide as it is high.
- minThumbWidth = (minHeight - paddingBottom) + (paddingHorizontal * 2);
- }
-}
-}
\ No newline at end of file
[2/6] git commit: [flex-examples] [refs/heads/develop] - Remove
redundant Android skins (it now comes with the 4.14 SDK)
Posted by bi...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/TextAreaHScrollBarThumbSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/TextAreaHScrollBarThumbSkin.as b/tourdeflexmobile/src/spark/skins/android4/TextAreaHScrollBarThumbSkin.as
deleted file mode 100644
index 5d3fec8..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/TextAreaHScrollBarThumbSkin.as
+++ /dev/null
@@ -1,116 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package spark.skins.android4
-{
-import mx.core.DPIClassification;
-import mx.core.mx_internal;
-
-use namespace mx_internal;
-
-/**
- * The ActionScript-based skin used for TextAreaHScrollBarThumb components
- * in mobile applications.
- *
- * @langversion 3.0
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- *
- */
-public class TextAreaHScrollBarThumbSkin extends HScrollBarThumbSkin
-{
- //--------------------------------------------------------------------------
- //
- // Class constants
- //
- //--------------------------------------------------------------------------
-
- // These constants are also accessed from HScrollBarSkin
- mx_internal static const PADDING_BOTTOM_640DPI:int = 16;
- mx_internal static const PADDING_HORIZONTAL_640DPI:int = 16;
- mx_internal static const PADDING_BOTTOM_480DPI:int = 12;
- mx_internal static const PADDING_HORIZONTAL_480DPI:int = 12;
- mx_internal static const PADDING_BOTTOM_320DPI:int = 8;
- mx_internal static const PADDING_HORIZONTAL_320DPI:int = 12;
- mx_internal static const PADDING_BOTTOM_240DPI:int = 6;
- mx_internal static const PADDING_HORIZONTAL_240DPI:int = 6;
- mx_internal static const PADDING_BOTTOM_120DPI:int = 3;
- mx_internal static const PADDING_HORIZONTAL_120DPI:int = 3;
- mx_internal static const PADDING_BOTTOM_DEFAULTDPI:int = 4;
- mx_internal static const PADDING_HORIZONTAL_DEFAULTDPI:int = 6;
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public function TextAreaHScrollBarThumbSkin()
- {
- super();
-
- // Depending on density set padding
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
- paddingBottom = PADDING_BOTTOM_640DPI;
- paddingHorizontal = PADDING_HORIZONTAL_640DPI;
- break;
- }
- case DPIClassification.DPI_480:
- {
- paddingBottom = TextAreaHScrollBarThumbSkin.PADDING_BOTTOM_480DPI;
- paddingHorizontal = TextAreaHScrollBarThumbSkin.PADDING_HORIZONTAL_480DPI;
- break;
- }
- case DPIClassification.DPI_320:
- {
- paddingBottom = PADDING_BOTTOM_320DPI;
- paddingHorizontal = PADDING_HORIZONTAL_320DPI;
- break;
- }
- case DPIClassification.DPI_240:
- {
- paddingBottom = PADDING_BOTTOM_240DPI;
- paddingHorizontal = PADDING_HORIZONTAL_240DPI;
- break;
- }
- case DPIClassification.DPI_120:
- {
- paddingBottom = PADDING_BOTTOM_120DPI;
- paddingHorizontal = PADDING_HORIZONTAL_120DPI;
- break;
- }
- default:
- {
- paddingBottom = PADDING_BOTTOM_DEFAULTDPI;
- paddingHorizontal = PADDING_HORIZONTAL_DEFAULTDPI;
- break;
- }
- }
- }
-}
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/TextAreaSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/TextAreaSkin.as b/tourdeflexmobile/src/spark/skins/android4/TextAreaSkin.as
deleted file mode 100644
index 6d1fa52..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/TextAreaSkin.as
+++ /dev/null
@@ -1,892 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
-
- import flash.events.Event;
- import flash.events.FocusEvent;
- import flash.events.KeyboardEvent;
- import flash.events.MouseEvent;
- import flash.events.SoftKeyboardEvent;
- import flash.geom.Point;
- import flash.geom.Rectangle;
- import flash.system.Capabilities;
- import flash.text.TextLineMetrics;
- import flash.ui.Keyboard;
-
- import mx.core.DPIClassification;
- import mx.core.EventPriority;
- import mx.core.FlexGlobals;
- import mx.core.mx_internal;
- import mx.events.FlexEvent;
- import mx.utils.Platform;
-
- import spark.components.Group;
- import spark.components.Scroller;
- import spark.components.TextArea;
- import spark.components.supportClasses.StyleableTextField;
- import spark.events.CaretBoundsChangeEvent;
- import spark.skins.android4.supportClasses.TextSkinBase;
-
- use namespace mx_internal;
-
- /**
- * ActionScript-based skin for TextArea components in mobile applications.
- *
- * @see spark.components.TextArea
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public class TextAreaSkin extends TextSkinBase
- {
- /**
- * @private
- * Right-margin of iOS native text control when editing on a retina display
- * based on fontSize 32.
- */
- mx_internal static var IOS_RIGHT_MARGIN_320:Number = 19;
-
- /**
- * @private
- * Right-margin of iOS native text control when editing on a retina display
- * based on fontSize 16 scaling from applicationDPI 160.
- */
- mx_internal static var IOS_RIGHT_MARGIN_160_SCALED_TO_320:Number = 9.4;
-
- /**
- * @private
- * Right-margin of iOS native text control when editing on a standard display
- * based on fontSize 16 and runtimeDPI 160.
- */
- mx_internal static var IOS_RIGHT_MARGIN_160:Number = 20.6;
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public function TextAreaSkin()
- {
- super();
-
- addEventListener(Event.RESIZE, resizeHandler);
-
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
- measuredDefaultWidth = 1024;
- measuredDefaultHeight = 212;
- layoutBorderSize = 4;
- flatheight = 9;
- break;
- }
- case DPIClassification.DPI_480:
- {
- measuredDefaultWidth = 880;
- measuredDefaultHeight = 140;
- layoutBorderSize = 3;
- flatheight = 7;
- break;
- }
- case DPIClassification.DPI_320:
- {
- measuredDefaultWidth = 612;
- measuredDefaultHeight = 106;
- layoutBorderSize = 2;
- flatheight = 6;
- break;
- }
- case DPIClassification.DPI_240:
- {
- measuredDefaultWidth = 440;
- measuredDefaultHeight = 70;
- layoutBorderSize = 2;
- flatheight = 5;
- break;
- }
- case DPIClassification.DPI_120:
- {
- measuredDefaultWidth = 220;
- measuredDefaultHeight = 35;
- layoutBorderSize = 1;
- flatheight = 2;
- break;
- }
- default:
- {
- measuredDefaultWidth = 306;
- measuredDefaultHeight = 53;
- layoutBorderSize = 1;
- flatheight = 3;
- break;
- }
- }
- addEventListener(FocusEvent.FOCUS_IN, focusChangeHandler);
- addEventListener(FocusEvent.FOCUS_OUT, focusChangeHandler);
- }
-
- //--------------------------------------------------------------------------
- //
- // Skin parts
- //
- //--------------------------------------------------------------------------
-
- /**
- * Scroller skin part.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public var scroller:Scroller;
-
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
-
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- */
- public var hostComponent:TextArea;
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
-
- protected var isFocused:Boolean = false;
-
- protected var flatheight:uint;
-
- /**
- * @private
- * The width of the component on the previous layout manager
- * pass. This gets set in updateDisplayList() and used in measure() on
- * the next layout pass. This is so our "guessed width" in measure()
- * will be as accurate as possible since textDisplay is multiline and
- * the textDisplay height is dependent on the width.
- *
- * In the constructor this is actually set based on the DPI.
- */
- mx_internal var oldUnscaledWidth:Number;
-
- private var textDisplayGroup:Group;
- private var _isIOS:Boolean;
- private var invalidateCaretPosition:Boolean = true;
- private var oldCaretBounds:Rectangle = new Rectangle(-1, -1, -1, -1);
- private var lastTextHeight:Number;
- private var lastTextWidth:Number;
-
- private var isTextDisplayTall:Boolean = true;
- private var growTextDisplay:Boolean = false;
- private var shrinkTextDisplay:Boolean = false;
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- override protected function createChildren():void
- {
- if (!textDisplay)
- {
- // wrap StyleableTextField in UIComponent
- textDisplay = StyleableTextField(createInFontContext(StyleableTextField));
- textDisplay.styleName = this;
- textDisplay.multiline = true;
- textDisplay.editable = true;
- textDisplay.lineBreak = getStyle("lineBreak");
- textDisplay.useTightTextBounds = false;
- textDisplay.scrollToRangeDelegate = scrollToRange;
-
- // on iOS, resize the TextField and let the native control handle scrolling
- _isIOS = Platform.isIOS;
-
- if (_isIOS)
- {
- // hard-coded rightMargin for iOS native text control
- // this value is independent of the paddingRight style
- var rightMargin:Number = 0;
- var isRetina:Boolean = false;
- var isScaling160to320:Boolean = false;
-
- // check for scaling
- if ("runtimeDPI" in FlexGlobals.topLevelApplication)
- {
- var runtimeDPI:Number = FlexGlobals.topLevelApplication.runtimeDPI as Number;
- isRetina = (runtimeDPI == DPIClassification.DPI_320);
- isScaling160to320 = isRetina
- && (applicationDPI == DPIClassification.DPI_160);
- }
-
- if (isRetina && !isScaling160to320)
- rightMargin = IOS_RIGHT_MARGIN_320;
- else if (isRetina && isScaling160to320)
- rightMargin = IOS_RIGHT_MARGIN_160_SCALED_TO_320;
- else
- rightMargin = IOS_RIGHT_MARGIN_160;
-
- textDisplay.rightMargin = rightMargin;
- }
- else
- {
- textDisplay.addEventListener(KeyboardEvent.KEY_DOWN, textDisplay_keyHandler);
- }
-
- textDisplay.addEventListener(Event.CHANGE, textDisplay_changeHandler);
- textDisplay.addEventListener(FlexEvent.VALUE_COMMIT, textDisplay_changeHandler);
- textDisplay.addEventListener(Event.SCROLL, textDisplay_scrollHandler);
- // Use a lower priority so that the StyleableTextField event handler is called first.
- // That handler cancels the event and we need to check for that case
- textDisplay.addEventListener(SoftKeyboardEvent.SOFT_KEYBOARD_ACTIVATING, textDisplay_softKeyboardActivatingHandler, false, EventPriority.DEFAULT_HANDLER);
- textDisplay.addEventListener(SoftKeyboardEvent.SOFT_KEYBOARD_ACTIVATE, textDisplay_softKeyboardActivateHandler);
- textDisplay.addEventListener(SoftKeyboardEvent.SOFT_KEYBOARD_DEACTIVATE, textDisplay_softKeyboardDeactivateHandler);
-
- textDisplay.left = getStyle("paddingLeft");
- textDisplay.top = getStyle("paddingTop");
- textDisplay.right = getStyle("paddingRight");
- textDisplay.bottom = getStyle("paddingBottom");
-
- // wrap StyleableTextComponent in Group for viewport
- textDisplayGroup = new Group();
- textDisplayGroup.clipAndEnableScrolling = true;
- textDisplayGroup.addElement(textDisplay);
- }
-
- if (!scroller)
- {
- scroller = new Scroller();
- scroller.minViewportInset = 0;
- scroller.measuredSizeIncludesScrollBars = false;
- scroller.ensureElementIsVisibleForSoftKeyboard = false;
-
- addChild(scroller);
- }
-
- if (!scroller.viewport)
- scroller.viewport = textDisplayGroup;
-
- super.createChildren();
- }
-
- /**
- * @private
- * TextArea prompt supports wrapping and multiline
- */
- override protected function createPromptDisplay():StyleableTextField
- {
- var prompt:StyleableTextField = super.createPromptDisplay();
- prompt.editable = true;
- prompt.wordWrap = true;
-
- return prompt;
- }
-
- /**
- * @private
- */
- override protected function measure():void
- {
- super.measure();
-
- var paddingTop:Number = getStyle("paddingTop");
- var paddingBottom:Number = getStyle("paddingBottom");
- var paddingLeft:Number = getStyle("paddingLeft");
- var paddingRight:Number = getStyle("paddingRight");
-
- // TextDisplay always defaults to 440 pixels wide (the value is DPI dependent),
- // and tall enough to show all text.
- //
- // You can set an explicit width and the height will adjust accordingly. The opposite
- // is not true: setting an explicit height will not adjust the width accordingly.
-
- measuredWidth = measuredDefaultWidth;
-
- // now we need to measure textDisplay's height. Unfortunately, this is tricky and
- // is dependent on textDisplay's width. Let's use the heuristic that our width
- // is the same as our last width.
- // We don't use layoutMeasuredWidth, because that value is just a constant and doesn't
- // take into account the fact that the TextArea could have an explicitWidth or could
- // be constrained by some value. However, we still default oldTextDisplayWidth to
- // be layoutMeasuredWidth the first time through.
- var textDisplayEstimatedWidth:Number = oldUnscaledWidth - paddingLeft - paddingRight;
-
- // now we need to measure textDisplay's height. Unfortunately, this is tricky and
- // is dependent on textDisplay's width.
- // Use the old textDisplay width as an estimte for the new one.
- // If we are wrong, we'll find out in updateDisplayList()
- textDisplay.commitStyles();
-
- // Clear min sizes first.
- textDisplay.minWidth = textDisplay.minHeight = NaN;
-
- // If lineBreak == explicit, always use NaN for estimated width
- if (getStyle("lineBreak") == "explicit")
- textDisplayEstimatedWidth = NaN;
-
- setElementSize(textDisplay, textDisplayEstimatedWidth, NaN);
-
- measuredHeight = getElementPreferredHeight(textDisplay) + paddingTop + paddingBottom;
- }
-
- /**
- * @private
- */
- override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.layoutContents(unscaledWidth, unscaledHeight);
-
- // position & size border
- if (border)
- {
- setElementSize(border, unscaledWidth, unscaledHeight);
- setElementPosition(border, 0, 0);
- }
-
- setElementSize(scroller, unscaledWidth, unscaledHeight);
- setElementPosition(scroller, 0, 0);
-
- // position & size the text
- var explicitLineBreak:Boolean = getStyle("lineBreak") == "explicit";
- var paddingLeft:Number = getStyle("paddingLeft");
- var paddingRight:Number = getStyle("paddingRight");
- var paddingTop:Number = getStyle("paddingTop");
- var paddingBottom:Number = getStyle("paddingBottom");
-
- var unscaledTextWidth:Number = unscaledWidth - paddingLeft - paddingRight;
- var unscaledTextHeight:Number = unscaledHeight - paddingTop - paddingBottom;
- var textHeight:Number;
- var textWidth:Number = explicitLineBreak ? textDisplay.measuredTextSize.x : unscaledTextWidth;
-
- var lineIndex:int;
- var topCharIndex:int;
- var charBounds:Rectangle;
-
- // grab old measured textDisplay height before resizing it
- var oldPreferredTextHeight:Number = getElementPreferredHeight(textDisplay);
-
- // set width first to measure height correctly
- textDisplay.commitStyles();
- textDisplay.setLayoutBoundsSize(textWidth, NaN);
-
- // In iOS, when we go into editing mode, the runtime overlays a native
- // text control over the textDisplay. In order to prevent the text
- // from overflowing the component and to get scrolling support, the
- // native text control must be the same size as the TextArea
- if (_isIOS)
- {
- if (shrinkTextDisplay)
- {
- // Switching to edit mode. Convert from viewport scrolling to
- // TextField scrolling
- var vsp:Number = textDisplayGroup.verticalScrollPosition;
-
- var lineMetrics:TextLineMetrics = textDisplay.getLineMetrics(0);
- var lineHeight:Number = lineMetrics.ascent + lineMetrics.descent;
-
- // TODO Figure out how to get the x offset. Right now is hard coded to 2
- // At least half the line should be showing before we scroll to that line
- // This makes the conversion from pixel to line based scrolling a little less jumpy
- lineIndex = textDisplay.getLineIndexAtPoint(2, vsp + lineHeight / 2) + 1;
- textDisplayGroup.verticalScrollPosition = 0;
- isTextDisplayTall = false;
- //trace("TAS.layoutContents shrinkText vsp",vsp,"lineIndex",lineIndex);
- }
-
- else if (growTextDisplay)
- {
- // Leaving edit mode. Convert from TextField scrolling to
- // viewport scrolling
- var scrollV:Number = textDisplay.scrollV;
-
- // TODO (jszeto) investigate using lineMetrics.lineHeight * scrollV instead of getCharBoundaries
- topCharIndex = textDisplay.getLineOffset(scrollV - 1);
- charBounds = textDisplay.getCharBoundaries(topCharIndex);
- // If the charBounds is null, just set vsp to 0
- if (charBounds == null)
- charBounds = new Rectangle(0, 0, 0, 0);
- textDisplay.scrollV = 1;
- isTextDisplayTall = true;
- //trace("TAS.layoutContents growText scrollV",scrollV,"topCharIndex",topCharIndex,"charBounds",charBounds);
- }
- }
-
- // TextField height should match its content or the TextArea bounds at minimum
- // iOS special case to prevent Flex Scroller scrolling when editable
- if (isTextDisplayTall)
- textHeight = Math.max(textDisplay.measuredTextSize.y, unscaledTextHeight);
- else
- textHeight = unscaledTextHeight;
-
- // FIXME (jasonsj): iOS native scroll bar appears even when explictHeight
- // is not specified. Focus-in is jumpy.
-
- if (promptDisplay)
- {
- promptDisplay.commitStyles();
- setElementSize(promptDisplay, unscaledTextWidth, textHeight);
- setElementPosition(promptDisplay, paddingLeft, paddingTop);
-
- // no need to update textDisplay if promptDisplay is present
- return;
- }
-
- // keep track of oldUnscaledWidth so we have a good guess as to the width
- // of the textDisplay on the next measure() pass
- oldUnscaledWidth = unscaledWidth;
-
- // set the width of textDisplay to textWidth.
- // set the height to oldTextHeight. If the height's actually wrong,
- // we'll invalidateSize() and go through this layout pass again anyways
- setElementSize(textDisplay, textWidth, textHeight);
-
- // Set minWidth/Height on the text so the textDisplayGroup sizes accordingly
- textDisplay.minWidth = textWidth;
- textDisplay.minHeight = textHeight;
- textDisplayGroup.invalidateDisplayList();
-
- // grab new measured textDisplay height after the textDisplay has taken its final width
- var newPreferredTextHeight:Number = getElementPreferredHeight(textDisplay);
-
- // if the resize caused the textDisplay's height to change (because of
- // text reflow), then we need to remeasure ourselves with our new width
- if (oldPreferredTextHeight != newPreferredTextHeight)
- invalidateSize();
-
- if (_isIOS)
- {
- if (shrinkTextDisplay)
- {
- scroller.validateNow();
- textDisplay.scrollV = lineIndex;
- }
- else if (growTextDisplay)
- {
- scroller.validateNow();
- textDisplayGroup.verticalScrollPosition = charBounds.y;
- }
-
- shrinkTextDisplay = false;
- growTextDisplay = false;
- }
-
- //trace("TAS.layoutContents tH",textHeight,"tW",textWidth,"invalidateCaret",invalidateCaretPosition);
-
- // checking if text fits in TextArea
- // does not apply to iOS due to native text editing and scrolling
- // invalidateCaretPosition will never be true for iOS
- if (invalidateCaretPosition && isTextDisplayTall)
- {
- // if the caret is outside the viewport, update the Group verticalScrollPosition
- var charIndex:int = textDisplay.selectionBeginIndex;
- var caretBounds:Rectangle = textDisplay.getCharBoundaries(charIndex);
- lineIndex = textDisplay.getLineIndexOfChar(charIndex);
-
- // getCharBoundaries() returns null for new lines
- if (!caretBounds)
- {
- // temporarily insert a character at the caretIndex
- textDisplay.replaceText(charIndex, charIndex, "W");
- caretBounds = textDisplay.getCharBoundaries(charIndex);
- lineIndex = textDisplay.getLineIndexOfChar(charIndex);
- textDisplay.replaceText(charIndex, charIndex + 1, "");
- }
-
- if (caretBounds)
- {
- // Scroll the internal Scroller to ensure the caret is visible
- if (textHeight > unscaledTextHeight)
- {
-
- if (charIndex == textDisplay.text.length)
- {
- // Make sure textDisplayGroup is validated, otherwise the
- // verticalScrollPosition may be out of bounds, which will
- // cause a bounce effect.
- textDisplayGroup.validateNow();
- textDisplayGroup.verticalScrollPosition = textHeight;
- }
- else
- {
- // caretTopPositon and caretBottomPosition are TextField-relative positions
- // the TextField is inset by padding styles of the TextArea (via the VGroup)
-
- // adjust top position to 0 when on the first line
- // caretTopPosition will be negative when off stage
- var caretTopPosition:Number = ((caretBounds.y) < 0 || (lineIndex == 0))
- ? 0 : caretBounds.y;
-
- // caretBottomPosition is the y coordinate of the bottom bounds of the caret
- var caretBottomPosition:Number = caretBounds.y + caretBounds.height;
-
- // note that verticalScrollPosition min/max do not account for padding
- var vspTop:Number = textDisplayGroup.verticalScrollPosition;
-
- // vspBottom should be the max visible Y in the TextField
- // coordinate space.
- // remove paddingBottom for some clearance between caret and border
- var vspBottom:Number = vspTop + unscaledHeight - paddingTop - paddingBottom;
-
- // is the caret in or below the padding and viewport?
- if (caretBottomPosition > vspBottom)
- {
- // adjust caretBottomPosition to max scroll position when on the last line
- if (lineIndex + 1 == textDisplay.numLines)
- {
- // use textHeight+paddings instead of textDisplayGroup.contentHeight
- // Group has not been resized by this point
- textDisplayGroup.verticalScrollPosition = (textHeight + paddingTop + paddingBottom) - textDisplayGroup.height;
- }
- else
- {
- // bottom edge of the caret moves just inside the bottom edge of the scroller
- // add delta between caret and vspBottom
- textDisplayGroup.verticalScrollPosition = vspTop + (caretBottomPosition - vspBottom);
- }
- }
- // is the caret above the viewport?
- else if (caretTopPosition < vspTop)
- {
- // top edge of the caret moves inside the top edge of the scroller
- textDisplayGroup.verticalScrollPosition = caretTopPosition;
- }
- }
-
- scroller.validateNow();
- }
-
- // Convert to local coordinates
- // Dispatch an event for an ancestor Scroller
- // It will scroll the TextArea so the caret is in view
- convertBoundsToLocal(caretBounds);
- if (oldCaretBounds == null || caretBounds.bottom != oldCaretBounds.bottom || caretBounds.top != oldCaretBounds.top)
- {
- //trace("TAS.layoutContents send caret CHANGE");
- dispatchEvent(new CaretBoundsChangeEvent(CaretBoundsChangeEvent.CARET_BOUNDS_CHANGE,true,true,oldCaretBounds,caretBounds));
- }
-
- oldCaretBounds = caretBounds;
- }
-
- invalidateCaretPosition = false;
- }
-
- // Make sure final scroll position is valid
- if (isTextDisplayTall)
- snapTextScrollPosition();
- }
-
- override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.drawBackground(unscaledWidth, unscaledHeight);
-
- var contentBackgroundColor:uint = getStyle("contentBackgroundColor");
- var contentBackgroundAlpha:Number = getStyle("contentBackgroundAlpha");
- //change border color and thickness when in focus
- var borderColor:uint = isFocused ? getStyle("focusColor") : getStyle("borderColor");
- var selectWidth:uint = isFocused ? layoutBorderSize + 1 : layoutBorderSize;
- if (isNaN(contentBackgroundAlpha))
- {
- contentBackgroundAlpha = 1;
- }
- if (getStyle("contentBackgroundBorder") == "flat")
- {
- var halfGap:int = flatheight * 2;
- //background
- graphics.beginFill(contentBackgroundColor, contentBackgroundAlpha);
- graphics.drawRect(0, 0, unscaledWidth, unscaledHeight - flatheight);
- graphics.endFill();
- //begin flat border
- graphics.beginFill(borderColor, 1);
- //left half border
- graphics.drawRect(0, unscaledHeight - halfGap, selectWidth, flatheight );
- //bottom border
- graphics.drawRect(0, unscaledHeight - flatheight, unscaledWidth, selectWidth);
- //right border
- graphics.drawRect(unscaledWidth - selectWidth, unscaledHeight - halfGap, selectWidth, flatheight);
- graphics.endFill();
- }
- else if (getStyle("contentBackgroundBorder") == "rectangle")
- {
- var borderWidth:uint = layoutBorderSize * 2;
- //rectangle border and background
- graphics.lineStyle(selectWidth, borderColor, 1);
- graphics.beginFill(contentBackgroundColor, contentBackgroundAlpha);
- graphics.drawRect(layoutBorderSize, layoutBorderSize, unscaledWidth - borderWidth, unscaledHeight - borderWidth);
- graphics.endFill();
- }
- }
-
- /**
- * @private
- * Make sure the scroll positions are valid, and adjust if needed.
- */
- private function snapTextScrollPosition():void
- {
- var maxHsp:Number = textDisplayGroup.contentWidth > textDisplayGroup.width ?
- textDisplayGroup.contentWidth-textDisplayGroup.width : 0;
- textDisplayGroup.horizontalScrollPosition =
- Math.min(Math.max(0,textDisplayGroup.horizontalScrollPosition),maxHsp);
-
- var maxVsp:Number = textDisplayGroup.contentHeight > textDisplayGroup.height ?
- textDisplayGroup.contentHeight-textDisplayGroup.height : 0;
-
- textDisplayGroup.verticalScrollPosition =
- Math.min(Math.max(0,textDisplayGroup.verticalScrollPosition),maxVsp);
- }
-
- /**
- * @private
- * Get the bounds of the caret
- */
- private function getCaretBounds():Rectangle
- {
- var charIndex:int = textDisplay.selectionBeginIndex;
- var caretBounds:Rectangle = textDisplay.getCharBoundaries(charIndex);
-
- if (!caretBounds)
- {
- textDisplay.replaceText(charIndex, charIndex, "W");
- caretBounds = textDisplay.getCharBoundaries(charIndex);
- textDisplay.replaceText(charIndex, charIndex + 1, "");
- }
-
- return caretBounds;
- }
-
- /**
- * @private
- * Convert bounds from textDisplay to local coordinates
- */
- private function convertBoundsToLocal(bounds:Rectangle):void
- {
- if (bounds)
- {
- var position:Point = new Point(bounds.x, bounds.y);
- position = textDisplay.localToGlobal(position);
- position = globalToLocal(position);
- bounds.x = position.x;
- bounds.y = position.y;
- }
- }
-
- /**
- * @private
- */
- private function scrollToRange(anchorPosition:int, activePosition:int):void
- {
- var pos:int = Math.min(anchorPosition, activePosition);
- var bounds:Rectangle = textDisplay.getCharBoundaries(pos);
- var vsp:int = textDisplayGroup.verticalScrollPosition;
- var paddingTop:Number = getStyle("paddingTop");
- var paddingBottom:Number = getStyle("paddingBottom");
-
- if (bounds && (bounds.top < vsp - paddingTop ||
- bounds.bottom > vsp + unscaledHeight - paddingTop - paddingBottom))
- {
- textDisplayGroup.verticalScrollPosition = bounds.top + paddingTop;
- snapTextScrollPosition();
- }
- }
-
- /**
- * @private
- * Handle size and caret position changes that occur when text content
- * changes.
- */
- private function textDisplay_changeHandler(event:Event):void
- {
- var tH:Number = textDisplay.textHeight;
- var tW:Number = textDisplay.textWidth;
- var explicitLineBreak:Boolean = getStyle("lineBreak") == "explicit";
-
- // Size and caret position have changed if the text height is different or
- // the text width is different and we aren't word wrapping
- if (tH != lastTextHeight || ( explicitLineBreak && tW != lastTextWidth))
- {
- invalidateSize();
- invalidateDisplayList();
- invalidateCaretPosition = true;
- }
-
- lastTextHeight = tH;
- lastTextWidth = tW;
- }
-
- /**
- * @private
- * Cancels any native scroll that the Flash Player attempts to do
- */
- private function textDisplay_scrollHandler(event:Event):void
- {
- // if iOS, let the OS handle scrolling
- if (_isIOS)
- return;
-
- // If not IOS, we will handle scrolling, so don't let the native
- // flash textfield scroll at all.
- if (textDisplay.scrollV > 1)
- textDisplay.scrollV = 1;
- if (textDisplay.scrollH > 0)
- textDisplay.scrollH = 0;
- }
-
- /**
- * @private
- * Adjust viewport when using key navigation
- */
- private function textDisplay_keyHandler(event:KeyboardEvent):void
- {
- // update scroll position when caret changes
- if ((event.keyCode == Keyboard.UP
- || event.keyCode == Keyboard.DOWN
- || event.keyCode == Keyboard.LEFT
- || event.keyCode == Keyboard.RIGHT))
- {
- invalidateDisplayList();
- invalidateCaretPosition = true;
- }
-
- // Change event is not always sent when delete key is pressed, so
- // invalidate the size here
- if (event.keyCode == Keyboard.BACKSPACE)
- {
- invalidateSize();
- }
- }
-
- /**
- * @private
- * When entering edit mode on iOS, we need to shrink the textDisplay to
- * the size of the TextArea
- */
- private function textDisplay_softKeyboardActivatingHandler(event:SoftKeyboardEvent):void
- {
- if (event.isDefaultPrevented())
- return;
-
- if (_isIOS && isTextDisplayTall)
- {
- //trace("TAS.SK ACTIVATING targ",event.target);
- shrinkTextDisplay = true;
- invalidateDisplayList();
- validateNow();
- }
- }
-
- /**
- * @private
- * Send a caret change event to an ancestor Scroller
- */
- private function textDisplay_softKeyboardActivateHandler(event:SoftKeyboardEvent):void
- {
- var keyboardRect:Rectangle = stage.softKeyboardRect;
-
- if (keyboardRect.width > 0 && keyboardRect.height > 0)
- {
- var newCaretBounds:Rectangle = getCaretBounds();
- convertBoundsToLocal(newCaretBounds);
-
- if (oldCaretBounds != newCaretBounds)
- {
- //trace("TAS.SK ACTIVATE",keyboardRect,"dispatch caret CHANGE","newCaretBounds",newCaretBounds);
- dispatchEvent(new CaretBoundsChangeEvent(CaretBoundsChangeEvent.CARET_BOUNDS_CHANGE,true,true,oldCaretBounds,newCaretBounds));
- oldCaretBounds = newCaretBounds;
- }
- }
- }
-
- /**
- * @private
- * On iOS, when leaving edit mode, we need to restore the textDisplay to the
- * height of the text.
- */
- private function textDisplay_softKeyboardDeactivateHandler(event:SoftKeyboardEvent):void
- {
- if (_isIOS && !isTextDisplayTall)
- {
- growTextDisplay = true;
- invalidateDisplayList();
- }
- }
-
- /**
- * @private
- */
- private function resizeHandler(event:Event):void
- {
- // Resizing needs to tickle the TextArea's internal auto-scroll logic
- invalidateCaretPosition = true;
- invalidateDisplayList();
- }
-
- /**
- * @private
- */
- override public function styleChanged(styleProp:String):void
- {
- super.styleChanged(styleProp);
-
- // propogate styleChanged explicitly to textDisplay
- if (textDisplay)
- textDisplay.styleChanged(styleProp);
-
- // Check for padding style changes
- if (!styleProp || styleProp == "styleName" || styleProp.indexOf("padding") >= 0)
- {
- if (textDisplay)
- {
- textDisplay.left = getStyle("paddingLeft");
- textDisplay.top = getStyle("paddingTop");
- textDisplay.right = getStyle("paddingRight");
- textDisplay.bottom = getStyle("paddingBottom");
- }
- }
- }
-
- private function focusChangeHandler(event:FocusEvent):void
- {
- isFocused = event.type == FocusEvent.FOCUS_IN;
- invalidateDisplayList();
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/TextAreaVScrollBarSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/TextAreaVScrollBarSkin.as b/tourdeflexmobile/src/spark/skins/android4/TextAreaVScrollBarSkin.as
deleted file mode 100644
index f65b679..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/TextAreaVScrollBarSkin.as
+++ /dev/null
@@ -1,105 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package spark.skins.android4
-{
-import mx.core.DPIClassification;
-import mx.core.mx_internal;
-
-use namespace mx_internal;
-
-/**
- * ActionScript-based skin for TextAreaVScrollBar components in mobile applications.
- *
- * @langversion 3.0
- * @playerversion Flash 10.1
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
-public class TextAreaVScrollBarSkin extends VScrollBarSkin
-{
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- *
- */
- public function TextAreaVScrollBarSkin()
- {
- super();
-
- thumbSkinClass = TextAreaVScrollBarThumbSkin;
- var paddingRight:int;
- var paddingVertical:int;
-
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
- minWidth = 30;
- paddingRight = TextAreaVScrollBarThumbSkin.PADDING_RIGHT_640DPI;
- paddingVertical = TextAreaVScrollBarThumbSkin.PADDING_VERTICAL_640DPI;
- break;
- }
- case DPIClassification.DPI_480:
- {
- minWidth = 22;
- paddingRight = TextAreaVScrollBarThumbSkin.PADDING_RIGHT_480DPI;
- paddingVertical = TextAreaVScrollBarThumbSkin.PADDING_VERTICAL_480DPI;
- break;
- }
- case DPIClassification.DPI_320:
- {
- minWidth = 15;
- paddingRight = TextAreaVScrollBarThumbSkin.PADDING_RIGHT_320DPI;
- paddingVertical = TextAreaVScrollBarThumbSkin.PADDING_VERTICAL_320DPI;
- break;
- }
- case DPIClassification.DPI_240:
- {
- minWidth = 11;
- paddingRight = TextAreaVScrollBarThumbSkin.PADDING_RIGHT_240DPI;
- paddingVertical = TextAreaVScrollBarThumbSkin.PADDING_VERTICAL_240DPI;
- break;
- }
- case DPIClassification.DPI_120:
- {
- minWidth = 6;
- paddingRight = TextAreaVScrollBarThumbSkin.PADDING_RIGHT_120DPI;
- paddingVertical = TextAreaVScrollBarThumbSkin.PADDING_VERTICAL_120DPI;
- break;
- }
- default:
- {
- // default DPI_160
- minWidth = 9;
- paddingRight = TextAreaVScrollBarThumbSkin.PADDING_RIGHT_DEFAULTDPI;
- paddingVertical = TextAreaVScrollBarThumbSkin.PADDING_VERTICAL_DEFAULTDPI;
- break;
- }
- }
-
- // The minimum height is set such that, at it's smallest size, the thumb appears
- // as high as it is wide.
- minThumbHeight = (minWidth - paddingRight) + (paddingVertical * 2);
- }
-}
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/TextAreaVScrollBarThumbSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/TextAreaVScrollBarThumbSkin.as b/tourdeflexmobile/src/spark/skins/android4/TextAreaVScrollBarThumbSkin.as
deleted file mode 100644
index 5cc1ea0..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/TextAreaVScrollBarThumbSkin.as
+++ /dev/null
@@ -1,117 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package spark.skins.android4
-{
-import mx.core.DPIClassification;
-import mx.core.mx_internal;
-
-use namespace mx_internal;
-
-/**
- * The ActionScript-based skin used for TextAreaHScrollBarThumb components
- * in mobile applications.
- *
- * @langversion 3.0
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- *
- */
-public class TextAreaVScrollBarThumbSkin extends VScrollBarThumbSkin
-{
- //--------------------------------------------------------------------------
- //
- // Class constants
- //
- //--------------------------------------------------------------------------
-
- // These constants are also accessed from TextAreaVScrollBarSkin
- mx_internal static const PADDING_RIGHT_640DPI:int = 16;
- mx_internal static const PADDING_VERTICAL_640DPI:int = 24;
- mx_internal static const PADDING_RIGHT_480DPI:int = 12;
- mx_internal static const PADDING_VERTICAL_480DPI:int = 18;
- mx_internal static const PADDING_RIGHT_320DPI:int = 8;
- mx_internal static const PADDING_VERTICAL_320DPI:int = 12;
- mx_internal static const PADDING_RIGHT_240DPI:int = 4;
- mx_internal static const PADDING_VERTICAL_240DPI:int = 6;
- mx_internal static const PADDING_RIGHT_120DPI:int = 2;
- mx_internal static const PADDING_VERTICAL_120DPI:int = 3;
- mx_internal static const PADDING_RIGHT_DEFAULTDPI:int = 4;
- mx_internal static const PADDING_VERTICAL_DEFAULTDPI:int = 6;
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- *
- */
- public function TextAreaVScrollBarThumbSkin()
- {
- super();
-
- // Depending on density set padding
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
- paddingRight = PADDING_RIGHT_640DPI;
- paddingVertical = PADDING_VERTICAL_640DPI;
- break;
- }
- case DPIClassification.DPI_480:
- {
- paddingRight = PADDING_RIGHT_480DPI;
- paddingVertical = PADDING_VERTICAL_480DPI;
- break;
- }
- case DPIClassification.DPI_320:
- {
- paddingRight = PADDING_RIGHT_320DPI;
- paddingVertical = PADDING_VERTICAL_320DPI;
- break;
- }
- case DPIClassification.DPI_240:
- {
- paddingRight = PADDING_RIGHT_240DPI;
- paddingVertical = PADDING_VERTICAL_240DPI;
- break;
- }
- case DPIClassification.DPI_120:
- {
- paddingRight = PADDING_RIGHT_120DPI;
- paddingVertical = PADDING_VERTICAL_120DPI;
- break;
- }
- default:
- {
- paddingRight = PADDING_RIGHT_DEFAULTDPI;
- paddingVertical = PADDING_VERTICAL_DEFAULTDPI;
- break;
- }
- }
- }
-}
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/TextInputSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/TextInputSkin.as b/tourdeflexmobile/src/spark/skins/android4/TextInputSkin.as
deleted file mode 100644
index 1ec2c11..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/TextInputSkin.as
+++ /dev/null
@@ -1,375 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
- import flash.events.Event;
- import flash.events.FocusEvent;
- import flash.events.SoftKeyboardEvent;
-
- import mx.core.DPIClassification;
- import mx.core.EventPriority;
- import mx.core.mx_internal;
- import mx.events.FlexEvent;
- import mx.utils.Platform;
-
- import spark.components.TextInput;
- import spark.components.supportClasses.StyleableTextField;
- import spark.skins.android4.supportClasses.TextSkinBase;
-
- use namespace mx_internal;
-
- /**
- * ActionScript-based skin for TextInput controls in mobile applications.
- *
- * @see spark.components.TextInput
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public class TextInputSkin extends TextSkinBase
- {
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public function TextInputSkin()
- {
- super();
-
- // on iOS, make adjustments for native text rendering
- _isIOS = Platform.isIOS;
-
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
- measuredDefaultWidth = 1200;
- measuredDefaultHeight = 132;
- layoutBorderSize = 4;
- flatheight = 9;
- break;
- }
- case DPIClassification.DPI_480:
- {
-
- measuredDefaultWidth = 880;
- measuredDefaultHeight = 100;
- layoutBorderSize = 3;
- flatheight = 7;
- break;
- }
- case DPIClassification.DPI_320:
- {
- measuredDefaultWidth = 600;
- measuredDefaultHeight = 66;
- layoutBorderSize = 2;
- flatheight = 6;
- break;
- }
- case DPIClassification.DPI_240:
- {
- measuredDefaultWidth = 440;
- measuredDefaultHeight = 50;
- layoutBorderSize = 2;
- flatheight = 5;
- break;
- }
- case DPIClassification.DPI_120:
- {
- measuredDefaultWidth = 220;
- measuredDefaultHeight = 25;
- layoutBorderSize = 1;
- flatheight = 2;
- break;
- }
- default:
- {
- measuredDefaultWidth = 300;
- measuredDefaultHeight = 33;
- layoutBorderSize = 1;
- flatheight = 3;
- break;
- }
- }
- addEventListener(FocusEvent.FOCUS_IN, focusChangeHandler);
- addEventListener(FocusEvent.FOCUS_OUT, focusChangeHandler);
- }
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
-
- protected var isFocused:Boolean = false;
-
- protected var flatheight:uint;
-
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- */
- public var hostComponent:TextInput; // SkinnableComponent will populate
-
- /**
- * @private
- */
- private var _isIOS:Boolean;
-
- /**
- * @private
- */
- private var _isEditing:Boolean;
-
- /**
- * @private
- */
- override protected function createChildren():void
- {
- super.createChildren();
-
- textDisplay.addEventListener("editableChanged", editableChangedHandler);
- textDisplay.addEventListener(FlexEvent.VALUE_COMMIT, valueCommitHandler);
-
- // remove hit area improvements on iOS when editing
- if (_isIOS)
- {
- textDisplay.addEventListener(SoftKeyboardEvent.SOFT_KEYBOARD_ACTIVATING, textDisplay_softKeyboardActivatingHandler, false, EventPriority.DEFAULT_HANDLER);
- textDisplay.addEventListener(SoftKeyboardEvent.SOFT_KEYBOARD_DEACTIVATE, textDisplay_softKeyboardDeactivateHandler);
- }
- }
-
- /**
- * @private
- */
- override protected function measure():void
- {
- super.measure();
-
- var paddingLeft:Number = getStyle("paddingLeft");
- var paddingRight:Number = getStyle("paddingRight");
- var paddingTop:Number = getStyle("paddingTop");
- var paddingBottom:Number = getStyle("paddingBottom");
- var textHeight:Number = getStyle("fontSize") as Number;
-
- if (textDisplay)
- {
- // temporarily change text for measurement
- var oldText:String = textDisplay.text;
-
- // commit styles so we can get a valid textHeight
- textDisplay.text = "Wj";
- textDisplay.commitStyles();
-
- textHeight = textDisplay.measuredTextSize.y;
- textDisplay.text = oldText;
- }
-
- // width is based on maxChars (if set)
- if (hostComponent && hostComponent.maxChars)
- {
- // Grab the fontSize and subtract 2 as the pixel value for each character.
- // This is just an approximation, but it appears to be a reasonable one
- // for most input and most font.
- var characterWidth:int = Math.max(1, (getStyle("fontSize") - 2));
- measuredWidth = (characterWidth * hostComponent.maxChars) +
- paddingLeft + paddingRight + StyleableTextField.TEXT_WIDTH_PADDING;
- }
-
- measuredHeight = paddingTop + textHeight + paddingBottom;
- }
-
- /**
- * @private
- */
- override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.layoutContents(unscaledWidth, unscaledHeight);
-
- // position & size border
- if (border)
- {
- setElementSize(border, unscaledWidth, unscaledHeight);
- setElementPosition(border, 0, 0);
- }
-
- // position & size the text
- var paddingLeft:Number = getStyle("paddingLeft");
- var paddingRight:Number = getStyle("paddingRight");
- var paddingTop:Number = getStyle("paddingTop");
- var paddingBottom:Number = getStyle("paddingBottom");
-
- var unscaledTextWidth:Number = unscaledWidth - paddingLeft - paddingRight;
- var unscaledTextHeight:Number = unscaledHeight - paddingTop - paddingBottom;
-
- // default vertical positioning is centered
- var textHeight:Number = getElementPreferredHeight(textDisplay);
- var textY:Number = Math.round(0.5 * (unscaledTextHeight - textHeight)) + paddingTop;
-
- // On iOS the TextField top and bottom edges are bounded by the padding.
- // On all other platforms, the height of the textDisplay is
- // textHeight + paddingBottom to increase hitArea on bottom.
- // Note: We don't move the Y position upwards because TextField
- // has way to set vertical positioning.
- // Note: iOS is a special case due to the clear button provided by the
- // native text control used while editing.
- var adjustedTextHeight:Number = (_isIOS && _isEditing) ? textHeight : textHeight + paddingBottom;
-
- if (textDisplay)
- {
- // We're going to do a few tricks to try to increase the size of our hitArea to make it
- // easier for users to select text or put the caret in a certain spot. To do that,
- // rather than set textDisplay.x=paddingLeft, we are going to set
- // textDisplay.leftMargin = paddingLeft. In addition, we're going to size the height
- // of the textDisplay larger than just the size of the text inside to increase the hitArea
- // on the bottom. We'll also assign textDisplay.rightMargin = paddingRight to increase the
- // the hitArea on the right. Unfortunately, there's no way to increase the hitArea on the top
- // just yet, but these three tricks definitely help out with regards to user experience.
- // See http://bugs.adobe.com/jira/browse/SDK-29406 and http://bugs.adobe.com/jira/browse/SDK-29405
-
- // set leftMargin, rightMargin to increase the hitArea. Need to set it before calling commitStyles().
- var marginChanged:Boolean = ((textDisplay.leftMargin != paddingLeft) ||
- (textDisplay.rightMargin != paddingRight));
-
- textDisplay.leftMargin = paddingLeft;
- textDisplay.rightMargin = paddingRight;
-
- // need to force a styleChanged() after setting leftMargin, rightMargin if they
- // changed values. Then we can validate the styles through commitStyles()
- if (marginChanged)
- textDisplay.styleChanged(null);
- textDisplay.commitStyles();
-
- setElementSize(textDisplay, unscaledWidth, adjustedTextHeight);
-
- // set x=0 since we're using textDisplay.leftMargin = paddingLeft
- setElementPosition(textDisplay, 0, textY);
- }
-
- if (promptDisplay)
- {
- promptDisplay.commitStyles();
- setElementSize(promptDisplay, unscaledTextWidth, adjustedTextHeight);
- setElementPosition(promptDisplay, paddingLeft, textY);
- }
- }
-
- override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.drawBackground(unscaledWidth, unscaledHeight);
-
- var contentBackgroundColor:uint = getStyle("contentBackgroundColor");
- var contentBackgroundAlpha:Number = getStyle("contentBackgroundAlpha");
- //change border color and thickness when in focus
- var borderColor:uint = isFocused ? getStyle("focusColor") : getStyle("borderColor");
- var selectWidth:uint = isFocused ? layoutBorderSize + 1 : layoutBorderSize;
- if (isNaN(contentBackgroundAlpha))
- {
- contentBackgroundAlpha = 1;
- }
- if (getStyle("contentBackgroundBorder") == "flat")
- {
- var halfGap:int = flatheight * 2;
- //background
- graphics.beginFill(contentBackgroundColor, contentBackgroundAlpha);
- graphics.drawRect(0, 0, unscaledWidth, unscaledHeight - flatheight);
- graphics.endFill();
- //begin flat border
- graphics.beginFill(borderColor, 1);
- //left half border
- graphics.drawRect(0, unscaledHeight - halfGap, selectWidth, flatheight );
- //bottom border
- graphics.drawRect(0, unscaledHeight - flatheight, unscaledWidth, selectWidth);
- //right border
- graphics.drawRect(unscaledWidth - selectWidth, unscaledHeight - halfGap, selectWidth, flatheight);
- graphics.endFill();
- }
- else if (getStyle("contentBackgroundBorder") == "rectangle")
- {
- var borderWidth:uint = layoutBorderSize * 2;
- //rectangle border and background
- graphics.lineStyle(selectWidth, borderColor, 1);
- graphics.beginFill(contentBackgroundColor, contentBackgroundAlpha);
- graphics.drawRect(layoutBorderSize, layoutBorderSize, unscaledWidth - borderWidth, unscaledHeight - borderWidth);
- graphics.endFill();
- }
- }
-
- /**
- * @private
- */
- private function editableChangedHandler(event:Event):void
- {
- invalidateDisplayList();
- }
-
- /**
- * @private
- * The text changed in some way.
- *
- * Dynamic fields (ie !editable) with no text measure with width=0 and height=0.
- * If the text changed, need to remeasure the text to get the correct height so it
- * will be laid out correctly.
- */
- private function valueCommitHandler(event:Event):void
- {
- if (textDisplay && !textDisplay.editable)
- invalidateDisplayList();
- }
-
- /**
- * @private
- */
- private function textDisplay_softKeyboardActivatingHandler(event:SoftKeyboardEvent):void
- {
- if (event.isDefaultPrevented())
- return;
-
- _isEditing = true;
- invalidateDisplayList();
- }
-
- /**
- * @private
- */
- private function textDisplay_softKeyboardDeactivateHandler(event:SoftKeyboardEvent):void
- {
- _isEditing = false;
- invalidateDisplayList();
- }
-
- private function focusChangeHandler(event:FocusEvent):void
- {
- isFocused = event.type == FocusEvent.FOCUS_IN;
- invalidateDisplayList();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/ToggleSwitchSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/ToggleSwitchSkin.as b/tourdeflexmobile/src/spark/skins/android4/ToggleSwitchSkin.as
deleted file mode 100644
index 7f50554..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/ToggleSwitchSkin.as
+++ /dev/null
@@ -1,506 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
-
- import flash.display.BlendMode;
- import flash.events.Event;
-
- import mx.core.DPIClassification;
- import mx.core.IVisualElement;
- import mx.core.UIComponent;
-
- import spark.components.ToggleSwitch;
- import spark.components.supportClasses.StyleableTextField;
- import spark.core.SpriteVisualElement;
- import spark.skins.android4.assets.ToggleSwitchBackground;
- import spark.skins.android4.assets.ToggleSwitchThumb_off;
- import spark.skins.mobile.supportClasses.MobileSkin;
-
-
- /**
- * ActionScript-based Android 4.x specific skin for the ToggleSwitch control.
- * This class is responsible for most of the
- * graphics drawing, with additional fxg assets.
- *
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- *
- * @see spark.components.ToggleSwitch
- */
- public class ToggleSwitchSkin extends MobileSkin
- {
- //----------------------------------------------------------------------------------------------
- //
- // Skin parts
- //
- //----------------------------------------------------------------------------------------------
-
- /**
- * The thumb skin part.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- public var thumb:IVisualElement;
- /**
- * The track skin part.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- public var track:IVisualElement;
-
- //----------------------------------
- // hostComponent
- //----------------------------------
-
- private var _hostComponent:ToggleSwitch;
- public var selectedLabelDisplay:LabelDisplayComponent;
-
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- */
- public function get hostComponent():ToggleSwitch
- {
- return _hostComponent;
- }
-
- public function set hostComponent(value:ToggleSwitch):void
- {
- if (_hostComponent)
- _hostComponent.removeEventListener("thumbPositionChanged", thumbPositionChanged_handler);
- _hostComponent = value;
- if (_hostComponent)
- _hostComponent.addEventListener("thumbPositionChanged", thumbPositionChanged_handler);
- }
-
- //----------------------------------
- // selectedLabel
- //----------------------------------
-
- private var _selectedLabel:String;
- /**
- * The text of the label showing when the component is selected.
- * Subclasses can set or override this property to customize the selected label.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected function get selectedLabel():String
- {
- return _selectedLabel;
- }
-
- protected function set selectedLabel(value:String):void
- {
- _selectedLabel = value;
- }
-
- //----------------------------------
- // unselectedLabel
- //----------------------------------
-
- private var _unselectedLabel:String;
- /**
- * The text of the label showing when the component is not selected.
- * Subclasses can set or override this property to customize the unselected label.
- *
- * @langversion 3.0
- * @playerversion AIR 3
- * @productversion Flex 4.6
- */
- protected function get unselectedLabel():String
- {
- return _unselectedLabel;
- }
-
- protected function set unselectedLabel(value:String):void
- {
- _unselectedLabel = value;
- }
-
-
- /**
- * The contents inside the skin, not including the outline
- * stroke
- */
- private var contents:UIComponent;
- private var switchTrack:Class;
- private var switchOff:Class;
- private var switchOn:Class;
- protected var trackWidth:Number;
- protected var trackHeight:Number;
- protected var layoutThumbWidth:Number;
- protected var layoutThumbHeight:Number;
- private var thumbOn:IVisualElement;
- private var thumbOff:IVisualElement;
-
- public function ToggleSwitchSkin()
- {
- super();
-
- switchTrack = spark.skins.android4.assets.ToggleSwitchBackground;
- switchOn = spark.skins.android4.assets.ToggleSwitchThumb_on;
- switchOff = spark.skins.android4.assets.ToggleSwitchThumb_off;
-
- switch(applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
- layoutThumbWidth = 188;
- layoutThumbHeight = 96;
- trackWidth = 388;
- trackHeight = 96;
- break;
- }
- case DPIClassification.DPI_480:
- {
- layoutThumbWidth = 140;
- layoutThumbHeight = 72;
- trackWidth = 291;
- trackHeight = 72;
- break;
- }
- case DPIClassification.DPI_320:
- {
- layoutThumbWidth = 94;
- layoutThumbHeight = 48;
- trackWidth = 194;
- trackHeight = 48;
- break;
- }
- case DPIClassification.DPI_240:
- {
- layoutThumbWidth = 70;
- layoutThumbHeight = 36;
- trackWidth = 146;
- trackHeight = 36;
- break;
- }
- case DPIClassification.DPI_120:
- {
- layoutThumbWidth = 35;
- layoutThumbHeight = 18;
- trackWidth = 73;
- trackHeight = 18;
- break;
- }
- default:
- {
- layoutThumbWidth = 47;
- layoutThumbHeight = 24;
- trackWidth = 97;
- trackHeight = 24;
- break;
- }
- }
-
- selectedLabel = resourceManager.getString("components","toggleSwitchSelectedLabel");
- unselectedLabel = resourceManager.getString("components","toggleSwitchUnselectedLabel");
- }
-
- override protected function createChildren():void
- {
- super.createChildren();
- contents = new UIComponent();
- contents.blendMode = BlendMode.LAYER;
- addChild(contents);
- drawTrack();
- drawThumbs();
- drawLabel();
- }
-
- override protected function measure():void
- {
- // The skin must be at least as large as the thumb
- measuredMinWidth = layoutThumbWidth;
- measuredMinHeight = layoutThumbHeight;
-
- // The preferred size will display all label text
- var labelWidth:Number = getElementPreferredWidth(selectedLabelDisplay);
- measuredWidth = layoutThumbWidth + labelWidth;
- measuredHeight = layoutThumbHeight;
- }
-
- override protected function commitCurrentState():void
- {
- toggleSelectionState();
- layoutThumbs();
- layoutLabel();
- }
-
- //The label is called selectedLabelDisplay because the hostComponent expects it
- protected function drawLabel():void
- {
- selectedLabelDisplay = new LabelDisplayComponent();
- selectedLabelDisplay.id = "selectedLabelDisplay";
- selectedLabelDisplay.text = selectedLabel;
- setElementSize(selectedLabelDisplay,thumb.width,thumb.height);
- contents.addChild(selectedLabelDisplay);
- }
-
- //Draw the track behind everything else
- protected function drawTrack():void
- {
- if(track == null)
- {
- track = new switchTrack();
- track.width = trackWidth;
- track.height = trackHeight;
- contents.addChildAt(SpriteVisualElement(track),0);
- }
- }
-
- //Draw both thumbs. Set skinpart thumb to be thumbOff because default state of the switch is OFF
- protected function drawThumbs():void
- {
- drawThumbOff();
- drawThumbOn();
- if(thumb == null)
- {
- thumb = thumbOff;
- }
- }
-
- //Thumb ON the right side; Thumb OFF is on the left side
- protected function layoutThumbs():void
- {
- setElementPosition(thumbOn,trackWidth/2,0);
- setElementPosition(thumbOff,0,0);
- }
-
- //Label display sould be at the same location as the thumb
- protected function layoutLabel():void
- {
- if(selectedLabelDisplay != null)
- {
- if(currentState.indexOf("AndSelected") != -1)
- {
- setElementPosition(selectedLabelDisplay,trackWidth/2,0);
- }
- else
- {
- setElementPosition(selectedLabelDisplay,0,0);
- }
- }
- }
-
- //Depending on current state, set skinpart thumb accordingly
- protected function toggleSelectionState():void
- {
- if(currentState.indexOf("AndSelected") != -1)
- {
- thumbOn.visible = true;
- thumbOff.visible = false;
- thumb = thumbOn;
- selectedLabelDisplay.text = selectedLabel;
- }
- else
- {
- thumbOff.visible = true;
- thumbOn.visible = false;
- thumb = thumbOff;
- selectedLabelDisplay.text = unselectedLabel;
- }
- }
-
- protected function drawThumbOn():void
- {
- thumbOn = new switchOn();
- thumbOn.width = layoutThumbWidth;
- thumbOn.height = layoutThumbHeight;
- contents.addChildAt(SpriteVisualElement(thumbOn),1);
- }
-
- protected function drawThumbOff():void
- {
- thumbOff = new switchOff();
- thumbOff.width = layoutThumbWidth;
- thumbOff.height = layoutThumbHeight;
- contents.addChildAt(SpriteVisualElement(thumbOff),1);
- }
-
- //Hostcomponent dispatches this event whenever the thumb position changes
- protected function thumbPositionChanged_handler(event:Event):void
- {
- moveSlidingContent();
- }
-
- //Move the current thumb and label along with the animating content
- protected function moveSlidingContent():void
- {
- if (!hostComponent)
- return;
- var x:Number = (track.getLayoutBoundsWidth() - thumb.getLayoutBoundsWidth()) *
- hostComponent.thumbPosition + track.getLayoutBoundsX();
- var y:Number = thumb.getLayoutBoundsY();
- setElementPosition(thumb, x, y);
- setElementPosition(selectedLabelDisplay, x, y);
- }
- }
-}
-
-
-import flash.events.Event;
-
-import mx.core.UIComponent;
-import mx.core.mx_internal;
-import mx.events.FlexEvent;
-
-import spark.components.supportClasses.StyleableTextField;
-import spark.core.IDisplayText;
-
-use namespace mx_internal;
-
-/**
- * @private
- * Component combining two labels to create the effect of text and its drop
- * shadow. The component can be used with advanced style selectors and the
- * styles "color", "textShadowColor", and "textShadowAlpha". Based off of
- * ActionBar.TitleDisplayComponent. These two should eventually be factored.
- */
-class LabelDisplayComponent extends UIComponent implements IDisplayText
-{
- public var shadowYOffset:Number = 0;
- private var labelChanged:Boolean = false;
- private var labelDisplay:StyleableTextField;
- private var labelDisplayShadow:StyleableTextField;
- private var _text:String;
-
- public function LabelDisplayComponent()
- {
- super();
- _text = "";
- }
-
- override public function get baselinePosition():Number
- {
- return labelDisplay.baselinePosition;
- }
-
- override protected function createChildren():void
- {
- super.createChildren();
-
- labelDisplay = StyleableTextField(createInFontContext(StyleableTextField));
- labelDisplay.styleName = this;
- labelDisplay.editable = false;
- labelDisplay.selectable = false;
- labelDisplay.multiline = false;
- labelDisplay.wordWrap = false;
- labelDisplay.addEventListener(FlexEvent.VALUE_COMMIT,
- labelDisplay_valueCommitHandler);
-
- labelDisplayShadow = StyleableTextField(createInFontContext(StyleableTextField));
- labelDisplayShadow.styleName = this;
- labelDisplayShadow.colorName = "textShadowColor";
- labelDisplayShadow.editable = false;
- labelDisplayShadow.selectable = false;
- labelDisplayShadow.multiline = false;
- labelDisplayShadow.wordWrap = false;
-
- addChild(labelDisplayShadow);
- addChild(labelDisplay);
- }
-
- override protected function commitProperties():void
- {
- super.commitProperties();
-
- if (labelChanged)
- {
- labelDisplay.text = text;
- invalidateSize();
- invalidateDisplayList();
- labelChanged = false;
- }
- }
-
- override protected function measure():void
- {
- if (labelDisplay.isTruncated)
- labelDisplay.text = text;
- labelDisplay.commitStyles();
- measuredWidth = labelDisplay.getPreferredBoundsWidth();
- measuredHeight = labelDisplay.getPreferredBoundsHeight();
- }
-
- override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
- {
- if (labelDisplay.isTruncated)
- labelDisplay.text = text;
- labelDisplay.commitStyles();
-
- var labelHeight:Number = labelDisplay.getPreferredBoundsHeight();
- var labelY:Number = (unscaledHeight - labelHeight) / 2;
-
- var labelWidth:Number = Math.min(unscaledWidth, labelDisplay.getPreferredBoundsWidth());
- var labelX:Number = (unscaledWidth - labelWidth) / 2;
-
- labelDisplay.setLayoutBoundsSize(labelWidth, labelHeight);
- labelDisplay.setLayoutBoundsPosition(labelX, labelY);
-
- labelDisplay.truncateToFit();
-
- labelDisplayShadow.commitStyles();
- labelDisplayShadow.setLayoutBoundsSize(labelWidth, labelHeight);
- labelDisplayShadow.setLayoutBoundsPosition(labelX, labelY + shadowYOffset);
-
- labelDisplayShadow.alpha = getStyle("textShadowAlpha");
-
- // unless the label was truncated, labelDisplayShadow.text was set in
- // the value commit handler
- if (labelDisplay.isTruncated)
- labelDisplayShadow.text = labelDisplay.text;
- }
-
- private function labelDisplay_valueCommitHandler(event:Event):void
- {
- labelDisplayShadow.text = labelDisplay.text;
- }
-
- public function get text():String
- {
- return _text;
- }
-
- public function set text(value:String):void
- {
- _text = value;
- labelChanged = true;
- invalidateProperties();
- }
-
- public function get isTruncated():Boolean
- {
- return labelDisplay.isTruncated;
- }
-
- public function showShadow(value:Boolean):void
- {
- labelDisplayShadow.visible = value;
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/TransparentNavigationButtonSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/TransparentNavigationButtonSkin.as b/tourdeflexmobile/src/spark/skins/android4/TransparentNavigationButtonSkin.as
deleted file mode 100644
index 6b31e22..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/TransparentNavigationButtonSkin.as
+++ /dev/null
@@ -1,109 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
-import flash.display.DisplayObject;
-import flash.display.Graphics;
-
-import mx.core.DPIClassification;
-import mx.core.mx_internal;
-
-import spark.skins.android4.assets.TransparentNavigationButton_down;
-import spark.skins.android4.assets.TransparentNavigationButton_up;
-import spark.skins.mobile.supportClasses.ActionBarButtonSkinBase;
-import spark.skins.mobile.supportClasses.MobileSkin;
-//import spark.skins.mobile320.assets.TransparentNavigationButton_down;
-//import spark.skins.mobile320.assets.TransparentNavigationButton_up;
-//import spark.skins.mobile480.assets.TransparentNavigationButton_down;
-//import spark.skins.mobile480.assets.TransparentNavigationButton_up;
-//import spark.skins.mobile640.assets.TransparentNavigationButton_down;
-//import spark.skins.mobile640.assets.TransparentNavigationButton_up;
-
-use namespace mx_internal;
-
-/**
- * The default skin class for buttons in the navigation area of the Spark ActionBar component
- * in mobile applications.
- *
- * @langversion 3.0
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
-public class TransparentNavigationButtonSkin extends ActionBarButtonSkinBase
-{
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- *
- */
- public function TransparentNavigationButtonSkin()
- {
- super();
-
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
- // upBorderSkin = spark.skins.mobile640.assets.TransparentActionButton_up;
- // downBorderSkin = spark.skins.mobile640.assets.TransparentActionButton_down;
-
- break;
- }
- case DPIClassification.DPI_480:
- {
- // upBorderSkin = spark.skins.mobile480.assets.TransparentActionButton_up;
- // downBorderSkin = spark.skins.mobile480.assets.TransparentActionButton_down;
-
- break;
- }
- case DPIClassification.DPI_320:
- {
- // upBorderSkin = spark.skins.mobile320.assets.TransparentNavigationButton_up;
- // downBorderSkin = spark.skins.mobile320.assets.TransparentNavigationButton_down;
-
- break;
- }
- default:
- {
- upBorderSkin = spark.skins.android4.assets.TransparentNavigationButton_up;
- downBorderSkin = spark.skins.android4.assets.TransparentNavigationButton_down;
-
- break;
- }
- }
- }
-
- override mx_internal function layoutBorder(unscaledWidth:Number, unscaledHeight:Number):void
- {
- // trailing vertical separator is outside the right bounds of the button
- setElementSize(border, unscaledWidth, unscaledHeight);
- setElementPosition(border, 0, 0);
- }
-}
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/VScrollBarSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/VScrollBarSkin.as b/tourdeflexmobile/src/spark/skins/android4/VScrollBarSkin.as
deleted file mode 100644
index 10312c5..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/VScrollBarSkin.as
+++ /dev/null
@@ -1,207 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
-
- import mx.core.DPIClassification;
- import mx.core.mx_internal;
-
- import spark.components.Button;
- import spark.components.VScrollBar;
- import spark.skins.mobile.supportClasses.MobileSkin;
-
- use namespace mx_internal;
-
- /**
- * ActionScript-based skin for VScrollBar components in mobile applications.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public class VScrollBarSkin extends MobileSkin
- {
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- *
- */
- public function VScrollBarSkin()
- {
- super();
-
- minHeight = 20;
- thumbSkinClass = VScrollBarThumbSkin;
- var paddingRight:int;
- var paddingVertical:int;
-
- // Depending on density set our measured width
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
- minWidth = 24;
- paddingRight = VScrollBarThumbSkin.PADDING_RIGHT_640DPI;
- paddingVertical = VScrollBarThumbSkin.PADDING_VERTICAL_640DPI;
- break;
- }
- case DPIClassification.DPI_480:
- {
- minWidth = 18;
- paddingRight = VScrollBarThumbSkin.PADDING_RIGHT_480DPI;
- paddingVertical = VScrollBarThumbSkin.PADDING_VERTICAL_480DPI;
- break;
- }
- case DPIClassification.DPI_320:
- {
- minWidth = 12;
- paddingRight = VScrollBarThumbSkin.PADDING_RIGHT_320DPI;
- paddingVertical = VScrollBarThumbSkin.PADDING_VERTICAL_320DPI;
- break;
- }
- case DPIClassification.DPI_240:
- {
- minWidth = 9;
- paddingRight = VScrollBarThumbSkin.PADDING_RIGHT_240DPI;
- paddingVertical = VScrollBarThumbSkin.PADDING_VERTICAL_240DPI;
- break;
- }
- case DPIClassification.DPI_120:
- {
- minWidth = 9;
- paddingRight = VScrollBarThumbSkin.PADDING_RIGHT_120DPI;
- paddingVertical = VScrollBarThumbSkin.PADDING_VERTICAL_120DPI;
- break;
- }
- default:
- {
- // default DPI_160
- minWidth = 6;
- paddingRight = VScrollBarThumbSkin.PADDING_RIGHT_DEFAULTDPI;
- paddingVertical = VScrollBarThumbSkin.PADDING_VERTICAL_DEFAULTDPI;
- break;
- }
- }
-
- // The minimum height is set such that, at it's smallest size, the thumb appears
- // as high as it is wide.
- minThumbHeight = (minWidth - paddingRight) + (paddingVertical * 2);
- }
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- */
- public var hostComponent:VScrollBar;
-
- /**
- * Minimum height for the thumb
- */
- protected var minThumbHeight:Number;
-
- /**
- * Skin to use for the thumb Button skin part
- */
- protected var thumbSkinClass:Class;
-
- //--------------------------------------------------------------------------
- //
- // Skin parts
- //
- //--------------------------------------------------------------------------
- /**
- * VScrollbar track skin part
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public var track:Button;
-
- /**
- * VScrollbar thumb skin part
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public var thumb:Button;
-
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods
- //
- //--------------------------------------------------------------------------
- /**
- * @private
- */
- override protected function createChildren():void
- {
- // Create our skin parts if necessary: track and thumb.
- if (!track)
- {
- // We don't want a visible track so we set the skin to MobileSkin
- track = new Button();
- track.setStyle("skinClass", spark.skins.mobile.supportClasses.MobileSkin);
- track.width = minWidth;
- track.height = minHeight;
- addChild(track);
- }
- if (!thumb)
- {
- thumb = new Button();
- thumb.minHeight = minThumbHeight;
- thumb.setStyle("skinClass", thumbSkinClass);
- thumb.width = minWidth;
- thumb.height = minWidth;
- addChild(thumb);
- }
- }
-
- /**
- * @private
- */
- override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.layoutContents(unscaledWidth, unscaledHeight);
-
- setElementSize(track, unscaledWidth, unscaledHeight);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/8ccec1f5/tourdeflexmobile/src/spark/skins/android4/VScrollBarThumbSkin.as
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/spark/skins/android4/VScrollBarThumbSkin.as b/tourdeflexmobile/src/spark/skins/android4/VScrollBarThumbSkin.as
deleted file mode 100644
index d9a3804..0000000
--- a/tourdeflexmobile/src/spark/skins/android4/VScrollBarThumbSkin.as
+++ /dev/null
@@ -1,178 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package spark.skins.android4
-{
-
- import flash.display.CapsStyle;
- import flash.display.JointStyle;
- import flash.display.LineScaleMode;
-
- import mx.core.DPIClassification;
- import mx.core.mx_internal;
- use namespace mx_internal;
-
- import spark.components.Button;
- import spark.skins.mobile.supportClasses.MobileSkin;
-
- /**
- * ActionScript-based skin for the VScrollBar thumb skin part in mobile applications.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- public class VScrollBarThumbSkin extends MobileSkin
- {
- //--------------------------------------------------------------------------
- //
- // Class constants
- //
- //--------------------------------------------------------------------------
-
- // These constants are also accessed from VScrollBarSkin
- mx_internal static const PADDING_RIGHT_640DPI:int = 10;
- mx_internal static const PADDING_VERTICAL_640DPI:int = 8;
- mx_internal static const PADDING_RIGHT_480DPI:int = 8;
- mx_internal static const PADDING_VERTICAL_480DPI:int = 6;
- mx_internal static const PADDING_RIGHT_320DPI:int = 5;
- mx_internal static const PADDING_VERTICAL_320DPI:int = 4;
- mx_internal static const PADDING_RIGHT_240DPI:int = 4;
- mx_internal static const PADDING_VERTICAL_240DPI:int = 3;
- mx_internal static const PADDING_RIGHT_120DPI:int = 2;
- mx_internal static const PADDING_VERTICAL_120DPI:int = 1;
- mx_internal static const PADDING_RIGHT_DEFAULTDPI:int = 3;
- mx_internal static const PADDING_VERTICAL_DEFAULTDPI:int = 2;
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- *
- */
- public function VScrollBarThumbSkin()
- {
- super();
-
- // Depending on density set padding
- switch (applicationDPI)
- {
- case DPIClassification.DPI_640:
- {
- minWidth = 19;
- paddingRight = VScrollBarThumbSkin.PADDING_RIGHT_640DPI;
- paddingVertical = VScrollBarThumbSkin.PADDING_VERTICAL_640DPI;
- break;
- }
- case DPIClassification.DPI_480:
- {
- minWidth = 19;
- paddingRight = VScrollBarThumbSkin.PADDING_RIGHT_480DPI;
- paddingVertical = VScrollBarThumbSkin.PADDING_VERTICAL_480DPI;
- break;
- }
- case DPIClassification.DPI_320:
- {
- paddingRight = PADDING_RIGHT_320DPI;
- paddingVertical = PADDING_VERTICAL_320DPI;
- break;
- }
- case DPIClassification.DPI_240:
- {
- paddingRight = PADDING_RIGHT_240DPI;
- paddingVertical = PADDING_VERTICAL_240DPI;
- break;
- }
- default:
- {
- paddingRight = PADDING_RIGHT_DEFAULTDPI;
- paddingVertical = PADDING_VERTICAL_DEFAULTDPI;
- break;
- }
- }
- }
-
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /**
- * @copy spark.skins.spark.ApplicationSkin#hostComponent
- */
- public var hostComponent:Button;
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
- /**
- * Padding from the right
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var paddingRight:int;
-
- /**
- * Vertical padding from top and bottom
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 2.5
- * @productversion Flex 4.5
- */
- protected var paddingVertical:int;
-
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @protected
- */
- override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.drawBackground(unscaledWidth, unscaledHeight);
-
- var thumbWidth:Number = unscaledWidth - paddingRight;
-
- graphics.beginFill(getStyle("thumbColor"), 1);
- graphics.drawRect(0.5, paddingVertical + 0.5,thumbWidth, unscaledHeight - 2 * paddingVertical);
-
- graphics.endFill();
- }
-
- }
-}
[6/6] git commit: [flex-examples] [refs/heads/develop] - Add
ActionBar example
Posted by bi...@apache.org.
Add ActionBar example
Project: http://git-wip-us.apache.org/repos/asf/flex-examples/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-examples/commit/dad386f5
Tree: http://git-wip-us.apache.org/repos/asf/flex-examples/tree/dad386f5
Diff: http://git-wip-us.apache.org/repos/asf/flex-examples/diff/dad386f5
Branch: refs/heads/develop
Commit: dad386f5b11e381ed446c0763d858cf598545f66
Parents: fde34a8
Author: OmPrakash Muppirala <bi...@gmail.com>
Authored: Fri Dec 19 15:34:41 2014 -0800
Committer: OmPrakash Muppirala <bi...@gmail.com>
Committed: Fri Dec 19 15:34:41 2014 -0800
----------------------------------------------------------------------
tourdeflexmobile/src/TourDeFlexMobile.mxml | 2 +
tourdeflexmobile/src/UIViews/ActionBarView.mxml | 86 ++++++++++++++++++++
2 files changed, 88 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/dad386f5/tourdeflexmobile/src/TourDeFlexMobile.mxml
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/TourDeFlexMobile.mxml b/tourdeflexmobile/src/TourDeFlexMobile.mxml
index 223b14f..8f12a7c 100644
--- a/tourdeflexmobile/src/TourDeFlexMobile.mxml
+++ b/tourdeflexmobile/src/TourDeFlexMobile.mxml
@@ -50,6 +50,7 @@ limitations under the License.
import LayoutViews.TimeMachineLayoutView;
import LayoutViews.VerticalLayoutView;
+ import UIViews.ActionBarView;
import UIViews.ButtonBarView;
import UIViews.CalloutButtonView;
import UIViews.CheckboxView;
@@ -216,6 +217,7 @@ limitations under the License.
change="changeHandler(event)" contentBackgroundColor="#eeeeee" downColor="#e0e0e0" selectionColor="#33B5E5">
<s:ArrayList>
<fx:Object label="UI COMPONENTS" type="separator"/>
+ <fx:Object label="ActionBar" type="view" view="{ActionBarView}"/>
<fx:Object label="ButtonBar" type="view" view="{ButtonBarView}"/>
<fx:Object label="CalloutButton" type="view" view="{CalloutButtonView}"/>
<fx:Object label="CheckBox" type="view" view="{CheckboxView}"/>
http://git-wip-us.apache.org/repos/asf/flex-examples/blob/dad386f5/tourdeflexmobile/src/UIViews/ActionBarView.mxml
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/UIViews/ActionBarView.mxml b/tourdeflexmobile/src/UIViews/ActionBarView.mxml
new file mode 100644
index 0000000..5329b85
--- /dev/null
+++ b/tourdeflexmobile/src/UIViews/ActionBarView.mxml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark" title="ActionBar">
+ <fx:Script>
+ <![CDATA[
+
+ protected function actionBarButtonHandler(event:MouseEvent):void
+ {
+ var labelStr:String = event.target.label;
+ label.text = labelStr;
+ }
+
+ protected function buttonHandler(event:MouseEvent):void
+ {
+ if(currentState == "DemoState")
+ {
+ currentState = "InfoState";
+ }
+ else if(currentState == "InfoState")
+ {
+ currentState = "DemoState";
+ }
+ }
+
+ ]]>
+ </fx:Script>
+ <s:states>
+ <s:State name="DemoState"/>
+ <s:State name="InfoState"/>
+ </s:states>
+ <fx:Declarations>
+ <s:MultiDPIBitmapSource id="aboutIcon"
+ source160dpi="@Embed('assets/icons/160/about.png')"
+ source240dpi="@Embed('assets/icons/240/about.png')"
+ source320dpi="@Embed('assets/icons/320/about.png')"
+ source480dpi="@Embed('assets/icons/480/about.png')"/>
+ <s:MultiDPIBitmapSource id="demoIcon"
+ source160dpi="@Embed('assets/icons/160/dock.png')"
+ source240dpi="@Embed('assets/icons/240/dock.png')"
+ source320dpi="@Embed('assets/icons/320/dock.png')"
+ source480dpi="@Embed('assets/icons/480/dock.png')"/>
+ </fx:Declarations>
+ <s:VGroup width="100%" height="100%" includeIn="DemoState" horizontalAlign="center" verticalAlign="middle">
+ <s:ActionBar id="actionBar" width="100%" >
+ <s:navigationContent>
+ <s:Button label="Back" click="actionBarButtonHandler(event)" />
+ <s:Button label="Next" click="actionBarButtonHandler(event)" />
+ </s:navigationContent>
+ <s:actionContent>
+ <s:Button label="Menu" click="actionBarButtonHandler(event)" />
+ <s:Button label="Save" click="actionBarButtonHandler(event)" />
+ </s:actionContent>
+ </s:ActionBar>
+ <s:Spacer height="10"/>
+ <s:Label id="label" horizontalCenter="0" textAlign="center"/>
+ </s:VGroup>
+ <s:TextArea includeIn="InfoState" selectable="false" left="10" right="10" top="10" bottom="10" editable="false" text="The ActionBar class defines a component that includes title, navigation, and action content groups. The ActionBar control provides a standard area for navigation and action controls. It lets you define global controls that can be used from anywhere in the application, or controls specific to a view.
+ The ActionBar control defines three distinct areas:
+ 
 
Navigation area
+ 
 
Contains components that let the user navigate the section. For example, you can define a home button in the navigation area. Use the navigationContent property to define the components that appear in the navigation area. Use the navigationLayout property to define the layout of the navigation area.
+ 
 
Title area
+ 
 
Contains either a String containing title text, or components. If you specify components, you cannot specify a title String. Use the title property to specify the String to appear in the title area. Use the titleContent property to define the components that appear in the title area. Use the titleLayout property to define the layout of the title area. If you specify a value for the titleContent property, the ActionBar skin ignores the title property.
+ 
 
Action area
+ 
 
Contains components that define actions the user can take in a view. For example, you might define a search or refresh button as part of the action area. Use the actionContent property to define the components that appear in the action area. Use the actionLayout property to define the layout of the action area."/>
+ <s:actionContent>
+ <s:Button click="buttonHandler(event)" icon.DemoState="{aboutIcon}" icon.InfoState="{demoIcon}"/>
+ </s:actionContent>
+</s:View>