Search in sources :

Example 1 with FreeFlowLayout

use of com.comcast.freeflow.layouts.FreeFlowLayout in project FreeFlow by Comcast.

the class FreeFlowContainerTest method testAllViewsAreGeneratedByFirstLayout.

/**
	 * Tests that all items are generated by the time predraw kicks in
	 * 
	 * @throws InterruptedException
	 */
public void testAllViewsAreGeneratedByFirstLayout() throws InterruptedException {
    final CountDownLatch lock = new CountDownLatch(1);
    main.runOnUiThread(new Runnable() {

        @Override
        public void run() {
            final FreeFlowContainer container = new FreeFlowContainer(main);
            DefaultSectionAdapter adapter = new DefaultSectionAdapter(main, 1, 2);
            container.setAdapter(adapter);
            VLayout vLayout = new VLayout();
            vLayout.setLayoutParams(new VLayout.LayoutParams(300, 200, 10));
            container.setLayout(vLayout);
            container.addFreeFlowEventListener(new FreeFlowEventListener() {

                @Override
                public void onLayoutChanging(FreeFlowLayout oldLayout, FreeFlowLayout newLayout) {
                }

                @Override
                public void layoutComputed() {
                }

                @Override
                public void layoutComplete(boolean areTransitionAnimationsPlaying) {
                    assertEquals("Correct number of children were not created", 3, container.getChildCount());
                }

                @Override
                public void dataChanged() {
                }

                @Override
                public void animationsStarted() {
                }

                @Override
                public void layoutChangeAnimationsComplete() {
                }
            });
            main.setContentView(container);
        }
    });
    lock.await(5000, TimeUnit.MILLISECONDS);
}
Also used : DefaultSectionAdapter(com.comcast.freeflow.helpers.DefaultSectionAdapter) VLayout(com.comcast.freeflow.layouts.VLayout) CountDownLatch(java.util.concurrent.CountDownLatch) FreeFlowLayout(com.comcast.freeflow.layouts.FreeFlowLayout)

Aggregations

DefaultSectionAdapter (com.comcast.freeflow.helpers.DefaultSectionAdapter)1 FreeFlowLayout (com.comcast.freeflow.layouts.FreeFlowLayout)1 VLayout (com.comcast.freeflow.layouts.VLayout)1 CountDownLatch (java.util.concurrent.CountDownLatch)1