protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.EmpresaCardLayout); EmpresaModel empresa = JsonConvert.DeserializeObject <EmpresaModel>(Intent.GetStringExtra("Empresa")); FindViewById <ImageButton>(Resource.Id.ibCerrar).Click += (sender, e) => OnBackPressed(); FindViewById <TextView>(Resource.Id.lblNombre).Text = empresa.Empresa_Nombre; ViewPager _viewPager = FindViewById <ViewPager>(Resource.Id.vpPerfil); _viewPager.Adapter = new EmpresaPageAdapter(this, new List <string> { Resources.GetString(Resource.String.str_profile_about_me), Resources.GetString(Resource.String.str_profile_social), Resources.GetString(Resource.String.str_profile_work) }, empresa); PagerSlidingTabStrip tabs = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs); tabs.SetTextColorResource(Resource.Color.comment_pressed); tabs.SetViewPager(_viewPager); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.SalasJuntasHistorialesLayout); Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetActionBar(toolbar); ActionBar.Title = Resources.GetString(Resource.String.SalasJuntas); ActionBar.SetDisplayHomeAsUpEnabled(true); ViewPager _viewPager = FindViewById <ViewPager>(Resource.Id.vpHistorial); _viewPager.Adapter = new HistorialesAdapter(this, new List <string> { Resources.GetString(Resource.String.Recientes), Resources.GetString(Resource.String.Historico), Resources.GetString(Resource.String.Canceladas) }); PagerSlidingTabStrip tabs = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs); tabs.SetTextColorResource(Resource.Color.comment_pressed); tabs.SetViewPager(_viewPager); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.DirectoriosLayout); Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetActionBar(toolbar); ActionBar.Title = Resources.GetString(Resource.String.Directorio); ActionBar.SetDisplayHomeAsUpEnabled(true); _viewPager = FindViewById <ViewPager>(Resource.Id.vpSucursal); List <UsuarioModel> usuarios = new UsuariosController().GetDirectorioUsuarios(); List <EmpresaModel> empresas = new EmpresaController().GetDirectorioEmpresas(); SimpleStorage storage = SimpleStorage.EditGroup("Login"); List <UsuarioModel> favoritos = new UsuariosController().GetMiembrosFavoritos(storage.Get("Usuario_Id"), storage.Get("Usuario_Tipo")); _viewPager.Adapter = new DirectorioAdapter(this, new List <string> { "Miembros", "Empresas", "Favoritos" }, usuarios, empresas, favoritos); PagerSlidingTabStrip tabs = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs); tabs.SetTextColorResource(Resource.Color.comment_pressed); tabs.SetViewPager(_viewPager); SearchView busqueda = FindViewById <SearchView>(Resource.Id.svBuscar); busqueda.SetQueryHint("Buscar..."); busqueda.QueryTextChange += (sender, e) => { _viewPager.Adapter = new DirectorioAdapter(this, new List <string> { "Miembros", "Empresas", "Favoritos" }, usuarios.Where(usuario => usuario.Usuario_Nombre.IndexOf(((SearchView)sender).Query, StringComparison.OrdinalIgnoreCase) >= 0).ToList(), empresas.Where(empresa => empresa.Empresa_Nombre.IndexOf(((SearchView)sender).Query, StringComparison.OrdinalIgnoreCase) >= 0).ToList(), favoritos.Where(miembro => miembro.Usuario_Nombre.IndexOf(((SearchView)sender).Query, StringComparison.OrdinalIgnoreCase) >= 0).ToList()); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.PerfilCardEditarLayout); miembro = JsonConvert.DeserializeObject <UsuarioModel>(Intent.GetStringExtra("Miembro")); FindViewById <ImageButton>(Resource.Id.ibCerrar).Click += (sender, e) => OnBackPressed(); imgPerfil = FindViewById <ImageView>(Resource.Id.ivPerfil); if (!string.IsNullOrEmpty(miembro.Usuario_Fotografia)) { miembro.Usuario_Fotografia_Perfil = new UploadImages().DownloadFileFTP(miembro.Usuario_Fotografia, usuario_imagen_path); photo = BitmapFactory.DecodeByteArray(miembro.Usuario_Fotografia_Perfil, 0, miembro.Usuario_Fotografia_Perfil.Length); imgPerfil.SetImageBitmap(ImagesHelper.GetRoundedShape(BitmapFactory.DecodeByteArray(miembro.Usuario_Fotografia_Perfil, 0, miembro.Usuario_Fotografia_Perfil.Length))); } else { imgPerfil.SetImageResource(Resource.Mipmap.ic_profile_empty); } imgFondo = FindViewById <ImageView>(Resource.Id.imgFondo); if (!string.IsNullOrEmpty(miembro.Usuario_Fotografia_Fondo)) { miembro.Usuario_Fotografia_FondoPerfil = new UploadImages().DownloadFileFTP(miembro.Usuario_Fotografia_Fondo, usuario_imagen_path); background = BitmapFactory.DecodeByteArray(miembro.Usuario_Fotografia_FondoPerfil, 0, miembro.Usuario_Fotografia_FondoPerfil.Length); imgFondo.SetImageBitmap(background); } FindViewById <Button>(Resource.Id.btnGuardar).Click += delegate { System.IO.MemoryStream stream = new System.IO.MemoryStream(); photo?.Compress(Bitmap.CompressFormat.Jpeg, 0, stream); miembro.Usuario_Fotografia_Perfil = stream?.ToArray(); stream = new System.IO.MemoryStream(); background?.Compress(Bitmap.CompressFormat.Jpeg, 0, stream); miembro.Usuario_Fotografia_FondoPerfil = stream?.ToArray(); if (new UsuariosController().UpdateDataMiembros(miembro.Usuario_Id, FindViewById <EditText>(Resource.Id.txtNombre).Text, FindViewById <EditText>(Resource.Id.txtApellidos).Text, miembro.Usuario_Correo_Electronico, miembro.Usuario_Telefono, miembro.Usuario_Celular, miembro.Usuario_Descripcion, DateTime.Parse(miembro.Usuario_Fecha_Nacimiento), miembro.Usuario_Fotografia_Perfil, miembro.Usuario_Fotografia_FondoPerfil)) { miembro.Redes_Sociales.AsParallel().ToList().ForEach(red => { if (!string.IsNullOrEmpty(red.Usuario_Red_Social_Id) || !string.IsNullOrEmpty(red.Red_Social_Enlace)) { new RedesSocialesController().SetRedSocial(miembro.Usuario_Id, miembro.Usuario_Tipo, red.Red_Social_Id, red.Red_Social_Enlace, red.Usuario_Red_Social_Id); } }); new EmpresaController().UpdateUsuarioEmpresaPerfil(miembro.Empresa_Actual.Empresa_Id, miembro.Usuario_Id, "", miembro.Empresa_Actual.Empresa_Nombre, miembro.Empresa_Actual.Empresa_Correo_Electronico, miembro.Empresa_Actual.Empresa_Pagina_Web, miembro.Usuario_Puesto, miembro.Empresa_Actual.Empresa_Logotipo_Perfil); Toast.MakeText(this, Resource.String.str_general_save, ToastLength.Short).Show(); Intent intent = new Intent(this, typeof(PerfilCardActivity)); intent.PutExtra("Miembro", JsonConvert.SerializeObject(new UsuariosController().GetMemberData(miembro.Usuario_Id, miembro.Usuario_Tipo))); StartActivity(intent); Finish(); } else { Toast.MakeText(this, Resource.String.str_general_save_error, ToastLength.Short).Show(); } }; FindViewById <ImageView>(Resource.Id.btnCamara).Click += delegate { Width = Height = 400; CreateDirectoryForPictures(); IsThereAnAppToTakePictures(); Intent intent = new Intent(MediaStore.ActionImageCapture); _file = new File(_dir, String.Format("{0}.jpg", Guid.NewGuid())); intent.PutExtra(MediaStore.ExtraOutput, Android.Net.Uri.FromFile(_file)); StartActivityForResult(intent, TakePicture); flag = true; }; FindViewById <ImageView>(Resource.Id.btnCamaraFondo).Click += delegate { Width = 1500; Height = 500; CreateDirectoryForPictures(); IsThereAnAppToTakePictures(); Intent intent = new Intent(MediaStore.ActionImageCapture); _file = new File(_dir, String.Format("{0}.jpg", Guid.NewGuid())); intent.PutExtra(MediaStore.ExtraOutput, Android.Net.Uri.FromFile(_file)); StartActivityForResult(intent, TakePicture); flag = false; }; FindViewById <EditText>(Resource.Id.txtNombre).Text = miembro.Usuario_Nombre; FindViewById <EditText>(Resource.Id.txtApellidos).Text = miembro.Usuario_Apellidos; FindViewById <TextView>(Resource.Id.lblEmpresa).Text = miembro.Usuario_Empresa_Nombre; ViewPager _viewPager = FindViewById <ViewPager>(Resource.Id.vpPerfil); _viewPager.Adapter = new PerfilEditarPageAdapter(this, new List <string> { Resources.GetString(Resource.String.str_profile_about_me), Resources.GetString(Resource.String.str_profile_social), Resources.GetString(Resource.String.str_profile_work) }, ref miembro); PagerSlidingTabStrip tabs = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs); tabs.SetTextColorResource(Resource.Color.comment_pressed); tabs.SetViewPager(_viewPager); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.PerfilCardLayout); miembro = JsonConvert.DeserializeObject <UsuarioModel>(Intent.GetStringExtra("Miembro")); FindViewById <ImageButton>(Resource.Id.ibCerrar).Click += (sender, e) => OnBackPressed(); imgPerfil = FindViewById <ImageView>(Resource.Id.ivPerfil); if (!string.IsNullOrEmpty(miembro.Usuario_Fotografia)) { miembro.Usuario_Fotografia_Perfil = new UploadImages().DownloadFileFTP(miembro.Usuario_Fotografia, usuario_imagen_path); photo = BitmapFactory.DecodeByteArray(miembro.Usuario_Fotografia_Perfil, 0, miembro.Usuario_Fotografia_Perfil.Length); imgPerfil.SetImageBitmap(ImagesHelper.GetRoundedShape(BitmapFactory.DecodeByteArray(miembro.Usuario_Fotografia_Perfil, 0, miembro.Usuario_Fotografia_Perfil.Length))); } else { imgPerfil.SetImageResource(Resource.Mipmap.ic_profile_empty); } imgFondo = FindViewById <ImageView>(Resource.Id.imgFondo); if (!string.IsNullOrEmpty(miembro.Usuario_Fotografia_Fondo)) { miembro.Usuario_Fotografia_FondoPerfil = new UploadImages().DownloadFileFTP(miembro.Usuario_Fotografia_Fondo, usuario_imagen_path); background = BitmapFactory.DecodeByteArray(miembro.Usuario_Fotografia_FondoPerfil, 0, miembro.Usuario_Fotografia_FondoPerfil.Length); imgFondo.SetImageBitmap(background); } FindViewById <TextView>(Resource.Id.lblNombre).Text = miembro.Usuario_Nombre + " " + miembro.Usuario_Apellidos; FindViewById <TextView>(Resource.Id.lblEmpresa).Text = miembro.Usuario_Empresa_Nombre; Button btnSeguir = FindViewById <Button>(Resource.Id.btnSeguir); FindViewById <Button>(Resource.Id.btnSendMessage).Click += delegate { Intent intent = PackageManager.GetLaunchIntentForPackage("mx.worklabs"); if (intent == null) { intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse("https://play.google.com/store/apps/details?id=mx.worklabs")); } intent.AddFlags(ActivityFlags.NewTask); StartActivity(intent); }; if (miembro.Usuario_Id == storage.Get("Usuario_Id") && miembro.Usuario_Tipo == storage.Get("Usuario_Tipo")) { FindViewById <Button>(Resource.Id.btnSendMessage).Visibility = Android.Views.ViewStates.Gone; btnSeguir.Visibility = Android.Views.ViewStates.Gone; ImageView editar = FindViewById <ImageView>(Resource.Id.btnEditar); editar.Visibility = Android.Views.ViewStates.Visible; editar.Click += delegate { Intent intent = new Intent(this, typeof(PerfilCardEditarActivity)); intent.PutExtra("Miembro", Intent.GetStringExtra("Miembro")); StartActivity(intent); Finish(); }; } isFavorite = new UsuariosController().IsMiembroFavorito(storage.Get("Usuario_Id"), storage.Get("Usuario_Tipo"), miembro.Usuario_Id, miembro.Usuario_Tipo); if (!isFavorite.Value) { btnSeguir.Text = Resources.GetString(Resource.String.str_social_network_unfollow); } FindViewById <Button>(Resource.Id.btnSeguir).Click += delegate { if (isFavorite.Value) { if (new UsuariosController().RemoveMiembroFavorito(isFavorite)) { btnSeguir.Text = Resources.GetString(Resource.String.str_social_network_follow); } else { btnSeguir.Text = Resources.GetString(Resource.String.str_social_network_unfollow); } } }; ViewPager _viewPager = FindViewById <ViewPager>(Resource.Id.vpPerfil); _viewPager.Adapter = new PerfilPageAdapter(this, new List <string> { Resources.GetString(Resource.String.str_profile_about_me), Resources.GetString(Resource.String.str_profile_social), Resources.GetString(Resource.String.str_profile_work) }, miembro); PagerSlidingTabStrip tabs = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs); tabs.SetTextColorResource(Resource.Color.comment_pressed); tabs.SetViewPager(_viewPager); if (storage.Get("Usuario_Id") == miembro.Usuario_Id && storage.Get("Usuario_Tipo") == miembro.Usuario_Tipo) { imgPerfil.Click += delegate { Width = Height = 400; CreateDirectoryForPictures(); IsThereAnAppToTakePictures(); Intent intent = new Intent(MediaStore.ActionImageCapture); _file = new File(_dir, String.Format("{0}.jpg", Guid.NewGuid())); intent.PutExtra(MediaStore.ExtraOutput, Android.Net.Uri.FromFile(_file)); StartActivityForResult(intent, TakePicture); flag = true; }; imgFondo.Click += delegate { Width = 1500; Height = 500; CreateDirectoryForPictures(); IsThereAnAppToTakePictures(); Intent intent = new Intent(MediaStore.ActionImageCapture); _file = new File(_dir, String.Format("{0}.jpg", Guid.NewGuid())); intent.PutExtra(MediaStore.ExtraOutput, Android.Net.Uri.FromFile(_file)); StartActivityForResult(intent, TakePicture); flag = false; }; } }