code: private void initPager() {
          // Setting up pager adapter
          pagerAdapter = new PhotoPagerAdapter(views.pager, getSettingsController());
  
          pagerListener = new ViewPager.SimpleOnPageChangeListener() {
              @Override
              public void onPageSelected(int position) {
                  onPhotoInPagerSelected(position);
              }
          };
  
          views.pager.setAdapter(pagerAdapter);
          views.pager.addOnPageChangeListener(pagerListener);
          views.pager.setPageTransformer(true, new DepthPageTransformer());
  
          // Setting up pager toolbar
          views.pagerToolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
          views.pagerToolbar.setNavigationOnClickListener(view -> onBackPressed());
  
          // Enabling immersive mode by clicking on full screen image
          pagerAdapter.setImageClickListener(() -> {
              if (!listAnimator.isLeaving()) {
                  // Toggle immersive mode
                  showSystemUi(!isSystemUiShown());
              }
          });
          getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(
                  visibility -> views.pagerToolbar.animate().alpha(isSystemUiShown() ? 1f : 0f));
      }
docs: Initializing pager and fullscreen mode.