Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); context = this; setContentView(R.layout.activity_pager); ButterKnife.bind(this); coordinator = (CoordinatorLayout) findViewById(R.id.PhotoPager_Layout); DisplayMetrics metrics = getResources().getDisplayMetrics(); imageWidth = metrics.widthPixels; imageHeight = metrics.heightPixels; handler = new Handler(); runnable = new Runnable() { @Override public void run() { View view = getWindow().getDecorView(); int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN |View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |View.SYSTEM_UI_FLAG_IMMERSIVE; view.setSystemUiVisibility(uiOptions); } }; startHandler(); overridePendingTransition(R.anim.media_zoom_in,0); SP = PreferenceUtil.getInstance(getApplicationContext()); securityObj = new SecurityHelper(SingleMediaActivity.this); allPhotoMode = getIntent().getBooleanExtra(getString(R.string.all_photo_mode), false); all_photo_pos = getIntent().getIntExtra(getString(R.string.position), 0); size_all = getIntent().getIntExtra(getString(R.string.allMediaSize), getAlbum().getCount()); String path2 = getIntent().getStringExtra("path"); pathForDescription = path2; try { Album album; if ((getIntent().getAction().equals(Intent.ACTION_VIEW) || getIntent().getAction().equals(ACTION_REVIEW)) && getIntent().getData() != null) { String path = ContentHelper.getMediaPath(getApplicationContext(), getIntent().getData()); pathForDescription = path; File file = null; if (path != null) file = new File(path); if (file != null && file.isFile()) album = new Album(getApplicationContext(), file); else { album = new Album(getApplicationContext(), getIntent().getData()); customUri = true; } getAlbums().addAlbum(0, album); } initUI(); setupUI(); } catch (Exception e) { e.printStackTrace(); } }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); supportPostponeEnterTransition(); context = this; setContentView(R.layout.activity_pager); ButterKnife.bind(this); coordinator = (CoordinatorLayout) findViewById(R.id.PhotoPager_Layout); DisplayMetrics metrics = getResources().getDisplayMetrics(); imageWidth = metrics.widthPixels; imageHeight = metrics.heightPixels; handler = new Handler(); runnable = new Runnable() { @Override public void run() { hideSystemUI(); } }; startHandler(); SP = PreferenceUtil.getInstance(getApplicationContext()); securityObj = new SecurityHelper(SingleMediaActivity.this); allPhotoMode = getIntent().getBooleanExtra(getString(R.string.all_photo_mode), false); all_photo_pos = getIntent().getIntExtra(getString(R.string.position), 0); size_all = getIntent().getIntExtra(getString(R.string.allMediaSize), getAlbum().getCount()); String path2 = getIntent().getStringExtra("path"); pathForDescription = path2; try { Album album; if ((getIntent().getAction().equals(Intent.ACTION_VIEW) || getIntent().getAction().equals(ACTION_REVIEW)) && getIntent().getData() != null) { String path = ContentHelper.getMediaPath(getApplicationContext(), getIntent().getData()); pathForDescription = path; File file = null; if (path != null) file = new File(path); if (file != null && file.isFile()) album = new Album(getApplicationContext(), file); else { album = new Album(getApplicationContext(), getIntent().getData()); customUri = true; } getAlbums().addAlbum(0, album); } initUI(); setupUI(); } catch (Exception e) { e.printStackTrace(); } }