"Auto-detecting Device Orientation Whilst Allowing User to Override" for GameDevAlgorithms.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| protected void onResume() { | |
| super.onResume(); | |
| //noinspection ResourceType | |
| setRequestedOrientation(Setting.get(Enums.Setting.Orientation).getIntValue()); | |
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public final static int ORIENTATION_AUTO = 4; | |
| public final static int ORIENTATION_LANDSCAPE = 6; | |
| public final static int ORIENTATION_PORTRAIT = 7; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private int getOrientationValue(int position) { | |
| switch (position) { | |
| case 1: return Constants.ORIENTATION_LANDSCAPE; | |
| case 2: return Constants.ORIENTATION_PORTRAIT; | |
| default: return Constants.ORIENTATION_AUTO; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment