Search in sources :

Example 1 with FakePager

use of com.bluelinelabs.conductor.support.util.FakePager in project Conductor by bluelinelabs.

the class StateSaveTests method createActivityController.

public void createActivityController(Bundle savedInstanceState) {
    ActivityController<Activity> activityController = Robolectric.buildActivity(Activity.class).create().start().resume();
    Router router = Conductor.attachRouter(activityController.get(), new FrameLayout(activityController.get()), savedInstanceState);
    TestController controller = new TestController();
    router.setRoot(RouterTransaction.with(controller));
    pager = new FakePager(new FrameLayout(activityController.get()));
    pager.setOffscreenPageLimit(1);
    pagerAdapter = new RouterPagerAdapter(controller) {

        @Override
        public void configureRouter(@NonNull Router router, int position) {
            if (!router.hasRootController()) {
                router.setRoot(RouterTransaction.with(new TestController()));
            }
        }

        @Override
        public int getCount() {
            return 20;
        }
    };
    pager.setAdapter(pagerAdapter);
}
Also used : FrameLayout(android.widget.FrameLayout) TestController(com.bluelinelabs.conductor.support.util.TestController) Activity(android.app.Activity) Router(com.bluelinelabs.conductor.Router) FakePager(com.bluelinelabs.conductor.support.util.FakePager)

Aggregations

Activity (android.app.Activity)1 FrameLayout (android.widget.FrameLayout)1 Router (com.bluelinelabs.conductor.Router)1 FakePager (com.bluelinelabs.conductor.support.util.FakePager)1 TestController (com.bluelinelabs.conductor.support.util.TestController)1