OSDN Git Service

Merge 3586fef5 from master. do not merge.
authorXavier Ducrohet <xav@android.com>
Thu, 19 May 2011 18:29:32 +0000 (11:29 -0700)
committerXavier Ducrohet <xav@android.com>
Thu, 19 May 2011 18:45:18 +0000 (11:45 -0700)
Add method to LayoutLibrary to query layoutlib api level and rev.

Change-Id: Ib34251b690c18167f69a5b389fcabddbf8bb0aa1

ide_common/src/com/android/ide/common/rendering/LayoutLibrary.java

index dd1a3dc..3d1c5db 100644 (file)
@@ -219,6 +219,33 @@ public class LayoutLibrary {
     // ------ Layout Lib API proxy
 
     /**
+     * Returns the API level of the layout library.
+     */
+    public int getApiLevel() {
+        if (mBridge != null) {
+            return mBridge.getApiLevel();
+        }
+
+        if (mLegacyBridge != null) {
+            return getLegacyApiLevel();
+        }
+
+        return 0;
+    }
+
+    /**
+     * Returns the revision of the library inside a given (layoutlib) API level.
+     * The true version number of the library is {@link #getApiLevel()}.{@link #getRevision()}
+     */
+    public int getRevision() {
+        if (mBridge != null) {
+            return mBridge.getRevision();
+        }
+
+        return 0;
+    }
+
+    /**
      * Returns whether the LayoutLibrary supports a given {@link Capability}.
      * @return true if it supports it.
      *