mirror of
https://github.com/bitwarden/mobile
synced 2025-12-30 15:13:24 +00:00
ios app extension theming
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user