mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 18:38:27 +03:00
theme splash for extensions
This commit is contained in:
parent
9145fa1c48
commit
fbd62153ee
7 changed files with 56 additions and 13 deletions
|
@ -23,6 +23,8 @@ namespace Bit.iOS.Autofill
|
|||
{
|
||||
InitApp();
|
||||
base.ViewDidLoad();
|
||||
Logo.Image = new UIImage(ThemeHelpers.LightTheme ? "logo.png" : "logo_white.png");
|
||||
View.BackgroundColor = ThemeHelpers.SplashBackgroundColor;
|
||||
_context = new Context
|
||||
{
|
||||
ExtContext = ExtensionContext
|
||||
|
@ -249,6 +251,7 @@ namespace Bit.iOS.Autofill
|
|||
ServiceContainer.Init();
|
||||
iOSCoreHelpers.RegisterHockeyApp();
|
||||
iOSCoreHelpers.Bootstrap();
|
||||
iOSCoreHelpers.AppearanceAdjustments();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,8 +14,16 @@ namespace Bit.iOS.Autofill
|
|||
[Register ("CredentialProviderViewController")]
|
||||
partial class CredentialProviderViewController
|
||||
{
|
||||
[Outlet]
|
||||
[GeneratedCode ("iOS Designer", "1.0")]
|
||||
UIKit.UIImageView Logo { get; set; }
|
||||
|
||||
void ReleaseDesignerOutlets ()
|
||||
{
|
||||
if (Logo != null) {
|
||||
Logo.Dispose ();
|
||||
Logo = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,6 +32,7 @@
|
|||
<segue destination="6855" kind="presentation" identifier="lockPasswordSegue" id="9874"/>
|
||||
<segue destination="10580" kind="presentation" identifier="setupSegue" modalTransitionStyle="coverVertical" id="11089"/>
|
||||
<segue destination="11552" kind="show" identifier="loginSearchSegue" id="12959"/>
|
||||
<outlet property="Logo" destination="1713" id="name-outlet-1713"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="45" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
|
|
|
@ -5,31 +5,51 @@ namespace Bit.iOS.Core.Utilities
|
|||
{
|
||||
public static class ThemeHelpers
|
||||
{
|
||||
public static bool LightTheme = true;
|
||||
public static UIColor SplashBackgroundColor = Xamarin.Forms.Color.FromHex("#efeff4").ToUIColor();
|
||||
public static UIColor BackgroundColor = Xamarin.Forms.Color.FromHex("#ffffff").ToUIColor();
|
||||
public static UIColor MutedColor = Xamarin.Forms.Color.FromHex("#777777").ToUIColor();
|
||||
|
||||
public static void SetAppearance(string theme)
|
||||
{
|
||||
var lightTheme = false;
|
||||
var mutedColor = Xamarin.Forms.Color.FromHex("#777777").ToUIColor();
|
||||
SetThemeVariables(theme);
|
||||
UIStepper.Appearance.TintColor = MutedColor;
|
||||
if(!LightTheme)
|
||||
{
|
||||
UISwitch.Appearance.TintColor = MutedColor;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetExtensionAppearance(string theme)
|
||||
{
|
||||
SetAppearance(theme);
|
||||
UIView.Appearance.BackgroundColor = BackgroundColor;
|
||||
}
|
||||
|
||||
private static void SetThemeVariables(string theme)
|
||||
{
|
||||
LightTheme = false;
|
||||
if(theme == "dark")
|
||||
{
|
||||
mutedColor = Xamarin.Forms.Color.FromHex("#a3a3a3").ToUIColor();
|
||||
MutedColor = Xamarin.Forms.Color.FromHex("#a3a3a3").ToUIColor();
|
||||
BackgroundColor = Xamarin.Forms.Color.FromHex("#303030").ToUIColor();
|
||||
SplashBackgroundColor = Xamarin.Forms.Color.FromHex("#222222").ToUIColor();
|
||||
}
|
||||
else if(theme == "black")
|
||||
{
|
||||
mutedColor = Xamarin.Forms.Color.FromHex("#a3a3a3").ToUIColor();
|
||||
MutedColor = Xamarin.Forms.Color.FromHex("#a3a3a3").ToUIColor();
|
||||
BackgroundColor = Xamarin.Forms.Color.FromHex("#000000").ToUIColor();
|
||||
SplashBackgroundColor = BackgroundColor;
|
||||
}
|
||||
else if(theme == "nord")
|
||||
{
|
||||
mutedColor = Xamarin.Forms.Color.FromHex("#d8dee9").ToUIColor();
|
||||
MutedColor = Xamarin.Forms.Color.FromHex("#d8dee9").ToUIColor();
|
||||
BackgroundColor = Xamarin.Forms.Color.FromHex("#3b4252").ToUIColor();
|
||||
SplashBackgroundColor = Xamarin.Forms.Color.FromHex("#2e3440").ToUIColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
lightTheme = true;
|
||||
}
|
||||
|
||||
UIStepper.Appearance.TintColor = mutedColor;
|
||||
if(!lightTheme)
|
||||
{
|
||||
UISwitch.Appearance.TintColor = mutedColor;
|
||||
LightTheme = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,8 @@ namespace Bit.iOS.Extension
|
|||
{
|
||||
InitApp();
|
||||
base.ViewDidLoad();
|
||||
View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);
|
||||
Logo.Image = new UIImage(ThemeHelpers.LightTheme ? "logo.png" : "logo_white.png");
|
||||
View.BackgroundColor = ThemeHelpers.SplashBackgroundColor;
|
||||
_context.ExtContext = ExtensionContext;
|
||||
foreach(var item in ExtensionContext.InputItems)
|
||||
{
|
||||
|
@ -385,6 +386,7 @@ namespace Bit.iOS.Extension
|
|||
ServiceContainer.Init();
|
||||
iOSCoreHelpers.RegisterHockeyApp();
|
||||
iOSCoreHelpers.Bootstrap();
|
||||
iOSCoreHelpers.AppearanceAdjustments();
|
||||
}
|
||||
|
||||
private bool IsLocked()
|
||||
|
|
|
@ -14,8 +14,16 @@ namespace Bit.iOS.Extension
|
|||
[Register ("LoadingViewController")]
|
||||
partial class LoadingViewController
|
||||
{
|
||||
[Outlet]
|
||||
[GeneratedCode ("iOS Designer", "1.0")]
|
||||
UIKit.UIImageView Logo { get; set; }
|
||||
|
||||
void ReleaseDesignerOutlets ()
|
||||
{
|
||||
if (Logo != null) {
|
||||
Logo.Dispose ();
|
||||
Logo = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,6 +32,7 @@
|
|||
<segue destination="6855" kind="presentation" identifier="lockPasswordSegue" id="9874"/>
|
||||
<segue destination="1845" kind="presentation" identifier="newLoginSegue" modalPresentationStyle="fullScreen" modalTransitionStyle="coverVertical" id="10498"/>
|
||||
<segue destination="10580" kind="presentation" identifier="setupSegue" modalTransitionStyle="coverVertical" id="11089"/>
|
||||
<outlet property="Logo" destination="1713" id="name-outlet-1713"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="45" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
|
|
Loading…
Reference in a new issue