1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-15 07:43:37 +00:00

generator tile and icon size adjustments

This commit is contained in:
Kyle Spearrin
2019-06-05 16:37:54 -04:00
parent a1a5d3b363
commit e0c52dea3a
26 changed files with 170 additions and 31 deletions

View File

@@ -231,7 +231,7 @@ namespace Bit.Droid.Accessibility
AppResources.BitwardenAutofillServiceNotificationContentOld; AppResources.BitwardenAutofillServiceNotificationContentOld;
var builder = new Notification.Builder(this); var builder = new Notification.Builder(this);
builder.SetSmallIcon(Resource.Drawable.notification_sm) builder.SetSmallIcon(Resource.Drawable.shield)
.SetContentTitle(AppResources.BitwardenAutofillService) .SetContentTitle(AppResources.BitwardenAutofillService)
.SetContentText(notificationContent) .SetContentText(notificationContent)
.SetTicker(notificationContent) .SetTicker(notificationContent)

View File

@@ -133,7 +133,8 @@
<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="Tiles\GeneratorTileService.cs" />
<Compile Include="Tiles\MyVaultTileService.cs" />
<Compile Include="Utilities\AndroidHelpers.cs" /> <Compile Include="Utilities\AndroidHelpers.cs" />
<Compile Include="Utilities\CustomFingerprintDialogFragment.cs" /> <Compile Include="Utilities\CustomFingerprintDialogFragment.cs" />
<Compile Include="Utilities\HockeyAppCrashManagerListener.cs" /> <Compile Include="Utilities\HockeyAppCrashManagerListener.cs" />
@@ -395,9 +396,6 @@
<ItemGroup> <ItemGroup>
<AndroidResource Include="Resources\drawable-xxxhdpi\refresh.png" /> <AndroidResource Include="Resources\drawable-xxxhdpi\refresh.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\notification_sm.png" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<AndroidResource Include="Resources\drawable\id.png" /> <AndroidResource Include="Resources\drawable\id.png" />
</ItemGroup> </ItemGroup>
@@ -443,18 +441,6 @@
<ItemGroup> <ItemGroup>
<AndroidResource Include="Resources\drawable-xxxhdpi\icon.png" /> <AndroidResource Include="Resources\drawable-xxxhdpi\icon.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\notification_sm.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xhdpi\notification_sm.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxhdpi\notification_sm.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxxhdpi\notification_sm.png" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<AndroidResource Include="Resources\drawable\pencil.png" /> <AndroidResource Include="Resources\drawable\pencil.png" />
</ItemGroup> </ItemGroup>
@@ -539,5 +525,32 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
</AndroidResource> </AndroidResource>
</ItemGroup> </ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\shield.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xhdpi\shield.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxhdpi\shield.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxxhdpi\shield.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\refresh_sm.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\refresh_sm.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xhdpi\refresh_sm.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxhdpi\refresh_sm.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxxhdpi\refresh_sm.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
</Project> </Project>

View File

@@ -143,7 +143,18 @@ namespace Bit.Droid
protected override void OnNewIntent(Intent intent) protected override void OnNewIntent(Intent intent)
{ {
base.OnNewIntent(intent); base.OnNewIntent(intent);
ParseYubiKey(intent.DataString); if(intent.GetBooleanExtra("generatorTile", false))
{
_messagingService.Send("popAllAndGoToTabGenerator");
}
if(intent.GetBooleanExtra("myVaultTile", false))
{
_messagingService.Send("popAllAndGoToTabMyVault");
}
else
{
ParseYubiKey(intent.DataString);
}
} }
public async override void OnRequestPermissionsResult(int requestCode, string[] permissions, public async override void OnRequestPermissionsResult(int requestCode, string[] permissions,
@@ -243,6 +254,7 @@ namespace Bit.Droid
{ {
Uri = Intent.GetStringExtra("uri") ?? Intent.GetStringExtra("autofillFrameworkUri"), Uri = Intent.GetStringExtra("uri") ?? Intent.GetStringExtra("autofillFrameworkUri"),
MyVaultTile = Intent.GetBooleanExtra("myVaultTile", false), MyVaultTile = Intent.GetBooleanExtra("myVaultTile", false),
GeneratorTile = Intent.GetBooleanExtra("generatorTile", false),
FromAutofillFramework = Intent.GetBooleanExtra("autofillFramework", false) FromAutofillFramework = Intent.GetBooleanExtra("autofillFramework", false)
}; };
var fillType = Intent.GetIntExtra("autofillFrameworkFillType", 0); var fillType = Intent.GetIntExtra("autofillFrameworkFillType", 0);

View File

@@ -9031,29 +9031,29 @@ namespace Bit.Droid
// aapt resource value: 0x7f020155 // aapt resource value: 0x7f020155
public const int notification_icon_background = 2130837845; public const int notification_icon_background = 2130837845;
// aapt resource value: 0x7f020156
public const int notification_sm = 2130837846;
// aapt resource value: 0x7f020164 // aapt resource value: 0x7f020164
public const int notification_template_icon_bg = 2130837860; public const int notification_template_icon_bg = 2130837860;
// aapt resource value: 0x7f020165 // aapt resource value: 0x7f020165
public const int notification_template_icon_low_bg = 2130837861; public const int notification_template_icon_low_bg = 2130837861;
// aapt resource value: 0x7f020156
public const int notification_tile_bg = 2130837846;
// aapt resource value: 0x7f020157 // aapt resource value: 0x7f020157
public const int notification_tile_bg = 2130837847; public const int notify_panel_notification_icon_bg = 2130837847;
// aapt resource value: 0x7f020158 // aapt resource value: 0x7f020158
public const int notify_panel_notification_icon_bg = 2130837848; public const int pencil = 2130837848;
// aapt resource value: 0x7f020159 // aapt resource value: 0x7f020159
public const int pencil = 2130837849; public const int plus = 2130837849;
// aapt resource value: 0x7f02015a // aapt resource value: 0x7f02015a
public const int plus = 2130837850; public const int refresh = 2130837850;
// aapt resource value: 0x7f02015b // aapt resource value: 0x7f02015b
public const int refresh = 2130837851; public const int refresh_sm = 2130837851;
// aapt resource value: 0x7f02015c // aapt resource value: 0x7f02015c
public const int search = 2130837852; public const int search = 2130837852;
@@ -10483,6 +10483,9 @@ namespace Bit.Droid
// aapt resource value: 0x7f0900c2 // aapt resource value: 0x7f0900c2
public const int MyVault = 2131296450; public const int MyVault = 2131296450;
// aapt resource value: 0x7f0900c3
public const int PasswordGenerator = 2131296451;
// aapt resource value: 0x7f090032 // aapt resource value: 0x7f090032
public const int abc_action_bar_home_description = 2131296306; public const int abc_action_bar_home_description = 2131296306;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 773 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 772 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 997 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 330 B

View File

@@ -6,4 +6,6 @@
</style> </style>
<style name="BlackTheme" parent="BlackTheme.Base"> <style name="BlackTheme" parent="BlackTheme.Base">
</style> </style>
<style name="NordTheme" parent="NordTheme.Base">
</style>
</resources> </resources>

View File

@@ -13,4 +13,7 @@
<string name="MyVault"> <string name="MyVault">
My Vault My Vault
</string> </string>
<string name="PasswordGenerator">
Password Generator
</string>
</resources> </resources>

View 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/PasswordGenerator",
Icon = "@drawable/refresh_sm")]
[IntentFilter(new string[] { ActionQsTile })]
[Register("com.x8bit.bitwarden.GeneratorTileService")]
public class GeneratorTileService : 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(MainActivity));
intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.SingleTop | ActivityFlags.ClearTop);
intent.PutExtra("generatorTile", true);
StartActivityAndCollapse(intent);
}
}
}

View File

@@ -17,7 +17,7 @@ namespace Bit.Droid.Tile
[Service(Permission = Android.Manifest.Permission.BindQuickSettingsTile, Label = "@string/MyVault", [Service(Permission = Android.Manifest.Permission.BindQuickSettingsTile, Label = "@string/MyVault",
Icon = "@drawable/shield")] Icon = "@drawable/shield")]
[IntentFilter(new string[] { ActionQsTile })] [IntentFilter(new string[] { ActionQsTile })]
[Register("com.x8bit.bitwarden.Tile.MyVaultTileService")] [Register("com.x8bit.bitwarden.MyVaultTileService")]
public class MyVaultTileService : TileService public class MyVaultTileService : TileService
{ {
public override void OnTileAdded() public override void OnTileAdded()

View File

@@ -122,6 +122,28 @@ namespace Bit.App
await Task.Delay(1000); await Task.Delay(1000);
await SetMainPageAsync(); await SetMainPageAsync();
} }
else if(message.Command == "popAllAndGoToTabGenerator" ||
message.Command == "popAllAndGoToTabMyVault")
{
Device.BeginInvokeOnMainThread(async () =>
{
if(Current.MainPage is TabsPage tabsPage)
{
while(tabsPage.Navigation.ModalStack.Count > 0)
{
await tabsPage.Navigation.PopModalAsync(false);
}
if(message.Command == "popAllAndGoToTabMyVault")
{
tabsPage.ResetToVaultPage();
}
else
{
tabsPage.ResetToGeneratorPage();
}
}
});
}
}); });
} }
@@ -214,7 +236,7 @@ namespace Bit.App
} }
else else
{ {
Current.MainPage = new TabsPage(); Current.MainPage = new TabsPage(_appOptions);
} }
} }
else else

View File

@@ -5,6 +5,7 @@ namespace Bit.App.Models
public class AppOptions public class AppOptions
{ {
public bool MyVaultTile { get; set; } public bool MyVaultTile { get; set; }
public bool GeneratorTile { get; set; }
public bool FromAutofillFramework { get; set; } public bool FromAutofillFramework { get; set; }
public CipherType? FillType { get; set; } public CipherType? FillType { get; set; }
public string Uri { get; set; } public string Uri { get; set; }

View File

@@ -1,5 +1,8 @@
using Bit.App.Effect; using Bit.App.Effect;
using Bit.App.Models;
using Bit.App.Resources; using Bit.App.Resources;
using Bit.Core.Abstractions;
using Bit.Core.Utilities;
using Xamarin.Forms; using Xamarin.Forms;
namespace Bit.App.Pages namespace Bit.App.Pages
@@ -7,8 +10,9 @@ namespace Bit.App.Pages
public class TabsPage : TabbedPage public class TabsPage : TabbedPage
{ {
private NavigationPage _groupingsPage; private NavigationPage _groupingsPage;
private NavigationPage _generatorPage;
public TabsPage() public TabsPage(AppOptions appOptions = null)
{ {
_groupingsPage = new NavigationPage(new GroupingsPage(true)) _groupingsPage = new NavigationPage(new GroupingsPage(true))
{ {
@@ -17,12 +21,12 @@ namespace Bit.App.Pages
}; };
Children.Add(_groupingsPage); Children.Add(_groupingsPage);
var generatorPage = new NavigationPage(new GeneratorPage(true, null, this)) _generatorPage = new NavigationPage(new GeneratorPage(true, null, this))
{ {
Title = AppResources.Generator, Title = AppResources.Generator,
Icon = "refresh.png" Icon = "refresh.png"
}; };
Children.Add(generatorPage); Children.Add(_generatorPage);
var settingsPage = new NavigationPage(new SettingsPage(this)) var settingsPage = new NavigationPage(new SettingsPage(this))
{ {
@@ -44,6 +48,12 @@ namespace Bit.App.Pages
Xamarin.Forms.PlatformConfiguration.AndroidSpecific.TabbedPage.SetBarItemColor(this, Xamarin.Forms.PlatformConfiguration.AndroidSpecific.TabbedPage.SetBarItemColor(this,
(Color)Application.Current.Resources["TabBarItemColor"]); (Color)Application.Current.Resources["TabBarItemColor"]);
} }
if(appOptions?.GeneratorTile ?? false)
{
appOptions.GeneratorTile = false;
ResetToGeneratorPage();
}
} }
public void ResetToVaultPage() public void ResetToVaultPage()
@@ -51,6 +61,11 @@ namespace Bit.App.Pages
CurrentPage = _groupingsPage; CurrentPage = _groupingsPage;
} }
public void ResetToGeneratorPage()
{
CurrentPage = _generatorPage;
}
protected async override void OnCurrentPageChanged() protected async override void OnCurrentPageChanged()
{ {
if(CurrentPage is NavigationPage navPage) if(CurrentPage is NavigationPage navPage)