Android, endlessly repeating animation against instrumentation.waitForIdleSync ()

I have a project with animated custom view. Animation is a simple alpha attenuation that repeats endlessly. Presentation cursor, and it makes it cursorlook like it is blinking. When I started writing functional unit tests for a project, I ran into the problem that the method getActivity()hangs in the method setUpdue to animation. getActivity()calls waitForIdleSync()before returning, and since the animation starts at the beginning, it getActivity()never returns. It actually took me quite a while to figure out if I would start a test and he would sit there doing nothing ... It will also happen 100% of the time.

I would not consider this BUG, ​​because technically, if the animation is running, the device is not idle, however this is a question. Any suggestions or workarounds that allow you to start the animation from the very beginning, and also use it waitForIdleSyncon time ActivityInstrumentationTestCase2s, will be greatly appreciated. I could implement a workaround not to use waitForIdleSync(), expecting other events to provide synchronization with test and application actions, however I still need to be called getActivity()at some point. Once in this method, it never returns with endless repeating animations. Also, the animation should start somewhere before the end of the method onRestart. Ideally, there would be a method waitForIdle(int timeout).

Am I starting the animation at the wrong time, or am I not starting the animation using the correct methods? I start / stop the animation programmatically because there is a need to start and stop the flashing behavior in the application. below is the code i use to start the animation. the method startBlinking(Context)is called from the constructor cursors...

public void startBlinking(Context context){
    Animation blink = AnimationUtils.loadAnimation(context, R.anim.cursor_blink);
    blink.setRepeatMode(Animation.RESTART);
    blink.setRepeatCount(Animation.INFINITE);
    startAnimation(blink);
}
+3
source share
1 answer

, AOSP, , - . , ( , ). , . , , , .

0

All Articles