summaryrefslogtreecommitdiffstats
path: root/tools/layoutlib
diff options
context:
space:
mode:
authorDeepanshu Gupta <deepanshu@google.com>2014-05-13 01:52:15 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-13 01:52:15 +0000
commitedae4e69512a7c9df1076fde70de83e15053a30a (patch)
treef49af95f48fa15922f072db754ebe291b3e05559 /tools/layoutlib
parent3ecaa88d83d04a0fd55b494829badbb41016f5a1 (diff)
parent8a39c3afb29f2540b05319042e758dd4d5f73a1e (diff)
downloadframeworks_base-edae4e69512a7c9df1076fde70de83e15053a30a.zip
frameworks_base-edae4e69512a7c9df1076fde70de83e15053a30a.tar.gz
frameworks_base-edae4e69512a7c9df1076fde70de83e15053a30a.tar.bz2
am 8a39c3af: Add orientation to configuration for layoutlib. [DO NOT MERGE]
* commit '8a39c3afb29f2540b05319042e758dd4d5f73a1e': Add orientation to configuration for layoutlib. [DO NOT MERGE]
Diffstat (limited to 'tools/layoutlib')
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
index 1db7994..b20f190 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
@@ -30,6 +30,7 @@ import com.android.layoutlib.bridge.Bridge;
import com.android.layoutlib.bridge.android.BridgeContext;
import com.android.resources.Density;
import com.android.resources.ResourceType;
+import com.android.resources.ScreenOrientation;
import com.android.resources.ScreenSize;
import android.content.res.Configuration;
@@ -345,6 +346,23 @@ public abstract class RenderAction<T extends RenderParams> extends FrameworkReso
config.compatScreenWidthDp = config.screenWidthDp;
config.compatScreenHeightDp = config.screenHeightDp;
+ ScreenOrientation orientation = hardwareConfig.getOrientation();
+ if (orientation != null) {
+ switch (orientation) {
+ case PORTRAIT:
+ config.orientation = Configuration.ORIENTATION_PORTRAIT;
+ break;
+ case LANDSCAPE:
+ config.orientation = Configuration.ORIENTATION_LANDSCAPE;
+ break;
+ case SQUARE:
+ config.orientation = Configuration.ORIENTATION_SQUARE;
+ break;
+ }
+ } else {
+ config.orientation = Configuration.ORIENTATION_UNDEFINED;
+ }
+
// TODO: fill in more config info.
return config;