flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mamsel...@apache.org
Subject [1/2] git commit: [flex-sdk] [refs/heads/develop] - INPROGRESS - FLEX-33949 Manage OS version in @media CSS implemented for iOS and desktop OS TODO: Android version from system/build.prop
Date Sun, 01 Dec 2013 16:33:53 GMT
Updated Branches:
  refs/heads/develop 2e0f18ca0 -> 66b542611


INPROGRESS - FLEX-33949 Manage OS version in @media CSS
implemented for iOS and desktop OS
TODO:  Android version from system/build.prop


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

Branch: refs/heads/develop
Commit: e82b45047ab0a61ae9ca47169ccffb04169db210
Parents: 2e0f18c
Author: mamsellem <maurice.amsellem@systar.com>
Authored: Sun Dec 1 17:21:49 2013 +0100
Committer: mamsellem <maurice.amsellem@systar.com>
Committed: Sun Dec 1 17:21:49 2013 +0100

----------------------------------------------------------------------
 .../framework/src/mx/utils/MediaQueryParser.as  | 28 +++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/e82b4504/frameworks/projects/framework/src/mx/utils/MediaQueryParser.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/src/mx/utils/MediaQueryParser.as b/frameworks/projects/framework/src/mx/utils/MediaQueryParser.as
index d670281..4e54140 100644
--- a/frameworks/projects/framework/src/mx/utils/MediaQueryParser.as
+++ b/frameworks/projects/framework/src/mx/utils/MediaQueryParser.as
@@ -103,6 +103,7 @@ public class MediaQueryParser
                 applicationDpi = moduleFactory.info()["applicationDPI"];
         }
         osPlatform = getPlatform();
+        osVersion = getOSVersion(osPlatform);
     }
     
     /**
@@ -407,7 +408,29 @@ public class MediaQueryParser
         // expression
         return s.toLowerCase();
     }
-    
+
+    /** @private
+     * extract OS version information from os
+     * os is typically a non-numeric string (such as Windows,  iPhone OS, Android, etc...)
 followed by a number.
+     * if no number is found, OS version is set to 0.
+     * os on ADL will return the host OS and not the device OS.
+     * That why we need to check for a specific sequence for iOS and Android
+     * */
+    private function getOSVersion(osPlatform: String ):Number {
+
+        //TODO (mamsellem)  retrieve  os version for Android, reading  system/build.prop
+
+        var os: String = Capabilities.os;
+        var osMatch: Array;
+        if (osPlatform == "ios"){
+            osMatch = os.match(/iPhone OS\s([\d\.]+)/);
+        }
+        else {
+            osMatch = os.match(/[A-Za-z\s]+([\d\.]+)/);
+        }
+       return osMatch ? Number(osMatch [1]) : 0.0;
+    }
+
     // the type of the media
     public var type:String = "screen";
     
@@ -416,6 +439,9 @@ public class MediaQueryParser
     
     // the platform of the media
     public var osPlatform:String;
+
+    // the platform os version of the media
+    public var osVersion: Number;
     
 }
 


Mime
View raw message