Take device orientation into account when switching UI layout.

PS2:
Use device rotation value to determine correct orientation.

Change-Id: If19d41727fd6a667a79c71f363b564cd2b6e1d49