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:34 UTC
[2/6] git commit: [flex-examples] [refs/heads/develop] - Remove
redundant Android skins (it now comes with the 4.14 SDK)
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();
- }
-
- }
-}