xamarin-forms-tab-badge icon indicating copy to clipboard operation
xamarin-forms-tab-badge copied to clipboard

[Legacy] Bagde icon does not work when the tabbed page is not the first page (main page)

Open viviFrom13 opened this issue 6 years ago • 5 comments

I have modify your sample to first start on a page with a button. When we click on the bouton it launches the tabbed page

In this case, the tab badge are not visibles.

In this case, the _tabLinearLayout have not children.

I am using the case legacy because my application is inherit form FormsApplicationActivity. and launch the projet Plugin.Badge.Sample.Droid.Legacy

How can we resolve it ?

I have debugged a little and the issue seems to be in

_tabLinearLayout = _tabLinearLayout ?? (rootGroup.GetChildAt(i) as ViewGroup)?.FindChildOfType<HorizontalScrollView>()?.FindChildOfType<LinearLayout>();

the _tabLinearLayout never has children !! Why ???

Thank for your anser .

I have attached the sample android i have modified and snapshots of the screens

Sample.zip

screenshot_20180327-090111 screenshot_20180327-090207

viviFrom13 avatar Mar 27 '18 07:03 viviFrom13

I have continued to debugged 👍 this problème comes from the ActionBarContainer.

When, the tabbedPage is the main page :

  • the ActionBarContainer has 3 childs ( ActionBarView, ActionBarContextView and the ScollingTabContainerView)

When the TabbedPage is in the secondpage :

  • the ActionBarContainer has 2 childs only ( ActionBarView, ActionBarContextView ) the ScollingTabContainerView is not Present !!!

Why ?

viviFrom13 avatar Mar 27 '18 09:03 viviFrom13

I have found. the ScollingTabContainerView is not here because the tabbedPage is not visible. So during, the navigation in the hierachy we are in the tree of the first page ( main page) not in the tree of the second page. So we have to wait a little before adding the bagdes

i have juste add a delay on the LegacyBadgedTabbedRenderer class private async void OnAppearing(object sender, EventArgs e) { Element.Appearing -= OnAppearing; await Task.Delay(1000); IViewParent root = ViewGroup;

viviFrom13 avatar Mar 27 '18 13:03 viviFrom13

@viviFrom13 Nice find, could you check if a shorter delay works (200ms)? Or maybe another page lifecycle event which can be used?

xabre avatar Mar 27 '18 15:03 xabre

The delay depends of the loading time of the window. For my own application i need a delay of 3000 :(

If i tried to use another event like focused by i never found someting that working.

Do you have another idea ?

viviFrom13 avatar Mar 28 '18 06:03 viviFrom13

@viviFrom13 is this still an issue?

xabre avatar Apr 11 '19 13:04 xabre