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/04/09 21:20:55 UTC

git commit: [flex-sdk] [refs/heads/new_android_skins] - Added measure() method so that the component knows its size

Repository: flex-sdk
Updated Branches:
  refs/heads/new_android_skins 67bcdc288 -> 18a5b5635


Added measure() method so that the component knows its size


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

Branch: refs/heads/new_android_skins
Commit: 18a5b5635477aadd4f994918ae86adba956042b4
Parents: 67bcdc2
Author: Om <bi...@gmail.com>
Authored: Wed Apr 9 12:18:52 2014 -0700
Committer: Om <bi...@gmail.com>
Committed: Wed Apr 9 12:18:52 2014 -0700

----------------------------------------------------------------------
 .../src/spark/skins/android4/ToggleSwitchSkin.as        | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/18a5b563/frameworks/projects/mobiletheme/src/spark/skins/android4/ToggleSwitchSkin.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mobiletheme/src/spark/skins/android4/ToggleSwitchSkin.as b/frameworks/projects/mobiletheme/src/spark/skins/android4/ToggleSwitchSkin.as
index 070481d..c5b99aa 100644
--- a/frameworks/projects/mobiletheme/src/spark/skins/android4/ToggleSwitchSkin.as
+++ b/frameworks/projects/mobiletheme/src/spark/skins/android4/ToggleSwitchSkin.as
@@ -233,6 +233,18 @@ package spark.skins.android4
 			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();