search bar for ios

This commit is contained in:
Kyle Spearrin 2019-06-24 11:53:19 -04:00
parent 38f91bce1c
commit d81585ccc3
5 changed files with 58 additions and 43 deletions

View file

@ -20,34 +20,33 @@
<u:DateTimeConverter x:Key="dateTime" />
<ToolbarItem Text="{u:I18n Close}" Clicked="Close_Clicked" Order="Primary" Priority="-1"
x:Name="_closeItem" x:Key="closeItem" />
<StackLayout
Orientation="Horizontal"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand"
Spacing="0"
Padding="0"
x:Name="_titleLayout"
x:Key="titleLayout">
<controls:MiButton
StyleClass="btn-title, btn-title-platform"
Text="&#xe5c4;"
VerticalOptions="CenterAndExpand"
Clicked="BackButton_Clicked"
x:Name="_backButton" />
<SearchBar
x:Name="_searchBar"
HorizontalOptions="FillAndExpand"
TextChanged="SearchBar_TextChanged"
SearchButtonPressed="SearchBar_SearchButtonPressed"
Placeholder="{Binding PageTitle}" />
</StackLayout>
<BoxView StyleClass="list-section-separator-bottom, list-section-separator-bottom-platform"
x:Name="_separator" x:Key="separator" />
</ResourceDictionary>
</ContentPage.Resources>
<NavigationPage.TitleView>
<StackLayout
Orientation="Horizontal"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand"
Spacing="0"
Padding="0"
x:Name="_titleLayout">
<controls:MiButton
StyleClass="btn-title, btn-title-platform"
Text="&#xe5c4;"
VerticalOptions="CenterAndExpand"
Clicked="BackButton_Clicked"
x:Name="_backButton" />
<SearchBar
x:Name="_searchBar"
HorizontalOptions="FillAndExpand"
BackgroundColor="Transparent"
TextChanged="SearchBar_TextChanged"
SearchButtonPressed="SearchBar_SearchButtonPressed"
Placeholder="{Binding PageTitle}" />
</StackLayout>
</NavigationPage.TitleView>
<StackLayout x:Name="_mainLayout">
<StackLayout x:Name="_mainLayout" Spacing="0" Padding="0">
<controls:FaLabel IsVisible="{Binding ShowSearchDirection}"
Text="&#xf002;"
StyleClass="text-muted"
@ -62,13 +61,13 @@
HorizontalOptions="CenterAndExpand"
HorizontalTextAlignment="Center" />
<ListView x:Name="_listView"
IsVisible="{Binding ShowList}"
ItemsSource="{Binding Ciphers}"
VerticalOptions="FillAndExpand"
HasUnevenRows="true"
CachingStrategy="RecycleElement"
ItemSelected="RowSelected"
StyleClass="list, list-platform">
IsVisible="{Binding ShowList}"
ItemsSource="{Binding Ciphers}"
VerticalOptions="FillAndExpand"
HasUnevenRows="true"
CachingStrategy="RecycleElement"
ItemSelected="RowSelected"
StyleClass="list, list-platform">
<ListView.ItemTemplate>
<DataTemplate x:DataType="views:CipherView">
<controls:CipherViewCell

View file

@ -43,7 +43,13 @@ namespace Bit.App.Pages
if(Device.RuntimePlatform == Device.iOS)
{
ToolbarItems.Add(_closeItem);
_titleLayout.Children.Remove(_backButton);
_searchBar.Placeholder = AppResources.Search;
_mainLayout.Children.Insert(0, _searchBar);
_mainLayout.Children.Insert(1, _separator);
}
else
{
NavigationPage.SetTitleView(this, _titleLayout);
}
_deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService");
}

View file

@ -21,6 +21,16 @@
<Setter Property="Margin"
Value="-4, 0, -4, -4" />
</Style>
<Style TargetType="SearchBar">
<Setter Property="BackgroundColor"
Value="Transparent" />
<Setter Property="TextColor"
Value="{StaticResource TitleEntryTextColor}" />
<Setter Property="CancelButtonColor"
Value="{StaticResource TitleEntryTextColor}" />
<Setter Property="PlaceholderColor"
Value="{StaticResource TitleEntryPlaceholderColor}" />
</Style>
<!-- Buttons -->

View file

@ -124,16 +124,6 @@
<Setter Property="TextColor"
Value="{StaticResource TitleTextColor}" />
</Style>
<Style TargetType="SearchBar">
<Setter Property="BackgroundColor"
Value="Transparent" />
<Setter Property="TextColor"
Value="{StaticResource TitleEntryTextColor}" />
<Setter Property="CancelButtonColor"
Value="{StaticResource TitleEntryTextColor}" />
<Setter Property="PlaceholderColor"
Value="{StaticResource TitleEntryPlaceholderColor}" />
</Style>
<!-- List -->
<Style TargetType="ListView"

View file

@ -26,6 +26,16 @@
<Setter Property="OnColor"
Value="{StaticResource SwitchOnColor}" />
</Style>
<Style TargetType="SearchBar">
<Setter Property="BackgroundColor"
Value="{StaticResource ListHeaderBackgroundColor}" />
<Setter Property="TextColor"
Value="{StaticResource TextColor}" />
<Setter Property="CancelButtonColor"
Value="{StaticResource PrimaryColor}" />
<Setter Property="PlaceholderColor"
Value="{StaticResource MutedColor}" />
</Style>
<!-- Buttons -->