Merge branch '2504--copy-on-longclick'
# Resolved Conflicts: # src/keepass2android/EntryActivity.cs
This commit is contained in:
@@ -51,6 +51,13 @@ namespace Kp2aAutofillParserTest
|
||||
RunTestFromAutofillInput(resourceName, "org.mozilla.firefox", "www.amazon.it");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestDoNotFillPasswordAsUsername()
|
||||
{
|
||||
var resourceName = "Kp2aAutofillParserTest.citibank.json";
|
||||
RunTestFromAutofillInput(resourceName, "com.konylabs.cbplpat", null);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CanDetectFieldsWithoutAutofillHints()
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
@@ -11,6 +11,7 @@
|
||||
<ItemGroup>
|
||||
<None Remove="android14-settings.json" />
|
||||
<None Remove="chrome-android10-amazon-it.json" />
|
||||
<None Remove="citibank.json" />
|
||||
<None Remove="com-expressvpn-vpn-android13.json" />
|
||||
<None Remove="com-ifs-banking-fiid3364-android13.json" />
|
||||
<None Remove="com-servicenet-mobile-focused.json" />
|
||||
@@ -46,6 +47,9 @@
|
||||
<EmbeddedResource Include="com-ifs-banking-fiid3364-android13.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="citibank.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="firefox-amazon-it.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
|
@@ -721,7 +721,7 @@ namespace keepass2android
|
||||
var stringView = new ExtraStringView(layout, valueView, valueViewVisible, keyView);
|
||||
|
||||
_stringViews.Add(key, stringView);
|
||||
RegisterTextPopup(valueViewContainer, valueViewContainer.FindViewById(Resource.Id.extra_vdots), key, isProtected);
|
||||
RegisterTextPopup(valueViewContainer, valueViewContainer.FindViewById(Resource.Id.extra_vdots), key, isProtected, layout);
|
||||
|
||||
return stringView;
|
||||
|
||||
@@ -731,6 +731,7 @@ namespace keepass2android
|
||||
|
||||
private List<IPopupMenuItem> RegisterPopup(string popupKey, View clickView, View anchorView)
|
||||
{
|
||||
|
||||
clickView.Click += (sender, args) =>
|
||||
{
|
||||
ShowPopup(anchorView, popupKey);
|
||||
@@ -959,16 +960,20 @@ namespace keepass2android
|
||||
RegisterProtectedTextView(Kp2aTotp.TotpKey, FindViewById<TextView>(Resource.Id.entry_totp), FindViewById<TextView>(Resource.Id.entry_totp_visible));
|
||||
|
||||
RegisterTextPopup(FindViewById<RelativeLayout> (Resource.Id.groupname_container),
|
||||
FindViewById (Resource.Id.entry_group_name), KeyGroupFullPath);
|
||||
FindViewById (Resource.Id.entry_group_name), KeyGroupFullPath,
|
||||
FindViewById(Resource.Id.entryfield_group_container));
|
||||
|
||||
RegisterTextPopup(FindViewById<RelativeLayout>(Resource.Id.username_container),
|
||||
FindViewById(Resource.Id.username_vdots), PwDefs.UserNameField);
|
||||
FindViewById(Resource.Id.username_vdots), PwDefs.UserNameField,
|
||||
FindViewById(Resource.Id.entryfield_container_username));
|
||||
|
||||
RegisterTextPopup(FindViewById<RelativeLayout>(Resource.Id.url_container),
|
||||
FindViewById(Resource.Id.url_vdots), PwDefs.UrlField)
|
||||
FindViewById(Resource.Id.url_vdots), PwDefs.UrlField,
|
||||
FindViewById(Resource.Id.entryfield_container_url))
|
||||
.Add(new GotoUrlMenuItem(this, PwDefs.UrlField));
|
||||
RegisterTextPopup(FindViewById<RelativeLayout>(Resource.Id.password_container),
|
||||
FindViewById(Resource.Id.password_vdots), PwDefs.PasswordField);
|
||||
FindViewById(Resource.Id.password_vdots), PwDefs.PasswordField,
|
||||
FindViewById(Resource.Id.entryfield_container_password));
|
||||
RegisterTextPopup(FindViewById<RelativeLayout>(Resource.Id.totp_container),
|
||||
FindViewById(Resource.Id.totp_vdots), Kp2aTotp.TotpKey);
|
||||
|
||||
@@ -987,7 +992,8 @@ namespace keepass2android
|
||||
}
|
||||
PopulateStandardText(Resource.Id.entry_comment, Resource.Id.entryfield_container_comment, PwDefs.NotesField);
|
||||
RegisterTextPopup(FindViewById<RelativeLayout>(Resource.Id.comment_container),
|
||||
FindViewById(Resource.Id.comment_vdots), PwDefs.NotesField);
|
||||
FindViewById(Resource.Id.comment_vdots), PwDefs.NotesField,
|
||||
FindViewById(Resource.Id.entryfield_container_comment));
|
||||
|
||||
PopulateText(Resource.Id.entry_tags, Resource.Id.entryfield_container_tags, concatTags(Entry.Tags));
|
||||
PopulateText(Resource.Id.entry_override_url, Resource.Id.entryfield_container_overrideurl, Entry.OverrideUrl);
|
||||
@@ -1084,12 +1090,12 @@ namespace keepass2android
|
||||
SendBroadcast(i);
|
||||
}
|
||||
}
|
||||
private List<IPopupMenuItem> RegisterTextPopup(View container, View anchor, string fieldKey)
|
||||
private List<IPopupMenuItem> RegisterTextPopup(View container, View anchor, string fieldKey, View outerContainer)
|
||||
{
|
||||
return RegisterTextPopup(container, anchor, fieldKey, Entry.Strings.GetSafe(fieldKey).IsProtected || fieldKey == Kp2aTotp.TotpKey);
|
||||
return RegisterTextPopup(container, anchor, fieldKey, Entry.Strings.GetSafe(fieldKey).IsProtected || fieldKey == Kp2aTotp.TotpKey, outerContainer);
|
||||
}
|
||||
|
||||
private List<IPopupMenuItem> RegisterTextPopup(View container, View anchor, string fieldKey, bool isProtected)
|
||||
private List<IPopupMenuItem> RegisterTextPopup(View container, View anchor, string fieldKey, bool isProtected, View outerContainer)
|
||||
{
|
||||
string popupKey = Strings.PrefixString + fieldKey;
|
||||
var popupItems = RegisterPopup(
|
||||
@@ -1108,6 +1114,11 @@ namespace keepass2android
|
||||
popupItems.Add(new ToggleVisibilityPopupMenuItem(this, valueView));
|
||||
}
|
||||
|
||||
//copy text to clipboard when the outer container (including the field icon on the left) or the inner container
|
||||
// (containing the textview and the vertical dots for the popup menu) is long-clicked.
|
||||
RegisterCopyOnLongClick(outerContainer, fieldKey, isProtected);
|
||||
RegisterCopyOnLongClick(container, fieldKey, isProtected);
|
||||
|
||||
if (fieldKey != PwDefs.UrlField //url already has a go-to-url menu
|
||||
&& (_stringViews[fieldKey].Text.StartsWith(KeePass.AndroidAppScheme)
|
||||
|| _stringViews[fieldKey].Text.StartsWith("http://")
|
||||
@@ -1118,6 +1129,11 @@ namespace keepass2android
|
||||
return popupItems;
|
||||
}
|
||||
|
||||
private void RegisterCopyOnLongClick(View container, string fieldKey, bool isProtected)
|
||||
{
|
||||
container.LongClick += (sender, args) =>
|
||||
CopyToClipboardService.CopyValueToClipboardWithTimeout(this, _stringViews[fieldKey].Text, isProtected);
|
||||
}
|
||||
|
||||
|
||||
private void ShowPopup(View anchor, string popupKey)
|
||||
@@ -1184,6 +1200,8 @@ namespace keepass2android
|
||||
value = SprEngine.Compile(value, new SprContext(Entry, App.Kp2a.CurrentDb.KpDatabase, SprCompileFlags.All));
|
||||
PopulateText(viewIds, containerViewId, value);
|
||||
_stringViews.Add(key, new StandardStringView(viewIds, containerViewId, this));
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void PopulateGroupText(int viewId, int containerViewId, String key)
|
||||
|
Reference in New Issue
Block a user