diff options
author | Deepanshu Gupta <deepanshu@google.com> | 2013-07-19 13:42:34 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-07-19 13:42:34 -0700 |
commit | 903709d738a92de467e22f3923d2a7e4e92e9148 (patch) | |
tree | c6603ea2b503805f714edf9be9f4a01ddb4c7d17 /tools/layoutlib | |
parent | 796feda0f0c54729a40852d8d4d48be0b934afb6 (diff) | |
parent | 388f85eb451bd0b61c8f48b500de5db6bca941f1 (diff) | |
download | frameworks_base-903709d738a92de467e22f3923d2a7e4e92e9148.zip frameworks_base-903709d738a92de467e22f3923d2a7e4e92e9148.tar.gz frameworks_base-903709d738a92de467e22f3923d2a7e4e92e9148.tar.bz2 |
am 388f85eb: am a2f41b23: am bf8be2ee: Merge "Add orientation to configuration for layoutlib." into jb-mr2-dev
* commit '388f85eb451bd0b61c8f48b500de5db6bca941f1':
Add orientation to configuration for layoutlib.
Diffstat (limited to 'tools/layoutlib')
-rw-r--r-- | tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java | 18 |
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 cbefd3d..b909bec 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; @@ -347,6 +348,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; |