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;
var builder = new Notification.Builder(this);
builder.SetSmallIcon(Resource.Drawable.notification_sm)
builder.SetSmallIcon(Resource.Drawable.shield)
.SetContentTitle(AppResources.BitwardenAutofillService)
.SetContentText(notificationContent)
.SetTicker(notificationContent)

View File

@ -133,7 +133,8 @@
<Compile Include="Services\CryptoPrimitiveService.cs" />
<Compile Include="Services\DeviceActionService.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\CustomFingerprintDialogFragment.cs" />
<Compile Include="Utilities\HockeyAppCrashManagerListener.cs" />
@ -395,9 +396,6 @@
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxxhdpi\refresh.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\notification_sm.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\id.png" />
</ItemGroup>
@ -443,18 +441,6 @@
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxxhdpi\icon.png" />
</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>
<AndroidResource Include="Resources\drawable\pencil.png" />
</ItemGroup>
@ -539,5 +525,32 @@
<SubType>Designer</SubType>
</AndroidResource>
</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" />
</Project>

View File

@ -143,7 +143,18 @@ namespace Bit.Droid
protected override void OnNewIntent(Intent 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,
@ -243,6 +254,7 @@ namespace Bit.Droid
{
Uri = Intent.GetStringExtra("uri") ?? Intent.GetStringExtra("autofillFrameworkUri"),
MyVaultTile = Intent.GetBooleanExtra("myVaultTile", false),
GeneratorTile = Intent.GetBooleanExtra("generatorTile", false),
FromAutofillFramework = Intent.GetBooleanExtra("autofillFramework", false)
};
var fillType = Intent.GetIntExtra("autofillFrameworkFillType", 0);

View File

@ -9031,29 +9031,29 @@ namespace Bit.Droid
// aapt resource value: 0x7f020155
public const int notification_icon_background = 2130837845;
// aapt resource value: 0x7f020156
public const int notification_sm = 2130837846;
// aapt resource value: 0x7f020164
public const int notification_template_icon_bg = 2130837860;
// aapt resource value: 0x7f020165
public const int notification_template_icon_low_bg = 2130837861;
// aapt resource value: 0x7f020156
public const int notification_tile_bg = 2130837846;
// aapt resource value: 0x7f020157
public const int notification_tile_bg = 2130837847;
public const int notify_panel_notification_icon_bg = 2130837847;
// aapt resource value: 0x7f020158
public const int notify_panel_notification_icon_bg = 2130837848;
public const int pencil = 2130837848;
// aapt resource value: 0x7f020159
public const int pencil = 2130837849;
public const int plus = 2130837849;
// aapt resource value: 0x7f02015a
public const int plus = 2130837850;
public const int refresh = 2130837850;
// aapt resource value: 0x7f02015b
public const int refresh = 2130837851;
public const int refresh_sm = 2130837851;
// aapt resource value: 0x7f02015c
public const int search = 2130837852;
@ -10483,6 +10483,9 @@ namespace Bit.Droid
// aapt resource value: 0x7f0900c2
public const int MyVault = 2131296450;
// aapt resource value: 0x7f0900c3
public const int PasswordGenerator = 2131296451;
// aapt resource value: 0x7f090032
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 name="BlackTheme" parent="BlackTheme.Base">
</style>
<style name="NordTheme" parent="NordTheme.Base">
</style>
</resources>

View File

@ -13,4 +13,7 @@
<string name="MyVault">
My Vault
</string>
<string name="PasswordGenerator">
Password Generator
</string>
</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",
Icon = "@drawable/shield")]
[IntentFilter(new string[] { ActionQsTile })]
[Register("com.x8bit.bitwarden.Tile.MyVaultTileService")]
[Register("com.x8bit.bitwarden.MyVaultTileService")]
public class MyVaultTileService : TileService
{
public override void OnTileAdded()

View File

@ -122,6 +122,28 @@ namespace Bit.App
await Task.Delay(1000);
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
{
Current.MainPage = new TabsPage();
Current.MainPage = new TabsPage(_appOptions);
}
}
else

View File

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

View File

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