Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

TweetStation landscape composer support and settings. #12

Open
wants to merge 1 commit into from

1 participant

@kellabyte

Added landscape support and settings to facilitate enabling/disabling rotation on timeline and composer views. Also added resource strings.

Sorry this took so long to complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 12, 2011
  1. @kellabyte

    Added landscape support and settings to facilitate enabling/disabling…

    kellabyte authored
    … rotation on timeline and composer views.
This page is out of date. Refresh to see the latest.
View
11 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" +
View
9 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)
View
37 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?
View
8 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";
View
9 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";
Something went wrong with that request. Please try again.