diff --git a/TweetStation/Dialogs/Settings.cs b/TweetStation/Dialogs/Settings.cs index 90200ed..c3f34d2 100644 --- a/TweetStation/Dialogs/Settings.cs +++ b/TweetStation/Dialogs/Settings.cs @@ -118,7 +118,7 @@ public override void ViewWillAppear (bool animated) SetupLeftItemEdit (); } - BooleanElement playMusic, chicken, selfOnRight, shadows, autoFav; + BooleanElement playMusic, chicken, selfOnRight, shadows, autoFav, rotateTimeline, rotateComposer; RootElement compress; public override void ViewWillDisappear (bool animated) @@ -136,6 +136,9 @@ public override void ViewWillDisappear (bool animated) BaseTimelineViewController.ChickenNoisesEnabled = chicken.Value; Util.Defaults.SetInt (compress.RadioSelected, "sizeCompression"); + Util.Defaults.SetInt (rotateTimeline.Value ? 0 : 1, "disableRotateTimeline"); + Util.Defaults.SetInt (rotateComposer.Value ? 0 : 1, "disableRotateComposer"); + Util.Defaults.Synchronize (); parent.ReloadData (); @@ -163,6 +166,12 @@ public Settings (DialogViewController parent) : base (UITableViewStyle.Grouped, } }) }, + + new Section (Locale.GetText ("Auto Rotate")){ + (rotateTimeline = new BooleanElement (Locale.GetText ("Timeline"), Util.Defaults.IntForKey ("disableRotateTimeline") == 0)), + (rotateComposer = new BooleanElement (Locale.GetText ("Compose Screen"), Util.Defaults.IntForKey ("disableRotateComposer") == 0)) + }, + new Section (Locale.GetText ("Inspiration"), Locale.GetText ("Twitter is best used when you are\n" + "inspired. I picked music and audio\n" + diff --git a/TweetStation/Main.cs b/TweetStation/Main.cs index 0a72685..ce76b01 100644 --- a/TweetStation/Main.cs +++ b/TweetStation/Main.cs @@ -431,7 +431,14 @@ public RotatingTabBar () : base () public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation) { - return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown); + if (Util.Defaults.IntForKey ("disableRotateTimeline") == 0) + { + return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown); + } + else + { + return (toInterfaceOrientation == UIInterfaceOrientation.Portrait); + } } void UpdatePosition (bool animate) diff --git a/TweetStation/UI/Composer.cs b/TweetStation/UI/Composer.cs index 0ad1040..c021e65 100644 --- a/TweetStation/UI/Composer.cs +++ b/TweetStation/UI/Composer.cs @@ -84,7 +84,7 @@ public ComposerView (RectangleF bounds, Composer composer, EventHandler cameraTa AddSubview (textView); AddSubview (charsLeft); } - + void HandleTextViewChanged (object sender, EventArgs e) { string text = textView.Text; @@ -568,6 +568,41 @@ public void Direct (UIViewController parent, string username) Activate (parent); } + + public override void WillRotate (UIInterfaceOrientation toInterfaceOrientation, double duration) + { + if (Util.Defaults.IntForKey ("disableRotateComposer") == 0) + { + int width = (int)UIScreen.MainScreen.Bounds.Width; + if (toInterfaceOrientation == UIInterfaceOrientation.LandscapeLeft + || toInterfaceOrientation == UIInterfaceOrientation.LandscapeRight) + { + width = (int)UIScreen.MainScreen.Bounds.Height; + } + + navigationBar.Frame = new RectangleF(0, 0, width, 44); + } + base.WillRotate (toInterfaceOrientation, duration); + } + + public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation) + { + if (Util.Defaults.IntForKey ("disableRotateComposer") == 0) + { + switch (toInterfaceOrientation) + { + case UIInterfaceOrientation.LandscapeLeft: + return true; + case UIInterfaceOrientation.LandscapeRight: + return true; + case UIInterfaceOrientation.Portrait: + return true; + case UIInterfaceOrientation.PortraitUpsideDown: + return false; + } + } + return false; + } } // Does anyone really use drafts? diff --git a/TweetStation/en.lproj/Localizable.strings b/TweetStation/en.lproj/Localizable.strings index 27f92ca..b70bf96 100644 --- a/TweetStation/en.lproj/Localizable.strings +++ b/TweetStation/en.lproj/Localizable.strings @@ -372,3 +372,11 @@ /* TweetStation.AppDelegate.NewAccountXAuth() */ "Your twitter username" = "Your twitter username"; +* TweetStation.Settings..ctor() */ +"Auto Rotate" = "Auto Rotate"; + +* TweetStation.Settings..ctor() */ +"Timeline" = "Timeline"; + +* TweetStation.Settings..ctor() */ +"Compose Screen" = "Compose Screen"; \ No newline at end of file diff --git a/TweetStation/es.lproj/Localizable.strings b/TweetStation/es.lproj/Localizable.strings index 181ee03..419ee16 100644 --- a/TweetStation/es.lproj/Localizable.strings +++ b/TweetStation/es.lproj/Localizable.strings @@ -374,3 +374,12 @@ /* TweetStation.UserSelector.MakeMirror() */ /* Flag: unmatched */ "@{0}" = "@{0}"; + +* TweetStation.Settings..ctor() */ +"Auto Rotate" = "Rotación automática"; + +* TweetStation.Settings..ctor() */ +"Timeline" = "Línea de tiempo"; + +* TweetStation.Settings..ctor() */ +"Compose Screen" = "Componen la pantalla"; \ No newline at end of file