Custom activity indicator

I’ve made a custom activity indicator, that essentially mirrors the functionality of the native activity indicator. I then overwrite the native.setActivityIndicator function with one of my own, so everywhere in my project where the activity indicator is called, it instead calls mine.

local activityIndicator = require 'CustomActivityIndicator';  
native.setActivityIndicator = activityIndicator.setActivityIndicator  

My function does the same thing, takes in a true and false, and enables and disables an activity indicator. As far as functionality is concerned, this is all well and good. However, my activity indicator will freeze when there is stuff being processed in the background. This is mostly noticeable during scene transitions, when the new scene is being created, all of the assets being loaded, etc. unlike the regular native indicator my indicator ceases movement. I assume this is due to the native activity indicator being lower lever, or just simply given higher priority, or perhaps im just being dumb the way im using mine.

My activity indicator’s basic code:

BeginActivityIndicator = function()  
  
 activityIndicatorState = true;  
 overlay.isVisible = true;  
 activityIndicator.isVisible = true;  
 activityIndicatorTransition = transition.to(activityIndicator, {time = 2000, rotation = activityIndicator.rotation + 360, onComplete = BeginActivityIndicator});  
  
end  

So, perhaps it’s due to me using a transition? Does anyone have any thoughts/answers as to why it would be freezing, and what I could do to stop that? [import]uid: 143007 topic_id: 34497 reply_id: 334497[/import]

I’m going to speculate that the native indicator is running in it’s own thread being that it’s a “native.*” api call and those don’t run in the same context as the OpenGL stuff, which you indicator would be. Anything that pauses your app, like garbage collection, removing/purging scenes, etc. will potentially impact your indicator.

But I’m just guessing.
[import]uid: 199310 topic_id: 34497 reply_id: 137155[/import]

Rob is correct, any animations/transitions/timers or similar will be interrupted when loading assets, changing scenes etc.

The only thing you can do currently to keep it animating is to load your assets in chunks, and have a slight delay between each load event. That way you can give your indicator a chance to animate. [import]uid: 84637 topic_id: 34497 reply_id: 137204[/import]

Cool, thanks. [import]uid: 143007 topic_id: 34497 reply_id: 137229[/import]

I’m going to speculate that the native indicator is running in it’s own thread being that it’s a “native.*” api call and those don’t run in the same context as the OpenGL stuff, which you indicator would be. Anything that pauses your app, like garbage collection, removing/purging scenes, etc. will potentially impact your indicator.

But I’m just guessing.
[import]uid: 199310 topic_id: 34497 reply_id: 137155[/import]

Rob is correct, any animations/transitions/timers or similar will be interrupted when loading assets, changing scenes etc.

The only thing you can do currently to keep it animating is to load your assets in chunks, and have a slight delay between each load event. That way you can give your indicator a chance to animate. [import]uid: 84637 topic_id: 34497 reply_id: 137204[/import]

Cool, thanks. [import]uid: 143007 topic_id: 34497 reply_id: 137229[/import]