diff options
author | Kenny Root <kenny@the-b.org> | 2009-06-14 05:11:33 +0000 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2009-06-14 05:11:33 +0000 |
commit | 124883868a152f91efdc7472faf2e36434f882aa (patch) | |
tree | 77f40b50cb75f35336f4d6a59715b2be07cceb77 /src | |
parent | 6adc671bfe47cd07340fc67f2b73d957773c1b90 (diff) | |
download | connectbot-124883868a152f91efdc7472faf2e36434f882aa.tar.gz connectbot-124883868a152f91efdc7472faf2e36434f882aa.tar.bz2 connectbot-124883868a152f91efdc7472faf2e36434f882aa.zip |
More lock screen checks for automatic rotation
git-svn-id: https://connectbot.googlecode.com/svn/trunk/connectbot@292 df292f66-193f-0410-a5fc-6d59da041ff2
Diffstat (limited to 'src')
-rw-r--r-- | src/org/connectbot/ConsoleActivity.java | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/org/connectbot/ConsoleActivity.java b/src/org/connectbot/ConsoleActivity.java index dae0c52..daf8046 100644 --- a/src/org/connectbot/ConsoleActivity.java +++ b/src/org/connectbot/ConsoleActivity.java @@ -105,6 +105,8 @@ public class ConsoleActivity extends Activity { protected TerminalBridge copySource = null; private int lastTouchRow, lastTouchCol; + private boolean forcedOrientation; + private ServiceConnection connection = new ServiceConnection() { public void onServiceConnected(ComponentName className, IBinder service) { bound = ((TerminalManager.TerminalBinder) service).getService(); @@ -556,12 +558,16 @@ public class ConsoleActivity extends Activity { rotate = rotateDefault; // request a forced orientation if requested by user - if (PreferenceConstants.ROTATION_LANDSCAPE.equals(rotate)) + if (PreferenceConstants.ROTATION_LANDSCAPE.equals(rotate)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); - else if (PreferenceConstants.ROTATION_PORTRAIT.equals(rotate)) + forcedOrientation = true; + } else if (PreferenceConstants.ROTATION_PORTRAIT.equals(rotate)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); - else + forcedOrientation = true; + } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); + forcedOrientation = false; + } } @@ -734,7 +740,7 @@ public class ConsoleActivity extends Activity { super.onPause(); Log.d(TAG, "onPause called"); - if (bound != null) + if (forcedOrientation && bound != null) bound.setResizeAllowed(false); } @@ -745,7 +751,7 @@ public class ConsoleActivity extends Activity { configureOrientation(); - if (bound != null) + if (forcedOrientation && bound != null) bound.setResizeAllowed(true); } @@ -882,9 +888,10 @@ public class ConsoleActivity extends Activity { Log.d(TAG, String.format("onConfigurationChanged; requestedOrientation=%d, newConfig.orientation=%d", getRequestedOrientation(), newConfig.orientation)); if (bound != null) { - if ((newConfig.orientation != Configuration.ORIENTATION_LANDSCAPE && + if (forcedOrientation && + (newConfig.orientation != Configuration.ORIENTATION_LANDSCAPE && getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) || - (newConfig.orientation != Configuration.ORIENTATION_PORTRAIT && + (newConfig.orientation != Configuration.ORIENTATION_PORTRAIT && getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)) bound.setResizeAllowed(false); else |