mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 02:18:27 +03:00
App: LoginPage.cs: Use a logo for the login button (#200)
* App: LoginPage.cs: Use a logo for the login button This adds a helper function which we can use to set logos for Windows platforms to ensure the user can see the UWP toolbar actions. This won't have an effect on non-Windows platforms. Signed-off-by: Alistair Francis <alistair@alistair23.me> * App: Pages: Set an icon for the save button on Windows Signed-off-by: Alistair Francis <alistair@alistair23.me> * App: Pages: Set an icon for submit, save and continue Set an icon for the submit, save and continue buttons when running on Windows platforms. Signed-off-by: Alistair Francis <alistair@alistair23.me> * App: Pages: Valut: Set an icon for the edit button Set the cog icon for the edit button when running on Windows platforms. Signed-off-by: Alistair Francis <alistair@alistair23.me>
This commit is contained in:
parent
25b75fd6e4
commit
baf785d9f1
15 changed files with 26 additions and 13 deletions
|
@ -2,6 +2,7 @@
|
||||||
using Bit.App.Abstractions;
|
using Bit.App.Abstractions;
|
||||||
using Bit.App.Controls;
|
using Bit.App.Controls;
|
||||||
using Bit.App.Resources;
|
using Bit.App.Resources;
|
||||||
|
using Bit.App.Utilities;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using XLabs.Ioc;
|
using XLabs.Ioc;
|
||||||
using Acr.UserDialogs;
|
using Acr.UserDialogs;
|
||||||
|
@ -111,7 +112,7 @@ namespace Bit.App.Pages
|
||||||
Content = StackLayout
|
Content = StackLayout
|
||||||
};
|
};
|
||||||
|
|
||||||
var toolbarItem = new ToolbarItem(AppResources.Save, null, async () => await SaveAsync(),
|
var toolbarItem = new ToolbarItem(AppResources.Save, Helpers.ToolbarImage("envelope.png"), async () => await SaveAsync(),
|
||||||
ToolbarItemOrder.Default, 0);
|
ToolbarItemOrder.Default, 0);
|
||||||
|
|
||||||
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
|
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
|
||||||
|
|
|
@ -81,7 +81,7 @@ namespace Bit.App.Pages
|
||||||
table.EstimatedRowHeight = 70;
|
table.EstimatedRowHeight = 70;
|
||||||
}
|
}
|
||||||
|
|
||||||
var loginToolbarItem = new ToolbarItem(AppResources.Submit, null, async () =>
|
var loginToolbarItem = new ToolbarItem(AppResources.Submit, Helpers.ToolbarImage("login.png"), async () =>
|
||||||
{
|
{
|
||||||
await CheckPasswordAsync();
|
await CheckPasswordAsync();
|
||||||
}, ToolbarItemOrder.Default, 0);
|
}, ToolbarItemOrder.Default, 0);
|
||||||
|
|
|
@ -112,7 +112,7 @@ namespace Bit.App.Pages
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
var loginToolbarItem = new ToolbarItem(AppResources.LogIn, null, async () =>
|
var loginToolbarItem = new ToolbarItem(AppResources.LogIn, Helpers.ToolbarImage("login.png"), async () =>
|
||||||
{
|
{
|
||||||
await LogIn();
|
await LogIn();
|
||||||
}, ToolbarItemOrder.Default, 0);
|
}, ToolbarItemOrder.Default, 0);
|
||||||
|
|
|
@ -114,7 +114,7 @@ namespace Bit.App.Pages
|
||||||
else if(_providerType.Value == TwoFactorProviderType.Authenticator ||
|
else if(_providerType.Value == TwoFactorProviderType.Authenticator ||
|
||||||
_providerType.Value == TwoFactorProviderType.Email)
|
_providerType.Value == TwoFactorProviderType.Email)
|
||||||
{
|
{
|
||||||
var continueToolbarItem = new ToolbarItem(AppResources.Continue, null, async () =>
|
var continueToolbarItem = new ToolbarItem(AppResources.Continue, Helpers.ToolbarImage("login.png"), async () =>
|
||||||
{
|
{
|
||||||
var token = TokenCell?.Entry.Text.Trim().Replace(" ", "");
|
var token = TokenCell?.Entry.Text.Trim().Replace(" ", "");
|
||||||
await LogInAsync(token);
|
await LogInAsync(token);
|
||||||
|
|
|
@ -80,7 +80,7 @@ namespace Bit.App.Pages
|
||||||
table.EstimatedRowHeight = 70;
|
table.EstimatedRowHeight = 70;
|
||||||
}
|
}
|
||||||
|
|
||||||
var submitToolbarItem = new ToolbarItem(AppResources.Submit, null, async () =>
|
var submitToolbarItem = new ToolbarItem(AppResources.Submit, Helpers.ToolbarImage("ion_chevron_right.png"), async () =>
|
||||||
{
|
{
|
||||||
await SubmitAsync();
|
await SubmitAsync();
|
||||||
}, ToolbarItemOrder.Default, 0);
|
}, ToolbarItemOrder.Default, 0);
|
||||||
|
|
|
@ -117,7 +117,7 @@ namespace Bit.App.Pages
|
||||||
Content = StackLayout
|
Content = StackLayout
|
||||||
};
|
};
|
||||||
|
|
||||||
var loginToolbarItem = new ToolbarItem(AppResources.Submit, null, async () =>
|
var loginToolbarItem = new ToolbarItem(AppResources.Submit, Helpers.ToolbarImage("ion_chevron_right.png"), async () =>
|
||||||
{
|
{
|
||||||
await Register();
|
await Register();
|
||||||
}, ToolbarItemOrder.Default, 0);
|
}, ToolbarItemOrder.Default, 0);
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace Bit.App.Pages
|
||||||
table.EstimatedRowHeight = 70;
|
table.EstimatedRowHeight = 70;
|
||||||
}
|
}
|
||||||
|
|
||||||
var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async () =>
|
var saveToolBarItem = new ToolbarItem(AppResources.Save, Helpers.ToolbarImage("envelope.png"), async () =>
|
||||||
{
|
{
|
||||||
if(_lastAction.LastActionWasRecent())
|
if(_lastAction.LastActionWasRecent())
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace Bit.App.Pages
|
||||||
mainTable.EstimatedRowHeight = 70;
|
mainTable.EstimatedRowHeight = 70;
|
||||||
}
|
}
|
||||||
|
|
||||||
var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async () =>
|
var saveToolBarItem = new ToolbarItem(AppResources.Save, Helpers.ToolbarImage("envelope.png"), async () =>
|
||||||
{
|
{
|
||||||
if(_lastAction.LastActionWasRecent())
|
if(_lastAction.LastActionWasRecent())
|
||||||
{
|
{
|
||||||
|
|
|
@ -112,7 +112,7 @@ namespace Bit.App.Pages
|
||||||
|
|
||||||
if(_passwordValueAction != null)
|
if(_passwordValueAction != null)
|
||||||
{
|
{
|
||||||
var selectToolBarItem = new ToolbarItem(AppResources.Select, null, async () =>
|
var selectToolBarItem = new ToolbarItem(AppResources.Select, Helpers.ToolbarImage("ion_chevron_right.png"), async () =>
|
||||||
{
|
{
|
||||||
if(_fromAutofill)
|
if(_fromAutofill)
|
||||||
{
|
{
|
||||||
|
|
|
@ -572,7 +572,7 @@ namespace Bit.App.Pages
|
||||||
|
|
||||||
private void InitSave()
|
private void InitSave()
|
||||||
{
|
{
|
||||||
var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async () =>
|
var saveToolBarItem = new ToolbarItem(AppResources.Save, Helpers.ToolbarImage("envelope.png"), async () =>
|
||||||
{
|
{
|
||||||
if(_lastAction.LastActionWasRecent())
|
if(_lastAction.LastActionWasRecent())
|
||||||
{
|
{
|
||||||
|
|
|
@ -132,7 +132,7 @@ namespace Bit.App.Pages
|
||||||
Margin = new Thickness(0, 40, 0, 0)
|
Margin = new Thickness(0, 40, 0, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async () =>
|
var saveToolBarItem = new ToolbarItem(AppResources.Save, Helpers.ToolbarImage("envelope.png"), async () =>
|
||||||
{
|
{
|
||||||
if(_lastAction.LastActionWasRecent() || _cipher == null)
|
if(_lastAction.LastActionWasRecent() || _cipher == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace Bit.App.Pages
|
||||||
Margin = new Thickness(10, 40, 10, 0)
|
Margin = new Thickness(10, 40, 10, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
SaveToolbarItem = new ToolbarItem(AppResources.Save, null, async () =>
|
SaveToolbarItem = new ToolbarItem(AppResources.Save, Helpers.ToolbarImage("envelope.png"), async () =>
|
||||||
{
|
{
|
||||||
if(_lastAction.LastActionWasRecent() || _cipher == null)
|
if(_lastAction.LastActionWasRecent() || _cipher == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -438,7 +438,7 @@ namespace Bit.App.Pages
|
||||||
|
|
||||||
private void InitSave()
|
private void InitSave()
|
||||||
{
|
{
|
||||||
var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async () =>
|
var saveToolBarItem = new ToolbarItem(AppResources.Save, Helpers.ToolbarImage("envelope.png"), async () =>
|
||||||
{
|
{
|
||||||
if(_lastAction.LastActionWasRecent())
|
if(_lastAction.LastActionWasRecent())
|
||||||
{
|
{
|
||||||
|
|
|
@ -500,6 +500,7 @@ namespace Bit.App.Pages
|
||||||
_page = page;
|
_page = page;
|
||||||
_cipherId = cipherId;
|
_cipherId = cipherId;
|
||||||
Text = AppResources.Edit;
|
Text = AppResources.Edit;
|
||||||
|
Icon = Helpers.ToolbarImage("cog.png");
|
||||||
ClickAction = async () => await ClickedItem();
|
ClickAction = async () => await ClickedItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,17 @@ namespace Bit.App.Utilities
|
||||||
|
|
||||||
return " ";
|
return " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string ToolbarImage(string image)
|
||||||
|
{
|
||||||
|
if (Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Android)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
public static async void CipherMoreClickedAsync(Page page, VaultListPageModel.Cipher cipher, bool autofill)
|
public static async void CipherMoreClickedAsync(Page page, VaultListPageModel.Cipher cipher, bool autofill)
|
||||||
{
|
{
|
||||||
var buttons = new List<string> { AppResources.View, AppResources.Edit };
|
var buttons = new List<string> { AppResources.View, AppResources.Edit };
|
||||||
|
|
Loading…
Reference in a new issue