mirror of
https://github.com/bitwarden/mobile
synced 2025-12-31 07:33:46 +00:00
Added favorites tab with new selected icon capabilities in TabbedPage
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Bit.App.Controls;
|
||||
using Bit.iOS.Controls;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
@@ -19,5 +20,45 @@ namespace Bit.iOS.Controls
|
||||
TabBar.BarTintColor = page.BarTintColor.ToUIColor();
|
||||
TabBar.BackgroundColor = page.BackgroundColor.ToUIColor();
|
||||
}
|
||||
|
||||
public override void ViewWillAppear(bool animated)
|
||||
{
|
||||
if(TabBar?.Items == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var tabs = Element as TabbedPage;
|
||||
if(tabs != null)
|
||||
{
|
||||
for(int i = 0; i < TabBar.Items.Length; i++)
|
||||
{
|
||||
UpdateItem(TabBar.Items[i], tabs.Children[i].Icon);
|
||||
}
|
||||
}
|
||||
|
||||
base.ViewWillAppear(animated);
|
||||
}
|
||||
|
||||
private void UpdateItem(UITabBarItem item, string icon)
|
||||
{
|
||||
if(item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
icon = string.Concat(icon, "_selected");
|
||||
if(item?.SelectedImage?.AccessibilityIdentifier == icon)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
item.SelectedImage = UIImage.FromBundle(icon);
|
||||
item.SelectedImage.AccessibilityIdentifier = icon;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
src/iOS/Resources/star.png
Normal file
BIN
src/iOS/Resources/star.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 556 B |
BIN
src/iOS/Resources/star@2x.png
Normal file
BIN
src/iOS/Resources/star@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1005 B |
BIN
src/iOS/Resources/star@3x.png
Normal file
BIN
src/iOS/Resources/star@3x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
src/iOS/Resources/star_selected.png
Normal file
BIN
src/iOS/Resources/star_selected.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 444 B |
BIN
src/iOS/Resources/star_selected@2x.png
Normal file
BIN
src/iOS/Resources/star_selected@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 706 B |
BIN
src/iOS/Resources/star_selected@3x.png
Normal file
BIN
src/iOS/Resources/star_selected@3x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 956 B |
@@ -375,6 +375,24 @@
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\bg%403x.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\star.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\star%402x.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\star%403x.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\star_selected.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\star_selected%402x.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\star_selected%403x.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
|
||||
Reference in New Issue
Block a user