Example usage for android.widget SlidingDrawer animateOpen

List of usage examples for android.widget SlidingDrawer animateOpen

Introduction

In this page you can find the example usage for android.widget SlidingDrawer animateOpen.

Prototype

public void animateOpen() 

Source Link

Document

Opens the drawer with an animation.

Usage

From source file:net.line2soft.preambul.views.SlippyMapActivity.java

/**
 * Displays the sliding drawer which contains navigation instructions, and loads instructions
 * @param id The ID of the {@link Excursion} to display
 */// ww w  .  j  a  va 2  s . c o m
private void showNavigationInstruction(int id) {
    try {
        //Set view pager
        NavigationInstructionPagerAdapter adapter = new NavigationInstructionPagerAdapter(MapController
                .getInstance(this).getCurrentLocation().getExcursions(this).get(id).getInstructions());
        ViewPager myPager = (ViewPager) findViewById(R.id.pager_nav);
        myPager.setAdapter(adapter);
        myPager.setOnPageChangeListener(listener);
        MapView mv = (MapView) findViewById(R.id.mapView);
        //Change zoom
        int zoomMoyen = mv.getMapZoomControls().getZoomLevelMin()
                + (int) ((mv.getMapZoomControls().getZoomLevelMax() - mv.getMapZoomControls().getZoomLevelMin())
                        / 2);
        mv.getController().setZoom(zoomMoyen);
        //Display sliding drawer
        SlidingDrawer slide = (SlidingDrawer) findViewById(R.id.drawer);
        slide.setVisibility(View.VISIBLE);
        setNavigationInstructionToDisplay(0);
        if (!slide.isOpened()) {
            slide.animateOpen();
        }
    } catch (Exception e) {
        displayInfo(getString(R.string.message_map_navigation_error));
        e.printStackTrace();
        hideNavigationInstruction();
    }
}