@Override
  public void onPoiListReceived(List<PointOfInterestDistance> list) {
    super.onPoiListReceived(list);

    // when a non-empty list is received, mask the indeterminate progress
    // bar. Then animate in the poi list and set the poi detail fragment to
    // show the route_id element in the list.
    BaseActionBarActivity abActivity = (BaseActionBarActivity) activity;
    abActivity.findViewById(R.id.progress).setVisibility(View.GONE);
    if (!list.isEmpty()) {
      View v = abActivity.findViewById(R.id.poicontainer);
      v.setVisibility(View.VISIBLE);

      abActivity
          .getSupportFragmentManager()
          .beginTransaction()
          .setCustomAnimations(R.anim.nearme_initial_list_slide_in, -1)
          .show(this.list)
          .commit();
      abActivity
          .getSupportFragmentManager()
          .beginTransaction()
          .setCustomAnimations(R.anim.nearme_initial_poi_slide_in, -1)
          .show(poiFragment)
          .commit();
      setPointOfInterest(list.get(0).poi);
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState, Activity activity) {
    super.onCreate(savedInstanceState, activity);

    BaseActionBarActivity abActivity = (BaseActionBarActivity) activity;
    FragmentManager manager = abActivity.getSupportFragmentManager();

    poiFragment = (PointOfInterestFragmentWithMap) manager.findFragmentById(R.id.poi_frag);
    list = (BaseFragment) manager.findFragmentById(R.id.list);

    // When the activity is route_id loaded, we must wait for position
    // acquisition. When my location is acquired, animate in the poi list
    // and then the poi detail. So in route_id place, show the indeterminate
    // progress bar and hide the two other fragments.
    if (!loaded) {
      abActivity
          .getSupportFragmentManager()
          .beginTransaction()
          .hide(list)
          .hide(poiFragment)
          .commit();
      abActivity.findViewById(R.id.progress).setVisibility(View.VISIBLE);
    }

    // only show the poi detail container. This containers serves to occupy
    // space when the poi list is animated in.
    else {
      View v = abActivity.findViewById(R.id.poicontainer);
      v.setVisibility(View.VISIBLE);
      abActivity.findViewById(R.id.progress).setVisibility(View.GONE);
    }
  }