mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 23:25:45 +03:00
use black text for search bar on light theme
This commit is contained in:
parent
4d8c665917
commit
a363712127
5 changed files with 35 additions and 4 deletions
21
src/App/Controls/ExtendedSearchBar.cs
Normal file
21
src/App/Controls/ExtendedSearchBar.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using Bit.App.Abstractions;
|
||||
using Bit.Core.Utilities;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Controls
|
||||
{
|
||||
public class ExtendedSearchBar : SearchBar
|
||||
{
|
||||
public ExtendedSearchBar()
|
||||
{
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
var deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService", true);
|
||||
if(!deviceActionService?.UsingDarkTheme() ?? false)
|
||||
{
|
||||
TextColor = Color.Black;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -34,7 +34,7 @@
|
|||
VerticalOptions="CenterAndExpand"
|
||||
Clicked="BackButton_Clicked"
|
||||
x:Name="_backButton" />
|
||||
<SearchBar
|
||||
<controls:ExtendedSearchBar
|
||||
x:Name="_searchBar"
|
||||
HorizontalOptions="FillAndExpand"
|
||||
TextChanged="SearchBar_TextChanged"
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
<Setter Property="Margin"
|
||||
Value="-4, 0, -4, -4" />
|
||||
</Style>
|
||||
<Style TargetType="SearchBar">
|
||||
<Style TargetType="SearchBar"
|
||||
ApplyToDerivedTypes="True">
|
||||
<Setter Property="BackgroundColor"
|
||||
Value="Transparent" />
|
||||
<Setter Property="TextColor"
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
<Setter Property="OnColor"
|
||||
Value="{StaticResource SwitchOnColor}" />
|
||||
</Style>
|
||||
<Style TargetType="SearchBar">
|
||||
<Style TargetType="SearchBar"
|
||||
ApplyToDerivedTypes="True">
|
||||
<Setter Property="BackgroundColor"
|
||||
Value="{StaticResource ListHeaderBackgroundColor}" />
|
||||
<Setter Property="TextColor"
|
||||
|
|
|
@ -353,7 +353,15 @@ namespace Bit.iOS.Core.Services
|
|||
|
||||
public bool UsingDarkTheme()
|
||||
{
|
||||
return UIScreen.MainScreen.TraitCollection.UserInterfaceStyle == UIUserInterfaceStyle.Dark;
|
||||
try
|
||||
{
|
||||
if(SystemMajorVersion() > 12)
|
||||
{
|
||||
return UIScreen.MainScreen.TraitCollection.UserInterfaceStyle == UIUserInterfaceStyle.Dark;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
return false;
|
||||
}
|
||||
|
||||
private void ImagePicker_FinishedPickingMedia(object sender, UIImagePickerMediaPickedEventArgs e)
|
||||
|
|
Loading…
Reference in a new issue