void SetupViews(View layout, Bundle savedInstanceState) { // inflate the map view mapview = FindViewById <MapView>(Resource.Id.map); // create the map view with the context mapview.OnCreate(savedInstanceState); // get the map, which calls the OnMapReady() method below (by virtue of the IOnMapReadyCallback interface that this class implements) mapview.GetMapAsync(this); Android.App.AlertDialog.Builder alerta; // inflate the content layout View _ContentLayout = layout.FindViewById <LinearLayout>(Resource.Id.contentLayoutMap); // inflate and set the profile image view var profilePhotoImageView = _ContentLayout.FindViewById <ImageViewAsync>(Resource.Id.profilePhotoImageView); if (profilePhotoImageView != null) { Bitmap image = null; byte[] imagenProvisional = null; if (empleado.usr_fotografia != null) { image = BitmapFactory.DecodeByteArray(empleado.usr_fotografia, 0, empleado.usr_fotografia.Length); } else { imagenProvisional = Convert.FromBase64String(HelperMethods.base64DefaultImage); image = BitmapFactory.DecodeByteArray(imagenProvisional, 0, imagenProvisional.Length); imagenProvisional = null; } profilePhotoImageView.SetImageBitmap(HelperMethods.redondearImagen(image, 500, 500)); image.Dispose(); image = null; } // infliate and set the name text view _ContentLayout.InflateAndBindTextView(Resource.Id.nameTextView, nombreCompletoEmpleado); // inflate and set the company name text view _ContentLayout.InflateAndBindTextView(Resource.Id.companyTextView, empleado.usr_identificacion); // inflate and set the job title text view _ContentLayout.InflateAndBindTextView(Resource.Id.jobTitleTextView, empleado.grp_nombre_cargo); _ContentLayout.InflateAndBindTextView(Resource.Id.streetAddressTextView, empleado.usr_direccion); _ContentLayout.InflateAndBindTextView(Resource.Id.phoneTextView, empleado.usr_telefonoMovil); _ContentLayout.InflateAndBindTextView(Resource.Id.emailTextView, empleado.usr_email); var consultaActionImageView = _ContentLayout.InflateAndBindLocalImageViewByResource(Resource.Id.consultaActionImageView, Resource.Drawable.consultar); consultaActionImageView.Click += (sender, e) => { // Start Query Activity Intent consultaIntent = new Intent(Application.Context, typeof(ConsultaActivity)); consultaIntent.PutExtra(Resources.GetString(Resource.String.ConsultaIntentKey), IdEmpleado); StartActivity(consultaIntent); HelperMethods.makeTransition(this); }; var messageActionImageView = _ContentLayout.InflateAndBindLocalImageViewByResource(Resource.Id.messageActionImageView, Resource.Mipmap.message); messageActionImageView.Click += (sender, e) => { // we're using the Messaging plugin from Carel Lotz here (included as a NuGet) var smsTask = MessagingPlugin.SmsMessenger; if (smsTask.CanSendSms) { if (empleado.usr_telefonoMovil != null && empleado.usr_telefonoMovil != "") { smsTask.SendSms(empleado.usr_telefonoMovil.SanitizePhoneNumber(), ""); } else { alerta = HelperMethods.setAlert("No hay telefono registrado", this); alerta.Show(); } } else { alerta = HelperMethods.setAlert("Imposible mandar SMS por problemas del celular", this); alerta.Show(); } }; var phoneActionImageView = _ContentLayout.InflateAndBindLocalImageViewByResource(Resource.Id.phoneActionImageView, Resource.Mipmap.phone); phoneActionImageView.Click += (sender, e) => { // we're using the Messaging plugin from Carel Lotz here (included as a NuGet) var phoneCallTask = MessagingPlugin.PhoneDialer; if (phoneCallTask.CanMakePhoneCall) { if (empleado.usr_telefonoMovil != null && empleado.usr_telefonoMovil != "") { phoneCallTask.MakePhoneCall(empleado.usr_telefonoMovil.SanitizePhoneNumber()); } else { alerta = HelperMethods.setAlert("No hay telefono registrado", this); alerta.Show(); } } else { alerta = HelperMethods.setAlert("Imposible llamar por problemas del celular", this); alerta.Show(); } }; var emailActionImageView = _ContentLayout.InflateAndBindLocalImageViewByResource(Resource.Id.emailActionImageView, Resource.Mipmap.email); emailActionImageView.Click += (sender, e) => { // we're using the Messaging plugin from Carel Lotz here (included as a NuGet) var emailTask = MessagingPlugin.EmailMessenger; if (emailTask.CanSendEmail) { if (empleado.usr_email != null && empleado.usr_email != "") { emailTask.SendEmail(empleado.usr_email, ""); } else { alerta = HelperMethods.setAlert("No hay email registrado", this); alerta.Show(); } } else { alerta = HelperMethods.setAlert("Imposible mandar EMAIL por problemas del celular", this); alerta.Show(); } }; }
// this override is called when the back button is tapped public override bool OnOptionsItemSelected(IMenuItem item) { Finish(); HelperMethods.makeTransition(this); return(true); }