Source:
<code>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) { <START> if (isUpdateAvailable()) { <END> 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(); }</code><technical_language>NetworkUtils.checkConnection() alert user try update a connection</technical_language>

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(); }