Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TweetStation landscape composer support and settings. #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion TweetStation/Dialogs/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 ();
Expand Down Expand Up @@ -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" +
Expand Down
9 changes: 8 additions & 1 deletion TweetStation/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
37 changes: 36 additions & 1 deletion TweetStation/UI/Composer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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?
Expand Down
8 changes: 8 additions & 0 deletions TweetStation/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";
9 changes: 9 additions & 0 deletions TweetStation/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";