public void callSamu() { // Lance un appel téléphonique au samu et set l'alerte avec le samu deja prevenu if (!currentAlert.getSamu()) { manager.updateAlertSAMU(currentAlert.getId()); Intent callSamuIntent = new Intent(Intent.ACTION_CALL, Uri.parse(getString(R.string.call_911_number))); startActivity(callSamuIntent); } else { manager.displayAlertMessage( getString(R.string.error_action_alert_title), getString(R.string.error_action_alert_samu)); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail_alert); // On récupère la map de la vue SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map); mapFragment.getMapAsync(this); // On récupère l'alerte séléctionnée currentAlert = (Alert) getIntent().getParcelableExtra(getString(R.string.alert_selected)); // On récupère les élements de la vue libelleType = (TextView) findViewById(R.id.DetailTypeAlertText); libelleSender = (TextView) findViewById(R.id.DetailSenderText); libelleReceiver = (TextView) findViewById(R.id.DetailReceiverText); libelleDistance = (TextView) findViewById(R.id.DetailDistance); icPolice = (ImageView) findViewById(R.id.alertPolice); icSamu = (ImageView) findViewById(R.id.alertSamu); pictureSender = (ImageView) findViewById(R.id.DetailimageView); // On set les valeurs de l'alerte aux différents éléments de la vue libelleType.setText(currentAlert.getType().toUpperCase()); libelleSender.setText( currentAlert.getSender() + SPACE + getString(R.string.list_alert_sender_view)); libelleReceiver.setText( currentAlert.getReceiver().length + SPACE + getString(R.string.list_alert_receiver_view)); new ImageDownloader(pictureSender) .execute(getString(R.string.image_server_path) + currentAlert.getPictureSender()); if (null != currentAlert.getDistance()) { libelleDistance.setText( currentAlert.getDistance().toString() + SPACE + getString(R.string.km)); } if (!currentAlert.getPolice()) icPolice.setVisibility(View.INVISIBLE); else icPolice.setVisibility(View.VISIBLE); if (!currentAlert.getSamu()) icSamu.setVisibility(View.INVISIBLE); else icSamu.setVisibility(View.VISIBLE); manager = new ApiManager(this); }