flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bigosma...@apache.org
Subject [16/47] git commit: [flex-sdk] [refs/heads/develop] - New Android 4.x specific HSliderSkin
Date Sun, 17 Aug 2014 08:24:15 GMT
New Android 4.x specific HSliderSkin


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/b7ba72ce
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/b7ba72ce
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/b7ba72ce

Branch: refs/heads/develop
Commit: b7ba72cea950839d6a31a991367b826d1d4c4b7a
Parents: 3ca6855
Author: Om <bigosmallm@gmail.com>
Authored: Mon Apr 14 17:49:11 2014 -0700
Committer: Om <bigosmallm@gmail.com>
Committed: Mon Apr 14 17:49:11 2014 -0700

----------------------------------------------------------------------
 frameworks/projects/mobiletheme/android4x.css   |   5 +
 .../src/spark/skins/android4/HSliderSkin.as     | 236 +++++++++++
 .../spark/skins/android4/HSliderThumbSkin.as    | 400 +++++++++++++++++++
 .../spark/skins/android4/HSliderTrackSkin.as    | 227 +++++++++++
 .../android4/assets/HSliderThumb_normal.fxg     |  34 ++
 .../android4/assets/HSliderThumb_pressed.fxg    |  39 ++
 .../skins/android4/assets/HSliderTrack.fxg      |  29 ++
 .../android4/assets/HSliderTrack_filled.fxg     |  29 ++
 8 files changed, 999 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b7ba72ce/frameworks/projects/mobiletheme/android4x.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/mobiletheme/android4x.css b/frameworks/projects/mobiletheme/android4x.css
index fee709c..80a55a0 100644
--- a/frameworks/projects/mobiletheme/android4x.css
+++ b/frameworks/projects/mobiletheme/android4x.css
@@ -106,6 +106,11 @@ CheckBox
 	chromeColor: #FFFFFF;
 }
 
+HSlider
+{
+    skinClass: ClassReference("spark.skins.android4.HSliderSkin");
+}
+
 RadioButton
 {
 	skinClass: ClassReference("spark.skins.android4.RadioButtonSkin");

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b7ba72ce/frameworks/projects/mobiletheme/src/spark/skins/android4/HSliderSkin.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mobiletheme/src/spark/skins/android4/HSliderSkin.as b/frameworks/projects/mobiletheme/src/spark/skins/android4/HSliderSkin.as
new file mode 100644
index 0000000..c07aef6
--- /dev/null
+++ b/frameworks/projects/mobiletheme/src/spark/skins/android4/HSliderSkin.as
@@ -0,0 +1,236 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 mx.core.ClassFactory;
+import mx.core.IFactory;
+
+import spark.components.Button;
+import spark.components.HSlider;
+import spark.skins.mobile.supportClasses.HSliderDataTip;
+import spark.skins.mobile.supportClasses.MobileSkin;
+
+/**
+ *  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;
+        dataTipClass = spark.skins.mobile.supportClasses.HSliderDataTip;
+        
+        blendMode = BlendMode.LAYER;
+    }
+    
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+    
+    /** 
+     *  @copy spark.skins.spark.ApplicationSkin#hostComponent
+     */
+    public var hostComponent:HSlider;
+    
+    //--------------------------------------------------------------------------
+    //
+    //  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 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 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);
+        
+        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);
+    }
+}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b7ba72ce/frameworks/projects/mobiletheme/src/spark/skins/android4/HSliderThumbSkin.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mobiletheme/src/spark/skins/android4/HSliderThumbSkin.as
b/frameworks/projects/mobiletheme/src/spark/skins/android4/HSliderThumbSkin.as
new file mode 100644
index 0000000..ae5309b
--- /dev/null
+++ b/frameworks/projects/mobiletheme/src/spark/skins/android4/HSliderThumbSkin.as
@@ -0,0 +1,400 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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;
+
+/**
+ *  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;
+				
+				// chromeColor ellipse goes up to the thumb border
+				chromeColorEllipseWidth = chromeColorEllipseHeight = 112;
+				chromeColorEllipseX = 1;
+				chromeColorEllipseY = 1;
+				
+				break;              
+			}
+			case DPIClassification.DPI_480:
+			{
+				// Note provisional may need changes
+				thumbImageWidth = 88;
+				thumbImageHeight = 88;
+				
+				hitZoneOffset = 20;
+				hitZoneSideLength = 130;
+				
+				// chromeColor ellipse goes up to the thumb border
+				chromeColorEllipseWidth = chromeColorEllipseHeight = 84; 
+				chromeColorEllipseX = chromeColorEllipseY = 1;
+				
+				break;
+			}
+            case DPIClassification.DPI_320:
+            {
+                thumbImageWidth = 58;
+                thumbImageHeight = 58;
+                
+                hitZoneOffset = 10;
+                hitZoneSideLength = 80;
+                
+                // chromeColor ellipse goes up to the thumb border
+                chromeColorEllipseWidth = chromeColorEllipseHeight = 56;
+                chromeColorEllipseX = 1;
+                chromeColorEllipseY = 1;
+                
+                break;              
+            }
+			case DPIClassification.DPI_240:
+			{
+				thumbImageWidth = 44;
+				thumbImageHeight = 44;
+				
+				hitZoneOffset = 10;
+				hitZoneSideLength = 65;
+				
+				// chromeColor ellipse goes up to the thumb border
+				chromeColorEllipseWidth = chromeColorEllipseHeight = 42; 
+				chromeColorEllipseX = chromeColorEllipseY = 1;
+				
+				break;
+			}
+			case DPIClassification.DPI_120:
+			{
+				thumbImageWidth = 22;
+				thumbImageHeight = 22;
+				
+				hitZoneOffset = 5;
+				hitZoneSideLength = 33;
+				
+				// chromeColor ellipse goes up to the thumb border
+				chromeColorEllipseWidth = chromeColorEllipseHeight = 21; 
+				chromeColorEllipseX = chromeColorEllipseY = 1;
+				
+				break;
+			}
+            default:
+            {
+                // default DPI_160
+                thumbImageWidth = 29;
+                thumbImageHeight = 29;
+                
+                hitZoneOffset = 5;
+                hitZoneSideLength = 40;
+                
+                // chromeColor ellipse goes up to the thumb border
+                chromeColorEllipseWidth = chromeColorEllipseHeight = 29;
+                chromeColorEllipseX = chromeColorEllipseY = 0;
+                
+                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;
+    
+    /**
+     *  Width of the chromeColor ellipse
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */    
+    protected var chromeColorEllipseWidth:int;
+    
+    /**
+     *  Height of the chromeColor ellipse
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */    
+    protected var chromeColorEllipseHeight:int;
+    
+    
+    /**
+     *  X position of the chromeColor ellipse
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */    
+    protected var chromeColorEllipseX:int;
+    
+    /**
+     *  Y position of the chromeColor ellipse
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */    
+    protected var chromeColorEllipseY: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-sdk/blob/b7ba72ce/frameworks/projects/mobiletheme/src/spark/skins/android4/HSliderTrackSkin.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mobiletheme/src/spark/skins/android4/HSliderTrackSkin.as
b/frameworks/projects/mobiletheme/src/spark/skins/android4/HSliderTrackSkin.as
new file mode 100644
index 0000000..d1cc29c
--- /dev/null
+++ b/frameworks/projects/mobiletheme/src/spark/skins/android4/HSliderTrackSkin.as
@@ -0,0 +1,227 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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
+		 */
+		protected 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-sdk/blob/b7ba72ce/frameworks/projects/mobiletheme/src/spark/skins/android4/assets/HSliderThumb_normal.fxg
----------------------------------------------------------------------
diff --git a/frameworks/projects/mobiletheme/src/spark/skins/android4/assets/HSliderThumb_normal.fxg
b/frameworks/projects/mobiletheme/src/spark/skins/android4/assets/HSliderThumb_normal.fxg
new file mode 100644
index 0000000..c046673
--- /dev/null
+++ b/frameworks/projects/mobiletheme/src/spark/skins/android4/assets/HSliderThumb_normal.fxg
@@ -0,0 +1,34 @@
+<?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.
+
+-->
+
+<Graphic version="2.0" xmlns="http://ns.adobe.com/fxg/2008">
+  <Group scaleGridLeft="6.75" scaleGridRight="20.25" scaleGridTop="20.25" scaleGridBottom="6.75">
+    <Path alpha="0.5" winding="nonZero" data="M27 13.5C27 20.9556 20.9561 27 13.5 27 6.04395
27 0 20.9556 0 13.5 0 6.04395 6.04395 0 13.5 0 20.9561 0 27 6.04395 27 13.5Z">
+      <fill>
+        <SolidColor color="#33B5E5"/>
+      </fill>
+    </Path>
+    <Path x="10.0049" y="10" winding="nonZero" data="M7 3.5C7 5.43262 5.43262 7 3.5 7
1.56738 7 0 5.43262 0 3.5 0 1.56689 1.56738 0 3.5 0 5.43262 0 7 1.56689 7 3.5Z">
+      <fill>
+        <SolidColor color="#33B5E5"/>
+      </fill>
+    </Path>
+  </Group>
+</Graphic>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b7ba72ce/frameworks/projects/mobiletheme/src/spark/skins/android4/assets/HSliderThumb_pressed.fxg
----------------------------------------------------------------------
diff --git a/frameworks/projects/mobiletheme/src/spark/skins/android4/assets/HSliderThumb_pressed.fxg
b/frameworks/projects/mobiletheme/src/spark/skins/android4/assets/HSliderThumb_pressed.fxg
new file mode 100644
index 0000000..416f795
--- /dev/null
+++ b/frameworks/projects/mobiletheme/src/spark/skins/android4/assets/HSliderThumb_pressed.fxg
@@ -0,0 +1,39 @@
+<?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.
+
+-->
+
+<Graphic version="2.0" xmlns="http://ns.adobe.com/fxg/2008">
+  <Group scaleGridLeft="7.75" scaleGridRight="23.25" scaleGridTop="23.25" scaleGridBottom="7.75">
+    <Path x="2" y="2" alpha="0.5" winding="nonZero" data="M27 13.5C27 20.9556 20.9561
27 13.5 27 6.04395 27 0 20.9556 0 13.5 0 6.04395 6.04395 0 13.5 0 20.9561 0 27 6.04395 27
13.5Z">
+      <fill>
+        <SolidColor color="#33B5E5"/>
+      </fill>
+    </Path>
+    <Path winding="nonZero" data="M15.5 2C22.9561 2 29 8.04395 29 15.5 29 22.9561 22.9561
29 15.5 29 8.04395 29 2 22.9561 2 15.5 2 8.04395 8.04395 2 15.5 2ZM15.5 0C6.95313 0 0 6.95313
0 15.5 0 24.0469 6.95313 31 15.5 31 24.0469 31 31 24.0469 31 15.5 31 6.95313 24.0469 0 15.5
0Z">
+      <fill>
+        <SolidColor color="#33B5E5"/>
+      </fill>
+    </Path>
+    <Path x="12.0049" y="12" winding="nonZero" data="M7 3.5C7 5.43262 5.43262 7 3.5 7
1.56738 7 0 5.43262 0 3.5 0 1.56689 1.56738 0 3.5 0 5.43262 0 7 1.56689 7 3.5Z">
+      <fill>
+        <SolidColor color="#33B5E5"/>
+      </fill>
+    </Path>
+  </Group>
+</Graphic>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b7ba72ce/frameworks/projects/mobiletheme/src/spark/skins/android4/assets/HSliderTrack.fxg
----------------------------------------------------------------------
diff --git a/frameworks/projects/mobiletheme/src/spark/skins/android4/assets/HSliderTrack.fxg
b/frameworks/projects/mobiletheme/src/spark/skins/android4/assets/HSliderTrack.fxg
new file mode 100644
index 0000000..ee464e0
--- /dev/null
+++ b/frameworks/projects/mobiletheme/src/spark/skins/android4/assets/HSliderTrack.fxg
@@ -0,0 +1,29 @@
+<?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.
+
+-->
+
+<Graphic version="2.0" xmlns="http://ns.adobe.com/fxg/2008">
+  <Group scaleGridLeft="82" scaleGridRight="246" scaleGridTop="1.5" scaleGridBottom="0.5">
+    <Path winding="nonZero" data="M328 2 0 2 0 0 328 0 328 2Z">
+      <fill>
+        <SolidColor color="#A6A6A6"/>
+      </fill>
+    </Path>
+  </Group>
+</Graphic>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b7ba72ce/frameworks/projects/mobiletheme/src/spark/skins/android4/assets/HSliderTrack_filled.fxg
----------------------------------------------------------------------
diff --git a/frameworks/projects/mobiletheme/src/spark/skins/android4/assets/HSliderTrack_filled.fxg
b/frameworks/projects/mobiletheme/src/spark/skins/android4/assets/HSliderTrack_filled.fxg
new file mode 100644
index 0000000..c4d4f74
--- /dev/null
+++ b/frameworks/projects/mobiletheme/src/spark/skins/android4/assets/HSliderTrack_filled.fxg
@@ -0,0 +1,29 @@
+<?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.
+
+-->
+
+<Graphic version="2.0" xmlns="http://ns.adobe.com/fxg/2008">
+  <Group scaleGridLeft="82" scaleGridRight="246" scaleGridTop="1.5" scaleGridBottom="0.5">
+    <Path winding="nonZero" data="M328 2 0 2 0 0 328 0 328 2Z">
+      <fill>
+        <SolidColor color="#33B5E5"/>
+      </fill>
+    </Path>
+  </Group>
+</Graphic>
\ No newline at end of file


Mime
View raw message