1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-12-21 16:07:42 +01:00

qs tile to quickly launch my vault (android)

This commit is contained in:
Kyle Spearrin 2017-09-19 15:55:15 -04:00
parent ea1b584436
commit 5950c33a43
12 changed files with 96 additions and 20 deletions

View File

@ -17,7 +17,7 @@
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v7.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
<AndroidSupportedAbis>armeabi,armeabi-v7a,x86</AndroidSupportedAbis>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
<AndroidStoreUncompressedFileExtensions />
@ -308,6 +308,7 @@
<Compile Include="Controls\ExtendedTextCellRenderer.cs" />
<Compile Include="Controls\ExtendedPickerRenderer.cs" />
<Compile Include="Controls\ExtendedEntryRenderer.cs" />
<Compile Include="MyVaultTileService.cs" />
<Compile Include="Services\HttpService.cs" />
<Compile Include="Services\AndroidKeyStoreStorageService.cs" />
<Compile Include="Services\LocalizeService.cs" />
@ -944,6 +945,9 @@
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxxhdpi\cog.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\shield.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<Import Project="..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

View File

@ -11,7 +11,7 @@ using XLabs.Ioc;
namespace Bit.Android
{
[Service(Permission = "android.permission.BIND_ACCESSIBILITY_SERVICE", Label = "bitwarden")]
[Service(Permission = global::Android.Manifest.Permission.BindAccessibilityService, Label = "bitwarden")]
[IntentFilter(new string[] { "android.accessibilityservice.AccessibilityService" })]
[MetaData("android.accessibilityservice", Resource = "@xml/accessibilityservice")]
public class AutofillService : AccessibilityService

View File

@ -74,6 +74,7 @@ namespace Bit.Android
_settings = Resolver.Resolve<ISettings>();
LoadApplication(new App.App(
uri,
Intent.GetBooleanExtra("myVaultTile", false),
Resolver.Resolve<IAuthService>(),
Resolver.Resolve<IConnectivity>(),
Resolver.Resolve<IUserDialogs>(),

View File

@ -0,0 +1,58 @@
using Android.App;
using Android.Content;
using Android.Service.QuickSettings;
using Java.Lang;
namespace Bit.Android
{
[Service(Permission = global::Android.Manifest.Permission.BindQuickSettingsTile,
Label = "@string/MyVault", Icon = "@drawable/shield")]
[IntentFilter(new string[] { ActionQsTile })]
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);
}
}
}

View File

@ -2769,8 +2769,8 @@ namespace Bit.Android
// aapt resource value: 0x7f0200e7
public const int notification_sm = 2130837735;
// aapt resource value: 0x7f0200f9
public const int notification_template_icon_bg = 2130837753;
// aapt resource value: 0x7f0200fa
public const int notification_template_icon_bg = 2130837754;
// aapt resource value: 0x7f0200e8
public const int paperclip = 2130837736;
@ -2797,31 +2797,34 @@ namespace Bit.Android
public const int share_tools = 2130837743;
// aapt resource value: 0x7f0200f0
public const int splash_screen = 2130837744;
public const int shield = 2130837744;
// aapt resource value: 0x7f0200f1
public const int star = 2130837745;
public const int splash_screen = 2130837745;
// aapt resource value: 0x7f0200f2
public const int star_selected = 2130837746;
public const int star = 2130837746;
// aapt resource value: 0x7f0200f3
public const int tools = 2130837747;
public const int star_selected = 2130837747;
// aapt resource value: 0x7f0200f4
public const int tools_selected = 2130837748;
public const int tools = 2130837748;
// aapt resource value: 0x7f0200f5
public const int trash = 2130837749;
public const int tools_selected = 2130837749;
// aapt resource value: 0x7f0200f6
public const int upload = 2130837750;
public const int trash = 2130837750;
// aapt resource value: 0x7f0200f7
public const int user = 2130837751;
public const int upload = 2130837751;
// aapt resource value: 0x7f0200f8
public const int yubikey = 2130837752;
public const int user = 2130837752;
// aapt resource value: 0x7f0200f9
public const int yubikey = 2130837753;
static Drawable()
{
@ -3756,6 +3759,9 @@ namespace Bit.Android
// aapt resource value: 0x7f080046
public const int Hello = 2131230790;
// aapt resource value: 0x7f08009a
public const int MyVault = 2131230874;
// aapt resource value: 0x7f08002e
public const int abc_action_bar_home_description = 2131230766;

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -5,4 +5,7 @@
accessibility service by tapping the toggle switch above, then press OK on the confirmation pop-up. You can then press
the back button twice to return to the main bitwarden app.
</string>
<string name="MyVault">
My Vault
</string>
</resources>

View File

@ -7,8 +7,8 @@ using System.Threading.Tasks;
namespace Bit.Android
{
[Activity(Theme = "@style/BitwardenTheme.Splash",
MainLauncher = true,
[Activity(Theme = "@style/BitwardenTheme.Splash",
MainLauncher = true,
NoHistory = true,
WindowSoftInputMode = global::Android.Views.SoftInput.StateHidden)]
public class SplashActivity : AppCompatActivity
@ -23,7 +23,9 @@ namespace Bit.Android
base.OnResume();
var startupWork = new Task(() =>
{
StartActivity(new Intent(Application.Context, typeof(MainActivity)));
var mainIntent = new Intent(Application.Context, typeof(MainActivity));
mainIntent.PutExtra("myVaultTile", Intent.GetBooleanExtra("myVaultTile", false));
StartActivity(mainIntent);
});
startupWork.Start();

View File

@ -35,6 +35,7 @@ namespace Bit.App
public App(
string uri,
bool myVault,
IAuthService authService,
IConnectivity connectivity,
IUserDialogs userDialogs,
@ -71,7 +72,7 @@ namespace Bit.App
}
else if(authService.IsAuthenticated)
{
MainPage = new MainPage();
MainPage = new MainPage(myVault: myVault);
}
else
{

View File

@ -7,7 +7,7 @@ namespace Bit.App.Pages
{
public class MainPage : ExtendedTabbedPage
{
public MainPage(string uri = null)
public MainPage(string uri = null, bool myVault = false)
{
TintColor = Color.FromHex("3c8dbc");
@ -33,7 +33,7 @@ namespace Bit.App.Pages
Children.Add(toolsNavigation);
Children.Add(settingsNavigation);
if(uri != null)
if(myVault || uri != null)
{
SelectedItem = vaultNavigation;
}

View File

@ -59,6 +59,7 @@ namespace Bit.iOS
LoadApplication(new App.App(
null,
false,
Resolver.Resolve<IAuthService>(),
Resolver.Resolve<IConnectivity>(),
Resolver.Resolve<IUserDialogs>(),

View File

@ -16,7 +16,7 @@
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v7.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">