Source:
private void setupObservers() { mViewModel.getTitle().observe(this, new Observer<String>() { @Override public void onChanged(@Nullable String title) { setTitle(title); } }); mViewModel.getSitePlugins().observe(this, new Observer<List<SitePluginModel>>() { @Override public void onChanged(@Nullable final List<SitePluginModel> sitePlugins) { refreshPluginAdapterAndVisibility(PluginListType.SITE, sitePlugins); } }); mViewModel.getNewPlugins().observe(this, new Observer<List<WPOrgPluginModel>>() { @Override public void onChanged(@Nullable final List<WPOrgPluginModel> newPlugins) { refreshPluginAdapterAndVisibility(PluginListType.NEW, newPlugins); } }); mViewModel.getPopularPlugins().observe(this, new Observer<List<WPOrgPluginModel>>() { @Override public void onChanged(@Nullable final List<WPOrgPluginModel> popularPlugins) { refreshPluginAdapterAndVisibility(PluginListType.POPULAR, popularPlugins); } }); mViewModel.getSitePluginsListStatus().observe(this, new Observer<PluginBrowserViewModel.PluginListStatus>() { @Override public void onChanged(@Nullable PluginBrowserViewModel.PluginListStatus listStatus) { showProgress(listStatus == PluginBrowserViewModel.PluginListStatus.FETCHING && mViewModel.isSitePluginsEmpty()); if (listStatus == PluginBrowserViewModel.PluginListStatus.ERROR) { ToastUtils.showToast(PluginBrowserActivity.this, R.string.plugin_fetch_error); } } }); mViewModel.getLastUpdatedWpOrgPluginSlug().observe(this, new Observer<String>() { @Override public void onChanged(@Nullable String slug) { if (!TextUtils.isEmpty(slug)) { reloadPluginWithSlug(slug); } } }); }

Target:
private void setupObservers() { mViewModel.getTitle().observe(this, new Observer<String>() { @Override public void onChanged(@Nullable String title) { setTitle(title); } }); mViewModel.getSitePlugins().observe(this, new Observer<List<SitePluginModel>>() { @Override public void onChanged(@Nullable final List<SitePluginModel> sitePlugins) { reloadPluginAdapterAndVisibility(PluginListType.SITE, sitePlugins); } }); mViewModel.getNewPlugins().observe(this, new Observer<List<WPOrgPluginModel>>() { @Override public void onChanged(@Nullable final List<WPOrgPluginModel> newPlugins) { reloadPluginAdapterAndVisibility(PluginListType.NEW, newPlugins); } }); mViewModel.getPopularPlugins().observe(this, new Observer<List<WPOrgPluginModel>>() { @Override public void onChanged(@Nullable final List<WPOrgPluginModel> popularPlugins) { reloadPluginAdapterAndVisibility(PluginListType.POPULAR, popularPlugins); } }); mViewModel.getSitePluginsListStatus().observe(this, new Observer<PluginBrowserViewModel.PluginListStatus>() { @Override public void onChanged(@Nullable PluginBrowserViewModel.PluginListStatus listStatus) { showProgress(listStatus == PluginBrowserViewModel.PluginListStatus.FETCHING && mViewModel.isSitePluginsEmpty()); if (listStatus == PluginBrowserViewModel.PluginListStatus.ERROR) { ToastUtils.showToast(PluginBrowserActivity.this, R.string.plugin_fetch_error); } } }); mViewModel.getLastUpdatedWpOrgPluginSlug().observe(this, new Observer<String>() { @Override public void onChanged(@Nullable String slug) { if (!TextUtils.isEmpty(slug)) { reloadPluginWithSlug(slug); } } }); }