mirror of
https://github.com/bitwarden/android.git
synced 2024-12-26 02:48:29 +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"
|
VerticalOptions="CenterAndExpand"
|
||||||
Clicked="BackButton_Clicked"
|
Clicked="BackButton_Clicked"
|
||||||
x:Name="_backButton" />
|
x:Name="_backButton" />
|
||||||
<SearchBar
|
<controls:ExtendedSearchBar
|
||||||
x:Name="_searchBar"
|
x:Name="_searchBar"
|
||||||
HorizontalOptions="FillAndExpand"
|
HorizontalOptions="FillAndExpand"
|
||||||
TextChanged="SearchBar_TextChanged"
|
TextChanged="SearchBar_TextChanged"
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
<Setter Property="Margin"
|
<Setter Property="Margin"
|
||||||
Value="-4, 0, -4, -4" />
|
Value="-4, 0, -4, -4" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style TargetType="SearchBar">
|
<Style TargetType="SearchBar"
|
||||||
|
ApplyToDerivedTypes="True">
|
||||||
<Setter Property="BackgroundColor"
|
<Setter Property="BackgroundColor"
|
||||||
Value="Transparent" />
|
Value="Transparent" />
|
||||||
<Setter Property="TextColor"
|
<Setter Property="TextColor"
|
||||||
|
|
|
@ -35,7 +35,8 @@
|
||||||
<Setter Property="OnColor"
|
<Setter Property="OnColor"
|
||||||
Value="{StaticResource SwitchOnColor}" />
|
Value="{StaticResource SwitchOnColor}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style TargetType="SearchBar">
|
<Style TargetType="SearchBar"
|
||||||
|
ApplyToDerivedTypes="True">
|
||||||
<Setter Property="BackgroundColor"
|
<Setter Property="BackgroundColor"
|
||||||
Value="{StaticResource ListHeaderBackgroundColor}" />
|
Value="{StaticResource ListHeaderBackgroundColor}" />
|
||||||
<Setter Property="TextColor"
|
<Setter Property="TextColor"
|
||||||
|
|
|
@ -353,7 +353,15 @@ namespace Bit.iOS.Core.Services
|
||||||
|
|
||||||
public bool UsingDarkTheme()
|
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)
|
private void ImagePicker_FinishedPickingMedia(object sender, UIImagePickerMediaPickedEventArgs e)
|
||||||
|
|
Loading…
Reference in a new issue