@Override
  public void onActivityCreated2(Bundle savedInstanceState) {

    HashMap<String, String> url_maps = new HashMap<String, String>();
    url_maps.put(
        "Hannibal",
        "http://static2.hypable.com/wp-content/uploads/2013/12/hannibal-season-2-release-date.jpg");
    url_maps.put("Big Bang Theory", "http://tvfiles.alphacoders.com/100/hdclearart-10.png");
    url_maps.put("House of Cards", "http://cdn3.nflximg.net/images/3093/2043093.jpg");
    url_maps.put(
        "Game of Thrones",
        "http://images.boomsbeat.com/data/images/full/19640/game-of-thrones-season-4-jpg.jpg");
    for (String name : url_maps.keySet()) {
      DefaultSliderView defaultSliderView = new DefaultSliderView(getActivity());
      defaultSliderView.image(url_maps.get(name));
      TextSliderView textSliderView = new TextSliderView(getActivity());
      // initialize a SliderLayout
      textSliderView
          .description(name)
          .image(url_maps.get(name))
          .setScaleType(BaseSliderView.ScaleType.Fit)
          .setOnSliderClickListener(this);
      // add your extra information
      textSliderView.getBundle().putString("extra", name);
      mDemoSlider.addSlider(defaultSliderView);
    }
    mDemoSlider.setPresetTransformer(SliderLayout.Transformer.Accordion);
    mDemoSlider.setPresetIndicator(SliderLayout.PresetIndicators.Center_Bottom);
    mDemoSlider.setCustomAnimation(new DescriptionAnimation());
    mDemoSlider.setDuration(4000);
    mDemoSlider.setCustomIndicator(customIndicator);
  }
 public void setPresetIndicator(PresetIndicators presetIndicator) {
   PagerIndicator pagerIndicator = (PagerIndicator) findViewById(presetIndicator.getResourceId());
   setCustomIndicator(pagerIndicator);
 }
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ActivitiesFragmentBinding binding =
        DataBindingUtil.inflate(inflater, R.layout.activities_fragment, container, false);
    binding.setCategory(category);

    Toolbar toolbar = binding.toolbar;
    AppCompatActivity activity = (AppCompatActivity) getActivity();
    activity.setSupportActionBar(toolbar);
    assert activity.getSupportActionBar() != null;
    final ActionBar ab = activity.getSupportActionBar();
    ab.setDisplayShowTitleEnabled(false);
    ab.setDisplayHomeAsUpEnabled(false);

    Spinner spinner = binding.spinner;
    spinner.setAdapter(
        new ArrayAdapter<>(
            ab.getThemedContext(), android.R.layout.simple_spinner_item, localizedCategory));
    spinner.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            if (currentCategory != position) {
              currentCategory = position;
              category.set(localizedCategory[currentCategory]);
              activities.clear();
              list.getAdapter().notifyDataSetChanged();
            }
          }

          @Override
          public void onNothingSelected(AdapterView<?> parent) {}
        });

    slider = binding.slider;
    slider.setCustomIndicator(binding.customIndicator);
    slider.setDuration(3500);
    slider.setPresetTransformer(SliderLayout.Transformer.Fade);
    api.getActivities("recommendations", 0, 5)
        .subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe(
            new Action1<List<Activity>>() {
              @Override
              public void call(List<Activity> activities) {
                slider.stopAutoCycle();
                slider.removeAllSliders();
                for (Activity activity : activities) {
                  ActivitySliderView view = new ActivitySliderView(getContext(), activity);
                  view.bundle(new Bundle());
                  view.getBundle().putLong("id", activity.getId());
                  view.setOnSliderClickListener(sliderClickListener);
                  slider.addSlider(view);
                }
                slider.startAutoCycle();
              }
            },
            new Action1<Throwable>() {
              @Override
              public void call(Throwable throwable) {
                Timber.e("failed to fetch recommended activities", throwable);
                throwable.printStackTrace();
              }
            });

    list = binding.list;
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
    list.setLayoutManager(linearLayoutManager);
    list.addItemDecoration(new MarginDownDecoration(getContext()));
    list.setAdapter(new ActivitiesAdapter(activities));
    list.addOnScrollListener(
        new EndlessRecyclerOnScrollListener(linearLayoutManager) {
          @Override
          public void onLoadMore(int currentPage) {
            loadPage(currentPage);
          }
        });

    // loadPage(0);

    return binding.getRoot();
  }