From d2d8ee504d5a9a87449f0d2c2ecd2e26e39ff27f Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 15 Feb 2017 21:56:02 -0500 Subject: [PATCH] cached images --- src/Android/Android.csproj | 16 +++++++++++++++ src/Android/MainApplication.cs | 2 ++ src/Android/packages.config | 2 ++ src/App/App.csproj | 12 +++++++++++ src/App/Controls/FormEntryCell.cs | 7 +++++-- src/App/Pages/HomePage.cs | 7 +++++-- src/App/Pages/Settings/SettingsAboutPage.cs | 7 +++++-- .../Pages/Tools/ToolsAutofillServicePage.cs | 9 +++++---- src/App/Pages/Tools/ToolsExtensionPage.cs | 19 ++++++++++++------ src/App/Pages/Tools/ToolsPage.cs | 7 +++++-- src/App/Pages/Vault/VaultListLoginsPage.cs | 3 ++- src/App/packages.config | 2 ++ src/iOS/AppDelegate.cs | 2 ++ src/iOS/iOS.csproj | 20 +++++++++++++++++++ src/iOS/packages.config | 3 +++ 15 files changed, 99 insertions(+), 19 deletions(-) diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj index c6aad805e..dd238eb26 100644 --- a/src/Android/Android.csproj +++ b/src/Android/Android.csproj @@ -91,6 +91,22 @@ ..\..\packages\BouncyCastle.1.8.1\lib\BouncyCastle.Crypto.dll True + + ..\..\packages\Xamarin.FFImageLoading.2.2.8\lib\MonoAndroid10\FFImageLoading.dll + True + + + ..\..\packages\Xamarin.FFImageLoading.Forms.2.2.8\lib\MonoAndroid10\FFImageLoading.Forms.dll + True + + + ..\..\packages\Xamarin.FFImageLoading.Forms.2.2.8\lib\MonoAndroid10\FFImageLoading.Forms.Droid.dll + True + + + ..\..\packages\Xamarin.FFImageLoading.2.2.8\lib\MonoAndroid10\FFImageLoading.Platform.dll + True + ..\..\packages\Xamarin.Forms.2.3.3.180\lib\MonoAndroid10\FormsViewGroup.dll True diff --git a/src/Android/MainApplication.cs b/src/Android/MainApplication.cs index aee406656..8357804bf 100644 --- a/src/Android/MainApplication.cs +++ b/src/Android/MainApplication.cs @@ -20,6 +20,7 @@ using XLabs.Ioc.Unity; using System.Threading.Tasks; using Plugin.Settings.Abstractions; using Xamarin.Android.Net; +using FFImageLoading.Forms.Droid; namespace Bit.Android { @@ -232,6 +233,7 @@ namespace Bit.Android CrossPushNotification.Initialize(container.Resolve(), "962181367620"); container.RegisterInstance(CrossPushNotification.Current, new ContainerControlledLifetimeManager()); + CachedImageRenderer.Init(); Resolver.SetResolver(new UnityResolver(container)); CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity); diff --git a/src/Android/packages.config b/src/Android/packages.config index 8804fed5e..ae60bb007 100644 --- a/src/Android/packages.config +++ b/src/Android/packages.config @@ -36,6 +36,8 @@ + + diff --git a/src/App/App.csproj b/src/App/App.csproj index 03b24fe92..fdcb8b5cb 100644 --- a/src/App/App.csproj +++ b/src/App/App.csproj @@ -260,6 +260,18 @@ ..\..\packages\Acr.UserDialogs.6.3.3\lib\portable-win+net45+wp8+win8+wpa81\Acr.UserDialogs.Interface.dll True + + ..\..\packages\Xamarin.FFImageLoading.2.2.8\lib\portable-net45+win8+wpa81+wp8\FFImageLoading.dll + True + + + ..\..\packages\Xamarin.FFImageLoading.Forms.2.2.8\lib\portable-net45+win8+wpa81+wp8\FFImageLoading.Forms.dll + True + + + ..\..\packages\Xamarin.FFImageLoading.2.2.8\lib\portable-net45+win8+wpa81+wp8\FFImageLoading.Platform.dll + True + ..\..\packages\HockeySDK.Xamarin.4.1.0\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10\HockeySDK.dll True diff --git a/src/App/Controls/FormEntryCell.cs b/src/App/Controls/FormEntryCell.cs index 368490417..c4a869a1f 100644 --- a/src/App/Controls/FormEntryCell.cs +++ b/src/App/Controls/FormEntryCell.cs @@ -1,4 +1,5 @@ using Bit.App.Abstractions; +using FFImageLoading.Forms; using System; using Xamarin.Forms; using XLabs.Ioc; @@ -67,11 +68,13 @@ namespace Bit.App.Controls { _tgr = new TapGestureRecognizer(); - var theImage = new Image + var theImage = new CachedImage { Source = imageSource, HorizontalOptions = LayoutOptions.Start, - VerticalOptions = LayoutOptions.Center + VerticalOptions = LayoutOptions.Center, + WidthRequest = 18, + HeightRequest = 18 }; theImage.GestureRecognizers.Add(_tgr); diff --git a/src/App/Pages/HomePage.cs b/src/App/Pages/HomePage.cs index ee5306a96..4ea00d4da 100644 --- a/src/App/Pages/HomePage.cs +++ b/src/App/Pages/HomePage.cs @@ -7,6 +7,7 @@ using Xamarin.Forms; using XLabs.Ioc; using Plugin.Settings.Abstractions; using Bit.App.Controls; +using FFImageLoading.Forms; namespace Bit.App.Pages { @@ -30,11 +31,13 @@ namespace Bit.App.Pages { MessagingCenter.Send(Application.Current, "ShowStatusBar", false); - var logo = new Image + var logo = new CachedImage { Source = "logo", VerticalOptions = LayoutOptions.CenterAndExpand, - HorizontalOptions = LayoutOptions.Center + HorizontalOptions = LayoutOptions.Center, + WidthRequest = 282, + HeightRequest = 44 }; var message = new Label diff --git a/src/App/Pages/Settings/SettingsAboutPage.cs b/src/App/Pages/Settings/SettingsAboutPage.cs index 22d098867..c01ef86f6 100644 --- a/src/App/Pages/Settings/SettingsAboutPage.cs +++ b/src/App/Pages/Settings/SettingsAboutPage.cs @@ -4,6 +4,7 @@ using Xamarin.Forms; using Bit.App.Abstractions; using XLabs.Ioc; using Bit.App.Resources; +using FFImageLoading.Forms; namespace Bit.App.Pages { @@ -19,10 +20,12 @@ namespace Bit.App.Pages public void Init() { - var logo = new Image + var logo = new CachedImage { Source = "logo", - HorizontalOptions = LayoutOptions.Center + HorizontalOptions = LayoutOptions.Center, + WidthRequest = 282, + HeightRequest = 44 }; var versionLabel = new Label diff --git a/src/App/Pages/Tools/ToolsAutofillServicePage.cs b/src/App/Pages/Tools/ToolsAutofillServicePage.cs index 52a425b7b..887bfbeaf 100644 --- a/src/App/Pages/Tools/ToolsAutofillServicePage.cs +++ b/src/App/Pages/Tools/ToolsAutofillServicePage.cs @@ -4,6 +4,7 @@ using Xamarin.Forms; using XLabs.Ioc; using Bit.App.Abstractions; using Bit.App.Resources; +using FFImageLoading.Forms; namespace Bit.App.Pages { @@ -74,7 +75,7 @@ namespace Bit.App.Pages TextColor = Color.Black }; - var step1Image = new Image + var step1Image = new CachedImage { Source = "accessibility_step1", HorizontalOptions = LayoutOptions.Center, @@ -92,7 +93,7 @@ namespace Bit.App.Pages TextColor = Color.Black }; - var step2Image = new Image + var step2Image = new CachedImage { Source = "accessibility_step2", HorizontalOptions = LayoutOptions.Center, @@ -119,7 +120,7 @@ namespace Bit.App.Pages TextColor = Color.Black }; - var tapNotificationImage = new Image + var tapNotificationImage = new CachedImage { Source = "accessibility_notification", HorizontalOptions = LayoutOptions.Center, @@ -128,7 +129,7 @@ namespace Bit.App.Pages HeightRequest = 74 }; - var tapNotificationIcon = new Image + var tapNotificationIcon = new CachedImage { Source = "accessibility_notification_icon", HorizontalOptions = LayoutOptions.Center, diff --git a/src/App/Pages/Tools/ToolsExtensionPage.cs b/src/App/Pages/Tools/ToolsExtensionPage.cs index fcecaab26..5e23893f4 100644 --- a/src/App/Pages/Tools/ToolsExtensionPage.cs +++ b/src/App/Pages/Tools/ToolsExtensionPage.cs @@ -8,6 +8,7 @@ using Xamarin.Forms; using XLabs.Ioc; using Bit.App.Abstractions; using Bit.App.Resources; +using FFImageLoading.Forms; namespace Bit.App.Pages { @@ -52,12 +53,14 @@ namespace Bit.App.Pages LineBreakMode = LineBreakMode.WordWrap }; - var notStartedImage = new Image + var notStartedImage = new CachedImage { Source = "ext-more", VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.Center, - Margin = new Thickness(0, -10, 0, 0) + Margin = new Thickness(0, -10, 0, 0), + WidthRequest = 290, + HeightRequest = 252 }; var notStartedButton = new ExtendedButton @@ -101,12 +104,14 @@ namespace Bit.App.Pages LineBreakMode = LineBreakMode.WordWrap }; - var notActivatedImage = new Image + var notActivatedImage = new CachedImage { Source = "ext-act", VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.Center, - Margin = new Thickness(0, -10, 0, 0) + Margin = new Thickness(0, -10, 0, 0), + WidthRequest = 290, + HeightRequest = 252 }; var notActivatedButton = new ExtendedButton @@ -151,12 +156,14 @@ namespace Bit.App.Pages Margin = new Thickness(0, 10, 0, 0) }; - var activatedImage = new Image + var activatedImage = new CachedImage { Source = "ext-use", VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.Center, - Margin = new Thickness(0, -10, 0, 0) + Margin = new Thickness(0, -10, 0, 0), + WidthRequest = 290, + HeightRequest = 252 }; var activatedButton = new ExtendedButton diff --git a/src/App/Pages/Tools/ToolsPage.cs b/src/App/Pages/Tools/ToolsPage.cs index a5a1080fe..e447c3127 100644 --- a/src/App/Pages/Tools/ToolsPage.cs +++ b/src/App/Pages/Tools/ToolsPage.cs @@ -6,6 +6,7 @@ using Bit.App.Controls; using Bit.App.Resources; using Xamarin.Forms; using XLabs.Ioc; +using FFImageLoading.Forms; namespace Bit.App.Pages { @@ -127,9 +128,11 @@ namespace Bit.App.Pages Text = detailText }; - var image = new Image + var image = new CachedImage { - Source = imageSource + Source = imageSource, + WidthRequest = 44, + HeightRequest = 44 }; var grid = new Grid diff --git a/src/App/Pages/Vault/VaultListLoginsPage.cs b/src/App/Pages/Vault/VaultListLoginsPage.cs index 3907cab1b..4246297cc 100644 --- a/src/App/Pages/Vault/VaultListLoginsPage.cs +++ b/src/App/Pages/Vault/VaultListLoginsPage.cs @@ -14,6 +14,7 @@ using Plugin.Settings.Abstractions; using Plugin.Connectivity.Abstractions; using System.Collections.Generic; using System.Threading; +using FFImageLoading.Forms; namespace Bit.App.Pages { @@ -490,7 +491,7 @@ namespace Bit.App.Pages { public VaultListHeaderViewCell(VaultListLoginsPage page) { - var image = new Image + var image = new CachedImage { Source = "folder", WidthRequest = 18, diff --git a/src/App/packages.config b/src/App/packages.config index 762576557..8496f4a0b 100644 --- a/src/App/packages.config +++ b/src/App/packages.config @@ -21,6 +21,8 @@ + + \ No newline at end of file diff --git a/src/iOS/AppDelegate.cs b/src/iOS/AppDelegate.cs index 1c9fd7fa8..63cba7cfc 100644 --- a/src/iOS/AppDelegate.cs +++ b/src/iOS/AppDelegate.cs @@ -25,6 +25,7 @@ using Bit.App.Pages; using HockeyApp.iOS; using Bit.iOS.Core; using Google.Analytics; +using FFImageLoading.Forms.Touch; namespace Bit.iOS { @@ -288,6 +289,7 @@ namespace Bit.iOS CrossPushNotification.Initialize(container.Resolve()); container.RegisterInstance(CrossPushNotification.Current, new ContainerControlledLifetimeManager()); + CachedImageRenderer.Init(); Resolver.SetResolver(new UnityResolver(container)); } diff --git a/src/iOS/iOS.csproj b/src/iOS/iOS.csproj index 7b0cb1208..7392772b9 100644 --- a/src/iOS/iOS.csproj +++ b/src/iOS/iOS.csproj @@ -272,6 +272,22 @@ ..\..\packages\BTProgressHUD.1.2.0.3\lib\Xamarin.iOS10\BTProgressHUD.dll True + + ..\..\packages\Xamarin.FFImageLoading.2.2.8\lib\Xamarin.iOS10\FFImageLoading.dll + True + + + ..\..\packages\Xamarin.FFImageLoading.Forms.2.2.8\lib\Xamarin.iOS10\FFImageLoading.Forms.dll + True + + + ..\..\packages\Xamarin.FFImageLoading.Forms.2.2.8\lib\Xamarin.iOS10\FFImageLoading.Forms.Touch.dll + True + + + ..\..\packages\Xamarin.FFImageLoading.2.2.8\lib\Xamarin.iOS10\FFImageLoading.Platform.dll + True + ..\..\packages\Xamarin.Google.iOS.Analytics.3.17.0\lib\Xamarin.iOS10\Google.Analytics.dll True @@ -374,6 +390,10 @@ ..\..\packages\Validation.2.3.7\lib\dotnet\Validation.dll True + + ..\..\packages\WebP.Touch.1.0.2\lib\Xamarin.iOS10\WebP.Touch.dll + True + ..\..\packages\Xamarin.Forms.2.3.3.180\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll True diff --git a/src/iOS/packages.config b/src/iOS/packages.config index f884d0303..b8e44b662 100644 --- a/src/iOS/packages.config +++ b/src/iOS/packages.config @@ -21,10 +21,13 @@ + + +