From e4926c44252831f859e7ef51bfbdca6d288bcf76 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 13 Jun 2016 22:04:25 -0400 Subject: [PATCH] Added favorites tab with new selected icon capabilities in TabbedPage --- src/App/Pages/MainPage.cs | 5 +++ src/App/Resources/AppResources.Designer.cs | 9 ++++ src/App/Resources/AppResources.resx | 4 ++ .../Controls/ExtendedTabbedPageRenderer.cs | 41 ++++++++++++++++++ src/iOS/Resources/star.png | Bin 0 -> 556 bytes src/iOS/Resources/star@2x.png | Bin 0 -> 1005 bytes src/iOS/Resources/star@3x.png | Bin 0 -> 1363 bytes src/iOS/Resources/star_selected.png | Bin 0 -> 444 bytes src/iOS/Resources/star_selected@2x.png | Bin 0 -> 706 bytes src/iOS/Resources/star_selected@3x.png | Bin 0 -> 956 bytes src/iOS/iOS.csproj | 18 ++++++++ 11 files changed, 77 insertions(+) create mode 100644 src/iOS/Resources/star.png create mode 100644 src/iOS/Resources/star@2x.png create mode 100644 src/iOS/Resources/star@3x.png create mode 100644 src/iOS/Resources/star_selected.png create mode 100644 src/iOS/Resources/star_selected@2x.png create mode 100644 src/iOS/Resources/star_selected@3x.png diff --git a/src/App/Pages/MainPage.cs b/src/App/Pages/MainPage.cs index 0657c8fd8..881330384 100644 --- a/src/App/Pages/MainPage.cs +++ b/src/App/Pages/MainPage.cs @@ -13,9 +13,13 @@ namespace Bit.App.Pages TintColor = Color.FromHex("ffffff"); var settingsNavigation = new ExtendedNavigationPage(new SettingsPage()); + var favoritesNavigation = new ExtendedNavigationPage(new VaultListSitesPage()); var vaultNavigation = new ExtendedNavigationPage(new VaultListSitesPage()); var syncNavigation = new ExtendedNavigationPage(new SyncPage()); + favoritesNavigation.Title = AppResources.Favorites; + favoritesNavigation.Icon = "star"; + vaultNavigation.Title = AppResources.MyVault; vaultNavigation.Icon = "fa-lock"; @@ -25,6 +29,7 @@ namespace Bit.App.Pages settingsNavigation.Title = AppResources.Settings; settingsNavigation.Icon = "fa-cogs"; + Children.Add(favoritesNavigation); Children.Add(vaultNavigation); Children.Add(syncNavigation); Children.Add(settingsNavigation); diff --git a/src/App/Resources/AppResources.Designer.cs b/src/App/Resources/AppResources.Designer.cs index 542410d9b..e0eccd502 100644 --- a/src/App/Resources/AppResources.Designer.cs +++ b/src/App/Resources/AppResources.Designer.cs @@ -178,6 +178,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Favorites. + /// + internal static string Favorites { + get { + return ResourceManager.GetString("Favorites", resourceCulture); + } + } + /// /// Looks up a localized string similar to Folder. /// diff --git a/src/App/Resources/AppResources.resx b/src/App/Resources/AppResources.resx index 415ae9eed..8519e6c16 100644 --- a/src/App/Resources/AppResources.resx +++ b/src/App/Resources/AppResources.resx @@ -168,6 +168,10 @@ Email Address Full label for a email address. + + Favorites + Title for your favorite items in the vault. + Folder Label for a folder. diff --git a/src/iOS/Controls/ExtendedTabbedPageRenderer.cs b/src/iOS/Controls/ExtendedTabbedPageRenderer.cs index b099d6311..80fa57254 100644 --- a/src/iOS/Controls/ExtendedTabbedPageRenderer.cs +++ b/src/iOS/Controls/ExtendedTabbedPageRenderer.cs @@ -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 { } + } } } diff --git a/src/iOS/Resources/star.png b/src/iOS/Resources/star.png new file mode 100644 index 0000000000000000000000000000000000000000..5bab927173d8667df50e82f5b405f88b3bd0f408 GIT binary patch literal 556 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@H3?x5i&EW)6_X2!ET!Hj31}jashyuOmRTAVE z%)rRR%)-jX&cVsW&C4$!BrGB(DI+VVprod$rLAjZVqsG=M+<6NYEnc;D!-1pc&R@QIb5X|B7@(<}JzX3_BqU1@c7`=MFgRR1ej~)C zQ&(??imu+&sk0`|l33CD?>~R(0|g)UUDK~H?tEiZInBAq(}|@a)5khav~u6JswI^`GCPU8T0N)9xMft=E%(dN{HCV--C8TkT?n k_>m`{=Ijj?Vf+7^b$`A<>xmWbtU+<^>FVdQ&MBb@0M;6V0{{R3 literal 0 HcmV?d00001 diff --git a/src/iOS/Resources/star@2x.png b/src/iOS/Resources/star@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..f0b893e464f5277fa51d83912b1096c69c0dab8c GIT binary patch literal 1005 zcmeAS@N?(olHy`uVBq!ia0vp^Iv~u!3?wz9Rv9xeFct>*gt!8^qkx_vARHO>0%%`V zNswPK10xeN3o9Et2NyRlAHRU0u!yL*q?ELbtem`pqLQ+jx|WWyiMfTPwXL1KgQJtH zyQi0LU`TjGOl*8&Qc6a4PHuidacOl;T|;YkPhbDUDbr`op1XL}`VE`5Zr{0U&w+!7 zkDoYm?&9U^H}5=n^yJx#mv7&H{QUL%&)TvR<-0**?vHp?Kx4g3pHI~2hI5{hLoxIZgqYt+) zN_LsENlo|F#3j7nQupTjY|;+Xl}(kOUUp6Q8_RUnr5^-iCbnC|EA+b6^s>V4$t`j(*=*RjeB=DDpG$%-e_ALn-5bM3Q5Q?`|e%5TpV z=6IHJQAXp0i0)#cqqnbzJFK}igXPMcoQMP0l5Jd{@MOiA=~yLQo!e~?eE9O+T~a!y zwj_lYxK3kIE@INZfBE{`QyQ`BZcdHJWaM`antq*8hOIm3e%Ow?)6*u!z3M!ndB==9 t(PqwC+rz09eh*jbFMpBx==6jAzquLvQWKAy46OhqSx;9#mvv4FO#l)n6bAqR literal 0 HcmV?d00001 diff --git a/src/iOS/Resources/star@3x.png b/src/iOS/Resources/star@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..36d080c54501755f04a6de8e75ff2c965244b143 GIT binary patch literal 1363 zcmeAS@N?(olHy`uVBq!ia0vp^P9V&|3?#2~eYnNIz_>HOC&U%V9R))%1U5!XumasZ zsU*lRn1PXrnT3^&or9B$n}?T=UqDbuL{wZtQc7AzR!&|)QCUS*O}qFq$yLU z&zLoP?z{zy7B5?|YW=1yTet7pbKv0N<0sCXJAd)&^_#cuJb3iv*^8HN-+%o4_507? ze}By>_GMsT+V1J%7$PD0_TcYuky3_Z55HR*b1SE$EDhvJ@|ZEJ*VRvIY3vf8&u&pG zGF@GhCA*(ai`C(54Ey%&XLq!?*w;6A=KNe)TqXC{T&7@3_{Cs9y~d(X2LtU~KTPT7 zW;u0q`N=>z*JlTU`Sg0u323m-pY>J9;?%km%Qs0^oI2B*_|lsx^;xjtrM!YEp%aTI zt+ASCRFvr9JDqdN#PeN&m-Py!_)aw5b$r!BO<{4it46L1d}>a)=_)_a=vG?3cu7s7_J*L#Hwf3H}*zHoq+<@*~`4bB2 zbHcpiIj5Dqx;TTsak5+X8S4X*-u(%eeP_sDV4n9+HZM0YE8pzFoVD#U9v`T7TbVPX zb*cE3#MikRw(CUV)*cXbS6t({LOy8HA(JWJH4lA|{jo24quaCxS=*H?r!UwOei0}u z7qG_m{{h!%!FfN0)2gQ|$YvAUrrk5M;n$8JiPZ-@7xUHHJFoNy8r|&s>I0*X#L_Q@ z`&V5K-r%b_lj|{8VfSUPOo=LyM+T{jOY9Q;63q@R2->)6&$0m3b6QgaH8SQd{T-Kn zRHN6sW_2kucf9D8YrNJ|nnKh2ugyq4@MyxVb%k-7dpyowTGgw%qfp#WV(q6DQmVh3 zG}nI0{;=&%m`IAFkOytIy%@f+)M^O+s&%=3Ft^!Xci!HRmUH zQ`0QBm62Ybc$cfp>|d}cKKGi4&ig4TT5p1w*ncfm&pXt=x9Y%Y?Sfk#lVie|`dMEF z$f|wWFz@w;+modhLeVx(Th-8z{ z<09w&^(<>!Yhlk|E*HEcTD@44BYbia-UFc^o{i% i>(-mh+5TmJ!G9)YWB&c`JN0gZ3ItLWSHTug9C*6=xvXTl?3?( zGcYnSv#_#raB^|;2nvfzNJ-1cDJUwdXlUygn3$SdSX%k`1_p(MMJ8q!7MIsGHFtLR zO`J4k)}qBrSFPQ&W#`co=Puv8_u$Ek*Kgl{{QULj@4s93o;c0Gz^LZw;usY~gYdf$aXkE7RqASZ> zibaCb<|@?-d)*chSs1o7K`zT*iQSw#Yx(x* zFo?RHnqU+snbo5Zup|A2Opx)L&*laRavRV4J1;wS;4X{Z+Ak6jZ7mm7D<>Q>zbST- z+vCi{xkfD3D!NBxH_deP*?2beh{Rs5lrxjrlGL~ZA~t{6U&Bz7yZO$?RS(aDQlh7; KpUXO@geCy33%$?) literal 0 HcmV?d00001 diff --git a/src/iOS/Resources/star_selected@3x.png b/src/iOS/Resources/star_selected@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..54e26da3a288d4f88c72134e549ebaa173ff12fe GIT binary patch literal 956 zcmeAS@N?(olHy`uVBq!ia0vp^P9V&|3?#2~eYnNIz-SlX6XFWwjsmhnAlERg9jH08 zB*-tAfsu)sg_Vt+gOi(wk6%DgNJLazN=`vVRZU$(OWVlA)W+7)#m&>p+sD_>KOiV9 zJR&A8DLFkOGdsVau(Z6QyKly;wGz}5{W-MlekVnA z-k8pH!()c}glYcTAjCvrpdZ__oMqr_%32 vCEsix^DNn8o+@EcFCDb6VIt?B>Hiom?BsL_ar*Wflmb0n{an^LB{Ts59#R&O literal 0 HcmV?d00001 diff --git a/src/iOS/iOS.csproj b/src/iOS/iOS.csproj index 59eae034b..2470f00e7 100644 --- a/src/iOS/iOS.csproj +++ b/src/iOS/iOS.csproj @@ -375,6 +375,24 @@ + + + + + + + + + + + + + + + + + +