mirror of
https://github.com/bitwarden/mobile
synced 2025-12-22 19:23:58 +00:00
ios app extension theming
This commit is contained in:
27
src/iOS.Core/Controllers/ExtendedUITableViewCell.cs
Normal file
27
src/iOS.Core/Controllers/ExtendedUITableViewCell.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using UIKit;
|
||||
|
||||
namespace Bit.iOS.Core.Controllers
|
||||
{
|
||||
public class ExtendedUITableViewCell : UITableViewCell
|
||||
{
|
||||
public ExtendedUITableViewCell()
|
||||
{
|
||||
BackgroundColor = ThemeHelpers.BackgroundColor;
|
||||
if(!ThemeHelpers.LightTheme)
|
||||
{
|
||||
SelectionStyle = UITableViewCellSelectionStyle.None;
|
||||
}
|
||||
}
|
||||
|
||||
public ExtendedUITableViewCell(UITableViewCellStyle style, string reusedId)
|
||||
: base(style, reusedId)
|
||||
{
|
||||
BackgroundColor = ThemeHelpers.BackgroundColor;
|
||||
if(!ThemeHelpers.LightTheme)
|
||||
{
|
||||
SelectionStyle = UITableViewCellSelectionStyle.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using System;
|
||||
using UIKit;
|
||||
|
||||
@@ -8,5 +9,36 @@ namespace Bit.iOS.Core.Controllers
|
||||
public ExtendedUITableViewController(IntPtr handle)
|
||||
: base(handle)
|
||||
{ }
|
||||
|
||||
public override void ViewWillAppear(bool animated)
|
||||
{
|
||||
UINavigationBar.Appearance.ShadowImage = new UIImage();
|
||||
UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
|
||||
base.ViewWillAppear(animated);
|
||||
}
|
||||
|
||||
public override void ViewDidLoad()
|
||||
{
|
||||
base.ViewDidLoad();
|
||||
if(View != null)
|
||||
{
|
||||
View.BackgroundColor = ThemeHelpers.BackgroundColor;
|
||||
}
|
||||
if(TableView != null)
|
||||
{
|
||||
TableView.BackgroundColor = ThemeHelpers.BackgroundColor;
|
||||
TableView.SeparatorColor = ThemeHelpers.SeparatorColor;
|
||||
}
|
||||
if(NavigationController?.NavigationBar != null)
|
||||
{
|
||||
NavigationController.NavigationBar.BarTintColor = ThemeHelpers.NavBarBackgroundColor;
|
||||
NavigationController.NavigationBar.BackgroundColor = ThemeHelpers.NavBarBackgroundColor;
|
||||
NavigationController.NavigationBar.TintColor = ThemeHelpers.NavBarTextColor;
|
||||
NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes
|
||||
{
|
||||
ForegroundColor = ThemeHelpers.NavBarTextColor
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
25
src/iOS.Core/Controllers/ExtendedUITableViewSource.cs
Normal file
25
src/iOS.Core/Controllers/ExtendedUITableViewSource.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using System;
|
||||
using UIKit;
|
||||
|
||||
namespace Bit.iOS.Core.Views
|
||||
{
|
||||
public abstract class ExtendedUITableViewSource : UITableViewSource
|
||||
{
|
||||
public override void WillDisplayHeaderView(UITableView tableView, UIView headerView, nint section)
|
||||
{
|
||||
if(headerView != null && headerView is UITableViewHeaderFooterView hv && hv.TextLabel != null)
|
||||
{
|
||||
hv.TextLabel.TextColor = ThemeHelpers.MutedColor;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WillDisplayFooterView(UITableView tableView, UIView footerView, nint section)
|
||||
{
|
||||
if(footerView != null && footerView is UITableViewHeaderFooterView fv && fv.TextLabel != null)
|
||||
{
|
||||
fv.TextLabel.TextColor = ThemeHelpers.MutedColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using System;
|
||||
using UIKit;
|
||||
|
||||
@@ -8,5 +9,31 @@ namespace Bit.iOS.Core.Controllers
|
||||
public ExtendedUIViewController(IntPtr handle)
|
||||
: base(handle)
|
||||
{ }
|
||||
|
||||
public override void ViewWillAppear(bool animated)
|
||||
{
|
||||
UINavigationBar.Appearance.ShadowImage = new UIImage();
|
||||
UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
|
||||
base.ViewWillAppear(animated);
|
||||
}
|
||||
|
||||
public override void ViewDidLoad()
|
||||
{
|
||||
base.ViewDidLoad();
|
||||
if(View != null)
|
||||
{
|
||||
View.BackgroundColor = ThemeHelpers.BackgroundColor;
|
||||
}
|
||||
if(NavigationController?.NavigationBar != null)
|
||||
{
|
||||
NavigationController.NavigationBar.BarTintColor = ThemeHelpers.NavBarBackgroundColor;
|
||||
NavigationController.NavigationBar.BackgroundColor = ThemeHelpers.NavBarBackgroundColor;
|
||||
NavigationController.NavigationBar.TintColor = ThemeHelpers.NavBarTextColor;
|
||||
NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes
|
||||
{
|
||||
ForegroundColor = ThemeHelpers.NavBarTextColor
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,13 +41,6 @@ namespace Bit.iOS.Core.Controllers
|
||||
public FormEntryTableViewCell MasterPasswordCell { get; set; } = new FormEntryTableViewCell(
|
||||
AppResources.MasterPassword);
|
||||
|
||||
public override void ViewWillAppear(bool animated)
|
||||
{
|
||||
UINavigationBar.Appearance.ShadowImage = new UIImage();
|
||||
UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
|
||||
base.ViewWillAppear(animated);
|
||||
}
|
||||
|
||||
public override void ViewDidLoad()
|
||||
{
|
||||
_lockService = ServiceContainer.Resolve<ILockService>("lockService");
|
||||
@@ -66,7 +59,6 @@ namespace Bit.iOS.Core.Controllers
|
||||
BaseNavItem.Title = _pinLock ? AppResources.VerifyPIN : AppResources.VerifyMasterPassword;
|
||||
BaseCancelButton.Title = AppResources.Cancel;
|
||||
BaseSubmitButton.Title = AppResources.Submit;
|
||||
View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);
|
||||
|
||||
var descriptor = UIFontDescriptor.PreferredBody;
|
||||
|
||||
@@ -238,7 +230,7 @@ namespace Bit.iOS.Core.Controllers
|
||||
PresentViewController(alert, true, null);
|
||||
}
|
||||
|
||||
public class TableSource : UITableViewSource
|
||||
public class TableSource : ExtendedUITableViewSource
|
||||
{
|
||||
private LockPasswordViewController _controller;
|
||||
|
||||
@@ -260,13 +252,13 @@ namespace Bit.iOS.Core.Controllers
|
||||
{
|
||||
if(indexPath.Row == 0)
|
||||
{
|
||||
var cell = new UITableViewCell();
|
||||
cell.TextLabel.TextColor = new UIColor(red: 0.24f, green: 0.55f, blue: 0.74f, alpha: 1.0f);
|
||||
var cell = new ExtendedUITableViewCell();
|
||||
cell.TextLabel.TextColor = ThemeHelpers.PrimaryColor;
|
||||
cell.TextLabel.Text = AppResources.UseFingerprintToUnlock;
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
return new UITableViewCell();
|
||||
return new ExtendedUITableViewCell();
|
||||
}
|
||||
|
||||
public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Bit.iOS.Core.Controllers
|
||||
public FormEntryTableViewCell NameCell { get; set; } = new FormEntryTableViewCell(AppResources.Name);
|
||||
public FormEntryTableViewCell UsernameCell { get; set; } = new FormEntryTableViewCell(AppResources.Username);
|
||||
public FormEntryTableViewCell PasswordCell { get; set; } = new FormEntryTableViewCell(AppResources.Password);
|
||||
public UITableViewCell GeneratePasswordCell { get; set; } = new UITableViewCell(
|
||||
public UITableViewCell GeneratePasswordCell { get; set; } = new ExtendedUITableViewCell(
|
||||
UITableViewCellStyle.Subtitle, "GeneratePasswordCell");
|
||||
public FormEntryTableViewCell UriCell { get; set; } = new FormEntryTableViewCell(AppResources.URI);
|
||||
public SwitchTableViewCell FavoriteCell { get; set; } = new SwitchTableViewCell(AppResources.Favorite);
|
||||
@@ -43,13 +43,6 @@ namespace Bit.iOS.Core.Controllers
|
||||
public abstract UIBarButtonItem BaseSaveButton { get; }
|
||||
public abstract Action Success { get; }
|
||||
|
||||
public override void ViewWillAppear(bool animated)
|
||||
{
|
||||
UINavigationBar.Appearance.ShadowImage = new UIImage();
|
||||
UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
|
||||
base.ViewWillAppear(animated);
|
||||
}
|
||||
|
||||
public override void ViewDidLoad()
|
||||
{
|
||||
_cipherService = ServiceContainer.Resolve<ICipherService>("cipherService");
|
||||
@@ -58,7 +51,7 @@ namespace Bit.iOS.Core.Controllers
|
||||
BaseNavItem.Title = AppResources.AddItem;
|
||||
BaseCancelButton.Title = AppResources.Cancel;
|
||||
BaseSaveButton.Title = AppResources.Save;
|
||||
View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);
|
||||
View.BackgroundColor = ThemeHelpers.BackgroundColor;
|
||||
|
||||
NameCell.TextField.Text = Context?.Uri?.Host ?? string.Empty;
|
||||
NameCell.TextField.ReturnKeyType = UIReturnKeyType.Next;
|
||||
@@ -87,6 +80,8 @@ namespace Bit.iOS.Core.Controllers
|
||||
};
|
||||
|
||||
GeneratePasswordCell.TextLabel.Text = AppResources.GeneratePassword;
|
||||
GeneratePasswordCell.TextLabel.TextColor = GeneratePasswordCell.TextLabel.TintColor =
|
||||
ThemeHelpers.TextColor;
|
||||
GeneratePasswordCell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
|
||||
|
||||
UriCell.TextField.Text = Context?.UrlString ?? string.Empty;
|
||||
@@ -206,7 +201,7 @@ namespace Bit.iOS.Core.Controllers
|
||||
AppResources.InternetConnectionRequiredMessage, AppResources.Ok);
|
||||
}
|
||||
|
||||
public class TableSource : UITableViewSource
|
||||
public class TableSource : ExtendedUITableViewSource
|
||||
{
|
||||
private LoginAddViewController _controller;
|
||||
|
||||
@@ -256,7 +251,7 @@ namespace Bit.iOS.Core.Controllers
|
||||
return _controller.NotesCell;
|
||||
}
|
||||
|
||||
return new UITableViewCell();
|
||||
return new ExtendedUITableViewCell();
|
||||
}
|
||||
|
||||
public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
|
||||
|
||||
@@ -26,9 +26,12 @@ namespace Bit.iOS.Core.Controllers
|
||||
public SwitchTableViewCell LowercaseCell { get; set; } = new SwitchTableViewCell("a-z");
|
||||
public SwitchTableViewCell NumbersCell { get; set; } = new SwitchTableViewCell("0-9");
|
||||
public SwitchTableViewCell SpecialCell { get; set; } = new SwitchTableViewCell("!@#$%^&*");
|
||||
public StepperTableViewCell MinNumbersCell { get; set; } = new StepperTableViewCell(AppResources.MinNumbers, 1, 0, 5, 1);
|
||||
public StepperTableViewCell MinSpecialCell { get; set; } = new StepperTableViewCell(AppResources.MinSpecial, 1, 0, 5, 1);
|
||||
public SliderTableViewCell LengthCell { get; set; } = new SliderTableViewCell(AppResources.Length, 10, 5, 64);
|
||||
public StepperTableViewCell MinNumbersCell { get; set; } = new StepperTableViewCell(
|
||||
AppResources.MinNumbers, 1, 0, 5, 1);
|
||||
public StepperTableViewCell MinSpecialCell { get; set; } = new StepperTableViewCell(
|
||||
AppResources.MinSpecial, 1, 0, 5, 1);
|
||||
public SliderTableViewCell LengthCell { get; set; } = new SliderTableViewCell(
|
||||
AppResources.Length, 10, 5, 64);
|
||||
|
||||
public PasswordGenerationOptions PasswordOptions { get; set; }
|
||||
public abstract UINavigationItem BaseNavItem { get; }
|
||||
@@ -36,13 +39,6 @@ namespace Bit.iOS.Core.Controllers
|
||||
public abstract UIBarButtonItem BaseSelectBarButton { get; }
|
||||
public abstract UILabel BasePasswordLabel { get; }
|
||||
|
||||
public override void ViewWillAppear(bool animated)
|
||||
{
|
||||
UINavigationBar.Appearance.ShadowImage = new UIImage();
|
||||
UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
|
||||
base.ViewWillAppear(animated);
|
||||
}
|
||||
|
||||
public async override void ViewDidLoad()
|
||||
{
|
||||
_passwordGenerationService = ServiceContainer.Resolve<IPasswordGenerationService>(
|
||||
@@ -51,13 +47,13 @@ namespace Bit.iOS.Core.Controllers
|
||||
BaseNavItem.Title = AppResources.PasswordGenerator;
|
||||
BaseCancelButton.Title = AppResources.Cancel;
|
||||
BaseSelectBarButton.Title = AppResources.Select;
|
||||
View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);
|
||||
|
||||
var descriptor = UIFontDescriptor.PreferredBody;
|
||||
BasePasswordLabel.Font = UIFont.FromName("Menlo-Regular", descriptor.PointSize * 1.3f);
|
||||
BasePasswordLabel.LineBreakMode = UILineBreakMode.TailTruncation;
|
||||
BasePasswordLabel.Lines = 1;
|
||||
BasePasswordLabel.AdjustsFontSizeToFitWidth = false;
|
||||
BasePasswordLabel.TextColor = ThemeHelpers.TextColor;
|
||||
|
||||
var controller = ChildViewControllers.LastOrDefault();
|
||||
if(controller != null)
|
||||
@@ -71,7 +67,8 @@ namespace Bit.iOS.Core.Controllers
|
||||
OptionsTableViewController.TableView.EstimatedRowHeight = 70;
|
||||
OptionsTableViewController.TableView.Source = new TableSource(this);
|
||||
OptionsTableViewController.TableView.AllowsSelection = true;
|
||||
OptionsTableViewController.View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);
|
||||
OptionsTableViewController.View.BackgroundColor = ThemeHelpers.BackgroundColor;
|
||||
OptionsTableViewController.TableView.SeparatorColor = ThemeHelpers.SeparatorColor;
|
||||
}
|
||||
|
||||
var options = await _passwordGenerationService.GetOptionsAsync();
|
||||
@@ -159,7 +156,8 @@ namespace Bit.iOS.Core.Controllers
|
||||
|
||||
private bool InvalidState()
|
||||
{
|
||||
return !LowercaseCell.Switch.On && !UppercaseCell.Switch.On && !NumbersCell.Switch.On && !SpecialCell.Switch.On;
|
||||
return !LowercaseCell.Switch.On && !UppercaseCell.Switch.On && !NumbersCell.Switch.On &&
|
||||
!SpecialCell.Switch.On;
|
||||
}
|
||||
|
||||
private async Task GeneratePasswordAsync()
|
||||
@@ -177,7 +175,7 @@ namespace Bit.iOS.Core.Controllers
|
||||
});
|
||||
}
|
||||
|
||||
public class TableSource : UITableViewSource
|
||||
public class TableSource : ExtendedUITableViewSource
|
||||
{
|
||||
private PasswordGeneratorViewController _controller;
|
||||
|
||||
@@ -190,8 +188,8 @@ namespace Bit.iOS.Core.Controllers
|
||||
{
|
||||
if(indexPath.Section == 0)
|
||||
{
|
||||
var cell = new UITableViewCell();
|
||||
cell.TextLabel.TextColor = new UIColor(red: 0.24f, green: 0.55f, blue: 0.74f, alpha: 1.0f);
|
||||
var cell = new ExtendedUITableViewCell();
|
||||
cell.TextLabel.TextColor = ThemeHelpers.PrimaryColor;
|
||||
if(indexPath.Row == 0)
|
||||
{
|
||||
cell.TextLabel.Text = AppResources.RegeneratePassword;
|
||||
@@ -232,7 +230,7 @@ namespace Bit.iOS.Core.Controllers
|
||||
return _controller.MinSpecialCell;
|
||||
}
|
||||
|
||||
return new UITableViewCell();
|
||||
return new ExtendedUITableViewCell();
|
||||
}
|
||||
|
||||
public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
|
||||
|
||||
@@ -9,6 +9,13 @@ namespace Bit.iOS.Core.Utilities
|
||||
public static UIColor SplashBackgroundColor = Xamarin.Forms.Color.FromHex("#efeff4").ToUIColor();
|
||||
public static UIColor BackgroundColor = Xamarin.Forms.Color.FromHex("#ffffff").ToUIColor();
|
||||
public static UIColor MutedColor = Xamarin.Forms.Color.FromHex("#777777").ToUIColor();
|
||||
public static UIColor SuccessColor = Xamarin.Forms.Color.FromHex("#00a65a").ToUIColor();
|
||||
public static UIColor PrimaryColor = Xamarin.Forms.Color.FromHex("#3c8dbc").ToUIColor();
|
||||
public static UIColor TextColor = Xamarin.Forms.Color.FromHex("#000000").ToUIColor();
|
||||
public static UIColor PlaceholderColor = Xamarin.Forms.Color.FromHex("#d0d0d0").ToUIColor();
|
||||
public static UIColor SeparatorColor = Xamarin.Forms.Color.FromHex("#dddddd").ToUIColor();
|
||||
public static UIColor NavBarBackgroundColor = Xamarin.Forms.Color.FromHex("#3c8dbc").ToUIColor();
|
||||
public static UIColor NavBarTextColor = Xamarin.Forms.Color.FromHex("#ffffff").ToUIColor();
|
||||
|
||||
public static void SetAppearance(string theme)
|
||||
{
|
||||
@@ -24,6 +31,24 @@ namespace Bit.iOS.Core.Utilities
|
||||
{
|
||||
SetAppearance(theme);
|
||||
UIView.Appearance.BackgroundColor = BackgroundColor;
|
||||
UILabel.Appearance.TextColor = TextColor;
|
||||
UITextField.Appearance.TintColor = TextColor;
|
||||
UITextView.Appearance.TintColor = TextColor;
|
||||
UITextField.Appearance.BackgroundColor = BackgroundColor;
|
||||
UITextView.Appearance.BackgroundColor = BackgroundColor;
|
||||
UITableView.Appearance.BackgroundColor = BackgroundColor;
|
||||
UITableView.Appearance.SeparatorColor = SeparatorColor;
|
||||
UINavigationBar.Appearance.BackgroundColor = NavBarBackgroundColor;
|
||||
UINavigationBar.Appearance.BarTintColor = NavBarBackgroundColor;
|
||||
UINavigationBar.Appearance.TintColor = NavBarTextColor;
|
||||
UINavigationBar.Appearance.Translucent = false;
|
||||
UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes()
|
||||
{
|
||||
TextColor = NavBarTextColor
|
||||
});
|
||||
UIBarButtonItem.Appearance.TintColor = NavBarTextColor;
|
||||
UIButton.Appearance.TintColor = TextColor;
|
||||
UILabel.AppearanceWhenContainedIn(typeof(UITableViewHeaderFooterView)).TextColor = MutedColor;
|
||||
}
|
||||
|
||||
private static void SetThemeVariables(string theme)
|
||||
@@ -31,21 +56,45 @@ namespace Bit.iOS.Core.Utilities
|
||||
LightTheme = false;
|
||||
if(theme == "dark")
|
||||
{
|
||||
var whiteColor = Xamarin.Forms.Color.FromHex("#ffffff").ToUIColor();
|
||||
MutedColor = Xamarin.Forms.Color.FromHex("#a3a3a3").ToUIColor();
|
||||
SuccessColor = Xamarin.Forms.Color.FromHex("#00a65a").ToUIColor();
|
||||
BackgroundColor = Xamarin.Forms.Color.FromHex("#303030").ToUIColor();
|
||||
SplashBackgroundColor = Xamarin.Forms.Color.FromHex("#222222").ToUIColor();
|
||||
PrimaryColor = Xamarin.Forms.Color.FromHex("#52bdfb").ToUIColor();
|
||||
TextColor = whiteColor;
|
||||
PlaceholderColor = Xamarin.Forms.Color.FromHex("#707070").ToUIColor();
|
||||
SeparatorColor = Xamarin.Forms.Color.FromHex("#191919").ToUIColor();
|
||||
NavBarBackgroundColor = Xamarin.Forms.Color.FromHex("#212121").ToUIColor();
|
||||
NavBarTextColor = whiteColor;
|
||||
}
|
||||
else if(theme == "black")
|
||||
{
|
||||
var blackColor = Xamarin.Forms.Color.FromHex("#000000").ToUIColor();
|
||||
var whiteColor = Xamarin.Forms.Color.FromHex("#ffffff").ToUIColor();
|
||||
MutedColor = Xamarin.Forms.Color.FromHex("#a3a3a3").ToUIColor();
|
||||
BackgroundColor = Xamarin.Forms.Color.FromHex("#000000").ToUIColor();
|
||||
SplashBackgroundColor = BackgroundColor;
|
||||
SuccessColor = Xamarin.Forms.Color.FromHex("#00a65a").ToUIColor();
|
||||
BackgroundColor = blackColor;
|
||||
SplashBackgroundColor = blackColor;
|
||||
PrimaryColor = Xamarin.Forms.Color.FromHex("#52bdfb").ToUIColor();
|
||||
TextColor = whiteColor;
|
||||
PlaceholderColor = Xamarin.Forms.Color.FromHex("#707070").ToUIColor();
|
||||
SeparatorColor = Xamarin.Forms.Color.FromHex("#282828").ToUIColor();
|
||||
NavBarBackgroundColor = blackColor;
|
||||
NavBarTextColor = whiteColor;
|
||||
}
|
||||
else if(theme == "nord")
|
||||
{
|
||||
MutedColor = Xamarin.Forms.Color.FromHex("#d8dee9").ToUIColor();
|
||||
SuccessColor = Xamarin.Forms.Color.FromHex("#a3be8c").ToUIColor();
|
||||
BackgroundColor = Xamarin.Forms.Color.FromHex("#3b4252").ToUIColor();
|
||||
SplashBackgroundColor = Xamarin.Forms.Color.FromHex("#2e3440").ToUIColor();
|
||||
PrimaryColor = Xamarin.Forms.Color.FromHex("#81a1c1").ToUIColor();
|
||||
TextColor = Xamarin.Forms.Color.FromHex("#e5e9f0").ToUIColor();
|
||||
PlaceholderColor = Xamarin.Forms.Color.FromHex("#7b88a1").ToUIColor();
|
||||
SeparatorColor = Xamarin.Forms.Color.FromHex("#2e3440").ToUIColor();
|
||||
NavBarBackgroundColor = Xamarin.Forms.Color.FromHex("#2e3440").ToUIColor();
|
||||
NavBarTextColor = Xamarin.Forms.Color.FromHex("#e5e9f0").ToUIColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Models.View;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.iOS.Core.Controllers;
|
||||
using Bit.iOS.Core.Models;
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using Foundation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -14,7 +16,7 @@ using UIKit;
|
||||
|
||||
namespace Bit.iOS.Core.Views
|
||||
{
|
||||
public class ExtensionTableSource : UITableViewSource
|
||||
public class ExtensionTableSource : ExtendedUITableViewSource
|
||||
{
|
||||
private const string CellIdentifier = "TableCell";
|
||||
|
||||
@@ -95,11 +97,12 @@ namespace Bit.iOS.Core.Views
|
||||
{
|
||||
if(Items == null || Items.Count() == 0)
|
||||
{
|
||||
var noDataCell = new UITableViewCell(UITableViewCellStyle.Default, "NoDataCell");
|
||||
var noDataCell = new ExtendedUITableViewCell(UITableViewCellStyle.Default, "NoDataCell");
|
||||
noDataCell.TextLabel.Text = AppResources.NoItemsTap;
|
||||
noDataCell.TextLabel.TextAlignment = UITextAlignment.Center;
|
||||
noDataCell.TextLabel.LineBreakMode = UILineBreakMode.WordWrap;
|
||||
noDataCell.TextLabel.Lines = 0;
|
||||
noDataCell.TextLabel.TextColor = ThemeHelpers.TextColor;
|
||||
return noDataCell;
|
||||
}
|
||||
|
||||
@@ -109,9 +112,9 @@ namespace Bit.iOS.Core.Views
|
||||
if(cell == null)
|
||||
{
|
||||
Debug.WriteLine("BW Log, Make new cell for list.");
|
||||
cell = new UITableViewCell(UITableViewCellStyle.Subtitle, CellIdentifier);
|
||||
cell.DetailTextLabel.TextColor = cell.DetailTextLabel.TintColor =
|
||||
new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f);
|
||||
cell = new ExtendedUITableViewCell(UITableViewCellStyle.Subtitle, CellIdentifier);
|
||||
cell.TextLabel.TextColor = cell.TextLabel.TintColor = ThemeHelpers.TextColor;
|
||||
cell.DetailTextLabel.TextColor = cell.DetailTextLabel.TintColor = ThemeHelpers.MutedColor;
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using System;
|
||||
using Bit.iOS.Core.Controllers;
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using System;
|
||||
using UIKit;
|
||||
|
||||
namespace Bit.iOS.Core.Views
|
||||
{
|
||||
public class FormEntryTableViewCell : UITableViewCell, ISelectable
|
||||
public class FormEntryTableViewCell : ExtendedUITableViewCell, ISelectable
|
||||
{
|
||||
public FormEntryTableViewCell(
|
||||
string labelName = null,
|
||||
@@ -22,7 +24,7 @@ namespace Bit.iOS.Core.Views
|
||||
Text = labelName,
|
||||
TranslatesAutoresizingMaskIntoConstraints = false,
|
||||
Font = UIFont.FromDescriptor(descriptor, 0.8f * pointSize),
|
||||
TextColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f)
|
||||
TextColor = ThemeHelpers.MutedColor
|
||||
};
|
||||
|
||||
ContentView.Add(Label);
|
||||
@@ -33,7 +35,10 @@ namespace Bit.iOS.Core.Views
|
||||
TextView = new UITextView
|
||||
{
|
||||
TranslatesAutoresizingMaskIntoConstraints = false,
|
||||
Font = UIFont.FromDescriptor(descriptor, pointSize)
|
||||
Font = UIFont.FromDescriptor(descriptor, pointSize),
|
||||
TextColor = ThemeHelpers.TextColor,
|
||||
TintColor = ThemeHelpers.TextColor,
|
||||
BackgroundColor = ThemeHelpers.BackgroundColor
|
||||
};
|
||||
|
||||
ContentView.Add(TextView);
|
||||
@@ -67,7 +72,10 @@ namespace Bit.iOS.Core.Views
|
||||
TranslatesAutoresizingMaskIntoConstraints = false,
|
||||
BorderStyle = UITextBorderStyle.None,
|
||||
Font = UIFont.FromDescriptor(descriptor, pointSize),
|
||||
ClearButtonMode = UITextFieldViewMode.WhileEditing
|
||||
ClearButtonMode = UITextFieldViewMode.WhileEditing,
|
||||
TextColor = ThemeHelpers.TextColor,
|
||||
TintColor = ThemeHelpers.TextColor,
|
||||
BackgroundColor = ThemeHelpers.BackgroundColor
|
||||
};
|
||||
|
||||
if(useLabelAsPlaceholder)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using CoreGraphics;
|
||||
using Bit.iOS.Core.Controllers;
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using CoreGraphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
@@ -6,7 +8,7 @@ using UIKit;
|
||||
|
||||
namespace Bit.iOS.Core.Views
|
||||
{
|
||||
public class PickerTableViewCell : UITableViewCell, ISelectable
|
||||
public class PickerTableViewCell : ExtendedUITableViewCell, ISelectable
|
||||
{
|
||||
private List<string> _items = new List<string>();
|
||||
private int _selectedIndex = 0;
|
||||
@@ -24,7 +26,7 @@ namespace Bit.iOS.Core.Views
|
||||
Text = labelName,
|
||||
TranslatesAutoresizingMaskIntoConstraints = false,
|
||||
Font = UIFont.FromDescriptor(descriptor, 0.8f * pointSize),
|
||||
TextColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f)
|
||||
TextColor = ThemeHelpers.MutedColor
|
||||
};
|
||||
|
||||
ContentView.Add(Label);
|
||||
@@ -33,7 +35,10 @@ namespace Bit.iOS.Core.Views
|
||||
{
|
||||
BorderStyle = UITextBorderStyle.None,
|
||||
TranslatesAutoresizingMaskIntoConstraints = false,
|
||||
Font = UIFont.FromDescriptor(descriptor, pointSize)
|
||||
Font = UIFont.FromDescriptor(descriptor, pointSize),
|
||||
TextColor = ThemeHelpers.TextColor,
|
||||
TintColor = ThemeHelpers.TextColor,
|
||||
BackgroundColor = ThemeHelpers.BackgroundColor
|
||||
};
|
||||
|
||||
var width = (float)UIScreen.MainScreen.Bounds.Width;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using System;
|
||||
using Bit.iOS.Core.Controllers;
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using System;
|
||||
using UIKit;
|
||||
|
||||
namespace Bit.iOS.Core.Views
|
||||
{
|
||||
public class SliderTableViewCell : UITableViewCell
|
||||
public class SliderTableViewCell : ExtendedUITableViewCell
|
||||
{
|
||||
private string _detailRightSpace = "\t";
|
||||
private int _value;
|
||||
@@ -12,14 +14,16 @@ namespace Bit.iOS.Core.Views
|
||||
: base(UITableViewCellStyle.Value1, nameof(SwitchTableViewCell))
|
||||
{
|
||||
TextLabel.Text = labelName;
|
||||
DetailTextLabel.TextColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f);
|
||||
TextLabel.TextColor = ThemeHelpers.TextColor;
|
||||
DetailTextLabel.TextColor = ThemeHelpers.MutedColor;
|
||||
|
||||
Slider = new UISlider
|
||||
{
|
||||
MinValue = min,
|
||||
MaxValue = max,
|
||||
TintColor = new UIColor(red: 0.24f, green: 0.55f, blue: 0.74f, alpha: 1.0f),
|
||||
Frame = new CoreGraphics.CGRect(0, 0, 180, 30)
|
||||
TintColor = ThemeHelpers.PrimaryColor,
|
||||
Frame = new CoreGraphics.CGRect(0, 0, 180, 30),
|
||||
BackgroundColor = ThemeHelpers.BackgroundColor
|
||||
};
|
||||
Slider.ValueChanged += Slider_ValueChanged;
|
||||
Value = value;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using System;
|
||||
using Bit.iOS.Core.Controllers;
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using System;
|
||||
using UIKit;
|
||||
|
||||
namespace Bit.iOS.Core.Views
|
||||
{
|
||||
public class StepperTableViewCell : UITableViewCell
|
||||
public class StepperTableViewCell : ExtendedUITableViewCell
|
||||
{
|
||||
// Give some space to the right of the detail in between the spacer.
|
||||
// This is a bit of a hack, but I did not see a way to specify a margin on the
|
||||
@@ -15,11 +17,12 @@ namespace Bit.iOS.Core.Views
|
||||
: base(UITableViewCellStyle.Value1, nameof(SwitchTableViewCell))
|
||||
{
|
||||
TextLabel.Text = labelName;
|
||||
DetailTextLabel.TextColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f);
|
||||
TextLabel.TextColor = ThemeHelpers.TextColor;
|
||||
DetailTextLabel.TextColor = ThemeHelpers.MutedColor;
|
||||
|
||||
Stepper = new UIStepper
|
||||
{
|
||||
TintColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f),
|
||||
TintColor = ThemeHelpers.MutedColor,
|
||||
MinimumValue = min,
|
||||
MaximumValue = max
|
||||
};
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
using System;
|
||||
using Bit.iOS.Core.Controllers;
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using System;
|
||||
using UIKit;
|
||||
|
||||
namespace Bit.iOS.Core.Views
|
||||
{
|
||||
public class SwitchTableViewCell : UITableViewCell
|
||||
public class SwitchTableViewCell : ExtendedUITableViewCell
|
||||
{
|
||||
public SwitchTableViewCell(string labelName)
|
||||
: base(UITableViewCellStyle.Default, nameof(SwitchTableViewCell))
|
||||
{
|
||||
TextLabel.Text = labelName;
|
||||
TextLabel.TextColor = ThemeHelpers.TextColor;
|
||||
Switch.TintColor = ThemeHelpers.MutedColor;
|
||||
Switch.OnTintColor = ThemeHelpers.PrimaryColor;
|
||||
AccessoryView = Switch;
|
||||
|
||||
Switch.ValueChanged += Switch_ValueChanged;
|
||||
|
||||
@@ -55,7 +55,9 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Constants.cs" />
|
||||
<Compile Include="Controllers\ExtendedUITableViewController.cs" />
|
||||
<Compile Include="Controllers\ExtendedUITableViewCell.cs" />
|
||||
<Compile Include="Controllers\ExtendedUIViewController.cs" />
|
||||
<Compile Include="Controllers\ExtendedUITableViewSource.cs" />
|
||||
<Compile Include="Controllers\LockPasswordViewController.cs" />
|
||||
<Compile Include="Controllers\LoginAddViewController.cs" />
|
||||
<Compile Include="Controllers\PasswordGeneratorViewController.cs" />
|
||||
|
||||
Reference in New Issue
Block a user