protected void getDetailedEndpointStatus() { try { Agent.getInstance() .getClientService() .getDetailedEndpointStatus(this.endpoint.getId(), Agent.getInstance().getMessenger()); } catch (RemoteException e) { Toast.makeText(this, R.string.service_offline, Toast.LENGTH_SHORT).show(); } }
protected void stopEndpoint() { try { this.endpoint.enabled = false; this.endpoint.setStatus(Endpoint.Status.UPDATING); Agent.getInstance() .getClientService() .stopEndpoint(this.endpoint, Agent.getInstance().getMessenger()); } catch (RemoteException e) { this.endpoint.setStatus(Endpoint.Status.OFFLINE); Toast.makeText(this, R.string.service_offline, Toast.LENGTH_SHORT).show(); } }
@Override protected void showFingerprintDialog() { if (!this.endpoint.isSSL()) { this.createInformationDialog(R.string.ssl_fingerprint, R.string.ssl_disabled).show(); } else if (this.endpoint.getStatus() != Endpoint.Status.ACTIVE && this.endpoint.getStatus() != Endpoint.Status.ONLINE) { this.createInformationDialog( R.string.ssl_fingerprint, R.string.endpoint_offline_no_fingerprint) .show(); } else { this.spinner = ProgressDialog.show( this, getString(R.string.ssl_fingerprint), getString(R.string.calculating), true); try { Agent.getInstance() .getClientService() .getPeerFingerprint( this.endpoint.getId(), new Messenger(new IncomingFingerprintHandler(this))); } catch (RemoteException e) { spinner.dismiss(); this.createInformationDialog(R.string.ssl_fingerprint, R.string.ssl_fingerprint_error); } } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle extras = this.getIntent().getExtras(); this.setContentView(R.layout.activity_endpoint); this.endpoint_status_indicator = (ConnectorStatusIndicator) this.findViewById(R.id.endpoint_status_indicator); this.endpoint_enabled = (CompoundButton) this.findViewById(R.id.endpoint_enabled); this.endpoint_enabled.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (EndpointActivity.this.setting_endpoint) return; if (isChecked) EndpointActivity.this.startEndpoint(); else EndpointActivity.this.stopEndpoint(); } }); this.endpoint_messages = (ListView) this.findViewById(R.id.endpoint_messages); this.endpoint_messages.setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL); this.endpoint_messages.setStackFromBottom(true); this.status_connected = (CheckListItemView) this.findViewById(R.id.endpoint_status_connected); this.status_enabled = (CheckListItemView) this.findViewById(R.id.endpoint_status_enabled); this.status_password = (CheckListItemView) this.findViewById(R.id.endpoint_status_password); this.status_sessions = (CheckListItemView) this.findViewById(R.id.endpoint_status_sessions); this.status_ssl = (CheckListItemView) this.findViewById(R.id.endpoint_status_ssl); this.setEndpoint( Agent.getInstance().getEndpointManager().get(extras.getInt(Endpoint.ENDPOINT_ID))); this.refreshStatus(); }