Skip to content
This repository was archived by the owner on Jul 2, 2022. It is now read-only.

Commit 5c85550

Browse files
committed
More features for larger fonts
1 parent 9d9e7f8 commit 5c85550

15 files changed

Lines changed: 72 additions & 47 deletions

File tree

CodeHub.Core/CodeHub.Core.iOS.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@
156156
<Project>{89E14828-85BB-4790-9B4E-E44DD4CE000E}</Project>
157157
<Name>GitHubSharp.MonoTouch</Name>
158158
</ProjectReference>
159+
<ProjectReference Include="..\lib\CodeFramework\CodeFramework.iOS\CodeFramework.iOS.csproj">
160+
<Project>{2698B412-26A3-4269-AA01-AC3BC79A0F14}</Project>
161+
<Name>CodeFramework.iOS</Name>
162+
</ProjectReference>
159163
</ItemGroup>
160164
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
161165
<ItemGroup />

CodeHub.Core/ViewModels/App/SettingsViewModel.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ namespace CodeHub.Core.ViewModels.App
1212
public class SettingsViewModel : BaseViewModel
1313
{
1414
private readonly IFeaturesService _featuresService;
15+
private readonly IDefaultValueService _defaultValueService;
1516

16-
public SettingsViewModel(IFeaturesService featuresService)
17+
public SettingsViewModel(IFeaturesService featuresService, IDefaultValueService defaultValueService)
1718
{
1819
_featuresService = featuresService;
20+
_defaultValueService = defaultValueService;
1921
}
2022

2123
public string DefaultStartupViewName
@@ -56,6 +58,12 @@ public bool AnalyticsEnabled
5658
}
5759
}
5860

61+
public bool LargeFonts
62+
{
63+
get { return _defaultValueService.Get<bool>("large_fonts"); }
64+
set { _defaultValueService.Set("large_fonts", value); }
65+
}
66+
5967
public bool PushNotificationsActivated
6068
{
6169
get { return _featuresService.IsPushNotificationsActivated; }

CodeHub.iOS/AppDelegate.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,13 @@ public override bool FinishedLaunching(UIApplication app, NSDictionary options)
6060
iRate.AppStoreID = 707173885;
6161

6262
this.window = new UIWindow(UIScreen.MainScreen.Bounds);
63-
64-
// Setup theme
65-
Theme.Setup();
66-
6763
var presenter = new TouchViewPresenter(this.window);
68-
6964
var setup = new Setup(this, presenter);
7065
setup.Initialize();
7166

67+
// Setup theme
68+
Theme.Setup();
69+
7270
Mvx.Resolve<CodeFramework.Core.Services.IAnalyticsService>().Init("YDPn28UeAWRt5dTlrd2IhIc3zW4atsiSPScqWmGI", "eDfhufHi88Az1IQkMsIR2o8j5Jmqjmc7FhyQradc");
7371

7472
if (options != null)

CodeHub.iOS/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<key>CFBundleIdentifier</key>
2222
<string>com.dillonbuchanan.codehub</string>
2323
<key>CFBundleShortVersionString</key>
24-
<string>2.2.0</string>
24+
<string>2.2.1</string>
2525
<key>CFBundleIconFiles</key>
2626
<array>
2727
<string>Icon-Small-50</string>
@@ -68,6 +68,6 @@
6868
</dict>
6969
</array>
7070
<key>CFBundleVersion</key>
71-
<string>2.2.0</string>
71+
<string>2.2.1</string>
7272
</dict>
7373
</plist>

CodeHub.iOS/Theme.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@ namespace CodeHub.iOS
66
{
77
public class Theme : ICodeFrameworkTheme
88
{
9-
public static Theme CurrentTheme { get; private set; }
9+
public static Theme CurrentTheme { get; private set; }
1010

1111
public static void Setup()
1212
{
1313
var theme = new Theme();
1414
CurrentTheme = theme;
1515
CodeFramework.iOS.Theme.CurrentTheme = theme;
16+
17+
var defaultValues = Cirrious.CrossCore.Mvx.Resolve<CodeFramework.Core.Services.IDefaultValueService>();
18+
Theme.CurrentTheme.FontSizeRatio = defaultValues.Get<bool>("large_fonts") ? 1.3f : 1.0f;
19+
1620
RepositoryCellView.RoundImages = false;
17-
MonoTouch.Dialog.StyledStringElement.DefaultTitleFont = UIFont.SystemFontOfSize(15f);
1821
MonoTouch.Dialog.NameTimeStringElement.NameColor = Theme.CurrentTheme.MainTitleColor;
22+
MonoTouch.Dialog.Element.FontSizeRatio = Theme.CurrentTheme.FontSizeRatio;
1923

2024
UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;
2125
UINavigationBar.Appearance.TintColor = UIColor.White;
@@ -34,7 +38,7 @@ public static void Setup()
3438
UISegmentedControl.Appearance.TintColor = UIColor.FromRGB(110, 110, 117);
3539
UITableViewHeaderFooterView.Appearance.TintColor = UIColor.FromRGB(228, 228, 228);
3640
UILabel.AppearanceWhenContainedIn(typeof(UITableViewHeaderFooterView)).TextColor = UIColor.FromRGB(136, 136, 136);
37-
UILabel.AppearanceWhenContainedIn(typeof(UITableViewHeaderFooterView)).Font = UIFont.SystemFontOfSize(13f);
41+
UILabel.AppearanceWhenContainedIn(typeof(UITableViewHeaderFooterView)).Font = UIFont.SystemFontOfSize(13f * Theme.CurrentTheme.FontSizeRatio);
3842

3943
UIToolbar.Appearance.BarTintColor = UIColor.FromRGB(245, 245, 245);
4044

@@ -43,15 +47,15 @@ public static void Setup()
4347
// CodeFramework.Elements.NewsFeedElement.LinkColor = theme.MainTitleColor;
4448
// CodeFramework.Elements.NewsFeedElement.TextColor = theme.MainTextColor;
4549
// CodeFramework.Elements.NewsFeedElement.NameColor = theme.MainTitleColor;
46-
}
50+
}
4751

4852
public UITextAttributes SegmentedControlText
4953
{
5054
get
5155
{
5256
return new UITextAttributes
5357
{
54-
Font = UIFont.SystemFontOfSize(14f),
58+
Font = UIFont.SystemFontOfSize(14f * Theme.CurrentTheme.FontSizeRatio),
5559
TextColor = UIColor.FromRGB(87, 85, 85),
5660
TextShadowColor = UIColor.FromRGBA(255, 255, 255, 125),
5761
TextShadowOffset = new UIOffset(0, 1)
@@ -149,5 +153,7 @@ public UIColor ApplicationNavigationBarTint
149153
return UIColor.Black;
150154
}
151155
}
156+
157+
public float FontSizeRatio { get; set; }
152158
}
153159
}

CodeHub.iOS/UrlRouterProvider.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public static class UrlRouteProvider
2020
new Route("^[^/]*/(?<Username>[^/]*)/(?<Repository>[^/]*)/pulls/$", typeof(CodeHub.Core.ViewModels.PullRequests.PullRequestsViewModel)),
2121
new Route("^[^/]*/(?<Username>[^/]*)/(?<Repository>[^/]*)/pull/(?<Id>[^/]*)/$", typeof(CodeHub.Core.ViewModels.PullRequests.PullRequestViewModel)),
2222
new Route("^[^/]*/(?<Username>[^/]*)/(?<Repository>[^/]*)/issues/$", typeof(CodeHub.Core.ViewModels.Issues.IssuesViewModel)),
23+
new Route("^[^/]*/(?<Username>[^/]*)/(?<Repository>[^/]*)/commits/$", typeof(CodeHub.Core.ViewModels.CommitsViewModel)),
24+
new Route("^[^/]*/(?<Username>[^/]*)/(?<Repository>[^/]*)/commits/(?<Node>[^/]*)/$", typeof(CodeHub.Core.ViewModels.ChangesetViewModel)),
2325
new Route("^[^/]*/(?<Username>[^/]*)/(?<Repository>[^/]*)/issues/(?<Id>[^/]*)/$", typeof(CodeHub.Core.ViewModels.Issues.IssueViewModel)),
2426
new Route("^[^/]*/(?<Username>[^/]*)/(?<Repository>[^/]*)/tree/(?<Branch>[^/]*)/(?<Path>.*)$", typeof(CodeHub.Core.ViewModels.Source.SourceTreeViewModel)),
2527
};

CodeHub.iOS/Views/App/SettingsView.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ private void CreateTable()
7272
};
7373
startupView.Tapped += () => vm.GoToDefaultStartupViewCommand.Execute(null);
7474

75+
var largeFonts = new TrueFalseElement("Large Fonts", vm.LargeFonts, x =>
76+
{
77+
vm.LargeFonts = x.Value;
78+
Theme.Setup();
79+
CreateTable();
80+
});
81+
7582
if (vm.PushNotificationsActivated)
7683
accountSection.Add(new TrueFalseElement("Push Notifications".t(), vm.PushNotificationsEnabled, e => vm.PushNotificationsEnabled = e.Value));
7784

@@ -89,7 +96,7 @@ private void CreateTable()
8996
//Assign the root
9097
var root = new RootElement(Title);
9198
root.Add(accountSection);
92-
root.Add(new Section("Appearance") { showOrganizationsInEvents, showOrganizations, repoDescriptions, startupView });
99+
root.Add(new Section("Appearance") { showOrganizationsInEvents, showOrganizations, repoDescriptions, startupView, largeFonts });
93100
root.Add(new Section ("Internal") { deleteCache, usage });
94101
Root = root;
95102

CodeHub.iOS/Views/Issues/IssueAddView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public override void ViewDidLoad()
4545
var content = new MultilinedElement("Description");
4646
content.Tapped += () =>
4747
{
48-
var composer = new Composer { Title = "Issue Description", Text = content.Value, ActionButtonText = "Save" };
48+
var composer = new Composer { Title = "Issue Description", Text = content.Value };
4949
composer.NewComment(this, (text) => {
5050
vm.Content = text;
5151
composer.CloseComposer();

CodeHub.iOS/Views/Issues/IssueEditView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public override void ViewDidLoad()
4545
var content = new MultilinedElement("Description");
4646
content.Tapped += () =>
4747
{
48-
var composer = new Composer { Title = "Issue Description", Text = content.Value, ActionButtonText = "Save" };
48+
var composer = new Composer { Title = "Issue Description", Text = content.Value };
4949
composer.NewComment(this, (text) => {
5050
vm.Content = text;
5151
composer.CloseComposer();

CodeHub.iOS/Views/NotificationsView.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public MarkReadSection(string text, NotificationsView parent, bool button)
8282
{
8383
_parent = parent;
8484
TextLabel.Text = text;
85+
TextLabel.Font = TextLabel.Font.WithSize(TextLabel.Font.PointSize * Theme.CurrentTheme.FontSizeRatio);
8586

8687
if (button)
8788
{

0 commit comments

Comments
 (0)