Source:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getPreferenceManager().isShowOnboarding() && !isTestRunning()) { startActivity(new Intent(MainActivity.this, OnboardingActivity.class)); finish(); } else { setContentView(R.layout.activity_main); ButterKnife.bind(this); bottomNavigation.setOnNavigationItemSelectedListener(item -> { switch (item.getItemId()) { case R.id.dashboard: getSupportFragmentManager().beginTransaction().replace(R.id.content, new DashboardFragment()).commit(); return true; case R.id.testResults: getSupportFragmentManager().beginTransaction().replace(R.id.content, new ResultListFragment()).commit(); return true; case R.id.settings: getSupportFragmentManager().beginTransaction().replace(R.id.content, new PreferenceGlobalFragment()).commit(); return true; default: return false; } }); bottomNavigation.setSelectedItemId(getIntent().getIntExtra(RES_ITEM, R.id.dashboard)); if (isTestRunning()) return; if (getPreferenceManager().isManualUploadDialog()) { new ConfirmDialogFragment.Builder() .withTitle(getString(R.string.Modal_ManualUpload_Title)) .withMessage(getString(R.string.Modal_ManualUpload_Paragraph)) .withPositiveButton(getString(R.string.Modal_ManualUpload_Enable)) .withNegativeButton(getString(R.string.Modal_ManualUpload_Disable)) .withExtra(MANUAL_UPLOAD_DIALOG) .build().show(getSupportFragmentManager(), null); } if (getPreferenceManager().isShareAnalyticsDialog()) { new ConfirmDialogFragment.Builder() .withTitle(getString(R.string.Modal_ShareAnalytics_Title)) .withMessage(getString(R.string.Modal_ShareAnalytics_Paragraph)) .withPositiveButton(getString(R.string.Modal_ShareAnalytics_Enable)) .withNegativeButton(getString(R.string.Modal_ShareAnalytics_Disable)) .withExtra(ANALYTICS_DIALOG) .build().show(getSupportFragmentManager(), null); } } }

Target:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getPreferenceManager().isShowOnboarding() && !isUITestRunning()) { startActivity(new Intent(MainActivity.this, OnboardingActivity.class)); finish(); } else { setContentView(R.layout.activity_main); ButterKnife.bind(this); bottomNavigation.setOnNavigationItemSelectedListener(item -> { switch (item.getItemId()) { case R.id.dashboard: getSupportFragmentManager().beginTransaction().replace(R.id.content, new DashboardFragment()).commit(); return true; case R.id.testResults: getSupportFragmentManager().beginTransaction().replace(R.id.content, new ResultListFragment()).commit(); return true; case R.id.settings: getSupportFragmentManager().beginTransaction().replace(R.id.content, new PreferenceGlobalFragment()).commit(); return true; default: return false; } }); bottomNavigation.setSelectedItemId(getIntent().getIntExtra(RES_ITEM, R.id.dashboard)); if (isUITestRunning()) { return; } if (getPreferenceManager().isManualUploadDialog()) { new ConfirmDialogFragment.Builder() .withTitle(getString(R.string.Modal_ManualUpload_Title)) .withMessage(getString(R.string.Modal_ManualUpload_Paragraph)) .withPositiveButton(getString(R.string.Modal_ManualUpload_Enable)) .withNegativeButton(getString(R.string.Modal_ManualUpload_Disable)) .withExtra(MANUAL_UPLOAD_DIALOG) .build().show(getSupportFragmentManager(), null); } if (getPreferenceManager().isShareAnalyticsDialog()) { new ConfirmDialogFragment.Builder() .withTitle(getString(R.string.Modal_ShareAnalytics_Title)) .withMessage(getString(R.string.Modal_ShareAnalytics_Paragraph)) .withPositiveButton(getString(R.string.Modal_ShareAnalytics_Enable)) .withNegativeButton(getString(R.string.Modal_ShareAnalytics_Disable)) .withExtra(ANALYTICS_DIALOG) .build().show(getSupportFragmentManager(), null); } } }