1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-15 10:25:20 +01:00
This commit is contained in:
Kyle Spearrin 2019-05-29 15:50:20 -04:00
parent 40484a7bf0
commit a1741fdd67
14 changed files with 265 additions and 139 deletions

View File

@ -15,6 +15,7 @@ using Bit.Droid.Receivers;
using Bit.App.Models;
using Bit.Core.Enums;
using Android.Nfc;
using Bit.App.Utilities;
namespace Bit.Droid
{
@ -56,6 +57,7 @@ namespace Bit.Droid
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
UpdateTheme(ThemeManager.GetTheme());
base.OnCreate(savedInstanceState);
if(!CoreHelpers.InDebugMode())
{
@ -95,6 +97,10 @@ namespace Bit.Droid
{
ListenYubiKey((bool)message.Data);
}
else if(message.Command == "updatedTheme")
{
Recreate();
}
});
}
@ -255,5 +261,17 @@ namespace Bit.Droid
_messagingService.Send("gotYubiKeyOTP", otp);
}
}
private void UpdateTheme(string theme)
{
if(theme == "dark")
{
SetTheme(Resource.Style.DarkTheme);
}
else
{
SetTheme(Resource.Style.MainTheme);
}
}
}
}

View File

@ -6722,44 +6722,44 @@ namespace Bit.Droid
public partial class Color
{
// aapt resource value: 0x7f0b007b
public const int abc_background_cache_hint_selector_material_dark = 2131427451;
// aapt resource value: 0x7f0b0082
public const int abc_background_cache_hint_selector_material_dark = 2131427458;
// aapt resource value: 0x7f0b007c
public const int abc_background_cache_hint_selector_material_light = 2131427452;
// aapt resource value: 0x7f0b0083
public const int abc_background_cache_hint_selector_material_light = 2131427459;
// aapt resource value: 0x7f0b007d
public const int abc_btn_colored_borderless_text_material = 2131427453;
// aapt resource value: 0x7f0b0084
public const int abc_btn_colored_borderless_text_material = 2131427460;
// aapt resource value: 0x7f0b007e
public const int abc_btn_colored_text_material = 2131427454;
// aapt resource value: 0x7f0b0085
public const int abc_btn_colored_text_material = 2131427461;
// aapt resource value: 0x7f0b007f
public const int abc_color_highlight_material = 2131427455;
// aapt resource value: 0x7f0b0086
public const int abc_color_highlight_material = 2131427462;
// aapt resource value: 0x7f0b0080
public const int abc_hint_foreground_material_dark = 2131427456;
// aapt resource value: 0x7f0b0087
public const int abc_hint_foreground_material_dark = 2131427463;
// aapt resource value: 0x7f0b0081
public const int abc_hint_foreground_material_light = 2131427457;
// aapt resource value: 0x7f0b0088
public const int abc_hint_foreground_material_light = 2131427464;
// aapt resource value: 0x7f0b000c
public const int abc_input_method_navigation_guard = 2131427340;
// aapt resource value: 0x7f0b0082
public const int abc_primary_text_disable_only_material_dark = 2131427458;
// aapt resource value: 0x7f0b0089
public const int abc_primary_text_disable_only_material_dark = 2131427465;
// aapt resource value: 0x7f0b0083
public const int abc_primary_text_disable_only_material_light = 2131427459;
// aapt resource value: 0x7f0b008a
public const int abc_primary_text_disable_only_material_light = 2131427466;
// aapt resource value: 0x7f0b0084
public const int abc_primary_text_material_dark = 2131427460;
// aapt resource value: 0x7f0b008b
public const int abc_primary_text_material_dark = 2131427467;
// aapt resource value: 0x7f0b0085
public const int abc_primary_text_material_light = 2131427461;
// aapt resource value: 0x7f0b008c
public const int abc_primary_text_material_light = 2131427468;
// aapt resource value: 0x7f0b0086
public const int abc_search_url_text = 2131427462;
// aapt resource value: 0x7f0b008d
public const int abc_search_url_text = 2131427469;
// aapt resource value: 0x7f0b000d
public const int abc_search_url_text_normal = 2131427341;
@ -6770,29 +6770,29 @@ namespace Bit.Droid
// aapt resource value: 0x7f0b000f
public const int abc_search_url_text_selected = 2131427343;
// aapt resource value: 0x7f0b0087
public const int abc_secondary_text_material_dark = 2131427463;
// aapt resource value: 0x7f0b0088
public const int abc_secondary_text_material_light = 2131427464;
// aapt resource value: 0x7f0b0089
public const int abc_tint_btn_checkable = 2131427465;
// aapt resource value: 0x7f0b008a
public const int abc_tint_default = 2131427466;
// aapt resource value: 0x7f0b008b
public const int abc_tint_edittext = 2131427467;
// aapt resource value: 0x7f0b008c
public const int abc_tint_seek_thumb = 2131427468;
// aapt resource value: 0x7f0b008d
public const int abc_tint_spinner = 2131427469;
// aapt resource value: 0x7f0b008e
public const int abc_tint_switch_track = 2131427470;
public const int abc_secondary_text_material_dark = 2131427470;
// aapt resource value: 0x7f0b008f
public const int abc_secondary_text_material_light = 2131427471;
// aapt resource value: 0x7f0b0090
public const int abc_tint_btn_checkable = 2131427472;
// aapt resource value: 0x7f0b0091
public const int abc_tint_default = 2131427473;
// aapt resource value: 0x7f0b0092
public const int abc_tint_edittext = 2131427474;
// aapt resource value: 0x7f0b0093
public const int abc_tint_seek_thumb = 2131427475;
// aapt resource value: 0x7f0b0094
public const int abc_tint_spinner = 2131427476;
// aapt resource value: 0x7f0b0095
public const int abc_tint_switch_track = 2131427477;
// aapt resource value: 0x7f0b0078
public const int accent = 2131427448;
@ -6815,8 +6815,8 @@ namespace Bit.Droid
// aapt resource value: 0x7f0b0015
public const int background_material_light = 2131427349;
// aapt resource value: 0x7f0b0072
public const int black = 2131427442;
// aapt resource value: 0x7f0b006f
public const int black = 2131427439;
// aapt resource value: 0x7f0b0079
public const int border = 2131427449;
@ -6869,17 +6869,17 @@ namespace Bit.Droid
// aapt resource value: 0x7f0b000b
public const int cardview_shadow_start_color = 2131427339;
// aapt resource value: 0x7f0b0070
public const int colorAccent = 2131427440;
// aapt resource value: 0x7f0b0075
public const int colorAccent = 2131427445;
// aapt resource value: 0x7f0b006e
public const int colorPrimary = 2131427438;
// aapt resource value: 0x7f0b0073
public const int colorPrimary = 2131427443;
// aapt resource value: 0x7f0b006f
public const int colorPrimaryDark = 2131427439;
// aapt resource value: 0x7f0b0074
public const int colorPrimaryDark = 2131427444;
// aapt resource value: 0x7f0b008f
public const int common_google_signin_btn_text_dark = 2131427471;
// aapt resource value: 0x7f0b0096
public const int common_google_signin_btn_text_dark = 2131427478;
// aapt resource value: 0x7f0b0000
public const int common_google_signin_btn_text_dark_default = 2131427328;
@ -6893,8 +6893,8 @@ namespace Bit.Droid
// aapt resource value: 0x7f0b0003
public const int common_google_signin_btn_text_dark_pressed = 2131427331;
// aapt resource value: 0x7f0b0090
public const int common_google_signin_btn_text_light = 2131427472;
// aapt resource value: 0x7f0b0097
public const int common_google_signin_btn_text_light = 2131427479;
// aapt resource value: 0x7f0b0004
public const int common_google_signin_btn_text_light_default = 2131427332;
@ -6908,14 +6908,35 @@ namespace Bit.Droid
// aapt resource value: 0x7f0b0007
public const int common_google_signin_btn_text_light_pressed = 2131427335;
// aapt resource value: 0x7f0b0091
public const int common_google_signin_btn_tint = 2131427473;
// aapt resource value: 0x7f0b0098
public const int common_google_signin_btn_tint = 2131427480;
// aapt resource value: 0x7f0b007f
public const int dark_accent = 2131427455;
// aapt resource value: 0x7f0b0080
public const int dark_border = 2131427456;
// aapt resource value: 0x7f0b007c
public const int dark_colorAccent = 2131427452;
// aapt resource value: 0x7f0b007a
public const int dark_colorPrimary = 2131427450;
// aapt resource value: 0x7f0b007b
public const int dark_colorPrimaryDark = 2131427451;
// aapt resource value: 0x7f0b007e
public const int dark_darkaccent = 2131427454;
// aapt resource value: 0x7f0b007d
public const int dark_primary = 2131427453;
// aapt resource value: 0x7f0b0077
public const int darkaccent = 2131427447;
// aapt resource value: 0x7f0b0073
public const int darkgray = 2131427443;
// aapt resource value: 0x7f0b0070
public const int darkgray = 2131427440;
// aapt resource value: 0x7f0b0049
public const int design_bottom_navigation_shadow_color = 2131427401;
@ -6926,8 +6947,8 @@ namespace Bit.Droid
// aapt resource value: 0x7f0b004b
public const int design_default_color_primary_dark = 2131427403;
// aapt resource value: 0x7f0b0092
public const int design_error = 2131427474;
// aapt resource value: 0x7f0b0099
public const int design_error = 2131427481;
// aapt resource value: 0x7f0b004c
public const int design_fab_shadow_end_color = 2131427404;
@ -6953,8 +6974,8 @@ namespace Bit.Droid
// aapt resource value: 0x7f0b0053
public const int design_snackbar_background_color = 2131427411;
// aapt resource value: 0x7f0b0093
public const int design_tint_password_toggle = 2131427475;
// aapt resource value: 0x7f0b009a
public const int design_tint_password_toggle = 2131427482;
// aapt resource value: 0x7f0b001e
public const int dim_foreground_disabled_material_dark = 2131427358;
@ -6983,8 +7004,8 @@ namespace Bit.Droid
// aapt resource value: 0x7f0b0025
public const int foreground_material_light = 2131427365;
// aapt resource value: 0x7f0b0074
public const int gray = 2131427444;
// aapt resource value: 0x7f0b0071
public const int gray = 2131427441;
// aapt resource value: 0x7f0b0026
public const int highlighted_text_material_dark = 2131427366;
@ -7022,14 +7043,14 @@ namespace Bit.Droid
// aapt resource value: 0x7f0b006c
public const int hockeyapp_text_white = 2131427436;
// aapt resource value: 0x7f0b007a
public const int ic_launcher_background = 2131427450;
// aapt resource value: 0x7f0b0081
public const int ic_launcher_background = 2131427457;
// aapt resource value: 0x7f0b006d
public const int launcher_background = 2131427437;
// aapt resource value: 0x7f0b0075
public const int lightgray = 2131427445;
// aapt resource value: 0x7f0b0072
public const int lightgray = 2131427442;
// aapt resource value: 0x7f0b0028
public const int material_blue_grey_800 = 2131427368;
@ -7067,71 +7088,71 @@ namespace Bit.Droid
// aapt resource value: 0x7f0b0033
public const int material_grey_900 = 2131427379;
// aapt resource value: 0x7f0b0094
public const int mtrl_bottom_nav_colored_item_tint = 2131427476;
// aapt resource value: 0x7f0b009b
public const int mtrl_bottom_nav_colored_item_tint = 2131427483;
// aapt resource value: 0x7f0b0095
public const int mtrl_bottom_nav_item_tint = 2131427477;
// aapt resource value: 0x7f0b009c
public const int mtrl_bottom_nav_item_tint = 2131427484;
// aapt resource value: 0x7f0b0054
public const int mtrl_btn_bg_color_disabled = 2131427412;
// aapt resource value: 0x7f0b0096
public const int mtrl_btn_bg_color_selector = 2131427478;
// aapt resource value: 0x7f0b009d
public const int mtrl_btn_bg_color_selector = 2131427485;
// aapt resource value: 0x7f0b0097
public const int mtrl_btn_ripple_color = 2131427479;
// aapt resource value: 0x7f0b009e
public const int mtrl_btn_ripple_color = 2131427486;
// aapt resource value: 0x7f0b0098
public const int mtrl_btn_stroke_color_selector = 2131427480;
// aapt resource value: 0x7f0b009f
public const int mtrl_btn_stroke_color_selector = 2131427487;
// aapt resource value: 0x7f0b0099
public const int mtrl_btn_text_btn_ripple_color = 2131427481;
// aapt resource value: 0x7f0b00a0
public const int mtrl_btn_text_btn_ripple_color = 2131427488;
// aapt resource value: 0x7f0b0055
public const int mtrl_btn_text_color_disabled = 2131427413;
// aapt resource value: 0x7f0b009a
public const int mtrl_btn_text_color_selector = 2131427482;
// aapt resource value: 0x7f0b00a1
public const int mtrl_btn_text_color_selector = 2131427489;
// aapt resource value: 0x7f0b0056
public const int mtrl_btn_transparent_bg_color = 2131427414;
// aapt resource value: 0x7f0b009b
public const int mtrl_chip_background_color = 2131427483;
// aapt resource value: 0x7f0b00a2
public const int mtrl_chip_background_color = 2131427490;
// aapt resource value: 0x7f0b009c
public const int mtrl_chip_close_icon_tint = 2131427484;
// aapt resource value: 0x7f0b00a3
public const int mtrl_chip_close_icon_tint = 2131427491;
// aapt resource value: 0x7f0b009d
public const int mtrl_chip_ripple_color = 2131427485;
// aapt resource value: 0x7f0b00a4
public const int mtrl_chip_ripple_color = 2131427492;
// aapt resource value: 0x7f0b009e
public const int mtrl_chip_text_color = 2131427486;
// aapt resource value: 0x7f0b00a5
public const int mtrl_chip_text_color = 2131427493;
// aapt resource value: 0x7f0b009f
public const int mtrl_fab_ripple_color = 2131427487;
// aapt resource value: 0x7f0b00a6
public const int mtrl_fab_ripple_color = 2131427494;
// aapt resource value: 0x7f0b0057
public const int mtrl_scrim_color = 2131427415;
// aapt resource value: 0x7f0b00a0
public const int mtrl_tabs_colored_ripple_color = 2131427488;
// aapt resource value: 0x7f0b00a7
public const int mtrl_tabs_colored_ripple_color = 2131427495;
// aapt resource value: 0x7f0b00a1
public const int mtrl_tabs_icon_color_selector = 2131427489;
// aapt resource value: 0x7f0b00a8
public const int mtrl_tabs_icon_color_selector = 2131427496;
// aapt resource value: 0x7f0b00a2
public const int mtrl_tabs_icon_color_selector_colored = 2131427490;
// aapt resource value: 0x7f0b00a9
public const int mtrl_tabs_icon_color_selector_colored = 2131427497;
// aapt resource value: 0x7f0b00a3
public const int mtrl_tabs_legacy_text_color_selector = 2131427491;
// aapt resource value: 0x7f0b00aa
public const int mtrl_tabs_legacy_text_color_selector = 2131427498;
// aapt resource value: 0x7f0b00a4
public const int mtrl_tabs_ripple_color = 2131427492;
// aapt resource value: 0x7f0b00ab
public const int mtrl_tabs_ripple_color = 2131427499;
// aapt resource value: 0x7f0b00a5
public const int mtrl_text_btn_text_color_selector = 2131427493;
// aapt resource value: 0x7f0b00ac
public const int mtrl_text_btn_text_color_selector = 2131427500;
// aapt resource value: 0x7f0b0058
public const int mtrl_textinput_default_box_stroke_color = 2131427416;
@ -7205,11 +7226,11 @@ namespace Bit.Droid
// aapt resource value: 0x7f0b0043
public const int switch_thumb_disabled_material_light = 2131427395;
// aapt resource value: 0x7f0b00a6
public const int switch_thumb_material_dark = 2131427494;
// aapt resource value: 0x7f0b00ad
public const int switch_thumb_material_dark = 2131427501;
// aapt resource value: 0x7f0b00a7
public const int switch_thumb_material_light = 2131427495;
// aapt resource value: 0x7f0b00ae
public const int switch_thumb_material_light = 2131427502;
// aapt resource value: 0x7f0b0044
public const int switch_thumb_normal_material_dark = 2131427396;
@ -7223,8 +7244,8 @@ namespace Bit.Droid
// aapt resource value: 0x7f0b0047
public const int tooltip_background_light = 2131427399;
// aapt resource value: 0x7f0b0071
public const int white = 2131427441;
// aapt resource value: 0x7f0b006e
public const int white = 2131427438;
static Color()
{
@ -11039,8 +11060,8 @@ namespace Bit.Droid
// aapt resource value: 0x7f0e016d
public const int Animation_Design_BottomSheetDialog = 2131624301;
// aapt resource value: 0x7f0e0205
public const int AppCompatDialogStyle = 2131624453;
// aapt resource value: 0x7f0e0207
public const int AppCompatDialogStyle = 2131624455;
// aapt resource value: 0x7f0e009d
public const int Base_AlertDialog_AppCompat = 2131624093;
@ -11615,6 +11636,12 @@ namespace Bit.Droid
// aapt resource value: 0x7f0e000e
public const int CardView_Light = 2131623950;
// aapt resource value: 0x7f0e0205
public const int DarkTheme = 2131624453;
// aapt resource value: 0x7f0e0206
public const int DarkTheme_Base = 2131624454;
// aapt resource value: 0x7f0e01ff
public const int HockeyApp_ButtonStyle = 2131624447;

View File

@ -1,16 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="launcher_background">#FFFFFF</color>
<color name="colorPrimary">#3c8dbc</color>
<color name="colorPrimaryDark">#222d32</color>
<color name="colorAccent">#3883af</color>
<color name="white">#FFFFFF</color>
<color name="black">#000000</color>
<color name="darkgray">#333333</color>
<color name="gray">#738182</color>
<color name="lightgray">#efeff4</color>
<color name="colorPrimary">#3c8dbc</color>
<color name="colorPrimaryDark">#222d32</color>
<color name="colorAccent">#3883af</color>
<color name="primary">#3c8dbc</color>
<color name="darkaccent">#222d32</color>
<color name="accent">#3883af</color>
<color name="border">#dddddd</color>
<color name="dark_colorPrimary">#52bdfb</color>
<color name="dark_colorPrimaryDark">#222d32</color>
<color name="dark_colorAccent">#449BCE</color>
<color name="dark_primary">#52bdfb</color>
<color name="dark_darkaccent">#222d32</color>
<color name="dark_accent">#449BCE</color>
<color name="dark_border">#545454</color>
</resources>

View File

@ -22,6 +22,23 @@
<item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
</style>
<style name="DarkTheme" parent="DarkTheme.Base">
</style>
<style name="DarkTheme.Base" parent="Theme.AppCompat">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<!--<item name="colorPrimary">@color/dark_primary</item>
<item name="colorPrimaryDark">@color/dark_accent</item>-->
<item name="colorAccent">@color/dark_primary</item>
<item name="colorControlNormal">@color/dark_border</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
<item name="android:colorActivatedHighlight">@android:color/transparent</item>
<item name="android:textCursorDrawable">@null</item>
<item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
</style>
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#FF4081</item>
</style>

View File

@ -62,13 +62,7 @@ namespace Bit.App
_i18nService = ServiceContainer.Resolve<II18nService>("i18nService") as MobileI18nService;
_deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService");
InitializeComponent();
SetCulture();
ThemeManager.SetThemeStyle("light");
MainPage = new HomePage();
var mainPageTask = SetMainPageAsync();
ServiceContainer.Resolve<MobilePlatformUtilsService>("platformUtilsService").Init();
Bootstrap();
_broadcasterService.Subscribe(nameof(App), async (message) =>
{
if(message.Command == "showDialog")
@ -257,5 +251,15 @@ namespace Bit.App
var parsedDomain = DomainName.TryParse("https://bitwarden.com", out var domainName);
});
}
private void Bootstrap()
{
InitializeComponent();
SetCulture();
ThemeManager.SetTheme();
MainPage = new HomePage();
var mainPageTask = SetMainPageAsync();
ServiceContainer.Resolve<MobilePlatformUtilsService>("platformUtilsService").Init();
}
}
}

View File

@ -7,6 +7,7 @@ using Bit.Core.Enums;
using Bit.Core.Utilities;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace Bit.App.Pages
{
@ -17,6 +18,7 @@ namespace Bit.App.Pages
private readonly IStorageService _storageService;
private readonly ITotpService _totpService;
private readonly IStateService _stateService;
private readonly IMessagingService _messagingService;
private bool _disableFavicon;
private bool _disableAutoTotpCopy;
@ -32,6 +34,7 @@ namespace Bit.App.Pages
_storageService = ServiceContainer.Resolve<IStorageService>("storageService");
_totpService = ServiceContainer.Resolve<ITotpService>("totpService");
_stateService = ServiceContainer.Resolve<IStateService>("stateService");
_messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
PageTitle = AppResources.Options;
@ -172,7 +175,11 @@ namespace Bit.App.Pages
{
var theme = ThemeOptions[ThemeSelectedIndex].Key;
await _storageService.SaveAsync(Constants.ThemeKey, theme);
ThemeManager.SetThemeStyle(theme);
if(Device.RuntimePlatform == Device.Android)
{
await _deviceActionService.ShowLoadingAsync(AppResources.Saving);
}
_messagingService.Send("updatedTheme", theme);
}
}

View File

@ -32,6 +32,10 @@ namespace Bit.App.Pages
Xamarin.Forms.PlatformConfiguration.AndroidSpecific.ToolbarPlacement.Bottom);
Xamarin.Forms.PlatformConfiguration.AndroidSpecific.TabbedPage.SetIsSwipePagingEnabled(this, false);
Xamarin.Forms.PlatformConfiguration.AndroidSpecific.TabbedPage.SetIsSmoothScrollEnabled(this, false);
Xamarin.Forms.PlatformConfiguration.AndroidSpecific.TabbedPage.SetBarSelectedItemColor(this,
(Color)Application.Current.Resources["TabBarSelectedItemColor"]);
Xamarin.Forms.PlatformConfiguration.AndroidSpecific.TabbedPage.SetBarItemColor(this,
(Color)Application.Current.Resources["TabBarItemColor"]);
}
protected async override void OnCurrentPageChanged()

View File

@ -349,7 +349,7 @@ namespace Bit.App.Pages
col.Checked = CollectionIds.Contains(col.Collection.Id);
}
}
if(Cipher.Login.Uris != null)
if(Cipher.Login?.Uris != null)
{
Uris.ResetWithRange(Cipher.Login.Uris);
}

View File

@ -12,7 +12,17 @@ namespace Bit.App.Services
private readonly HashSet<string> _preferenceStorageKeys = new HashSet<string>
{
Constants.LockOptionKey
Constants.LockOptionKey,
Constants.ThemeKey,
Constants.DefaultUriMatch,
Constants.DisableAutoTotpCopyKey,
Constants.DisableFaviconKey,
Constants.ClearClipboardKey,
Constants.AccessibilityAutofillPasswordFieldKey,
Constants.AccessibilityAutofillPersistNotificationKey,
Constants.LastActiveKey,
Constants.PushInitialPromptShownKey,
Constants.LastFileCacheClearKey
};
public MobileStorageService(

View File

@ -8,7 +8,8 @@ namespace Bit.App.Services
{
public class PreferencesStorageService : IStorageService
{
private readonly string _keyFormat = "bwPreferencesStorage:{0}";
public static string KeyFormat = "bwPreferencesStorage:{0}";
private readonly string _sharedName;
private readonly JsonSerializerSettings _jsonSettings = new JsonSerializerSettings
{
@ -22,7 +23,7 @@ namespace Bit.App.Services
public Task<T> GetAsync<T>(string key)
{
var formattedKey = string.Format(_keyFormat, key);
var formattedKey = string.Format(KeyFormat, key);
if(!Xamarin.Essentials.Preferences.ContainsKey(formattedKey, _sharedName))
{
return Task.FromResult(default(T));
@ -73,7 +74,7 @@ namespace Bit.App.Services
return RemoveAsync(key);
}
var formattedKey = string.Format(_keyFormat, key);
var formattedKey = string.Format(KeyFormat, key);
var objType = typeof(T);
if(objType == typeof(string))
{
@ -109,7 +110,7 @@ namespace Bit.App.Services
public Task RemoveAsync(string key)
{
var formattedKey = string.Format(_keyFormat, key);
var formattedKey = string.Format(KeyFormat, key);
if(Xamarin.Essentials.Preferences.ContainsKey(formattedKey, _sharedName))
{
Xamarin.Essentials.Preferences.Remove(formattedKey, _sharedName);

View File

@ -2,6 +2,7 @@
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Bit.App.Styles.Base"
xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
xmlns:fab="clr-namespace:Refractored.FabControl;assembly=Refractored.FabControl"
xmlns:controls="clr-namespace:Bit.App.Controls">
@ -62,6 +63,13 @@
Value="{StaticResource SliderThumbBorderColor}" />
</Style>
<!-- Pages -->
<Style TargetType="TabbedPage"
ApplyToDerivedTypes="True">
<Setter Property="BarBackgroundColor"
Value="{StaticResource TabBarBackgroundColor}" />
</Style>
<!-- Buttons -->
<Style TargetType="Button"
ApplyToDerivedTypes="True"
@ -89,7 +97,7 @@
<Setter Property="ColorRipple"
Value="{StaticResource FabPressedColor}" />
</Style>
<!-- Title -->
<Style TargetType="Button"
Class="btn-title"
@ -212,7 +220,7 @@
<Setter Property="VerticalOptions"
Value="CenterAndExpand" />
</Style>
<!-- Box -->
<Style TargetType="StackLayout"

View File

@ -15,14 +15,14 @@
<Color x:Key="BorderColor">#111111</Color>
<Color x:Key="DisabledIconColor">#c7c7cd</Color>
<Color x:Key="BoxBorderColor">#2f2f2f</Color>
<Color x:Key="BoxBorderColor">#545454</Color>
<Color x:Key="BoxHeaderTextColor">#52bdfb</Color>
<Color x:Key="TitleTextColor">#ffffff</Color>
<Color x:Key="TitleEntryTextColor">#ffffff</Color>
<Color x:Key="TitleEntryPlaceholderColor">#707070</Color>
<Color x:Key="ListItemBorderColor">#2f2f2f</Color>
<Color x:Key="ListItemBorderColor">#545454</Color>
<Color x:Key="ListHeaderTextColor">#52bdfb</Color>
<Color x:Key="SliderThumbColor">#ffffff</Color>
@ -30,5 +30,9 @@
<Color x:Key="SliderTrackColor">#52bdfb</Color>
<Color x:Key="FabColor">#52bdfb</Color>
<Color x:Key="FabPressedColor">#52bdfb</Color>
<Color x:Key="FabPressedColor">#449BCE</Color>
<Color x:Key="TabBarBackgroundColor">#212121</Color>
<Color x:Key="TabBarItemColor">#C0C0C0</Color>
<Color x:Key="TabBarSelectedItemColor">#52bdfb</Color>
</ResourceDictionary>

View File

@ -31,4 +31,8 @@
<Color x:Key="FabColor">#3c8dbc</Color>
<Color x:Key="FabPressedColor">#3883af</Color>
<Color x:Key="TabBarBackgroundColor">#ffffff</Color>
<Color x:Key="TabBarItemColor">#C0C0C0</Color>
<Color x:Key="TabBarSelectedItemColor">#3c8dbc</Color>
</ResourceDictionary>

View File

@ -1,4 +1,6 @@
using Bit.App.Styles;
using Bit.App.Services;
using Bit.App.Styles;
using Bit.Core;
using Xamarin.Forms;
namespace Bit.App.Utilities
@ -37,5 +39,16 @@ namespace Bit.App.Utilities
Application.Current.Resources.MergedDictionaries.Add(new iOS());
}
}
public static void SetTheme()
{
SetThemeStyle(GetTheme());
}
public static string GetTheme()
{
return Xamarin.Essentials.Preferences.Get(
string.Format(PreferencesStorageService.KeyFormat, Constants.ThemeKey), default(string));
}
}
}