Skip to content

Commit

Permalink
Update page title
Browse files Browse the repository at this point in the history
  • Loading branch information
uholeschak committed Dec 30, 2024
1 parent 2ddd689 commit c3a4204
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion BmwDeepObd/MainActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2171,6 +2171,8 @@ protected void ConnectAction(object sender, ConnectActionArgs connectActionArgs,
else
{
ActivityCommon.JobReader.UpdateCompatIdUsage();
_fragmentStateAdapter?.UpdatePageTitles();

if (ActivityCommon.JobReader.CompatIdsUsed)
{
ShowBallonMessage(GetString(Resource.String.compile_compat_id_warn), ActivityCommon.BalloonDismissDuration, BalloonAlligment.Top);
Expand Down Expand Up @@ -7700,7 +7702,7 @@ public TabPageInfo(JobReader.PageInfo pageInfo, long itemId, int resourceId, str
public JobReader.PageInfo PageInfo { get; }
public long ItemId { get; }
public int ResourceId { get; }
public string Title { get; }
public string Title { get; set; }
}

private static long IdOffset;
Expand Down Expand Up @@ -7776,6 +7778,29 @@ public void AddPage(JobReader.PageInfo pageInfo, int resourceId, string title)

NotifyItemInserted(position);
}

public void UpdatePageTitles()
{
bool changed = false;
foreach (TabPageInfo tabPageInfo in _pageList)
{
JobReader.PageInfo pageInfo = tabPageInfo.PageInfo;
if (pageInfo != null)
{
string title = GetPageString(pageInfo, pageInfo.Name);
if (tabPageInfo.Title != title)
{
tabPageInfo.Title = title;
changed = true;
}
}
}

if (changed)
{
NotifyDataSetChanged();
}
}
}

public class TabContentFragment : Fragment
Expand Down

0 comments on commit c3a4204

Please sign in to comment.