Skip to content

Commit

Permalink
Merge pull request #2493 from PhilippC/1327--replace-placeholders-in-…
Browse files Browse the repository at this point in the history
…more-places

replace placeholder in title for viewing entries and autofill entry a…
  • Loading branch information
PhilippC authored Jan 3, 2024
2 parents d2778e8 + 9f08e00 commit 674ae26
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/keepass2android/EntryActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -937,10 +937,9 @@ protected void FillData()
iv.SetImageDrawable(Resources.GetDrawable(Resource.Drawable.ic00));
}



SupportActionBar.Title = Entry.Strings.ReadSafe(PwDefs.TitleField);
SupportActionBar.SetDisplayHomeAsUpEnabled(true);
SupportActionBar.Title = SprEngine.Compile(SupportActionBar.Title, new SprContext(Entry, App.Kp2a.CurrentDb.KpDatabase, SprCompileFlags.All));
SupportActionBar.SetDisplayHomeAsUpEnabled(true);
SupportActionBar.SetHomeButtonEnabled(true);

PopulateGroupText (Resource.Id.entry_group_name, Resource.Id.entryfield_group_container, KeyGroupFullPath);
Expand Down
6 changes: 5 additions & 1 deletion src/keepass2android/search/SearchProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ You should have received a copy of the GNU General Public License
using KeePassLib.Utility;
using System.Threading;
using System.Collections.Generic;
using KeePass.Util.Spr;

namespace keepass2android.search
{
Expand Down Expand Up @@ -294,7 +295,10 @@ public override string GetString(int column)
return Position.ToString(CultureInfo.InvariantCulture);
case 1: // SuggestColumnText1
string username = CurrentEntry.Strings.ReadSafe(PwDefs.UserNameField);
return CurrentEntry.Strings.ReadSafe(PwDefs.TitleField) + (string.IsNullOrWhiteSpace(username) ? "" : " ("+username+")");
username = SprEngine.Compile(username, new SprContext(CurrentEntry, App.Kp2a.CurrentDb.KpDatabase, SprCompileFlags.All));
var title = CurrentEntry.Strings.ReadSafe(PwDefs.TitleField);
title = SprEngine.Compile(title, new SprContext(CurrentEntry, App.Kp2a.CurrentDb.KpDatabase, SprCompileFlags.All));
return title + (string.IsNullOrWhiteSpace(username) ? "" : " ("+username+")");
case 2: // SuggestColumnText2
return Internationalise(_entriesWithContexts[Position].resultContext);
case 3: // SuggestColumnIcon1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Android.Runtime;
using Android.Views;
using Android.Widget;
using KeePass.Util.Spr;
using keepass2android.services.AutofillBase;
using keepass2android.services.AutofillBase.model;
using Keepass2android.Pluginsdk;
Expand Down Expand Up @@ -108,6 +109,7 @@ public static FilledAutofillFieldCollection<ViewNodeInputField> GetFilledAutofil


fieldCollection.DatasetName = pwEntry.Strings.ReadSafe(PwDefs.TitleField);
fieldCollection.DatasetName = SprEngine.Compile(fieldCollection.DatasetName, new SprContext(pwEntry, App.Kp2a.CurrentDb.KpDatabase, SprCompileFlags.All));

return fieldCollection;
}
Expand Down
3 changes: 2 additions & 1 deletion src/keepass2android/views/PwEntryView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ private void PopulateView(View ev, PwEntry pw, int pos)
}

String title = pw.Strings.ReadSafe(PwDefs.TitleField);
var str = new SpannableString(title);
title = SprEngine.Compile(title, new SprContext(_entry, db.KpDatabase, SprCompileFlags.All));
var str = new SpannableString(title);

if (isExpired)
{
Expand Down

0 comments on commit 674ae26

Please sign in to comment.