mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 23:25:45 +03:00
dark keyboard on dark themes. resolves #588
This commit is contained in:
parent
e2d1da02d3
commit
b5dcdc74d7
9 changed files with 82 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using Bit.iOS.Autofill.Models;
|
using Bit.iOS.Autofill.Models;
|
||||||
using Foundation;
|
using Foundation;
|
||||||
using UIKit;
|
using UIKit;
|
||||||
|
@ -27,6 +27,10 @@ namespace Bit.iOS.Autofill
|
||||||
CancelBarButton.Title = AppResources.Cancel;
|
CancelBarButton.Title = AppResources.Cancel;
|
||||||
SearchBar.Placeholder = AppResources.Search;
|
SearchBar.Placeholder = AppResources.Search;
|
||||||
SearchBar.BackgroundColor = SearchBar.BarTintColor = ThemeHelpers.ListHeaderBackgroundColor;
|
SearchBar.BackgroundColor = SearchBar.BarTintColor = ThemeHelpers.ListHeaderBackgroundColor;
|
||||||
|
if(!ThemeHelpers.LightTheme)
|
||||||
|
{
|
||||||
|
SearchBar.KeyboardAppearance = UIKeyboardAppearance.Dark;
|
||||||
|
}
|
||||||
|
|
||||||
TableView.RowHeight = UITableView.AutomaticDimension;
|
TableView.RowHeight = UITableView.AutomaticDimension;
|
||||||
TableView.EstimatedRowHeight = 44;
|
TableView.EstimatedRowHeight = 44;
|
||||||
|
|
|
@ -8,6 +8,7 @@ using Bit.App.Resources;
|
||||||
using Bit.Core.Abstractions;
|
using Bit.Core.Abstractions;
|
||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
using Bit.Core.Models.View;
|
using Bit.Core.Models.View;
|
||||||
|
using Bit.iOS.Core.Utilities;
|
||||||
using Bit.iOS.Core.Views;
|
using Bit.iOS.Core.Views;
|
||||||
using CoreGraphics;
|
using CoreGraphics;
|
||||||
using Foundation;
|
using Foundation;
|
||||||
|
@ -203,6 +204,10 @@ namespace Bit.iOS.Core.Services
|
||||||
{
|
{
|
||||||
input.KeyboardType = UIKeyboardType.NumberPad;
|
input.KeyboardType = UIKeyboardType.NumberPad;
|
||||||
}
|
}
|
||||||
|
if(!ThemeHelpers.LightTheme)
|
||||||
|
{
|
||||||
|
input.KeyboardAppearance = UIKeyboardAppearance.Dark;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
var vc = GetPresentedViewController();
|
var vc = GetPresentedViewController();
|
||||||
vc?.PresentViewController(alert, true, null);
|
vc?.PresentViewController(alert, true, null);
|
||||||
|
|
|
@ -41,6 +41,11 @@ namespace Bit.iOS.Core.Views
|
||||||
BackgroundColor = ThemeHelpers.BackgroundColor
|
BackgroundColor = ThemeHelpers.BackgroundColor
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(!ThemeHelpers.LightTheme)
|
||||||
|
{
|
||||||
|
TextView.KeyboardAppearance = UIKeyboardAppearance.Dark;
|
||||||
|
}
|
||||||
|
|
||||||
ContentView.Add(TextView);
|
ContentView.Add(TextView);
|
||||||
ContentView.AddConstraints(new NSLayoutConstraint[] {
|
ContentView.AddConstraints(new NSLayoutConstraint[] {
|
||||||
NSLayoutConstraint.Create(TextView, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, 15f),
|
NSLayoutConstraint.Create(TextView, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, 15f),
|
||||||
|
@ -78,6 +83,11 @@ namespace Bit.iOS.Core.Views
|
||||||
BackgroundColor = ThemeHelpers.BackgroundColor
|
BackgroundColor = ThemeHelpers.BackgroundColor
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(!ThemeHelpers.LightTheme)
|
||||||
|
{
|
||||||
|
TextField.KeyboardAppearance = UIKeyboardAppearance.Dark;
|
||||||
|
}
|
||||||
|
|
||||||
if(useLabelAsPlaceholder)
|
if(useLabelAsPlaceholder)
|
||||||
{
|
{
|
||||||
TextField.Placeholder = labelName;
|
TextField.Placeholder = labelName;
|
||||||
|
|
|
@ -41,6 +41,11 @@ namespace Bit.iOS.Core.Views
|
||||||
BackgroundColor = ThemeHelpers.BackgroundColor
|
BackgroundColor = ThemeHelpers.BackgroundColor
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(!ThemeHelpers.LightTheme)
|
||||||
|
{
|
||||||
|
TextField.KeyboardAppearance = UIKeyboardAppearance.Dark;
|
||||||
|
}
|
||||||
|
|
||||||
var width = (float)UIScreen.MainScreen.Bounds.Width;
|
var width = (float)UIScreen.MainScreen.Bounds.Width;
|
||||||
var toolbar = new UIToolbar(new RectangleF(0, 0, width, 44))
|
var toolbar = new UIToolbar(new RectangleF(0, 0, width, 44))
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,6 +20,7 @@ namespace Bit.iOS.Renderers
|
||||||
Control.TextContainerInset = new UIEdgeInsets(0, 0, 0, 0);
|
Control.TextContainerInset = new UIEdgeInsets(0, 0, 0, 0);
|
||||||
Control.TextContainer.LineFragmentPadding = 0;
|
Control.TextContainer.LineFragmentPadding = 0;
|
||||||
UpdateTintColor();
|
UpdateTintColor();
|
||||||
|
UpdateKeyboardAppearance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,5 +37,13 @@ namespace Bit.iOS.Renderers
|
||||||
{
|
{
|
||||||
Control.TintColor = Element.TextColor.ToUIColor();
|
Control.TintColor = Element.TextColor.ToUIColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateKeyboardAppearance()
|
||||||
|
{
|
||||||
|
if(!Core.Utilities.ThemeHelpers.LightTheme)
|
||||||
|
{
|
||||||
|
Control.KeyboardAppearance = UIKeyboardAppearance.Dark;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ namespace Bit.iOS.Renderers
|
||||||
Control.ClearButtonMode = UITextFieldViewMode.WhileEditing;
|
Control.ClearButtonMode = UITextFieldViewMode.WhileEditing;
|
||||||
UpdateTintColor();
|
UpdateTintColor();
|
||||||
UpdateFontSize();
|
UpdateFontSize();
|
||||||
|
UpdateKeyboardAppearance();
|
||||||
iOSHelpers.SetBottomBorder(Control);
|
iOSHelpers.SetBottomBorder(Control);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,5 +58,13 @@ namespace Bit.iOS.Renderers
|
||||||
{
|
{
|
||||||
Control.TintColor = Element.TextColor.ToUIColor();
|
Control.TintColor = Element.TextColor.ToUIColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateKeyboardAppearance()
|
||||||
|
{
|
||||||
|
if(!Core.Utilities.ThemeHelpers.LightTheme)
|
||||||
|
{
|
||||||
|
Control.KeyboardAppearance = UIKeyboardAppearance.Dark;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,15 @@ namespace Bit.iOS.Renderers
|
||||||
var descriptor = UIFontDescriptor.PreferredBody;
|
var descriptor = UIFontDescriptor.PreferredBody;
|
||||||
Control.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize);
|
Control.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize);
|
||||||
iOSHelpers.SetBottomBorder(Control);
|
iOSHelpers.SetBottomBorder(Control);
|
||||||
|
UpdateKeyboardAppearance();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateKeyboardAppearance()
|
||||||
|
{
|
||||||
|
if(!Core.Utilities.ThemeHelpers.LightTheme)
|
||||||
|
{
|
||||||
|
Control.KeyboardAppearance = UIKeyboardAppearance.Dark;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
28
src/iOS/Renderers/CustomSearchBarRenderer.cs
Normal file
28
src/iOS/Renderers/CustomSearchBarRenderer.cs
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
using Bit.iOS.Renderers;
|
||||||
|
using UIKit;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using Xamarin.Forms.Platform.iOS;
|
||||||
|
|
||||||
|
[assembly: ExportRenderer(typeof(SearchBar), typeof(CustomSearchBarRenderer))]
|
||||||
|
namespace Bit.iOS.Renderers
|
||||||
|
{
|
||||||
|
public class CustomSearchBarRenderer : SearchBarRenderer
|
||||||
|
{
|
||||||
|
protected override void OnElementChanged(ElementChangedEventArgs<SearchBar> e)
|
||||||
|
{
|
||||||
|
base.OnElementChanged(e);
|
||||||
|
if(e.NewElement is SearchBar)
|
||||||
|
{
|
||||||
|
UpdateKeyboardAppearance();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateKeyboardAppearance()
|
||||||
|
{
|
||||||
|
if(!Core.Utilities.ThemeHelpers.LightTheme)
|
||||||
|
{
|
||||||
|
Control.KeyboardAppearance = UIKeyboardAppearance.Dark;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -137,6 +137,7 @@
|
||||||
<Compile Include="Migration\KeyChainStorageService.cs" />
|
<Compile Include="Migration\KeyChainStorageService.cs" />
|
||||||
<Compile Include="NFCReaderDelegate.cs" />
|
<Compile Include="NFCReaderDelegate.cs" />
|
||||||
<Compile Include="Renderers\CustomButtonRenderer.cs" />
|
<Compile Include="Renderers\CustomButtonRenderer.cs" />
|
||||||
|
<Compile Include="Renderers\CustomSearchBarRenderer.cs" />
|
||||||
<Compile Include="Renderers\CustomTabbedRenderer.cs" />
|
<Compile Include="Renderers\CustomTabbedRenderer.cs" />
|
||||||
<Compile Include="Renderers\CustomPickerRenderer.cs" />
|
<Compile Include="Renderers\CustomPickerRenderer.cs" />
|
||||||
<Compile Include="Renderers\CustomEntryRenderer.cs" />
|
<Compile Include="Renderers\CustomEntryRenderer.cs" />
|
||||||
|
|
Loading…
Reference in a new issue