public PessoaViewCell() { var pessoaProfileImage = new CircleImage { BorderColor = AppColors.BrandColor(), BorderThickness = 2, HeightRequest = 50, WidthRequest = 50, Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; pessoaProfileImage.SetBinding(Image.SourceProperty, "ImagemSource"); var distanciaLabel = new Label() { FontAttributes = FontAttributes.Bold, FontSize = 12, TextColor = Color.FromHex("#666") }; distanciaLabel.SetBinding( Label.TextProperty, new Binding( "Distancia", stringFormat: "{0} Kilometros ") ); var nomeLabel = new Label() { FontFamily = Device.OnPlatform("HelveticaNeue-Bold", "sans-serif-black", null), FontSize = 18, TextColor = Color.Black }; nomeLabel.SetBinding(Label.TextProperty, "Nome"); var onlineImage = new Image() { Source = ImageSource.FromResource(Constants.RetornarCaminhoParaImagens("online.png")), HeightRequest = 8, WidthRequest = 8 }; onlineImage.SetBinding(Image.IsVisibleProperty, "Online"); var onLineLabel = new Label() { FontFamily = Device.OnPlatform("HelveticaNeue-Bold", "sans-serif-black", null), Text = "Online", TextColor = AppColors.BrandColor(), FontSize = 12, }; onLineLabel.SetBinding(Label.IsVisibleProperty, "Online"); var offlineImage = new Image() { Source = ImageSource.FromResource(Constants.RetornarCaminhoParaImagens("offline.png")), HeightRequest = 8, WidthRequest = 8 }; offlineImage.SetBinding(Image.IsVisibleProperty, "Offline"); var offLineLabel = new Label() { FontFamily = Device.OnPlatform("HelveticaNeue-Bold", "sans-serif-black", null), Text = "5 horas atrás", TextColor = Color.FromHex("#ddd"), FontSize = 12, }; offLineLabel.SetBinding(Label.IsVisibleProperty, "Offline"); var starLabel = new Label() { FontFamily = Device.OnPlatform("HelveticaNeue-Bold", "sans-serif-black", null), FontSize = 12, TextColor = Color.Gray }; starLabel.SetBinding(Label.TextProperty, "Rating"); var starImage = new Image() { Source = ImageSource.FromResource(Constants.RetornarCaminhoParaImagens("star.png")), HeightRequest = 12, WidthRequest = 12 }; var ratingStack = new StackLayout() { Spacing = 3, Orientation = StackOrientation.Horizontal, Children = { starImage, starLabel } }; var statusLayout = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { distanciaLabel, onlineImage, onLineLabel, offlineImage, offLineLabel } }; var vetDetailsLayout = new StackLayout { Padding = new Thickness(10, 0, 0, 0), Spacing = 0, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { nomeLabel, statusLayout, ratingStack } }; var tapImage = new Image() { Source = ImageSource.FromResource(Constants.RetornarCaminhoParaImagens("tap.png")), HorizontalOptions = LayoutOptions.End, HeightRequest = 12, }; var cellLayout = new StackLayout { Spacing = 0, Padding = new Thickness(10, 5, 10, 5), Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { pessoaProfileImage, vetDetailsLayout, tapImage } }; this.View = cellLayout; }
public PessoaDetalhePage(Pessoa pessoa) { this.BackgroundColor = Color.White; this.pessoa = pessoa; this.backgroundImage = new Image { Source = ImageSource.FromResource(Constants.RetornarCaminhoParaImagens("backgroudColors.jpg")), Aspect = Aspect.AspectFill, IsOpaque = true, Opacity = 0.8 }; if (Device.OS == TargetPlatform.Android) { this.backgroundCurveEffect = new Image { Aspect = Aspect.AspectFill, Source = ImageSource.FromResource(Constants.RetornarCaminhoParaImagens("dome_Android.png")) }; } else if (Device.OS == TargetPlatform.iOS) { this.backgroundCurveEffect = new Image { Aspect = Aspect.Fill, Source = ImageSource.FromResource(Constants.RetornarCaminhoParaImagens("dome.png")) }; } this.fotoPessoa = new CircleImage { Source = this.pessoa.ImagemSource, BorderColor = AppColors.BrandColor(), BorderThickness = 2, HeightRequest = 50, WidthRequest = 50, Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; this.messageImage = new Image { Source = ImageSource.FromResource(Constants.RetornarCaminhoParaImagens("SMS-32.png")) }; var messageClick = new TapGestureRecognizer(); messageClick.Tapped += async(sender, e) => { App.nroParaEnviarSMS = this.pessoa.Telefone; App.textoParaEnviarSMS = String.Format("Olá {0}", this.pessoa.Nome); var _pagina = Activator.CreateInstance <SMSPage>(); await this.Navigation.PushModalAsync(_pagina); }; this.messageImage.GestureRecognizers.Add(messageClick); this.callImage = new Image { Source = ImageSource.FromResource(Constants.RetornarCaminhoParaImagens("Phone-32.png")) }; var callClick = new TapGestureRecognizer(); callClick.Tapped += async(sender, e) => { App.nroTelefoneParaLigar = this.pessoa.Telefone; var _pagina = Activator.CreateInstance <CallPage>(); await this.Navigation.PushModalAsync(_pagina); }; this.callImage.GestureRecognizers.Add(callClick); this.detailContent = new PessoaDetailsContent(this.pessoa.Nome, this.pessoa.Email, this.pessoa.Descricao); this.btnVoltar = new Button { BorderColor = AppColors.BrandColor(), BorderRadius = 6, BorderWidth = 0.5, Text = "Voltar", TextColor = Color.White, BackgroundColor = AppColors.BrandColor(), VerticalOptions = LayoutOptions.FillAndExpand, WidthRequest = 110 }; btnVoltar.Clicked += async(sender, e) => { if (App.Navigation != null) { var pagina = Activator.CreateInstance <ListaPessoasPage>(); await this.Navigation.PushModalAsync(pagina); } else { await this.Navigation.PopModalAsync(); } }; var absLayout = new AbsoluteLayout { HeightRequest = 100 }; AbsoluteLayout.SetLayoutFlags(backgroundImage, AbsoluteLayoutFlags.All); AbsoluteLayout.SetLayoutBounds(backgroundImage, new Rectangle(0, 0, 1, 0.5)); AbsoluteLayout.SetLayoutFlags(backgroundCurveEffect, AbsoluteLayoutFlags.YProportional); AbsoluteLayout.SetLayoutBounds(backgroundCurveEffect, new Rectangle(0, 0.46, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); AbsoluteLayout.SetLayoutFlags(messageImage, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutBounds(messageImage, new Rectangle(0.15, 0.55, 35, 35)); AbsoluteLayout.SetLayoutFlags(callImage, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutBounds(callImage, new Rectangle(0.85, 0.55, 30, 30)); AbsoluteLayout.SetLayoutFlags(fotoPessoa, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutBounds(fotoPessoa, new Rectangle(0.53, 0.40, 160, 160)); AbsoluteLayout.SetLayoutFlags(detailContent.Content, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutBounds(detailContent.Content, new Rectangle(0.55, 0.80, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); AbsoluteLayout.SetLayoutFlags(btnVoltar, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutBounds(btnVoltar, new Rectangle(0.53, 0.95, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); absLayout.Children.Add(backgroundImage); absLayout.Children.Add(backgroundCurveEffect); absLayout.Children.Add(messageImage); absLayout.Children.Add(callImage); absLayout.Children.Add(fotoPessoa); absLayout.Children.Add(detailContent.Content); absLayout.Children.Add(btnVoltar); this.Content = absLayout; }
public NovaPessoaPage() { txtNome = new Entry { Placeholder = "Nome", HeightRequest = 60, WidthRequest = 80 }; txtEmail = new Entry { Placeholder = "Email", HeightRequest = 60, WidthRequest = 80 }; txtTelefone = new Entry { Placeholder = "Telefone", HeightRequest = 60, WidthRequest = 80 }; txtBio = new BioEntry { HeightRequest = 150, WidthRequest = 150, }; unknownImage = new CircleImage { Source = ImageSource.FromResource(Constants.RetornarCaminhoParaImagens("Unknown.gif")) }; var unknownImage_Click = new TapGestureRecognizer(); unknownImage_Click.Tapped += async(sender, e) => await TrataCliqueNaFoto(); this.unknownImage.GestureRecognizers.Add(unknownImage_Click); btnAdicionarPessoa = new Button { BorderColor = AppColors.BrandColor(), BorderRadius = 6, BorderWidth = 0.5, Text = "Adicionar", TextColor = Color.White, BackgroundColor = AppColors.BrandColor(), HorizontalOptions = LayoutOptions.StartAndExpand, WidthRequest = 110, HeightRequest = 40 }; this.btnAdicionarPessoa.Clicked += (sender, e) => TrataClique(); this.btnVoltar = new Button { BorderColor = AppColors.BrandColor(), BorderRadius = 6, BorderWidth = 0.5, Text = "Voltar", TextColor = Color.White, BackgroundColor = AppColors.BrandColor(), HorizontalOptions = LayoutOptions.EndAndExpand, WidthRequest = 110, HeightRequest = 40 }; var buttonsLayout = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { btnAdicionarPessoa, btnVoltar } }; mainlayout = new StackLayout { Padding = new Thickness(0, Device.OnPlatform(10, 5, 0), 5, 0), Children = { unknownImage, txtNome, txtEmail, txtTelefone, txtBio, buttonsLayout } }; MessagingCenter.Subscribe <SelecionaFotoPage, Image>(this, "SalvouFoto", (sender, arg) => { if (arg != null && arg.Source != null) { this.imgFoto = new Image(); this.imgFoto = arg; Acr.UserDialogs.UserDialogs.Instance.Alert("Imagem salva com sucesso"); } }); this.Content = mainlayout; }
public ListaPessoasPage() { this.listViewPessoas = new ListView { HasUnevenRows = true, ItemTemplate = new DataTemplate(typeof(PessoaViewCell)) }; this.listViewPessoas.ItemTapped += async(sender, e) => await TrataCliqueNoListView(e.Item); this.listViewPessoas.ItemSelected += (sender, e) => { if (e.SelectedItem == null) { return; } ((ListView)sender).SelectedItem = null; }; this.btnBuscarPessoaPorVoz = new Button { BorderColor = AppColors.BrandColor(), BorderRadius = 6, BorderWidth = 0.5, Text = "Buscar", TextColor = Color.White, BackgroundColor = AppColors.BrandColor(), WidthRequest = 110, HeightRequest = 40, HorizontalOptions = LayoutOptions.StartAndExpand }; this.btnBuscarPessoaPorVoz.SetBinding(Button.CommandProperty, "BtnBuscarPessoaPorVoz_Click"); this.btnAdicionarPessoa = new Button { BorderColor = AppColors.BrandColor(), BorderRadius = 6, BorderWidth = 0.5, Text = "Adicionar", TextColor = Color.White, BackgroundColor = AppColors.BrandColor(), WidthRequest = 110, HeightRequest = 40, HorizontalOptions = LayoutOptions.EndAndExpand }; this.btnAdicionarPessoa.SetBinding(Button.CommandProperty, "BtnAdicionarNovaPessoa_CLick"); var btnFooter = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(10, 0, 10, 5), Children = { btnBuscarPessoaPorVoz, btnAdicionarPessoa } }; this.mainlayout = new StackLayout { Padding = new Thickness(5, Device.OnPlatform(20, 10, 0), 5, 5), Children = { listViewPessoas, btnFooter } }; this.Content = mainlayout; }