mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 15:15:34 +03:00
myvault tile service
This commit is contained in:
parent
49cde1c67d
commit
68a85a2561
2 changed files with 69 additions and 0 deletions
|
@ -141,6 +141,7 @@
|
||||||
<Compile Include="Services\CryptoPrimitiveService.cs" />
|
<Compile Include="Services\CryptoPrimitiveService.cs" />
|
||||||
<Compile Include="Services\DeviceActionService.cs" />
|
<Compile Include="Services\DeviceActionService.cs" />
|
||||||
<Compile Include="Services\LocalizeService.cs" />
|
<Compile Include="Services\LocalizeService.cs" />
|
||||||
|
<Compile Include="Tile\MyVaultTileService.cs" />
|
||||||
<Compile Include="Utilities\AndroidHelpers.cs" />
|
<Compile Include="Utilities\AndroidHelpers.cs" />
|
||||||
<Compile Include="Utilities\HockeyAppCrashManagerListener.cs" />
|
<Compile Include="Utilities\HockeyAppCrashManagerListener.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
68
src/Android/Tile/MyVaultTileService.cs
Normal file
68
src/Android/Tile/MyVaultTileService.cs
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
using Android.App;
|
||||||
|
using Android.Content;
|
||||||
|
using Android.OS;
|
||||||
|
using Android.Runtime;
|
||||||
|
using Android.Service.QuickSettings;
|
||||||
|
using Android.Views;
|
||||||
|
using Android.Widget;
|
||||||
|
using Java.Lang;
|
||||||
|
|
||||||
|
namespace Bit.Droid.Tile
|
||||||
|
{
|
||||||
|
[Service(Permission = Android.Manifest.Permission.BindQuickSettingsTile, Label = "@string/MyVault",
|
||||||
|
Icon = "@drawable/shield")]
|
||||||
|
[IntentFilter(new string[] { ActionQsTile })]
|
||||||
|
[Register("com.x8bit.bitwarden.Tile.MyVaultTileService")]
|
||||||
|
public class MyVaultTileService : TileService
|
||||||
|
{
|
||||||
|
public override void OnTileAdded()
|
||||||
|
{
|
||||||
|
base.OnTileAdded();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnStartListening()
|
||||||
|
{
|
||||||
|
base.OnStartListening();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnStopListening()
|
||||||
|
{
|
||||||
|
base.OnStopListening();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnTileRemoved()
|
||||||
|
{
|
||||||
|
base.OnTileRemoved();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnClick()
|
||||||
|
{
|
||||||
|
base.OnClick();
|
||||||
|
|
||||||
|
if(IsLocked)
|
||||||
|
{
|
||||||
|
UnlockAndRun(new Runnable(() =>
|
||||||
|
{
|
||||||
|
LaunchMyVault();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LaunchMyVault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LaunchMyVault()
|
||||||
|
{
|
||||||
|
var intent = new Intent(this, typeof(SplashActivity));
|
||||||
|
intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.SingleTop | ActivityFlags.ClearTop);
|
||||||
|
intent.PutExtra("myVaultTile", true);
|
||||||
|
StartActivityAndCollapse(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue