Source:
public void onViewCreated(@NonNull final View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mRvAllergens = view.findViewById(R.id.allergens_recycle); mEmptyMessageView = view.findViewById(R.id.emptyAllergensView); productRepository = ProductRepository.getInstance(); mDataObserver = new DataObserver(); bottomNavigationView = view.findViewById((R.id.bottom_navigation)); bottomNavigationView.getMenu().getItem(0).setCheckable(false); BottomNavigationListenerInstaller.install(bottomNavigationView,getActivity(),getContext()); productRepository.getAllergensByEnabledAndLanguageCode(true, Locale.getDefault().getLanguage()); final String language = LocaleHelper.getLanguage(getContext()); productRepository.getAllergensByEnabledAndLanguageCode(true, language) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(allergens -> { mAllergensEnabled = allergens; mAdapter = new AllergensAdapter(productRepository, mAllergensEnabled); mRvAllergens.setAdapter(mAdapter); mRvAllergens.setLayoutManager(new LinearLayoutManager(view.getContext())); mRvAllergens.setHasFixedSize(true); mAdapter.registerAdapterDataObserver(mDataObserver); mDataObserver.onChanged(); }, e->Log.e(AllergensAlertFragment.class.getSimpleName(),"getAllergensByEnabledAndLanguageCode",e)); productRepository.getAllergensByLanguageCode(language) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(allergens -> { mAllergensFromDao = allergens; }, e->Log.e(AllergensAlertFragment.class.getSimpleName(),"getAllergensByLanguageCode",e)); currentView = view; mSettings = getActivity().getSharedPreferences("prefs", 0); }

Target:
public void onViewCreated(@NonNull final View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mRvAllergens = view.findViewById(R.id.allergens_recycle); mEmptyMessageView = view.findViewById(R.id.emptyAllergensView); productRepository = ProductRepository.getInstance(); mDataObserver = new DataObserver(); bottomNavigationView = view.findViewById((R.id.bottom_navigation)); BottomNavigationListenerInstaller.selectNavigationItem(bottomNavigationView, 0); BottomNavigationListenerInstaller.install(bottomNavigationView,getActivity(),getContext()); productRepository.getAllergensByEnabledAndLanguageCode(true, Locale.getDefault().getLanguage()); final String language = LocaleHelper.getLanguage(getContext()); productRepository.getAllergensByEnabledAndLanguageCode(true, language) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(allergens -> { mAllergensEnabled = allergens; mAdapter = new AllergensAdapter(productRepository, mAllergensEnabled); mRvAllergens.setAdapter(mAdapter); mRvAllergens.setLayoutManager(new LinearLayoutManager(view.getContext())); mRvAllergens.setHasFixedSize(true); mAdapter.registerAdapterDataObserver(mDataObserver); mDataObserver.onChanged(); }, e->Log.e(AllergensAlertFragment.class.getSimpleName(),"getAllergensByEnabledAndLanguageCode",e)); productRepository.getAllergensByLanguageCode(language) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(allergens -> { mAllergensFromDao = allergens; }, e->Log.e(AllergensAlertFragment.class.getSimpleName(),"getAllergensByLanguageCode",e)); currentView = view; mSettings = getActivity().getSharedPreferences("prefs", 0); }