Source:
private void setupViews() { mInstalledVersionTextView = findViewById(R.id.plugin_installed_version); mAvailableVersionTextView = findViewById(R.id.plugin_available_version); mUpdateVersionTextView = findViewById(R.id.plugin_btn_update); mSwitchActive = findViewById(R.id.plugin_state_active); mSwitchAutoupdates = findViewById(R.id.plugin_state_autoupdates); mSwitchActive.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (compoundButton.isPressed()) { mPlugin.setIsActive(b); dispatchUpdateAction(); } } }); mSwitchAutoupdates.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (compoundButton.isPressed()) { mPlugin.setIsAutoUpdateEnabled(b); dispatchUpdateAction(); } } }); mUpdateVersionTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (isUpdateAvailable()) { UpdateSitePluginVersionPayload payload = new UpdateSitePluginVersionPayload(mSite, mPlugin); mDispatcher.dispatch(PluginActionBuilder.newUpdateSitePluginVersionAction(payload)); } } }); findViewById(R.id.plugin_wp_org_page).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ActivityLauncher.openUrlExternal(PluginDetailActivity.this, getWpOrgPluginUrl()); } }); findViewById(R.id.plugin_home_page).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ActivityLauncher.openUrlExternal(PluginDetailActivity.this, mPlugin.getPluginUrl()); } }); refreshViews(); }

Target:
private void setupViews() { mInstalledVersionTextView = findViewById(R.id.plugin_installed_version); mAvailableVersionTextView = findViewById(R.id.plugin_available_version); mUpdateVersionTextView = findViewById(R.id.plugin_btn_update); mSwitchActive = findViewById(R.id.plugin_state_active); mSwitchAutoupdates = findViewById(R.id.plugin_state_autoupdates); mSwitchActive.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (compoundButton.isPressed()) { mPlugin.setIsActive(b); dispatchUpdateAction(); } } }); mSwitchAutoupdates.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (compoundButton.isPressed()) { mPlugin.setIsAutoUpdateEnabled(b); dispatchUpdateAction(); } } }); mUpdateVersionTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (NetworkUtils.checkConnection(PluginDetailActivity.this) && isUpdateAvailable()) { UpdateSitePluginVersionPayload payload = new UpdateSitePluginVersionPayload(mSite, mPlugin); mDispatcher.dispatch(PluginActionBuilder.newUpdateSitePluginVersionAction(payload)); } } }); findViewById(R.id.plugin_wp_org_page).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ActivityLauncher.openUrlExternal(PluginDetailActivity.this, getWpOrgPluginUrl()); } }); findViewById(R.id.plugin_home_page).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ActivityLauncher.openUrlExternal(PluginDetailActivity.this, mPlugin.getPluginUrl()); } }); refreshViews(); }