mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 15:15:34 +03:00
restart app after theme change
This commit is contained in:
parent
6e91d66b2c
commit
cc8b8f9ceb
6 changed files with 47 additions and 4 deletions
|
@ -99,7 +99,7 @@ namespace Bit.Droid
|
||||||
}
|
}
|
||||||
else if(message.Command == "updatedTheme")
|
else if(message.Command == "updatedTheme")
|
||||||
{
|
{
|
||||||
Recreate();
|
RestartApp();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -273,5 +273,15 @@ namespace Bit.Droid
|
||||||
SetTheme(Resource.Style.MainTheme);
|
SetTheme(Resource.Style.MainTheme);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RestartApp()
|
||||||
|
{
|
||||||
|
var intent = new Intent(this, typeof(SplashActivity));
|
||||||
|
var pendingIntent = PendingIntent.GetActivity(this, 5923650, intent, PendingIntentFlags.CancelCurrent);
|
||||||
|
var alarmManager = GetSystemService(AlarmService) as AlarmManager;
|
||||||
|
var triggerMs = Java.Lang.JavaSystem.CurrentTimeMillis() + 500;
|
||||||
|
alarmManager.Set(AlarmType.Rtc, triggerMs, pendingIntent);
|
||||||
|
Java.Lang.JavaSystem.Exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,8 +86,9 @@
|
||||||
StyleClass="box-value" />
|
StyleClass="box-value" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<Label
|
<Label
|
||||||
|
StyleClass="box-footer-label"
|
||||||
Text="{u:I18n ThemeDescription}"
|
Text="{u:I18n ThemeDescription}"
|
||||||
StyleClass="box-footer-label" />
|
x:Name="_themeDescriptionLabel" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using Bit.App.Resources;
|
||||||
|
using System;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Bit.App.Pages
|
namespace Bit.App.Pages
|
||||||
|
@ -15,6 +16,11 @@ namespace Bit.App.Pages
|
||||||
_themePicker.ItemDisplayBinding = new Binding("Value");
|
_themePicker.ItemDisplayBinding = new Binding("Value");
|
||||||
_uriMatchPicker.ItemDisplayBinding = new Binding("Value");
|
_uriMatchPicker.ItemDisplayBinding = new Binding("Value");
|
||||||
_clearClipboardPicker.ItemDisplayBinding = new Binding("Value");
|
_clearClipboardPicker.ItemDisplayBinding = new Binding("Value");
|
||||||
|
if(Device.RuntimePlatform == Device.Android)
|
||||||
|
{
|
||||||
|
_themeDescriptionLabel.Text = string.Concat(_themeDescriptionLabel.Text, " ",
|
||||||
|
AppResources.RestartIsRequired);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async override void OnAppearing()
|
protected async override void OnAppearing()
|
||||||
|
|
|
@ -177,7 +177,8 @@ namespace Bit.App.Pages
|
||||||
await _storageService.SaveAsync(Constants.ThemeKey, theme);
|
await _storageService.SaveAsync(Constants.ThemeKey, theme);
|
||||||
if(Device.RuntimePlatform == Device.Android)
|
if(Device.RuntimePlatform == Device.Android)
|
||||||
{
|
{
|
||||||
await _deviceActionService.ShowLoadingAsync(AppResources.Saving);
|
await _deviceActionService.ShowLoadingAsync(AppResources.Restarting);
|
||||||
|
await Task.Delay(1000);
|
||||||
}
|
}
|
||||||
_messagingService.Send("updatedTheme", theme);
|
_messagingService.Send("updatedTheme", theme);
|
||||||
}
|
}
|
||||||
|
|
18
src/App/Resources/AppResources.Designer.cs
generated
18
src/App/Resources/AppResources.Designer.cs
generated
|
@ -3057,6 +3057,24 @@ namespace Bit.App.Resources {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Restarting....
|
||||||
|
/// </summary>
|
||||||
|
public static string Restarting {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Restarting", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Restart is required..
|
||||||
|
/// </summary>
|
||||||
|
public static string RestartIsRequired {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("RestartIsRequired", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Re-type Master Password.
|
/// Looks up a localized string similar to Re-type Master Password.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1557,4 +1557,11 @@
|
||||||
<data name="ThemeDescription" xml:space="preserve">
|
<data name="ThemeDescription" xml:space="preserve">
|
||||||
<value>Change the application's color theme.</value>
|
<value>Change the application's color theme.</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="RestartIsRequired" xml:space="preserve">
|
||||||
|
<value>Restart is required.</value>
|
||||||
|
<comment>Referring to restarting the application.</comment>
|
||||||
|
</data>
|
||||||
|
<data name="Restarting" xml:space="preserve">
|
||||||
|
<value>Restarting...</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
Loading…
Reference in a new issue