Samsung / Tizen.CircularUI

Tizen Wearable CircularUI project is to develop an open source software motivate software developer to creating Tizen Wearable Xamarin Forms app more easily and efficiently.
Other
80 stars 32 forks source link

CircleListView within CarouselView crashes when the ListView has been swiped away before the animation ends #364

Closed KieronQuinn closed 3 years ago

KieronQuinn commented 3 years ago

Describe the bug When using one (or more) CircleListView within a CarouselView, if the user swipes away from the focused CircleListview while the animation is still running (ie. they scroll by swipe or rotary action then swipe away), the app will hard crash with a NullReferenceException.

To Reproduce Steps to reproduce the behavior:

  1. Create a CarouselView containing two 'pages', containing one or more CircleListView (my setup has the second page with a CircleListView, the first page is dynamic between a CircleScrollView and a CircleListVIew)
  2. Open the app and swipe to the second page
  3. Scroll up and down a few times, then swipe off the page back to the first.
  4. The app will crash with the following exception:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Tizen.Wearable.CircularUI.Forms.Renderer.CircleListViewRenderer.OnScrollAnimationStopped(Object sender, EventArgs args)

Expected behavior The page should be swiped away without issue

Screenshots First page (scrollview) Second page (circlelistview)

Environment (please complete the following information):

EmilAlipiev commented 3 years ago

Exactly my problem. Looks like no fix yet for it. Did you find a workaround for this? maybe Some thread.sleep or?

EmilAlipiev commented 3 years ago

@rookiejava you know if we can find a solution for this? :) just tagging in case if you have missed it thanks

KieronQuinn commented 3 years ago

Exactly my problem. Looks like no fix yet for it. Did you find a workaround for this? maybe Some thread.sleep or?

Nope. I actually abandoned my whole Tizen project entirely and intend to switch to the new WearOS powered watch in the next couple of weeks. Tizen turned out to just be too buggy and annoying to develop on.

EmilAlipiev commented 3 years ago

Too bad Tizen has such potential i am doing WearOS also and i find I can complete a task with Tizen even faster as it supports XF but it has too less support unfortunately. One thing also good existing TIzen apps are working on Samsung Watch 4 now.

EmilAlipiev commented 3 years ago

Regarding the error, I tried to override OnScrollAnimationStopped with some null controls but somehow it doesnt help and below exception is still fired. I am guessing that it occurs within the Core or somewhere else.


  public class MyCustomListViewRenderer : CircleListViewRenderer
    {
        new MyCustomListView Element => base.Element as MyCustomListView;

        protected override void OnElementReady()
        {
            base.OnElementReady();
            Control.ScrollAnimationStopped += OnScrollAnimationStopped;
        }

        private void OnScrollAnimationStopped(object sender, EventArgs arrgs)
        {
            if (Control == null || Element == null)
                return;

            GenListItem item = Control.GetItemByPosition(180, 180, out int pos);
            if (item == null)
                return;

            if (item.Data is NListView.ItemContext itemContext && itemContext != null && pos == 0)
            {
                var obj = itemContext.Cell?.BindingContext;
                if (obj != null)
                {
                    var index = Element.TemplatedItems.GetGlobalIndexOfItem(obj);
                    Log.Debug("TEST", $"Item index: {index}");
                    Element.NotifyHighlightedItem(obj, index);
                }
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && Control != null)
            {
                Control.ScrollAnimationStopped -= OnScrollAnimationStopped;
            }
            base.Dispose(disposing);
        }
    }
System.NullReferenceException: Object reference not set to an instance of an object.   
 at Tizen.Wearable.CircularUI.Forms.Renderer.CircleListViewRenderer.OnScrollAnimationStopped(Object sender, EventArgs args)   
 at ElmSharp.SmartEvent.SendEvent(Object sender, EventArgs e)  
 at ElmSharp.SmartEvent`1.<>c__DisplayClass12_0.<add_On>b__0(IntPtr d, IntPtr o, IntPtr e) 
 at Tizen.Applications.CoreBackend.UICoreBackend.Run(String[] args)    at Tizen.Applications.CoreApplication.Run(String[] args)  
 at Tizen.Applications.CoreUIApplication.Run(String[] args)   
 at myWorkoutAccessoryC.Program.Main(String[] args) Fatal error. 
KieronQuinn commented 3 years ago

One thing also good existing TIzen apps are working on Samsung Watch 4 now.

I don't think this is the case, WearOS doesn't run Tizen apps. We're actually seeing companies port the apps, they're not using the same code.

EmilAlipiev commented 3 years ago

I am not sure in general wearos but when you create a new tizen app and want to publish via Samsung developer Portal, there is option to publish for watch 4 and active 4 as well. So I mean samsung watch 4 with wearos is able to run tizen apps.

rookiejava commented 3 years ago

Nope. I actually abandoned my whole Tizen project entirely and intend to switch to the new WearOS powered watch in the next couple of weeks. Tizen turned out to just be too buggy and annoying to develop on.

My Bad. I'm sorry to check this issue too late. We will check and get back as soon as possible. (/cc @shyunMin @sung-su @JoonghyunCho )

you know if we can find a solution for this? :) just tagging in case if you have missed it thanks

Thank you for reminding me. :-)

shyunMin commented 3 years ago

Hello @KieronQuinn, sorry again for the late answer. We tested a scenario like you said with CarouselView, ScrollView and CircleListView, and the issue is not reproduced on an emulator, unfortunately. We will test it on the target product as soon as we get to find one.

KieronQuinn commented 3 years ago

I vaguely recall that it might have worked in the emulator but not on device, but I was unable to get an internet connection to work on the emulator so it was hard to test.

shyunMin commented 3 years ago

Hello @KieronQuinn, I've checked the issue and pushed the patch to fix it. I'll let you know as soon as a new package applied the change is published. Thanks for reporting the issue.

shyunMin commented 2 years ago

Just in case you missed. Fixed package has been released! Thanks. https://github.com/Samsung/Tizen.CircularUI/releases/tag/release-1.5.4