public TestPage() { NavigationPage.SetHasNavigationBar(this, false); CustomLayout masterLayout = new CustomLayout(); masterLayout.BackgroundColor = Color.Transparent; IDeviceSpec deviceSpec = DependencyService.Get<IDeviceSpec>(); StackLayout layout = new StackLayout(); layout.WidthRequest = deviceSpec.ScreenWidth; layout.HeightRequest = deviceSpec.ScreenHeight * 50 / 100; layout.BackgroundColor = Color.Transparent; StackLayout layout2 = new StackLayout(); layout2.WidthRequest = deviceSpec.ScreenWidth; layout2.HeightRequest = deviceSpec.ScreenHeight * 50 / 100; layout2.BackgroundColor = Color.Red; masterLayout.AddChildToLayout( layout, 0, 0 ); masterLayout.AddChildToLayout(layout2, 0, 50); Content = masterLayout; }
public CustomMenuItemCell() { CustomLayout masterLayout = new CustomLayout(); masterLayout.BackgroundColor = Constants.MENU_BG_COLOR; //IDeviceSpec deviceSpec = DependencyService.Get<IDeviceSpec>(); double screenWidth = App.screenWidth; double screenHeight = App.screenHeight; Label name = new Label(); name.SetBinding(Label.TextProperty, "Name"); name.TextColor = Constants.MAIN_MENU_TEXT_COLOR;//Color.Black; name.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; name.FontSize = Device.OnPlatform(12, 17, 18); StackLayout divider = new StackLayout(); divider.WidthRequest = screenWidth; divider.HeightRequest = .75; divider.BackgroundColor = Color.FromRgb(255, 255, 255); Image sideImage = new Image(); sideImage.WidthRequest = 25; sideImage.HeightRequest = 25; sideImage.SetBinding(Image.SourceProperty, "ImageName"); sideImage.Aspect = Aspect.Fill; masterLayout.WidthRequest = screenWidth; masterLayout.HeightRequest = screenHeight * Device.OnPlatform(30, 50, 10) / 100; masterLayout.AddChildToLayout(sideImage, (float)5, (float)Device.OnPlatform(5, 0, 50), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); masterLayout.AddChildToLayout(name, (float)Device.OnPlatform( 15, 15 , 15 ), (float)Device.OnPlatform(5, 0, 50), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); // masterLayout.AddChildToLayout(divider, (float)1, (float)20, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); this.View = masterLayout; }
public ApplicationSettingsPage() { NavigationPage.SetHasNavigationBar(this, false); masterLayout = new CustomLayout(); masterLayout.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY; screenWidth = App.screenWidth; mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), "Purpose Color", Color.Black, "back", true); mainTitleBar.imageAreaTapGestureRecognizer.Tapped += imageAreaTapGestureRecognizer_Tapped; subTitleBar = new PurposeColorBlueSubTitleBar(Constants.SUB_TITLE_BG_COLOR, "Application Settings",false, true); subTitleBar.BackButtonTapRecognizer.Tapped += (s, e) => { App.masterPage.IsPresented = !App.masterPage.IsPresented; }; progressBar = DependencyService.Get<IProgressBar>(); signOutButton = new Button { Text = "Sign out", TextColor = Color.White, BorderColor = Color.Transparent, BorderWidth = 0, BackgroundColor = Constants.BLUE_BG_COLOR }; profileButton = new Button { Text = "Profile settings", TextColor = Color.White, BorderColor = Color.Transparent, BorderWidth = 0, BackgroundColor = Constants.BLUE_BG_COLOR }; changePassword = new Button { Text = "Change password", TextColor = Color.White, BorderColor = Color.Transparent, BorderWidth = 0, BackgroundColor = Constants.BLUE_BG_COLOR }; signOutButton.WidthRequest = screenWidth * 80 / 100; changePassword.WidthRequest = screenWidth * 80 / 100; profileButton.WidthRequest = screenWidth * 80 / 100; masterLayout.AddChildToLayout(mainTitleBar, 0, 0); masterLayout.AddChildToLayout(subTitleBar, 0, Device.OnPlatform(9, 10, 10)); masterLayout.AddChildToLayout(profileButton, 10, 20); masterLayout.AddChildToLayout(changePassword, 10, Device.OnPlatform(30, 30,28)); //masterLayout.AddChildToLayout( signOutButton, 10, Device.OnPlatform(40, 40,38)); signOutButton.Clicked += OnSignOutButtonClicked; changePassword.Clicked += ChangePassword_Clicked; profileButton.Clicked += ProfileButton_Clicked; Content = masterLayout; }
public GemsMoreDetailsPage(GemsEmotionsDetails emotionsList, GemsGoalsDetails goalsList, string eventMedia, string eventMediaThumb, string eventNoMedia, string goalsMedia, string goalsMediaThumb, string goalsNoMedia) { NavigationPage.SetHasNavigationBar(this, false); masterLayout = new CustomLayout(); masterLayout.BackgroundColor = Color.FromRgb(244, 244, 244); IProgressBar progressBar = DependencyService.Get<IProgressBar>(); eventsMediaPath = eventMedia; eventsMediaThumbPath = eventMediaThumb; goalsMediaPath = goalsMedia; goalsMediaThumbPath = goalsMediaThumb; goalsNoMediaPath = goalsNoMedia; eventsNoMediaPath = eventNoMedia; emotionsMasterList = emotionsList; goalsMasterList = goalsList; isFirstTime = true; // PurposeColorTitleBar mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), "Purpose Color", Color.Black, "back", false); mainTitleBar = new GemsPageTitleBarWithBack(Color.FromRgb(8, 135, 224), "Add Supporting Emotions", Color.White, "", false); mainTitleBar.imageAreaTapGestureRecognizer.Tapped += (object sender, EventArgs e) => { try { App.masterPage.IsPresented = !App.masterPage.IsPresented; } catch (Exception) { } }; if (emotionsMasterList != null) { mainTitleBar.title.Text = emotionsMasterList.emotion_title; } else { mainTitleBar.title.Text = goalsMasterList.goal_title; } masterScroll = new ScrollView(); masterScroll.WidthRequest = App.screenWidth; masterScroll.HeightRequest = App.screenHeight * 85 / 100; masterScroll.IsClippedToBounds = true; masterStack = new StackLayout(); masterStack.Orientation = StackOrientation.Vertical; masterStack.BackgroundColor = Color.Transparent; this.Appearing += OnAppearing; masterScroll.Content = masterStack; masterLayout.AddChildToLayout(mainTitleBar, 0, 0); masterLayout.AddChildToLayout(masterScroll, 0, 10); Content = masterLayout; }
public GemsPageTitleBarWithBack(Color backGroundColor, string titleValue, Color titleColor, string backButtonTitle, bool imageRequired = false) { Cross.IDeviceSpec spec = DependencyService.Get<Cross.IDeviceSpec>(); int titlebarHeight = (int)spec.ScreenHeight * 10 / 100; int titlebarWidth = (int)spec.ScreenWidth; this.BackgroundColor = backGroundColor; masterLayout = new CustomLayout(); masterLayout.HeightRequest = titlebarHeight; masterLayout.WidthRequest = titlebarWidth; masterLayout.BackgroundColor = backGroundColor; Image backButton = new Image(); backButton.Source = Device.OnPlatform("bckarow.png", "bckarow.png", "//Assets//bckarow.png"); backButton.HeightRequest = 30; backButton.WidthRequest = 25; imageAreaTapGestureRecognizer = new TapGestureRecognizer(); backButton.GestureRecognizers.Add(imageAreaTapGestureRecognizer); title = new Label(); title.Text = titleValue; title.FontSize = 20; title.TextColor = Color.White; Image logo = new Image(); logo.Source = Device.OnPlatform("logo_icon.png", "logo_icon.png", "//Assets//logo_icon.png"); logo.WidthRequest = spec.ScreenWidth; logo.HeightRequest = titlebarHeight; logo.WidthRequest = spec.ScreenWidth * 10 / 100; logo.HeightRequest = spec.ScreenHeight * 8 / 100; masterLayout.AddChildToLayout(logo, 10, 5, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); masterLayout.AddChildToLayout(title, 22, 30, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); masterLayout.AddChildToLayout(backButton, 2, 25, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); if (imageRequired) { // masterLayout.AddChildToLayout(userImg, 80, Device.OnPlatform( 17, 15, 17 ), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); } Content = masterLayout; }
public AudioRecorderPage() { NavigationPage.SetHasNavigationBar(this, false); CustomLayout masterLayout = new CustomLayout(); masterLayout.HorizontalOptions = LayoutOptions.Center; masterLayout.BackgroundColor = Color.FromRgb(230, 255, 254); PurposeColorSubTitleBar subTitleBar = new PurposeColorSubTitleBar(Color.FromRgb(12, 113, 210), "Audio recorder", false); masterLayout.AddChildToLayout(subTitleBar, 0, Device.OnPlatform(2, 4, 4)); PurposeColor.CustomControls.PurposeColorTitleBar titleBar = new PurposeColor.CustomControls.PurposeColorTitleBar(Color.FromRgb(8, 137, 216), "Purpose Color", Color.Black, "back", true); masterLayout.AddChildToLayout(titleBar, 0, 0); Button recordBtn = new Button { Text = "Record", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }; recordBtn.Clicked += RecordBtn_Clicked; masterLayout.AddChildToLayout(recordBtn, 10, 20); Button stopRecordBtn = new Button { Text = "Stop Recording", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }; stopRecordBtn.Clicked += StopRecordBtn_Clicked; masterLayout.AddChildToLayout(stopRecordBtn, 10, 30); Button PlaybackBtn = new Button { Text = "Playback", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }; PlaybackBtn.Clicked += PlaybackBtn_Clicked; masterLayout.AddChildToLayout(PlaybackBtn, 10, 40); Content = masterLayout; }
public CustomTitleBar( Color backGroundColor, string titleValue, Color titleColor, string backButtonTitle ) { //Cross.IDeviceSpec spec = DependencyService.Get<Cross.IDeviceSpec>(); int titlebarHeight = (int)App.screenHeight * 10 / 100;//(int)spec.ScreenHeight * 10 / 100; int titlebarWidth = (int)App.screenWidth;//(int)spec.ScreenWidth; this.BackgroundColor = backGroundColor; masterLayout = new CustomLayout(); masterLayout.HeightRequest = titlebarHeight; masterLayout.WidthRequest = titlebarWidth; masterLayout.BackgroundColor = backGroundColor; ImageButton menuButton = new ImageButton(); menuButton.Source = Device.OnPlatform("menu.png", "menu.png", "//Assets//menu.png"); menuButton.HeightRequest = 50; menuButton.WidthRequest = 50; imageAreaTapGestureRecognizer = new TapGestureRecognizer(); menuButton.GestureRecognizers.Add(imageAreaTapGestureRecognizer); title = new Label(); title.Text = titleValue; title.FontSize = 15; title.TextColor = Color.Black; Image logo = new Image(); logo.Source = Device.OnPlatform("logo.png", "logo.png", "//Assets//logo.png"); logo.WidthRequest = App.screenWidth; //spec.ScreenWidth; logo.HeightRequest = titlebarHeight; masterLayout.AddChildToLayout(logo, 0, 0, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); masterLayout.AddChildToLayout(menuButton, 2, 10, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); Content = masterLayout; }
public LoginGooglePage() { CustomLayout masterLayout = new CustomLayout(); masterLayout.BackgroundColor = Color.Gray; CustomEntry paswordEntry = new CustomEntry { Placeholder = "Password" }; CustomEntry confirmPaswordEntry = new CustomEntry { Placeholder = "Confirm Password" }; Button submitButton = new Button { Text = "Submit", TextColor = Color.Black, BorderColor = Color.Black, BorderWidth = 2 }; paswordEntry.WidthRequest = App.screenWidth * 80 / 100; confirmPaswordEntry.WidthRequest = App.screenWidth * 80 / 100; submitButton.WidthRequest = App.screenWidth * 40 / 100; masterLayout.AddChildToLayout(paswordEntry, 10, 30); masterLayout.AddChildToLayout(confirmPaswordEntry, 10, 45); masterLayout.AddChildToLayout(submitButton, 30, 60); submitButton.Clicked += OnSubmitButtonClicked; Content = masterLayout; }
public CustomListMenu(CustomLayout containerLayout, List<PurposeColor.CustomControls.CustomListViewItem> itemSource) { pageContainedLayout = containerLayout; this.BackgroundColor = Color.Transparent; masterLayout = new CustomLayout(); masterLayout.BackgroundColor = Color.Transparent; #region LIST VIEW listView = new ListView(); listView.ItemsSource = itemSource; listView.ItemTemplate = new DataTemplate(typeof(PurposeColor.CustomControls.CustomListViewCellItem)); listView.WidthRequest = Device.OnPlatform(App.screenWidth * .28, App.screenWidth * .30, App.screenWidth * .30); listView.HeightRequest = Device.OnPlatform(itemSource.Count * 44,itemSource.Count * 45, itemSource.Count * 45); listView.SeparatorVisibility = SeparatorVisibility.None; listView.HorizontalOptions = LayoutOptions.Center; listView.VerticalOptions = LayoutOptions.Center; listView.BackgroundColor = Color.Transparent; listView.Opacity = 1; #endregion Image bg = new Image { WidthRequest = Device.OnPlatform((App.screenWidth * .30) + 2, (App.screenWidth * .31) + 2, (App.screenWidth * .31) + 2), HeightRequest = Device.OnPlatform(itemSource.Count * 48,itemSource.Count * 50, itemSource.Count * 50), Source = Device.OnPlatform("arrow_box.png", "arrow_box.png", "//Assets//arrow_box.png"), VerticalOptions = LayoutOptions.Start, Aspect = Aspect.Fill }; masterLayout.AddChildToLayout(bg, 0, 0); masterLayout.AddChildToLayout(listView, 1, 2); masterLayout.HeightRequest = itemSource.Count * 65; masterLayout.WidthRequest = App.screenWidth * .34; Content = new StackLayout { Padding = 1, BackgroundColor = Color.Transparent, Children = { masterLayout }, HeightRequest = itemSource.Count * 70 };//App.screenHeight * .21 }
public AddContentSubTitlebar(Color backGroundColor, string titleValue, bool nextButtonVisible = true, bool backButtonVisible = true) { int titlebarHeight = (int)App.screenHeight * 7 / 100; int titlebarWidth = (int)App.screenWidth; this.BackgroundColor = backGroundColor; masterLayout = new CustomLayout(); masterLayout.HeightRequest = titlebarHeight; masterLayout.WidthRequest = titlebarWidth; masterLayout.BackgroundColor = backGroundColor; Image bgImage = new Image(); bgImage.Source = Device.OnPlatform("top_bg.png", "top_bg.png", "//Assets//top_bg.png"); bgImage.WidthRequest = App.screenWidth; bgImage.HeightRequest = titlebarHeight; bgImage.Aspect = Aspect.Fill; Image backArrow = new Image(); backArrow.Source = Device.OnPlatform("arrow_blue.png", "arrow_blue.png", "//Assets//arrow_blue.png"); backArrow.HeightRequest = App.screenHeight * 4 / 100; backArrow.WidthRequest = App.screenWidth * 5 / 100; BackButtonTapRecognizer = new TapGestureRecognizer(); backArrow.GestureRecognizers.Add(BackButtonTapRecognizer); //Image imgDivider = new Image(); //imgDivider.Source = Device.OnPlatform("top_seperate.png", "top_seperate.png", "//Assets//top_seperate.png"); //imgDivider.HeightRequest = spec.ScreenHeight * 4 / 100; NextButton = new Button(); NextButton.Text = "Next"; NextButton.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; NextButton.FontSize = Device.OnPlatform(12, 12, 17); NextButton.TextColor = Color.White; NextButton.BackgroundColor = Color.Transparent; NextButton.BorderColor = Color.Transparent; NextButton.BorderWidth = 0; NextButton.WidthRequest = App.screenWidth * Device.OnPlatform(15, 15, 25) / 100; NextButton.HeightRequest = App.screenHeight * Device.OnPlatform(5, 5, 8) / 100; title = new Label(); title.Text = titleValue; title.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; title.FontSize = Device.OnPlatform(17, 20, 22); title.TextColor = Color.FromHex("#1e7fd2"); //Image logo = new Image(); //logo.Source = Device.OnPlatform("logo.png", "logo.png", "//Assets//logo.png"); //logo.WidthRequest = spec.ScreenWidth; //logo.HeightRequest = titlebarHeight; //logo.WidthRequest = spec.ScreenWidth * 70 / 100; //logo.HeightRequest = spec.ScreenHeight * 8 / 100; // masterLayout.AddChildToLayout(bgImage, 0, 0, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); masterLayout.AddChildToLayout(title, 20, 22, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); if (nextButtonVisible) { // masterLayout.AddChildToLayout(imgDivider, 75, 25, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); masterLayout.AddChildToLayout(NextButton, Device.OnPlatform(83, 83, 76), Device.OnPlatform(10, 10, -5), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); } if (backButtonVisible) { masterLayout.AddChildToLayout(backArrow, 3, 25, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); } Content = masterLayout; }
public GemsCell() { CustomLayout absTopLayout = new CustomLayout(); absTopLayout.BackgroundColor = Color.FromRgb(230, 255, 254); IDeviceSpec deviceSpec = DependencyService.Get<IDeviceSpec>(); Image profileImage = new Image(); profileImage.WidthRequest = deviceSpec.ScreenWidth * 15 / 100; profileImage.HeightRequest = deviceSpec.ScreenHeight * 9 / 100; profileImage.SetBinding(Image.SourceProperty, "ProfilePhoto"); profileImage.Aspect = Aspect.Fill; Label profileName = new Label(); profileName.SetBinding( Label.TextProperty, "Name" ); profileName.TextColor = Color.Blue; Label dateInfo = new Label(); dateInfo.SetBinding( Label.TextProperty, "DateInfo" ); dateInfo.TextColor = Color.Gray; Label gemInfo = new Label(); gemInfo.TextColor = Color.Black; gemInfo.SetBinding(Label.TextProperty, "GemInfo"); gemInfo.WidthRequest = deviceSpec.ScreenWidth * 90 / 100; Image gemImage = new Image(); gemImage.WidthRequest = deviceSpec.ScreenWidth * 90 / 100; gemImage.HeightRequest = deviceSpec.ScreenHeight * 25 / 100; gemImage.SetBinding( Image.SourceProperty, "GemImage" ); gemImage.Aspect = Aspect.Fill; /* Button seeMore = new Button(); seeMore.Text = "see more"; seeMore.FontSize = Device.OnPlatform(12, 12, 18); seeMore.TextColor = Color.Blue; seeMore.BackgroundColor = Color.Transparent; seeMore.BorderColor = Color.Transparent; seeMore.BorderWidth = 0; seeMore.SetBinding(Button.ClassIdProperty, "Name"); seeMore.SetBinding( Button.IsVisibleProperty, "IsSeeMoreVisible" ); seeMore.Clicked += (object sender, EventArgs e) => { Button btn = sender as Button; Gems selGem = GemsPage.gemsSource.FirstOrDefault(i => i.Name == btn.ClassId); if( selGem != null ) { App.Navigator.PushModalAsync( new GemsDetailedView( selGem.GemInfo, selGem.GemImage ) ); } };*/ StackLayout masterStakLayout = new StackLayout(); masterStakLayout.Orientation = StackOrientation.Vertical; StackLayout gemInfoImageLayout = new StackLayout(); absTopLayout.WidthRequest = deviceSpec.ScreenWidth; absTopLayout.AddChildToLayout(profileImage, 5, 5); absTopLayout.AddChildToLayout(profileName, 23, 5); absTopLayout.AddChildToLayout( dateInfo, 23, 8 ); gemInfoImageLayout.Children.Add( gemInfo ); gemInfoImageLayout.Children.Add( gemImage ); masterStakLayout.Children.Add( absTopLayout ); masterStakLayout.Children.Add( gemInfoImageLayout ); this.View = masterStakLayout; }
public CommunityGemsPage() { NavigationPage.SetHasNavigationBar(this, false); CustomLayout masterLayout = new CustomLayout(); masterLayout.BackgroundColor = Color.FromRgb(230, 255, 254); PurposeColorTitleBar titleBar = new PurposeColorTitleBar(Color.FromRgb(8, 137, 216), "Purpose Color", Color.Black, "back"); PurposeColorSubTitleBar subTitleBar = new PurposeColorSubTitleBar(Color.FromRgb(12, 113, 210), "Emotional Awareness"); gemsSource = new List<Gems>(); Gems gemItems = new Gems(); gemItems.ArrowImage = ""; gemItems.DateInfo = "2015 Janury 30"; gemItems.GemImage = Device.OnPlatform("manali.jpg", "manali.jpg", "//Assets//manali.jpg"); gemItems.Name = "Lance Clusner"; gemItems.ProfilePhoto = Device.OnPlatform("avatar.jpg", "avatar.jpg", "//Assets//avatar.jpg"); gemItems.GemInfo = "This is just a dummy page to check how it displays in mobile devices. below picture is taken from manali. Manali is a high-altitude Himalayan resort town in India’s northern Himachal Pradesh state. It has a reputation as a backpacking center and honeymoon destination. Set on the Beas River, it’s a gateway for skiing in the Solang Valley and trekking in Parvati Valley. It's also a jumping-off point for paragliding, rafting and mountaineering in the Pir Panjal mountains, home to 4,000m-high Rohtang Pass..Manali is a high-altitude Himalayan resort town in India’s northern Himachal Pradesh state. It has a reputation as a backpacking center and honeymoon destination. Set on the Beas River, it’s a gateway for skiing in the Solang Valley and trekking in Parvati Valley. It's also a jumping-off point for paragliding, rafting and mountaineering in the Pir Panjal mountains, home to 4,000m-high Rohtang Pass.Manali is a high-altitude Himalayan resort town in India’s northern Himachal Pradesh state. It has a reputation as a backpacking center and honeymoon destination. Set on the Beas River, it’s a gateway for skiing in the Solang Valley and trekking in Parvati Valley. It's also a jumping-off point for paragliding, rafting and mountaineering in the Pir Panjal mountains, home to 4,000m-high Rohtang Pass..Manali is a high-altitude Himalayan resort town in India’s northern Himachal Pradesh state. It has a reputation as a backpacking center and honeymoon destination. Set on the Beas River, it’s a gateway for skiing in the Solang Valley and trekking in Parvati Valley. It's also a jumping-off point for paragliding, rafting and mountaineering in the Pir Panjal mountains, home to 4,000m-high Rohtang Pass.Manali is a high-altitude Himalayan resort town in India’s northern Himachal Pradesh state. It has a reputation as a backpacking center and honeymoon destination. Set on the Beas River, it’s a gateway for skiing in the Solang Valley and trekking in Parvati Valley. It's also a jumping-off point for paragliding, rafting and mountaineering in the Pir Panjal mountains, home to 4,000m-high Rohtang Pass..Manali is a high-altitude Himalayan resort town in India’s northern Himachal Pradesh state. It has a reputation as a backpacking center and honeymoon destination. Set on the Beas River, it’s a gateway for skiing in the Solang Valley and trekking in Parvati Valley. It's also a jumping-off point for paragliding, rafting and mountaineering in the Pir Panjal mountains, home to 4,000m-high Rohtang Pass..Manali is a high-altitude Himalayan resort town in India’s northern Himachal Pradesh state. It has a reputation as a backpacking center and honeymoon destination. Set on the Beas River, it’s a gateway for skiing in the Solang Valley and trekking in Parvati Valley. It's also a jumping-off point for paragliding, rafting and mountaineering in the Pir Panjal mountains, home to 4,000m-high Rohtang Pass.Manali is a high-altitude Himalayan resort town in India’s northern Himachal Pradesh state. It has a reputation as a backpacking center and honeymoon destination. Set on the Beas River, it’s a gateway for skiing in the Solang Valley and trekking in Parvati Valley. It's also a jumping-off point for paragliding, rafting and mountaineering in the Pir Panjal mountains, home to 4,000m-high Rohtang Pass.Manali is a high-altitude Himalayan resort town in India’s northern Himachal Pradesh state. It has a reputation as a backpacking center and honeymoon destination. Set on the Beas River, it’s a gateway for skiing in the Solang Valley and trekking in Parvati Valley. It's also a jumping-off point for paragliding, rafting and mountaineering in the Pir Panjal mountains, home to 4,000m-high Rohtang Pass."; Gems gemItem2 = new Gems(); gemItem2.ArrowImage = ""; gemItem2.DateInfo = "2015 Janury 30"; gemItem2.GemImage = Device.OnPlatform("manali.jpg", "manali.jpg", "//Assets//manali.jpg"); gemItem2.Name = "Virender Sehwag"; gemItem2.ProfilePhoto = Device.OnPlatform("avatar.jpg", "avatar.jpg", "//Assets//avatar.jpg"); gemItem2.GemInfo = "This is just a dummy page to check how "; Gems gemItem3 = new Gems(); gemItem3.ArrowImage = ""; gemItem3.DateInfo = "2015 Janury 30"; gemItem3.GemImage = Device.OnPlatform("manali.jpg", "manali.jpg", "//Assets//manali.jpg"); gemItem3.Name = "Brian lara"; gemItem3.ProfilePhoto = Device.OnPlatform("avatar.jpg", "avatar.jpg", "//Assets//avatar.jpg"); gemItem3.GemInfo = "This is just a dummy page to check how This is just a dummy page to check how This is just a dummy page to check how This is just a dummy page to check how This is just a dummy page to check how This is just a dummy page to check how This is just a dummy page to check how "; for (int index = 0; index < 50; index++ ) { gemsSource.Add(gemItems); gemsSource.Add(gemItem2); gemsSource.Add(gemItem3); gemsSource.Add(gemItems); } ListView gemsList = new ListView(); gemsList.ItemTemplate = new DataTemplate(typeof(GemsCell)); gemsList.SeparatorVisibility = SeparatorVisibility.None; gemsList.BackgroundColor = Color.FromRgb(230, 255, 254); gemsList.ItemsSource = gemsSource; gemsList.HeightRequest = deviceSpec.ScreenHeight * 75 / 100; gemsList.HasUnevenRows = true; masterLayout.AddChildToLayout(titleBar, 0, 0); masterLayout.AddChildToLayout(subTitleBar, 0, 10); masterLayout.AddChildToLayout( gemsList, 0, 20 ); Content = masterLayout; }
public ActionPreviewCellItem() { masterLayout = new CustomLayout(); masterLayout.BackgroundColor = Constants.MENU_BG_COLOR; // IDeviceSpec deviceSpec = DependencyService.Get<IDeviceSpec>(); name = new Label(); name.SetBinding(Label.TextProperty, "Name"); name.TextColor = Color.Gray; name.FontSize = Device.OnPlatform(12, 15, 18); name.WidthRequest = App.screenWidth * 50 / 100; divider = new StackLayout(); divider.WidthRequest = App.screenWidth; divider.HeightRequest = .75; divider.BackgroundColor = Color.FromRgb(255, 255, 255); deleteButton = new CustomImageButton(); deleteButton.ImageName = Device.OnPlatform("delete_button.png", "delete_button.png", @"/Assets/delete_button.png"); deleteButton.WidthRequest = Device.OnPlatform( 20, 20, 60 ); deleteButton.HeightRequest = Device.OnPlatform(20, 20, 60); deleteButton.SetBinding(CustomImageButton.ClassIdProperty, "Name"); deleteButton.Clicked += (sender, e) => { Device.BeginInvokeOnMainThread(() => { try { CustomImageButton button = sender as CustomImageButton; PreviewItem itemToDel = FeelingsSecondPage.actionPreviewListSource.FirstOrDefault(item => item.Name == button.ClassId); if (itemToDel != null) { mainPage.ShowAlert("Are you sure you want to delete this item ?.", itemToDel); } } catch (Exception ex) { } }); }; masterLayout.WidthRequest = App.screenWidth; masterLayout.HeightRequest = App.screenHeight * Device.OnPlatform(30, 50, 6) / 100; masterLayout.AddChildToLayout(name, (float)Device.OnPlatform(5, 5, 5), (float)Device.OnPlatform(5, 5, 25), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); masterLayout.AddChildToLayout(deleteButton, (float)Device.OnPlatform( 80, 80, 75 ), (float)Device.OnPlatform(5, 3.5, 5), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); // masterLayout.AddChildToLayout(divider, (float)1, (float)20, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); this.View = masterLayout; }
public FeelingsSecondPage() { progressBar = DependencyService.Get<IProgressBar>(); NavigationPage.SetHasNavigationBar(this, false); masterLayout = new CustomLayout(); masterLayout.BackgroundColor = Color.FromRgb(244, 244, 244); //deviceSpec = DependencyService.Get<IDeviceSpec>(); AddEventsSituationsOrThoughts.feelingSecondPage = this; this.Appearing += FeelingsSecondPage_Appearing; actionPreviewListSource = new ObservableCollection<PreviewItem>(); mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), "Purpose Color", Color.Black, "back", true); mainTitleBar.imageAreaTapGestureRecognizer.Tapped += imageAreaTapGestureRecognizer_Tapped; subTitleBar = new PurposeColorSubTitleBar(Constants.SUB_TITLE_BG_COLOR, "Emotional Awareness"); subTitleBar.BackButtonTapRecognizer.Tapped += OnBackButtonTapRecognizerTapped; subTitleBar.NextButtonTapRecognizer.Tapped += NextButtonTapRecognizer_Tapped; screenHeight = App.screenHeight; screenWidth = App.screenWidth; aePicker = null; actionlist = null; Label firstLine = new Label(); firstLine.Text = "Does being"; firstLine.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; firstLine.TextColor = Color.FromRgb(40, 47, 50); firstLine.HeightRequest = screenHeight * 15 / 100; firstLine.HorizontalOptions = LayoutOptions.Center; firstLine.WidthRequest = screenWidth; firstLine.XAlign = TextAlignment.Center; Label secondLine = new Label(); secondLine.Text = App.SelectedEmotion; secondLine.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; secondLine.FontAttributes = FontAttributes.Italic; secondLine.TextColor = Constants.BLUE_BG_COLOR;//Color.FromRgb(40, 47, 50); secondLine.HeightRequest = screenHeight * 15 / 100; secondLine.HorizontalOptions = LayoutOptions.Center; secondLine.WidthRequest = screenWidth; secondLine.XAlign = TextAlignment.Center; Label thirdLine = new Label(); thirdLine.Text = "support your goals and dreams?"; thirdLine.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; thirdLine.TextColor = Color.FromRgb(40, 50, 50); thirdLine.HeightRequest = screenHeight * 11 / 100; thirdLine.HorizontalOptions = LayoutOptions.Center; thirdLine.WidthRequest = screenWidth; thirdLine.XAlign = TextAlignment.Center; goalsAndDreamsPickerButton = new PurposeColor.interfaces.CustomImageButton(); goalsAndDreamsPickerButton.ImageName = Device.OnPlatform("select_box_whitebg.png", "select_box_whitebg.png", @"/Assets/select_box_whitebg.png"); goalsAndDreamsPickerButton.Text = "Goals & Dreams"; goalsAndDreamsPickerButton.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; goalsAndDreamsPickerButton.TextOrientation = interfaces.TextOrientation.Left; goalsAndDreamsPickerButton.FontSize = 17; goalsAndDreamsPickerButton.TextColor = Color.Gray; goalsAndDreamsPickerButton.WidthRequest = screenWidth * 90 / 100; goalsAndDreamsPickerButton.Clicked += OnGoalsPickerButtonClicked; actionPickerButton = new CustomImageButton(); actionPickerButton.IsVisible = false; actionPickerButton.BackgroundColor = Color.FromRgb(30, 126, 210); actionPickerButton.Text = "Add Supporting Actions"; actionPickerButton.TextColor = Color.White; actionPickerButton.TextOrientation = TextOrientation.Middle; actionPickerButton.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; // actionPickerButton.TextOrientation = interfaces.TextOrientation.Left; actionPickerButton.WidthRequest = screenWidth * 90 / 100; actionPickerButton.Clicked += OnActionPickerButtonClicked; if (App.screenDensity > 1.5) { firstLine.FontSize = Device.OnPlatform(20, 20, 30); secondLine.FontSize = Device.OnPlatform(20, 22, 30); thirdLine.FontSize = Device.OnPlatform(20, 20, 30); actionPickerButton.FontSize = 17; actionPickerButton.HeightRequest = screenHeight * 6 / 100; goalsAndDreamsPickerButton.HeightRequest = screenHeight * 6 / 100; } else { firstLine.FontSize = Device.OnPlatform(16, 18, 26); secondLine.FontSize = Device.OnPlatform(16, 20, 26); thirdLine.FontSize = Device.OnPlatform(16, 18, 26); actionPickerButton.FontSize = 15; actionPickerButton.HeightRequest = screenHeight * 9 / 100; goalsAndDreamsPickerButton.HeightRequest = screenHeight * 9 / 100; } slider = new CustomSlider { Minimum = -2, Maximum = 2, WidthRequest = screenWidth * 90 / 100 }; slider.StopGesture = GetstopGetsture; //Image sliderDivider1 = new Image(); //sliderDivider1.Source = "drag_sepeate.png"; //Image sliderDivider2 = new Image(); //sliderDivider2.Source = "drag_sepeate.png"; //Image sliderDivider3 = new Image(); //sliderDivider3.Source = "drag_sepeate.png"; //Image sliderBG = new Image(); //sliderBG.Source = "drag_bg.png"; this.Appearing += FeelingNowPage_Appearing; masterLayout.AddChildToLayout(mainTitleBar, 0, 0); masterLayout.AddChildToLayout(subTitleBar, 0, Device.OnPlatform(9, 10, 9)); masterLayout.AddChildToLayout(firstLine, 0, 20); masterLayout.AddChildToLayout(secondLine, 0, 25); masterLayout.AddChildToLayout(thirdLine, 0, 30); //masterLayout.AddChildToLayout(sliderBG, 7, 45); masterLayout.AddChildToLayout(slider, 5, Device.OnPlatform(37, 35, 34)); /* masterLayout.AddChildToLayout(sliderDivider1, 30, 45.5f); masterLayout.AddChildToLayout(sliderDivider2, 50, 45.5f); masterLayout.AddChildToLayout(sliderDivider3, 70, 45.5f);*/ masterLayout.AddChildToLayout(goalsAndDreamsPickerButton, 5, Device.OnPlatform(50, 50, 45)); masterLayout.AddChildToLayout(actionPickerButton, 5, Device.OnPlatform(65, 65, 55)); listContainer = new StackLayout(); listContainer.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY; listContainer.WidthRequest = screenWidth * 90 / 100; listContainer.HeightRequest = screenHeight * 20 / 100; listContainer.ClassId = "preview"; actionPreviewListView = new ListView(); actionPreviewListView.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY; actionPreviewListView.ItemTemplate = new DataTemplate(typeof(ActionPreviewCellItem)); ActionPreviewCellItem.mainPage = this; actionPreviewListView.SeparatorVisibility = SeparatorVisibility.None; actionPreviewListView.Opacity = 1; actionPreviewListView.ItemsSource = actionPreviewListSource; listContainer.Children.Add(actionPreviewListView); masterLayout.AddChildToLayout(listContainer, 5, Device.OnPlatform(73, 73, 64)); Content = masterLayout; }
void CreatePendingGoalsView( bool pendingGoals ) { try { if (pendingGoalsObject == null || pendingGoalsObject.resultarray == null) return; if (pendingGoalsObject.resultarray.Count < 1) { DisplayAlert(Constants.ALERT_TITLE, "You have no pending goals !.", Constants.ALERT_OK); return; } // Pending goals foreach (var item in pendingGoalsObject.resultarray) { StackLayout cellContainer = new StackLayout(); cellContainer.Orientation = StackOrientation.Vertical; cellContainer.BackgroundColor = Color.White;// Color.FromRgb(244, 244, 244); cellContainer.Spacing = 0; cellContainer.Padding = new Thickness(10, 10, 10, 10); double screenWidth = App.screenWidth; double screenHeight = App.screenHeight; TapGestureRecognizer goalsTap = new TapGestureRecognizer(); goalsTap.Tapped += OnGoalsTapped; Label firstDetailsInfo = new Label(); string firstDetails = (item.goal_details != null) ? item.goal_details : ""; if (firstDetails.Length > 120) { firstDetails = firstDetails.Substring(0, 120); firstDetails += "...."; } firstDetailsInfo.Text = firstDetails; firstDetailsInfo.TextColor = Color.Gray; firstDetailsInfo.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; firstDetailsInfo.WidthRequest = App.screenWidth * 60 / 100; firstDetailsInfo.HeightRequest = 45; int firstDetailsInfoFontSize = (App.screenDensity > 1.5) ? Device.OnPlatform(17, 15, 13) : 20; firstDetailsInfo.FontSize = Device.OnPlatform(firstDetailsInfoFontSize, firstDetailsInfoFontSize, firstDetailsInfoFontSize); firstDetailsInfo.ClassId = item.goal_id; firstDetailsInfo.GestureRecognizers.Add(goalsTap); Image goalImage = new Image(); if (pendingGoals) { goalImage.Source = Device.OnPlatform("goals_badge_red.png", "goals_badge_red.png", "//Assets//goals_badge_red.png"); } else { goalImage.Source = Device.OnPlatform("goals_badge_blue.png", "goals_badge_blue.png", "//Assets//goals_badge_blue.png"); } goalImage.HeightRequest = 100; goalImage.WidthRequest = 30; goalImage.Aspect = Aspect.Fill; Image mediaImage = new Image(); mediaImage.Source = Constants.SERVICE_BASE_URL + item.goal_media;//Device.OnPlatform("avatar.jpg", "avatar.jpg", "//Assets//avatar.jpg"); mediaImage.HeightRequest = 80; mediaImage.WidthRequest = 100; mediaImage.GestureRecognizers.Add(goalsTap); mediaImage.ClassId = item.goal_id; mediaImage.Aspect = Aspect.Fill; StackLayout firstRow = new StackLayout(); firstRow.Orientation = StackOrientation.Horizontal; firstRow.BackgroundColor = Color.White; firstRow.WidthRequest = App.screenWidth - 20; firstRow.Padding = new Thickness(0, 10, 0, 10); firstRow.Children.Add(goalImage); firstRow.Children.Add(firstDetailsInfo); firstRow.Children.Add(mediaImage); cellContainer.Children.Add(firstRow); if (item.pending_action_title != null) { foreach (var pendingItem in item.pending_action_title) { TapGestureRecognizer checkboxTap = new TapGestureRecognizer(); checkboxTap.Tapped += OnPendingGoalsTapped; Image bgImage = new Image(); bgImage.Source = Device.OnPlatform("select_box_whitebg.png", "select_box_whitebg.png", "//Assets//select_box_whitebg.png"); bgImage.WidthRequest = App.screenWidth - 40; bgImage.HeightRequest = Device.OnPlatform(50, 50, 50); bgImage.Aspect = Aspect.Fill; Label pendingGoalTitle = new Label(); pendingGoalTitle.TextColor = Color.Black; pendingGoalTitle.XAlign = TextAlignment.Center; pendingGoalTitle.FontSize = Device.OnPlatform(15, 15, 18); pendingGoalTitle.WidthRequest = App.screenWidth * Device.OnPlatform(65, 60, 60) / 100; // pendingGoalTitle.HeightRequest = Device.OnPlatform(25, 20, 40); pendingGoalTitle.Text = (pendingItem != null && pendingItem.action_title != null) ? pendingItem.action_title : ""; if (pendingGoalTitle.Text.Length > 20) { pendingGoalTitle.Text = pendingGoalTitle.Text.Substring(0, 20); pendingGoalTitle.Text = pendingGoalTitle.Text + "...."; } StackLayout trasprntClickLayout = new StackLayout(); trasprntClickLayout.WidthRequest = 50; trasprntClickLayout.HeightRequest = 50; trasprntClickLayout.BackgroundColor = Color.Transparent; trasprntClickLayout.VerticalOptions = LayoutOptions.Center; trasprntClickLayout.GestureRecognizers.Add(checkboxTap); Image tickImage = new Image(); tickImage.IsEnabled = false; tickImage.Source = Device.OnPlatform("tick_box.png", "tick_box.png", "//Assets//tick_box.png"); tickImage.Aspect = Aspect.Fill; tickImage.WidthRequest = 20; tickImage.HeightRequest = 20; tickImage.ClassId = pendingItem.goal_id + "&&" + pendingItem.savedgoal_id; tickImage.HorizontalOptions = LayoutOptions.Center; tickImage.VerticalOptions = LayoutOptions.End; tickImage.TranslationY = 15; trasprntClickLayout.Children.Add(tickImage); CustomLayout pendingRow = new CustomLayout(); pendingRow.ClassId = pendingItem.savedgoal_id; pendingRow.WidthRequest = App.screenWidth * 90 / 100; pendingRow.HeightRequest = 50; pendingRow.AddChildToLayout(bgImage, 0, 0, (int)pendingRow.WidthRequest, (int)pendingRow.HeightRequest); //pendingRow.AddChildToLayout(tickImage, Device.OnPlatform( 4, 2, 2 ), Device.OnPlatform( -5, 25, 25 ), (int)pendingRow.WidthRequest, (int)pendingRow.HeightRequest); pendingRow.AddChildToLayout(trasprntClickLayout, 0, 0, (int)pendingRow.WidthRequest, (int)pendingRow.HeightRequest); pendingRow.AddChildToLayout(pendingGoalTitle, Device.OnPlatform(15, 20, 20), Device.OnPlatform(31, 25, 25), (int)pendingRow.WidthRequest, (int)pendingRow.HeightRequest); cellContainer.ClassId = pendingItem.savedgoal_id; cellContainer.Children.Add(pendingRow); } masterStack.Children.Add(cellContainer); StackLayout trans = new StackLayout(); trans.BackgroundColor = Color.FromRgb(244, 244, 244); trans.HeightRequest = 30; trans.WidthRequest = App.screenWidth; trans.ClassId = "translayout"; masterStack.Children.Add(trans); } } } catch (Exception ex) { Debug.WriteLine( ex.Message ); } }
public GemsMainPage() { NavigationPage.SetHasNavigationBar(this, false); masterLayout = new CustomLayout(); masterLayout.BackgroundColor = Color.FromRgb(244, 244, 244); progressBar = DependencyService.Get<IProgressBar>(); progressBar.ShowProgressbar ("Loading gems.."); App.isEmotionsListing = false; isLoadingFromDetailsPage = false; this.Appearing += OnAppearing; this.Disappearing += GemsMainPage_Disappearing; mainTitleBar = new GemsPageTitleBar(Color.FromRgb(8, 135, 224), "Goal Enabling Materials", Color.White, "", true); mainTitleBar.imageAreaTapGestureRecognizer.Tapped += OnImageAreaTapGestureRecognizerTapped; masterScroll = new ScrollView(); masterScroll.WidthRequest = App.screenWidth; masterScroll.HeightRequest = App.screenHeight * 85 / 100; masterScroll.BackgroundColor = Color.White; masterScroll.Scrolled += OnScroll; masterScroll.IsClippedToBounds = true; masterStack = new StackLayout(); masterStack.Orientation = StackOrientation.Vertical; masterStack.BackgroundColor = Color.White; emotionLabel = new Label { Text = "EMOTIONS ", FontFamily = Constants.HELVERTICA_NEUE_LT_STD, FontSize = Device.OnPlatform (14, 18, 14), HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center, TextColor = Color.White, WidthRequest = App.screenWidth * .5, XAlign = TextAlignment.Center }; emotionsButtion = new StackLayout{ Children = { emotionLabel }, BackgroundColor = Color.FromRgb(8, 159, 245), Orientation = StackOrientation.Horizontal, WidthRequest = App.screenWidth * .5 ///HorizontalOptions = LayoutOptions.Center }; emotionListingBtnTapgesture = new TapGestureRecognizer (); emotionListingBtnTapgesture.Tapped += ShowEmotionsTapGesture_Tapped; emotionsButtion.GestureRecognizers.Add (emotionListingBtnTapgesture); goalsAndDreamsLabel = new Label { Text = "GOALS & DREAMS", FontFamily = Constants.HELVERTICA_NEUE_LT_STD, FontSize = Device.OnPlatform (14, 18, 14), HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center, TextColor = Color.Gray, XAlign = TextAlignment.Center }; goalsButton = new StackLayout{ Children = { goalsAndDreamsLabel }, BackgroundColor = Constants.INPUT_GRAY_LINE_COLOR, Orientation = StackOrientation.Horizontal, WidthRequest = App.screenWidth * .5, HorizontalOptions = LayoutOptions.Center, Padding = new Thickness(Device.OnPlatform(20,15,20),0,0,0) }; goalsListingBtnTapgesture = new TapGestureRecognizer (); goalsListingBtnTapgesture.Tapped += GoalsListingBtnTapgesture_Tapped; goalsButton.GestureRecognizers.Add (goalsListingBtnTapgesture); masterLayout.AddChildToLayout(mainTitleBar, 0, 0); masterLayout.AddChildToLayout(new StackLayout{HeightRequest = App.screenHeight * 0.08, Orientation = StackOrientation.Horizontal, Spacing = 0, Children = {emotionsButtion, goalsButton}}, 0,Device.OnPlatform(9,10,10)); progressBar.HideProgressbar (); }
public LogInPage() { App.IsLoggedIn = false; NavigationPage.SetHasNavigationBar(this, false); masterLayout = new CustomLayout(); masterLayout.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY; screenHeight = App.screenHeight; screenWidth = App.screenWidth; PurposeColorTitleBar mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), "Purpose Color", Color.Black, "back", true); mainTitleBar.imageAreaTapGestureRecognizer.Tapped += imageAreaTapGestureRecognizer_Tapped; subTitleBar = new PurposeColorBlueSubTitleBar(Constants.SUB_TITLE_BG_COLOR, " Sign In", true, true); subTitleBar.NextButtonTapRecognizer.Tapped += (s, e) => { OnSignInButtonClicked(signInButton, null); }; subTitleBar.BackButtonTapRecognizer.Tapped += (s, e) => { App.masterPage.IsPresented = !App.masterPage.IsPresented; }; userNameEntry = new CustomEntry { Placeholder = "Username", Keyboard = Keyboard.Email, HeightRequest = Device.OnPlatform(50, 50,75) // Text = "apptester" // for testing only // remove after testing }; passwordEntry = new CustomEntry { Placeholder = "Password", IsPassword = true, HeightRequest = Device.OnPlatform(50, 50, 75) }; signInButton = new Button { Text = "Sign in", TextColor = Color.White, BorderColor = Color.Transparent, BorderWidth = 0, BackgroundColor = Constants.BLUE_BG_COLOR //HeightRequest = 50 }; TapGestureRecognizer forgotPasswordTap = new TapGestureRecognizer(); forgotPasswordLabel = new Label { Text = "Forgot password", TextColor = Constants.BLUE_BG_COLOR, BackgroundColor = Color.Transparent, FontSize = Device.OnPlatform(12,12,15), HeightRequest = Device.OnPlatform(15, 25, 25), }; forgotPasswordLabel.GestureRecognizers.Add(forgotPasswordTap); forgotPasswordTap.Tapped += (s, e) => { try { Navigation.PushAsync(new ForgotPassword()); } catch (Exception) { } }; TapGestureRecognizer registerTap = new TapGestureRecognizer(); registerLabel = new Label { Text = "Sign up with us", TextColor = Constants.BLUE_BG_COLOR, BackgroundColor = Color.Transparent, FontSize = Device.OnPlatform(12, 12, 15), HeightRequest = Device.OnPlatform(15, 25, 25), }; registerLabel.GestureRecognizers.Add(registerTap); registerTap.Tapped += (s, e) => { try { Navigation.PushModalAsync(new RegistrationPageOne()); } catch (Exception) { } }; googleSignInButton = new Button { Text = "Sign in with Google", TextColor = Color.White, BorderColor = Color.Transparent, BorderWidth = 0, BackgroundColor = Constants.BLUE_BG_COLOR }; faceBookSignInButton = new Button { Text = "Sign in with Facebook", TextColor = Color.White, BorderColor = Color.Transparent, BorderWidth = 0, BackgroundColor = Constants.BLUE_BG_COLOR }; indicator = new ActivityIndicator(); indicator.IsRunning = true; indicator.IsEnabled = true; indicator.IsVisible = false; userNameEntry.WidthRequest = screenWidth * 80 / 100; passwordEntry.WidthRequest = screenWidth * 80 / 100; signInButton.WidthRequest = screenWidth * 80 / 100; googleSignInButton.WidthRequest = screenWidth * 80 / 100; faceBookSignInButton.WidthRequest = screenWidth * 80 / 100; //imgsignInButton.WidthRequest = deviceSpec.ScreenWidth * 10 / 100; //imgsignInButton.HeightRequest = deviceSpec.ScreenHeight * 5 / 100; masterLayout.AddChildToLayout(mainTitleBar, 0, 0); masterLayout.AddChildToLayout(subTitleBar, 0, Device.OnPlatform(9, 10, 10)); masterLayout.AddChildToLayout(userNameEntry, 10, Device.OnPlatform(30, 30, 30)); masterLayout.AddChildToLayout(passwordEntry, 10, Device.OnPlatform(40, 40, 38)); masterLayout.AddChildToLayout(signInButton, 10, Device.OnPlatform(50, 50, 47)); masterLayout.AddChildToLayout(forgotPasswordLabel, Device.OnPlatform(11, 11, 13), Device.OnPlatform(60,59,47)); masterLayout.AddChildToLayout(registerLabel, Device.OnPlatform(62, 66, 65), Device.OnPlatform(60,59,47)); // masterLayout.AddChildToLayout(googleSignInButton, 10, Device.OnPlatform(65,65,62)); // masterLayout.AddChildToLayout(faceBookSignInButton, 10, Device.OnPlatform(75, 75, 70)); googleSignInButton.Clicked += OnGoogleSignInButtonClicked; faceBookSignInButton.Clicked += faceBookSignInButton_Clicked; signInButton.Clicked += OnSignInButtonClicked; Content = masterLayout; }
public AddEventsSituationsOrThoughts(string title, DetailsPageModel detailsPageModel = null) { NavigationPage.SetHasNavigationBar(this, false); masterLayout = new CustomLayout(); audioRecorder = DependencyService.Get<PurposeColor.interfaces.IAudioRecorder>(); //deviceSpec = DependencyService.Get<IDeviceSpec>(); screenHeight = App.screenHeight; screenWidth = App.screenWidth; masterLayout.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY; pageTitle = title; lattitude = string.Empty; longitude = string.Empty; currentAddress = string.Empty; int devWidth = (int)screenWidth; App.MediaArray = new List<MediaItem>(); App.ContactsArray = new List<string>(); App.PreviewListSource.Clear(); int textInputWidth = (int)(devWidth * .80); contactSelectAction = OnContactSelected; #region TITLE BARS TopTitleBar = new StackLayout { BackgroundColor = Constants.BLUE_BG_COLOR, HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions = LayoutOptions.StartAndExpand, Padding = 0, Spacing = 0, Children = { new BoxView { WidthRequest = screenWidth } } }; masterLayout.AddChildToLayout(TopTitleBar, 0, 0); string trimmedPageTitle = string.Empty; int titleMaxLength = 24; if (App.screenDensity > 1.5) { titleMaxLength = 24; } else { titleMaxLength = 22; } if (title.Length > titleMaxLength) { trimmedPageTitle = title.Substring(0, titleMaxLength); trimmedPageTitle += ".."; } else { trimmedPageTitle = pageTitle; } subTitleBar = new PurposeColorBlueSubTitleBar(Constants.SUB_TITLE_BG_COLOR, trimmedPageTitle, true, true); masterLayout.AddChildToLayout(subTitleBar, 0, 1); subTitleBar.BackButtonTapRecognizer.Tapped += OnBackButtonTapRecognizerTapped; subTitleBar.NextButtonTapRecognizer.Tapped += NextButtonTapRecognizer_Tapped; #endregion #region EVENT TITLE - CUSTOM ENTRY eventTitle = new CustomEntry { VerticalOptions = LayoutOptions.StartAndExpand, HorizontalOptions = LayoutOptions.StartAndExpand, BackgroundColor = Color.White, Placeholder = "Title", TextColor = Color.FromHex("#424646"), HeightRequest = Device.OnPlatform(50,50,73), WidthRequest = (int)(devWidth * .90) // 90% of screen, }; eventTitle.TextChanged += EventTitle_TextChanged; //if (App.screenDensity > 1.5) //{ // eventTitle.HeightRequest = screenHeight * 6 / 100; //} //else //{ // eventTitle.HeightRequest = screenHeight * 9 / 100; //} masterLayout.AddChildToLayout(eventTitle, 5, 11); #endregion #region EVENT DESCRIPTION eventDescription = new CustomEditor { VerticalOptions = LayoutOptions.StartAndExpand, HorizontalOptions = LayoutOptions.StartAndExpand, HeightRequest = 100, Placeholder = pageTitle, BackgroundColor = Color.White }; eventDescription.TextChanged += EventDescription_TextChanged; eventDescription.WidthRequest = textInputWidth; if (detailsPageModel != null) { if (detailsPageModel.IsCopyingGem) { isUpdatePage = false; } else { isUpdatePage = true; } currentGemId = detailsPageModel.gemId; if (detailsPageModel.gemType != null) { currentGemType = detailsPageModel.gemType; switch (currentGemType) { case GemType.Goal: pageTitle = Constants.EDIT_GOALS; break; case GemType.Event: pageTitle = Constants.EDIT_EVENTS; break; case GemType.Action: pageTitle = Constants.EDIT_ACTIONS; break; default: break; } } if (detailsPageModel.titleVal != null) { eventTitle.Text = detailsPageModel.titleVal; } if ( detailsPageModel.description != null) { eventDescription.Text = detailsPageModel.description; } } #endregion #region MEDIA INPUTS Image pinButton = new Image { BackgroundColor = Color.Transparent, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Source = Device.OnPlatform("icn_attach.png", "icn_attach.png", "//Assets//icn_attach.png"), }; StackLayout pinButtonHolder = new StackLayout { Padding = 10, VerticalOptions = LayoutOptions.Start, Children = { pinButton } }; TapGestureRecognizer pinButtonTapRecognizer = new TapGestureRecognizer(); pinButtonHolder.GestureRecognizers.Add(pinButtonTapRecognizer); pinButtonTapRecognizer.Tapped += (s, e) => { iconContainerGrid.IsVisible = !iconContainerGrid.IsVisible; }; Image audioRecodeOnButton = new Image { BackgroundColor = Color.Transparent, VerticalOptions = LayoutOptions.Center, Source = Device.OnPlatform("mic.png", "mic.png", "//Assets//mic.png"), }; audioRecodeOnHolder = new StackLayout { Padding = 10, VerticalOptions = LayoutOptions.End, Children = { audioRecodeOnButton } }; TapGestureRecognizer RecodeOnTapRecognizer = new TapGestureRecognizer(); audioRecodeOnHolder.GestureRecognizers.Add(RecodeOnTapRecognizer); audioRecodeOffButton = new Image { BackgroundColor = Color.Transparent, VerticalOptions = LayoutOptions.Center, Source = Device.OnPlatform("turn_off_mic.png", "turn_off_mic.png", "//Assets//turn_off_mic.png"), }; audioRecodeOffHolder = new StackLayout { BackgroundColor = Color.Transparent, Padding = 10, VerticalOptions = LayoutOptions.End, IsVisible = false, Children = { audioRecodeOffButton } }; TapGestureRecognizer RecodeOffTapRecognizer = new TapGestureRecognizer(); audioRecodeOffHolder.GestureRecognizers.Add(RecodeOffTapRecognizer); audioRecodeOffHolder.TranslateTo(0, Device.OnPlatform(audioRecodeOffButton.Y + 60, audioRecodeOffButton.Y + 60, audioRecodeOffButton.Y + 50), 5, null); audioRecodeOnHolder.TranslateTo(0, Device.OnPlatform(audioRecodeOffButton.Y + 60, audioRecodeOffButton.Y + 60, audioRecodeOffButton.Y + 50), 5, null); RecodeOnTapRecognizer.Tapped += RecodeOnTapRecognizer_Tapped; RecodeOffTapRecognizer.Tapped += RecodeOffTapRecognizer_Tapped; StackLayout menuPinContainer = new StackLayout { BackgroundColor = Color.White, Orientation = StackOrientation.Vertical, HeightRequest = 140, WidthRequest = (int)(devWidth * .10), Children = { pinButtonHolder, audioRecodeOnHolder, audioRecodeOffHolder } }; TapGestureRecognizer locationlabelTap = new TapGestureRecognizer(); locationInfo = new Label(); locationInfo.TextColor = Constants.BLUE_BG_COLOR; locationInfo.BackgroundColor = Color.Transparent; locationInfo.FontSize = 12; locationInfo.HeightRequest = Device.OnPlatform(15, 25, 25); locationInfo.GestureRecognizers.Add(locationlabelTap); locationlabelTap.Tapped += OnEditLocationInfo; editLocationAndContactsStack = new StackLayout(); editLocationAndContactsStack.Padding = new Thickness(1, 1, 1, 1); editLocationAndContactsStack.BackgroundColor = Color.FromRgb(30, 126, 210); editLocationAndContactsStack.WidthRequest = App.screenWidth * 90 / 100; editLocationAndContactsStack.IsVisible = false; editLocationAndContactsStack.Orientation = StackOrientation.Horizontal; locAndContactsEntry = new Entry(); locAndContactsEntry.TextColor = Color.Black; locAndContactsEntry.BackgroundColor = Color.White; locAndContactsEntry.VerticalOptions = LayoutOptions.Center; locAndContactsEntry.WidthRequest = App.screenWidth * 80 / 100; locAndContactsEntry.HeightRequest = 50; editLocationDoneButton = new CustomImageButton(); editLocationDoneButton.VerticalOptions = LayoutOptions.Center; editLocationDoneButton.ImageName = "icn_done.png"; editLocationDoneButton.HeightRequest = 25; editLocationDoneButton.WidthRequest = 25; editLocationDoneButton.Clicked += OnLocationEditCompleted; editLocationAndContactsStack.Children.Add(locAndContactsEntry); editLocationAndContactsStack.Children.Add(editLocationDoneButton); if (Device.OS == TargetPlatform.iOS) { editLocationAndContactsStack.TranslationY = -30; } locLayout = new StackLayout(); locLayout.Orientation = StackOrientation.Vertical; locLayout.BackgroundColor = Color.Transparent; locLayout.Children.Add(locationInfo); TapGestureRecognizer contactsLabelTap = new TapGestureRecognizer(); contactInfo = new Label(); contactInfo.TextColor = Constants.BLUE_BG_COLOR; contactInfo.BackgroundColor = Color.Transparent; contactInfo.FontSize = 12; contactInfo.HeightRequest = Device.OnPlatform(15, 25, 25); contactInfo.GestureRecognizers.Add(contactsLabelTap); contactsLabelTap.Tapped += async (object sender, EventArgs e) => { editLocationAndContactsStack.ClassId = "contactedit"; string spanContacts = ""; if (contactInfo.FormattedText != null && contactInfo.FormattedText.Spans.Count > 1) spanContacts = contactInfo.FormattedText.Spans[1].Text; locAndContactsEntry.Text = spanContacts; editLocationAndContactsStack.IsVisible = true; contactInfo.IsVisible = false; iconContainerGrid.IsVisible = false; locationInfo.IsVisible = true; await editLocationAndContactsStack.TranslateTo(100, 0, 300, Easing.SinInOut); await editLocationAndContactsStack.TranslateTo(0, 0, 300, Easing.SinIn); }; locLayout.IsVisible = false; contactInfo.IsVisible = false; #endregion if(detailsPageModel != null) { if (detailsPageModel.eventMediaArray!= null && detailsPageModel.eventMediaArray.Count > 0) { foreach (EventMedia eventObj in detailsPageModel.eventMediaArray) { if (eventObj.event_media != null && !eventObj.event_media.Contains("default")) { AddFilenameToMediaList(eventObj.event_media); } } } if (detailsPageModel.goal_media != null && detailsPageModel.goal_media.Count > 0) { foreach (SelectedGoalMedia goalObj in detailsPageModel.goal_media) { if (goalObj.goal_media != null && !goalObj.goal_media.Contains("default")) { AddFilenameToMediaList(goalObj.goal_media); } } } if (detailsPageModel.actionMediaArray != null && detailsPageModel.actionMediaArray.Count > 0) { foreach (ActionMedia actionObj in detailsPageModel.actionMediaArray) { if (actionObj.action_media != null && !actionObj.action_media.Contains("default")) { AddFilenameToMediaList(actionObj.action_media); } } } } StackLayout entryAndLocContainer = new StackLayout(); entryAndLocContainer.Orientation = StackOrientation.Vertical; entryAndLocContainer.BackgroundColor = Color.White; entryAndLocContainer.Children.Add( eventDescription ); entryAndLocContainer.Children.Add(contactInfo); entryAndLocContainer.Children.Add(locLayout); textInputContainer = new StackLayout { Orientation = StackOrientation.Horizontal, Spacing = 0, Padding = 0, Children = { entryAndLocContainer, menuPinContainer } }; #region ICONS audioInput = new Image() { Source = Device.OnPlatform("ic_music.png", "ic_music.png", "//Assets//ic_music.png"), Aspect = Aspect.AspectFit }; int ICON_SIZE = 8; if( Device.OS == TargetPlatform.WinPhone ) { audioInput.WidthRequest = screenWidth * ICON_SIZE / 100; audioInput.HeightRequest = screenWidth * ICON_SIZE / 100; } audioInputStack = new StackLayout { Padding = new Thickness(5, 10, 5, 10), //BackgroundColor = Constants.STACK_BG_COLOR_GRAY, //HorizontalOptions = LayoutOptions.Center, Spacing = 0, Children = { audioInput /*, new Label { Text = "Audio", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) }*/ } }; cameraInput = new Image() { Source = Device.OnPlatform("icn_camera.png", "icn_camera.png", "//Assets//icn_camera.png"), Aspect = Aspect.AspectFit }; if (Device.OS == TargetPlatform.WinPhone) { cameraInput.WidthRequest = screenWidth * ICON_SIZE / 100; cameraInput.HeightRequest = screenWidth * ICON_SIZE / 100; } cameraInputStack = new StackLayout { Padding = new Thickness(5, 10, 5, 10), //BackgroundColor = Constants.STACK_BG_COLOR_GRAY, //HorizontalOptions = LayoutOptions.Center, Spacing = 0, Children = { cameraInput /*, new Label { Text = "Camera", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) } */ } }; cameraInputStack.ClassId = "camera"; #region CAMERA TAP RECOGNIZER CameraTapRecognizer = new TapGestureRecognizer(); cameraInputStack.GestureRecognizers.Add(CameraTapRecognizer); CameraTapRecognizer.Tapped += async (s, e) => { try { await ApplyAnimation( cameraInputStack ); StackLayout send = s as StackLayout; MediaSourceChooser chooser = new MediaSourceChooser(this, masterLayout, send.ClassId); chooser.ClassId = "mediachooser"; masterLayout.AddChildToLayout(chooser, 0, 0); } catch (System.Exception ex) { DisplayAlert("Camera", ex.Message + " Please try again later", "ok"); } /* try { StackLayout send = s as StackLayout; MediaSourceChooser chooser = new MediaSourceChooser(this, masterLayout, send.ClassId); chooser.ClassId = "mediachooser"; masterLayout.AddChildToLayout(chooser, 0, 0); } catch (System.Exception ex) { DisplayAlert("Camera", ex.Message + " Please try again later", "ok"); } */ }; #endregion galleryInput = new Image() { Source = Device.OnPlatform("icn_gallery.png", "icn_gallery.png", "//Assets//icn_gallery.png"), Aspect = Aspect.AspectFit }; if (Device.OS == TargetPlatform.WinPhone) { galleryInput.WidthRequest = screenWidth * ICON_SIZE / 100; galleryInput.HeightRequest = screenWidth * ICON_SIZE / 100; } galleryInputStack = new StackLayout { Padding = new Thickness(5, 10, 5, 10), Spacing = 0, Children = { galleryInput //new Label { Text = "Gallery", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) } } }; galleryInputStack.ClassId = "gallery"; #region GALLERY TAP RECOGNIZER TapGestureRecognizer galleryInputStackTapRecognizer = new TapGestureRecognizer(); galleryInputStack.GestureRecognizers.Add(galleryInputStackTapRecognizer); galleryInputStackTapRecognizer.Tapped += async (s, e) => { await ApplyAnimation( galleryInputStack ); StackLayout send = s as StackLayout; MediaSourceChooser chooser = new MediaSourceChooser(this, masterLayout, send.ClassId); chooser.ClassId = "mediachooser"; masterLayout.AddChildToLayout(chooser, 0, 0); }; #endregion locationInput = new Image() { Source = Device.OnPlatform("icn_location.png", "icn_location.png", "//Assets//icn_location.png"), Aspect = Aspect.AspectFit }; if (Device.OS == TargetPlatform.WinPhone) { locationInput.WidthRequest = screenWidth * ICON_SIZE / 100; locationInput.HeightRequest = screenWidth * ICON_SIZE / 100; } locationInputStack = new StackLayout { Padding = new Thickness(5, 10, 5, 10), //BackgroundColor = Constants.STACK_BG_COLOR_GRAY, //HorizontalOptions = LayoutOptions.Center, Spacing = 0, Children = { locationInput //, new Label { Text = "Location", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) } } }; #region LOCATION TAP RECOGNIZER TapGestureRecognizer locationInputTapRecognizer = new TapGestureRecognizer(); locationInputStack.GestureRecognizers.Add(locationInputTapRecognizer); locationInputTapRecognizer.Tapped += LocationInputTapRecognizer_Tapped; #endregion contactInput = new Image() { Source = Device.OnPlatform("icn_contact.png", "icn_contact.png", "//Assets//icn_contact.png"), Aspect = Aspect.AspectFit }; if (Device.OS == TargetPlatform.WinPhone) { contactInput.WidthRequest = screenWidth * ICON_SIZE / 100; contactInput.HeightRequest = screenWidth * ICON_SIZE / 100; } contactInputStack = new StackLayout { Padding = new Thickness(5, 10, 0, 10), Spacing = 0, Children = { contactInput //new Label { Text = "Contact", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) } } }; #region CONTACTS TAP RECOGNIZER TapGestureRecognizer contactsInputTapRecognizer = new TapGestureRecognizer(); contactInputStack.GestureRecognizers.Add(contactsInputTapRecognizer); contactsInputTapRecognizer.Tapped += async (s, e) => { await ApplyAnimation( contactInputStack ); try { if( Device.OS == TargetPlatform.Android || Device.OS == TargetPlatform.iOS ) { IContactPicker testicker = DependencyService.Get< IContactPicker >(); testicker.ShowContactPicker(); } } catch (Exception ex) { DisplayAlert("contactsInputTapRecognizer: ", ex.Message, "ok"); } }; #endregion #endregion #region ICON CONTAINER GRID iconContainerGrid = new Grid { IsVisible = false, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition { Height = GridLength.Auto } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(((screenWidth * .80) )/4, GridUnitType.Absolute) }, // icon container x = 3 //new ColumnDefinition { Width = GridLength.Auto }, // new ColumnDefinition { Width = new GridLength(((screenWidth * .80)) /5, GridUnitType.Absolute) }, new ColumnDefinition { Width = new GridLength(((screenWidth * .80))/4, GridUnitType.Absolute) }, new ColumnDefinition { Width = new GridLength(((screenWidth * .80))/4, GridUnitType.Absolute) }, new ColumnDefinition { Width = new GridLength(((screenWidth * .80))/4, GridUnitType.Absolute) }, } }; iconContainerGrid.Children.Add(galleryInputStack, 0, 0); iconContainerGrid.Children.Add(cameraInputStack, 1, 0); // iconContainerGrid.Children.Add(audioInputStack, 2, 0); iconContainerGrid.Children.Add(locationInputStack, 2, 0); iconContainerGrid.Children.Add(contactInputStack, 3, 0); textinputAndIconsHolder = new StackLayout { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.Center, Spacing = 0, Padding = 0, Children = { textInputContainer, iconContainerGrid, editLocationAndContactsStack } }; Button createEvent = new Button(); if (pageTitle == Constants.ADD_ACTIONS || pageTitle == Constants.ADD_GOALS || pageTitle == Constants.EDIT_ACTIONS || pageTitle == Constants.EDIT_GOALS) { createEvent.BackgroundColor = Color.Transparent; createEvent.TextColor = Constants.BLUE_BG_COLOR; createEvent.Text = "Create Reminder"; createEvent.FontSize = 12; createEvent.BorderWidth = 0; createEvent.BorderColor = Color.Transparent; createEvent.Clicked += createEvent_Clicked; if( Device.OS == TargetPlatform.iOS ) createEvent.TranslationY = -8; textinputAndIconsHolder.Children.Add(createEvent); } masterLayout.AddChildToLayout(textinputAndIconsHolder, 5, 21); #region PREVIEW LIST listContainer = new StackLayout(); listContainer.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY; listContainer.WidthRequest = screenWidth * 90 / 100; listContainer.HeightRequest = screenHeight * 25 / 100; listContainer.ClassId = "preview"; previewListView = new ListView(); previewListView.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY; PreviewListViewCellItem.addEvntObject = this; previewListView.ItemTemplate = new DataTemplate(typeof(PreviewListViewCellItem)); previewListView.SeparatorVisibility = SeparatorVisibility.None; previewListView.Opacity = 1; previewListView.ItemsSource = App.PreviewListSource; previewListView.ItemSelected += (object sender, SelectedItemChangedEventArgs e) => { /* PreviewItem items = previewListView.SelectedItem as PreviewItem; if( items != null ) App.Navigator.PushModalAsync( new VideoPlayerView( items.Path ) );*/ previewListView.SelectedItem = null; }; listContainer.Children.Add(previewListView); masterLayout.AddChildToLayout(listContainer, 5, Device.OnPlatform( 63, 63, 50 )); #endregion //masterLayout.AddChildToLayout(locationEditStack, 5, 30 ); #endregion Content = masterLayout; }
public MediaSourceChooser(AddEventsSituationsOrThoughts masterObject, CustomLayout pageContainer, string type) { MasterObject = masterObject; CustomLayout masterLayout = new CustomLayout(); masterLayout.BackgroundColor = Color.Transparent; //IDeviceSpec deviceSpec = DependencyService.Get<IDeviceSpec>(); double screenWidth = App.screenWidth; double screenHeight = App.screenHeight; PageContainer = pageContainer; StackLayout layout = new StackLayout(); layout.BackgroundColor = Color.Black; layout.Opacity = .6; layout.WidthRequest = screenWidth; layout.HeightRequest = screenHeight; TapGestureRecognizer emptyAreaTapGestureRecognizer = new TapGestureRecognizer(); emptyAreaTapGestureRecognizer.Tapped += (s, e) => { View pickView = PageContainer.Children.FirstOrDefault(pick => pick.ClassId == "mediachooser"); PageContainer.Children.Remove(pickView); pickView = null; }; layout.GestureRecognizers.Add(emptyAreaTapGestureRecognizer); CustomImageButton imageButton = new CustomImageButton(); imageButton.ImageName = Device.OnPlatform("image.png", "image.png", @"/Assets/image.png"); imageButton.WidthRequest = screenWidth * 20 / 100; imageButton.HeightRequest = screenHeight * 10 / 100; imageButton.ClassId = type; imageButton.Clicked += OnImageButtonClicked; CustomImageButton videoButton = new CustomImageButton(); videoButton.ImageName = Device.OnPlatform("video.png", "video.png", @"/Assets/video.png"); videoButton.WidthRequest = screenWidth * 20 / 100; videoButton.HeightRequest = screenHeight * 10 / 100; videoButton.ClassId = type; videoButton.Clicked += OnVideoButtonClicked; masterLayout.AddChildToLayout(layout, 0, 0); masterLayout.AddChildToLayout(imageButton, 40, 40); masterLayout.AddChildToLayout(videoButton, 40, 60); this.BackgroundColor = Color.Transparent; Content = masterLayout; }
public CustomEventView(CustomLayout containerLayout, int topY, string title, bool titelBarRequired, bool addButtonRequired) { pageContainedLayout = containerLayout; masterLayout = new CustomLayout(); masterLayout.BackgroundColor = Color.Transparent; screenHeight = App.screenHeight; screenWidth = App.screenWidth; pageTitle = title; topYPos = topY; StackLayout layout = new StackLayout(); layout.BackgroundColor = Color.Black; layout.Opacity = .4; layout.WidthRequest = screenWidth; layout.HeightRequest = screenHeight; TapGestureRecognizer emptyAreaTapGestureRecognizer = new TapGestureRecognizer(); emptyAreaTapGestureRecognizer.Tapped += (s, e) => { View pickView = pageContainedLayout.Children.FirstOrDefault(pick => pick.ClassId == "ePicker"); pageContainedLayout.Children.Remove(pickView); pickView = null; }; layout.GestureRecognizers.Add(emptyAreaTapGestureRecognizer); StackLayout listContainer = new StackLayout(); listContainer.WidthRequest = screenWidth * 96 / 100; listContainer.HeightRequest = screenHeight * topY / 100; listContainer.Orientation = StackOrientation.Vertical; StackLayout listHeader = new StackLayout(); listHeader.WidthRequest = screenWidth * 96 / 100; listHeader.HeightRequest = screenHeight * 10 / 100; listHeader.BackgroundColor = Color.FromRgb(30, 126, 210); listTitle = new Label(); listTitle.Text = title; listTitle.TextColor = Color.White; listTitle.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; listTitle.FontSize = 17; startDatePickerButton = new PurposeColor.interfaces.CustomImageButton(); startDatePickerButton.ImageName = Device.OnPlatform("select_box_whitebg.png", "select_box_whitebg.png", "//Assets//select_box_whitebg.png"); if (App.SelectedActionStartDate != null && App.SelectedActionStartDate.Trim().Length > 0) { startDatePickerButton.Text = App.SelectedActionStartDate; } else { startDatePickerButton.Text = "Start Date"; } startDatePickerButton.FontSize = 18; startDatePickerButton.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; startDatePickerButton.TextOrientation = interfaces.TextOrientation.Left; startDatePickerButton.TextColor = Color.Gray; startDatePickerButton.WidthRequest = screenWidth * 90 / 100; startDatePickerButton.HeightRequest = screenHeight * 8 / 100; startDatePickerButton.Clicked += startDatePickerButton_Clicked; endDatePickerButton = new PurposeColor.interfaces.CustomImageButton(); endDatePickerButton.ImageName = Device.OnPlatform("select_box_whitebg.png", "select_box_whitebg.png", "//Assets//select_box_whitebg.png"); if (App.SelectedActionStartDate != null && App.SelectedActionStartDate.Trim().Length > 0) { endDatePickerButton.Text = App.SelectedActionEndDate; } else { endDatePickerButton.Text = "End Date"; } endDatePickerButton.FontSize = 18; endDatePickerButton.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; endDatePickerButton.TextOrientation = interfaces.TextOrientation.Left; endDatePickerButton.TextColor = Color.Gray; endDatePickerButton.WidthRequest = screenWidth * 90 / 100; endDatePickerButton.HeightRequest = screenHeight * 8 / 100; endDatePickerButton.Clicked += endDatePickerButton_Clicked; this.WidthRequest = screenWidth; this.HeightRequest = screenHeight; masterLayout.AddChildToLayout(layout, 0, 0); /* if (titelBarRequired) { masterLayout.AddChildToLayout(listHeader, 2, (100 - topY - 1) - 10); masterLayout.AddChildToLayout(listTitle, 5, (100 - topY - 1) - 7); }*/ listContainer.Children.Add(startDatePickerButton); listContainer.Children.Add(endDatePickerButton); masterLayout.AddChildToLayout(listContainer, 2, 100 - topY - 1); this.BackgroundColor = Color.Transparent; Content = masterLayout; }
async void OnAppearing(object sender, EventArgs e) { if (!isFirstTime) return; // this.Animate("", (s) => Layout(new Rectangle(X, (1 - s) * Height, Width, Height)), 0, 1000, Easing.SpringIn, null, null); // slide up if (emotionsMasterList != null) { for (int index = 0; index < emotionsMasterList.event_details.Count; index++) { TapGestureRecognizer tap = new TapGestureRecognizer (); tap.Tapped += OnEmotionTapped; StackLayout cellMasterLayout = new StackLayout (); cellMasterLayout.Orientation = StackOrientation.Vertical; cellMasterLayout.BackgroundColor = Color.White; StackLayout headerLayout = new StackLayout (); headerLayout.Orientation = StackOrientation.Vertical; headerLayout.BackgroundColor = Color.FromRgb (244, 244, 244); CustomLayout customLayout = new CustomLayout (); customLayout.BackgroundColor = Color.FromRgb (244, 244, 244); double screenWidth = App.screenWidth; double screenHeight = App.screenHeight; customLayout.ClassId = emotionsMasterList.event_details [index].event_id; customLayout.GestureRecognizers.Add ( tap); CustomImageButton mainTitle = new CustomImageButton (); // mainTitle.IsEnabled = false; mainTitle.BackgroundColor = Color.FromRgb (30, 126, 210); mainTitle.ImageName = Device.OnPlatform ("blue_bg.png", "blue_bg.png", @"/Assets/blue_bg.png"); mainTitle.Text = "My Supporting Emotions"; mainTitle.TextColor = Color.White; mainTitle.FontSize = Device.OnPlatform (12, 12, 18); mainTitle.WidthRequest = App.screenWidth; mainTitle.TextOrientation = TextOrientation.Middle; headerLayout.VerticalOptions = LayoutOptions.CenterAndExpand; mainTitle.HeightRequest = 80; Label subTitle = new Label (); subTitle.Text = (emotionsMasterList.event_title != null && emotionsMasterList.event_title.Count > 0) ? emotionsMasterList.event_title [index].event_title : "empty"; subTitle.TextColor = Color.Gray; subTitle.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; subTitle.XAlign = TextAlignment.Center; int subTitleFontSize = (App.screenDensity > 1.5) ? 18 : 16; subTitle.VerticalOptions = LayoutOptions.Center; subTitle.FontSize = Device.OnPlatform (subTitleFontSize, subTitleFontSize, 22); subTitle.WidthRequest = App.screenWidth * 90 / 100; headerLayout.HorizontalOptions = LayoutOptions.Center; subTitle.HeightRequest = Device.OnPlatform (40, 40, 30); subTitle.ClassId = emotionsMasterList.event_details [index].event_id; subTitle.GestureRecognizers.Add ( tap); Label firstDetailsInfo = new Label (); string trimmedFirstDetails = (emotionsMasterList.event_details != null && emotionsMasterList.event_details.Count > 0) ? emotionsMasterList.event_details [index].event_details : "empty"; if (trimmedFirstDetails != null && trimmedFirstDetails.Length > 50) { trimmedFirstDetails = trimmedFirstDetails.Substring (0, 50); trimmedFirstDetails = trimmedFirstDetails + "...."; trimmedFirstDetails = trimmedFirstDetails.Replace ("\\n", string.Empty); trimmedFirstDetails = trimmedFirstDetails.Replace ("\\r", string.Empty); } firstDetailsInfo.Text = trimmedFirstDetails; firstDetailsInfo.TextColor = Color.Gray; firstDetailsInfo.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; firstDetailsInfo.WidthRequest = App.screenWidth * 60 / 100; firstDetailsInfo.HeightRequest = 40; firstDetailsInfo.ClassId = emotionsMasterList.event_details [index].event_id; firstDetailsInfo.GestureRecognizers.Add ( tap); int firstDetailsInfoFontSize = (App.screenDensity > 1.5) ? Device.OnPlatform (17, 16, 13) : 15; firstDetailsInfo.FontSize = Device.OnPlatform (firstDetailsInfoFontSize, firstDetailsInfoFontSize, firstDetailsInfoFontSize); Label firstDateInfo = new Label (); firstDateInfo.Text = (emotionsMasterList.event_datetime != null && emotionsMasterList.event_datetime.Count > 0) ? emotionsMasterList.event_datetime [index].event_datetime : "empty"; //firstDateInfo.Text = "2015 Januvary 30"; firstDateInfo.TextColor = Color.Black; firstDateInfo.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; int dateFontSize = (App.screenDensity > 1.5) ? Device.OnPlatform (13, 15, 13) : 12; firstDateInfo.FontSize = Device.OnPlatform (dateFontSize, dateFontSize, dateFontSize); firstDateInfo.ClassId = emotionsMasterList.event_details [index].event_id; firstDateInfo.GestureRecognizers.Add ( tap); Image firstEmotionsImage = new Image (); firstEmotionsImage.WidthRequest = App.screenWidth * Device.OnPlatform (30, 28, 25) / 100; firstEmotionsImage.HeightRequest = App.screenWidth * Device.OnPlatform (25, 22, 18) / 100; string eventID = emotionsMasterList.event_details[index].event_id; List<EventMedia> firstThumbMedia = emotionsMasterList.event_media.FindAll(itm => itm.event_id == eventID).ToList(); bool firstImageValidity = (firstThumbMedia != null && firstThumbMedia.Count > 0 && !string.IsNullOrEmpty(firstThumbMedia[0].event_media)) ? true : false; string firstImageSource = (firstImageValidity) ? Constants.SERVICE_BASE_URL + eventsMediaThumbPath + firstThumbMedia[0].event_media : Constants.SERVICE_BASE_URL + eventsNoMediaPath; if (firstThumbMedia != null && firstThumbMedia[0].media_type == "mp4" ) { firstImageSource = Device.OnPlatform("video.png", "video.png", "//Assets//video.png"); } else if (firstThumbMedia[0] != null && (firstThumbMedia[0].media_type == "3gpp" || firstThumbMedia[0].media_type == "aac" ) ) { firstImageSource = Device.OnPlatform("audio.png", "audio.png", "//Assets//audio.png"); } else if (firstThumbMedia[0] != null && firstThumbMedia[0].media_type == "wav") { firstImageSource = Device.OnPlatform("audio.png", "audio.png", "//Assets//audio.png"); } firstEmotionsImage.Source = firstImageSource; firstEmotionsImage.ClassId = emotionsMasterList.event_details [index].event_id; firstEmotionsImage.GestureRecognizers.Add ( tap); firstEmotionsImage.Aspect = Aspect.Fill; //firstEmotionsImage.SetBinding(Image.SourceProperty, "FirstImage"); customLayout.WidthRequest = screenWidth; customLayout.HeightRequest = 125;//screenHeight * Device.OnPlatform(30, 31, 7) / 100; StackLayout viewContainer = new StackLayout (); viewContainer.WidthRequest = App.screenWidth; viewContainer.HeightRequest = 100;//screenHeight * Device.OnPlatform(30, 27, 7) / 100; viewContainer.BackgroundColor = Color.White; Image divider = new Image (); divider.Source = "line_seperate.png"; divider.BackgroundColor = Color.Transparent; divider.WidthRequest = App.screenWidth * 85 / 100; customLayout.AddChildToLayout (viewContainer, 0, Device.OnPlatform (-5, 0, 0)); customLayout.AddChildToLayout (firstDetailsInfo, 5, Device.OnPlatform (-3, 2, 2)); customLayout.AddChildToLayout (firstDateInfo, 5, Device.OnPlatform (4, 9, 6)); customLayout.AddChildToLayout (firstEmotionsImage, Device.OnPlatform( 67, 65, 67 ), Device.OnPlatform (-3, 2, 1)); masterStack.Children.Add (customLayout); } isFirstTime = false; } else if (goalsMasterList != null) { for (int index = 0; index < goalsMasterList.action_details.Count; index++) { TapGestureRecognizer tap = new TapGestureRecognizer (); tap.Tapped += OnGoalsTapped;; StackLayout cellMasterLayout = new StackLayout(); cellMasterLayout.Orientation = StackOrientation.Vertical; cellMasterLayout.BackgroundColor = Color.White; StackLayout headerLayout = new StackLayout(); headerLayout.Orientation = StackOrientation.Vertical; headerLayout.BackgroundColor = Color.FromRgb(244, 244, 244); CustomLayout customLayout = new CustomLayout(); customLayout.BackgroundColor = Color.FromRgb(244, 244, 244); double screenWidth = App.screenWidth; double screenHeight = App.screenHeight; customLayout.ClassId = goalsMasterList.action_details [index].goalaction_id; customLayout.GestureRecognizers.Add ( tap ); CustomImageButton mainTitle = new CustomImageButton(); // mainTitle.IsEnabled = false; mainTitle.BackgroundColor = Color.FromRgb(30, 126, 210); mainTitle.ImageName = Device.OnPlatform("blue_bg.png", "blue_bg.png", @"/Assets/blue_bg.png"); mainTitle.Text = "My Goals and Dreams"; mainTitle.TextColor = Color.White; mainTitle.FontSize = Device.OnPlatform(12, 12, 18); mainTitle.WidthRequest = App.screenWidth; mainTitle.TextOrientation = TextOrientation.Middle; headerLayout.VerticalOptions = LayoutOptions.CenterAndExpand; mainTitle.HeightRequest = 80; Label subTitle = new Label(); subTitle.Text = (goalsMasterList.action_title != null && goalsMasterList.action_title.Count > 0) ? goalsMasterList.action_title[index].action_title : "empty"; subTitle.TextColor = Color.Gray; subTitle.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; subTitle.XAlign = TextAlignment.Center; int subTitleFontSize = (App.screenDensity > 1.5) ? 18 : 16; subTitle.VerticalOptions = LayoutOptions.Center; subTitle.FontSize = Device.OnPlatform(subTitleFontSize, subTitleFontSize, 22); subTitle.WidthRequest = App.screenWidth * 90 / 100; headerLayout.HorizontalOptions = LayoutOptions.Center; subTitle.HeightRequest = Device.OnPlatform(40, 40, 30); Label firstDetailsInfo = new Label(); string trimmedFirstDetails = (goalsMasterList.action_details != null &&goalsMasterList.action_details.Count > 0) ? goalsMasterList.action_details[index].action_details : "empty"; if (trimmedFirstDetails != null && trimmedFirstDetails.Length > 50) { trimmedFirstDetails = trimmedFirstDetails.Substring(0, 50); trimmedFirstDetails = trimmedFirstDetails + "...."; trimmedFirstDetails = trimmedFirstDetails.Replace("\\n", string.Empty); trimmedFirstDetails = trimmedFirstDetails.Replace("\\r", string.Empty); } firstDetailsInfo.Text = trimmedFirstDetails; firstDetailsInfo.TextColor = Color.Gray; firstDetailsInfo.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; firstDetailsInfo.WidthRequest = App.screenWidth * 60 / 100; firstDetailsInfo.HeightRequest = 40; firstDetailsInfo.ClassId = goalsMasterList.action_details [index].goalaction_id; firstDetailsInfo.GestureRecognizers.Add ( tap ); int firstDetailsInfoFontSize = (App.screenDensity > 1.5) ? Device.OnPlatform(17, 16, 13) : 15; firstDetailsInfo.FontSize = Device.OnPlatform(firstDetailsInfoFontSize, firstDetailsInfoFontSize, firstDetailsInfoFontSize); Label firstDateInfo = new Label(); firstDateInfo.Text = (goalsMasterList.action_datetime != null && goalsMasterList.action_datetime.Count > 0) ? goalsMasterList.action_datetime[index].action_datetime : "empty"; //firstDateInfo.Text = "2015 Januvary 30"; firstDateInfo.TextColor = Color.Black; firstDateInfo.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; firstDateInfo.ClassId = goalsMasterList.action_details [index].goalaction_id; firstDateInfo.GestureRecognizers.Add ( tap ); int dateFontSize = (App.screenDensity > 1.5) ? Device.OnPlatform(13, 15, 13) : 12; firstDateInfo.FontSize = Device.OnPlatform(dateFontSize, dateFontSize, dateFontSize); Image firstEmotionsImage = new Image(); firstEmotionsImage.WidthRequest = App.screenWidth * Device.OnPlatform (30, 28, 25) / 100; firstEmotionsImage.HeightRequest = App.screenWidth * Device.OnPlatform (25, 22, 18) / 100; firstEmotionsImage.ClassId = goalsMasterList.action_details [index].goalaction_id; string actionID = goalsMasterList.action_details[index].goalaction_id; List<ActionMedia> FirstThumbMedia = goalsMasterList.action_media.FindAll(itm => itm.goalaction_id == actionID).ToList(); firstEmotionsImage.GestureRecognizers.Add ( tap ); bool firstImageValidity = (FirstThumbMedia != null && FirstThumbMedia.Count > 0 && !string.IsNullOrEmpty(FirstThumbMedia[0].action_media)) ? true : false; string firstImageSource = (firstImageValidity) ? Constants.SERVICE_BASE_URL + goalsMediaThumbPath + FirstThumbMedia[0].action_media : Constants.SERVICE_BASE_URL + goalsNoMediaPath; if ( FirstThumbMedia!= null && FirstThumbMedia[0].media_type == "mp4") { firstImageSource = Device.OnPlatform("video.png", "video.png", "//Assets//video.png"); } else if (FirstThumbMedia[0].media_type == "3gpp" || FirstThumbMedia[0].media_type == "aac") { firstImageSource = Device.OnPlatform("audio.png", "audio.png", "//Assets//audio.png"); } else if (FirstThumbMedia[0].media_type == "wav") { firstImageSource = Device.OnPlatform("audio.png", "audio.png", "//Assets//audio.png"); } firstEmotionsImage.Source = Device.OnPlatform(firstImageSource, firstImageSource, firstImageSource); //firstEmotionsImage.SetBinding(Image.SourceProperty, "FirstImage"); customLayout.WidthRequest = screenWidth; customLayout.HeightRequest = 125;//screenHeight * Device.OnPlatform(30, 31, 7) / 100; StackLayout viewContainer = new StackLayout(); viewContainer.WidthRequest = App.screenWidth; viewContainer.HeightRequest = 100;//screenHeight * Device.OnPlatform(30, 27, 7) / 100; viewContainer.BackgroundColor = Color.White; Image divider = new Image(); divider.Source = "line_seperate.png"; divider.BackgroundColor = Color.Transparent; divider.WidthRequest = App.screenWidth * 85 / 100; customLayout.AddChildToLayout(viewContainer, 0, Device.OnPlatform(-5, 0, 0)); customLayout.AddChildToLayout(firstDetailsInfo, 5, Device.OnPlatform(-3, 2, 2)); customLayout.AddChildToLayout(firstDateInfo, 5, Device.OnPlatform(4, 9, 6)); customLayout.AddChildToLayout(firstEmotionsImage, Device.OnPlatform(67, 65, 67), Device.OnPlatform(-3, 2, 1)); masterStack.Children.Add(customLayout); } isFirstTime = false; } if (Device.OS == TargetPlatform.WinPhone) { StackLayout spaceOffsetlayout = new StackLayout(); spaceOffsetlayout.WidthRequest = App.screenWidth * 50 / 100; spaceOffsetlayout.HeightRequest = Device.OnPlatform(0, 0, 100); spaceOffsetlayout.BackgroundColor = Color.Transparent; masterStack.Children.Add(spaceOffsetlayout); } }
public SourceChooser(CustomLayout pageContainer, string type, ProfileSettingsPage parentObject) { CustomLayout masterLayout = new CustomLayout(); masterLayout.BackgroundColor = Color.Transparent; //IDeviceSpec deviceSpec = DependencyService.Get<IDeviceSpec>(); double screenWidth = App.screenWidth; double screenHeight = App.screenHeight; PageContainer = pageContainer; callerObject = parentObject; StackLayout layout = new StackLayout(); layout.BackgroundColor = Color.Black; layout.Opacity = .6; layout.WidthRequest = screenWidth; layout.HeightRequest = screenHeight; TapGestureRecognizer emptyAreaTapGestureRecognizer = new TapGestureRecognizer(); emptyAreaTapGestureRecognizer.Tapped += (s, e) => { View pickView = PageContainer.Children.FirstOrDefault(pick => pick.ClassId == "mediachooser"); PageContainer.Children.Remove(pickView); pickView = null; }; layout.GestureRecognizers.Add(emptyAreaTapGestureRecognizer); CustomImageButton imageButton = new CustomImageButton(); imageButton.ImageName = Device.OnPlatform("photoCamera_icon.png", "photoCamera_icon.png", @"/Assets/photoCamera_icon.png"); imageButton.WidthRequest = screenWidth * 20 / 100; imageButton.HeightRequest = screenHeight * 10 / 100; imageButton.ClassId = type; imageButton.Clicked += OnImageButtonClicked; CustomImageButton selectFromGalleryButton = new CustomImageButton(); selectFromGalleryButton.ImageName = Device.OnPlatform("image.png", "image.png", @"/Assets/image.png"); selectFromGalleryButton.WidthRequest = screenWidth * 20 / 100; selectFromGalleryButton.HeightRequest = screenHeight * 10 / 100; selectFromGalleryButton.ClassId = type; selectFromGalleryButton.Clicked += SelectFromGalleryButtonClicked; masterLayout.AddChildToLayout(layout, 0, 0); masterLayout.AddChildToLayout(imageButton, 40, 40); masterLayout.AddChildToLayout(selectFromGalleryButton, 40, 60); this.BackgroundColor = Color.Transparent; Content = masterLayout; }
void RenderGems( CommunityGemsObject gemsObject, bool prevButtonNeeded ) { try { /*Button loadPreviousGems = new Button(); loadPreviousGems.BackgroundColor = Color.Transparent; loadPreviousGems.TextColor = Constants.BLUE_BG_COLOR; loadPreviousGems.Text = "Load previous gems"; loadPreviousGems.FontSize = 12; loadPreviousGems.BorderWidth = 0; loadPreviousGems.BorderColor = Color.Transparent; loadPreviousGems.Clicked += OnLoadPreviousGemsClicked; masterStackLayout.Children.Add( loadPreviousGems );*/ foreach (var item in gemsObject.resultarray ) { CustomLayout masterStack = new CustomLayout(); masterStack.WidthRequest = App.screenWidth * 102 / 100; masterStack.ClassId = "masterstack" + item.gem_id; masterStack.BackgroundColor = Color.White;// Color.FromRgb(244, 244, 244); #region TOOLS LAYOUT StackLayout toolsLayout = new StackLayout(); toolsLayout.BackgroundColor = Color.White; toolsLayout.Spacing = App.screenWidth*.10; toolsLayout.Orientation = StackOrientation.Horizontal; //toolsLayout.WidthRequest = App.screenWidth * 95 / 100; toolsLayout.HeightRequest = App.screenHeight * .05; toolsLayout.HorizontalOptions = LayoutOptions.Center; toolsLayout.Padding = new Thickness(10, 0, 10, 0); likeButtonTap = new TapGestureRecognizer(); Image likeButton = new Image(); string likeSource = ( item.like_status == 1 ) ? "icn_liked.png" : "icn_like.png"; likeButton.Source = likeSource; likeButton.WidthRequest = Device.OnPlatform(15, 15, 15); likeButton.HeightRequest = Device.OnPlatform(15, 15, 15); likeButton.VerticalOptions = LayoutOptions.Center; likeButton.ClassId = item.gem_id + "&&" + item.gem_type; likeButton.GestureRecognizers.Add(likeButtonTap); Label likeLabel = new Label { Text = "Like", FontFamily = Constants.HELVERTICA_NEUE_LT_STD, TextColor = Color.Gray, VerticalOptions = LayoutOptions.Center, FontSize = Device.OnPlatform(12, 12, 15), ClassId = item.gem_id + "&&" + item.gem_type }; likeLabel.GestureRecognizers.Add(likeButtonTap); Label likeCount = new Label { Text = ( item.likecount > 0 ) ? item.likecount.ToString() : "", FontFamily = Constants.HELVERTICA_NEUE_LT_STD, TextColor = Color.Blue, VerticalOptions = LayoutOptions.Center, FontSize = Device.OnPlatform(12, 12, 15) }; StackLayout likeLayout = new StackLayout{Children = {likeCount, likeButton, likeLabel}, Orientation = StackOrientation.Horizontal, Spacing = 5}; toolsLayout.Children.Add( likeLayout ); // toolsLayout.Children.Add(likeCount); // toolsLayout.Children.Add(likeButton); // toolsLayout.Children.Add(likeLabel); likeButtonTap.Tapped += async (object tapSender, EventArgs eTap) => { try { string gemID = ""; Image likeImg = tapSender as Image; Label like = tapSender as Label; Label likeCountLabel = new Label(); if (likeImg != null) { int likeImgIndex = likeLayout.Children.IndexOf( likeImg ); if( likeImgIndex > 0 ) { likeCountLabel =(Label) likeLayout.Children[ likeImgIndex - 1 ]; } if (likeImg.ClassId != null) gemID = likeImg.ClassId; } if (like != null) { int labelIndex = likeLayout.Children.IndexOf( like ); if( labelIndex > 0 ) { likeImg =(Image) likeLayout.Children[ labelIndex - 1 ]; likeCountLabel =(Label) likeLayout.Children[ labelIndex - 2 ]; } if (like.ClassId != null) gemID = like.ClassId; } //likeButtonTap.Tapped -= OnLikeButtonTapped; progressBar.ShowProgressbar("Requesting... "); /////////////// for testing ///////////// string[] delimiters = { "&&" }; string[] clasIDArray = gemID.Split(delimiters, StringSplitOptions.None); string selectedGemID = clasIDArray [0]; string selectedGemType = clasIDArray [1]; LikeResponse likeRes = await ServiceHelper.LikeGem( selectedGemID, selectedGemType ); if( likeRes != null ) { string source = ( likeRes.like_status == 1 ) ? "icn_liked.png" : "icn_like.png"; likeImg.Source = source; if( likeCountLabel != null ) likeCountLabel.Text = ( likeRes.likecount > 0 ) ? likeRes.likecount.ToString() : ""; } progressBar.HideProgressbar(); } catch (Exception ex) { progressBar.HideProgressbar(); DisplayAlert(Constants.ALERT_TITLE, "Could not process the request now.", Constants.ALERT_OK); } progressBar.HideProgressbar(); }; Image shareButton = new Image(); shareButton.Source = Device.OnPlatform("share.png", "share.png", "//Assets//share.png"); shareButton.WidthRequest = Device.OnPlatform(15, 15, 15); shareButton.HeightRequest = Device.OnPlatform(15, 15, 15); shareButton.VerticalOptions = LayoutOptions.Center; shareButton.ClassId = item.gem_id; shareLabel = new Label { Text = "Share", FontFamily = Constants.HELVERTICA_NEUE_LT_STD, TextColor = Color.Gray, VerticalOptions = LayoutOptions.Center, FontSize = Device.OnPlatform(12, 12, 15), ClassId = item.gem_id }; shareButtonTap = new TapGestureRecognizer(); shareButtonTap.Tapped += OnShareButtonTapped; shareButton.GestureRecognizers.Add(shareButtonTap); shareLabel.GestureRecognizers.Add(shareButtonTap); toolsLayout.Children.Add( new StackLayout{Children = {shareButton, shareLabel}, Orientation = StackOrientation.Horizontal, Spacing = 5}); // toolsLayout.Children.Add(shareButton); // toolsLayout.Children.Add(shareLabel); Image commentButton = new Image(); commentButton.Source = Device.OnPlatform("icon_cmnt.png", "icon_cmnt.png", "//Assets//icon_cmnt.png"); commentButton.WidthRequest = Device.OnPlatform(15, 15, 15); commentButton.HeightRequest = Device.OnPlatform(15, 15, 15); commentButton.VerticalOptions = LayoutOptions.Center; commentButton.ClassId = item.gem_id + "&&" + item.gem_type; Label commentsLabel = new Label { VerticalOptions = LayoutOptions.Center, FontFamily = Constants.HELVERTICA_NEUE_LT_STD, TextColor = Color.Gray, FontSize = Device.OnPlatform(12, 12, 15), ClassId = item.gem_id + "&&" + item.gem_type }; if( item.comment_count > 0 ) { commentsLabel.Text = "Comments (" + item.comment_count.ToString() + ")"; } else { commentsLabel.Text = "Comments"; } commentButtonTap = new TapGestureRecognizer(); commentButtonTap.Tapped += OnCommentButtonTapped; //commentButton.GestureRecognizers.Add(commentButtonTap); commentsLabel.GestureRecognizers.Add(commentButtonTap); toolsLayout.Children.Add( new StackLayout{Children = {commentButton, commentsLabel}, Orientation = StackOrientation.Horizontal, Spacing = 5}); // // toolsLayout.Children.Add(commentButton); // toolsLayout.Children.Add(commentsLabel); #endregion #region title, description Image profileImage = new Image(); profileImage.Source = (item.profileimg != null) ? Constants.SERVICE_BASE_URL + item.profileimg : "avatar.jpg"; profileImage.WidthRequest = 60; profileImage.HeightRequest = 60; profileImage.Aspect = Aspect.Fill; profileImage.ClassId = item.user_id; TapGestureRecognizer profileImageTag = new TapGestureRecognizer(); profileImageTag.Tapped += ProfileImageTag_Tapped; profileImage.GestureRecognizers.Add(profileImageTag); Label userName = new Label(); userName.Text = item.firstname; userName.TextColor = Color.Black; userName.WidthRequest = App.screenWidth * 90 / 100; userName.FontAttributes = FontAttributes.Bold; userName.FontSize = Device.OnPlatform(14, 15, 12); userName.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; title = new Label(); title.Text = item.gem_datetime; title.TextColor = Color.Black; title.WidthRequest = App.screenWidth * 90 / 100; title.FontSize = Device.OnPlatform(12, 12, 12); title.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; description = new Label(); description.WidthRequest = App.screenWidth * .80; description.Text = item.gem_details; description.TextColor = Color.Black; description.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; description.FontSize = Device.OnPlatform(12, 15, 15); CustomImageButton menuButton = new CustomImageButton { ImageName = Device.OnPlatform("downarrow.png", "downarrow.png", "//Assets//downarrow.png"), Text = string.Empty, HorizontalOptions = LayoutOptions.End, BackgroundColor = Color.Transparent, WidthRequest = 30, HeightRequest = 20, ClassId = item.gem_id }; menuButton.Clicked += GemMenuButton_Clicked; CustomImageButton followButton = new CustomImageButton(); //followButton.Text = "Follow"; followButton.ImageName = "follow.png"; followButton.TextColor = Color.White; followButton.HeightRequest = 20; followButton.BackgroundColor = Color.FromRgb(8, 135, 224); followButton.WidthRequest = 60; followButton.ClassId = item.user_id; followButton.IsEnabled = true; if( item.follow_status > 0 ) { followButton.ImageName = "follow_disable.png"; followButton.IsEnabled = false; } followButton.Clicked += async (object fsender, EventArgs fe) => { CustomImageButton btn = fsender as CustomImageButton; btn.ImageName = "follow_disable.png"; btn.IsEnabled = false; if( btn != null && btn.ClassId != null ) { if( currentUser != null ) { progressBar.ShowProgressbar( "Loading...." ); FollowResponse resp = await ServiceHelper.SendFollowRequest( currentUser.UserId.ToString(), btn.ClassId.ToString() ); if( resp != null && resp.code == "400" ) { progressBar.ShowToast( "Already sent reqeust." ); } progressBar.HideProgressbar(); } } }; // masterStack.AddChildToLayout(pageTitle, 1, 1); //masterStack.AddChildToLayout(menuButton, 79, 1); masterStack.AddChildToLayout(profileImage, 4, 1); masterStack.AddChildToLayout(userName, 25, 3); masterStack.AddChildToLayout(title, 25, 7); if( (item.user_id != currentUser.UserId.ToString() ) && item.can_follow == "1") { masterStack.AddChildToLayout(followButton, 80, 3 ); } TapGestureRecognizer moreTap = new TapGestureRecognizer(); moreTap.Tapped += async (object senderr, EventArgs ee) => { Image more = senderr as Image; if (more != null) { IProgressBar progress = DependencyService.Get<IProgressBar>(); progress.ShowProgressbar("Loading more medias.."); App.masterPage.IsPresented = false; CommunityGemsDetails gemInfo = communityGems.resultarray.FirstOrDefault(itm => itm.gem_id == more.ClassId); if (gemInfo != null) { List<PurposeColor.Constants.MediaDetails> mediaPlayerList = new List<PurposeColor.Constants.MediaDetails>(); List<string> listToDownload = new List<string>(); foreach (var mediaItem in gemInfo.gem_media ) { if(string.IsNullOrEmpty(mediaItem.gem_media)) { continue; } if (mediaItem.media_type == "png" || mediaItem.media_type == "jpg" || mediaItem.media_type == "jpeg") { listToDownload.Add(Constants.SERVICE_BASE_URL+ mediaItem.gem_media); string fileName = System.IO.Path.GetFileName(mediaItem.gem_media); mediaItem.gem_media = App.DownloadsPath + fileName; mediaPlayerList.Add(new PurposeColor.Constants.MediaDetails() { ImageName = mediaItem.gem_media, ID = item.gem_id, MediaType = mediaItem.media_type, Url = mediaItem.gem_media }); } else if( mediaItem.media_type == "mp4" || mediaItem.media_type == "3gpp" ) { mediaItem.gem_media = Constants.SERVICE_BASE_URL + mediaItem.gem_media ; mediaPlayerList.Add(new PurposeColor.Constants.MediaDetails() { ImageName = mediaItem.video_thumb, ID = item.gem_id, MediaType = mediaItem.media_type, Url = mediaItem.gem_media }); } else { mediaItem.gem_media = Constants.SERVICE_BASE_URL + mediaItem.gem_media ; mediaPlayerList.Add(new PurposeColor.Constants.MediaDetails() { ImageName = mediaItem.gem_media, ID = item.gem_id, MediaType = mediaItem.media_type, Url = mediaItem.gem_media }); } } // down load files // if (listToDownload != null && listToDownload.Count > 0) { IDownload downloader = DependencyService.Get<IDownload>(); await downloader.DownloadFiles(listToDownload); } await Navigation.PushAsync(new CommunityMediaViewer(mediaPlayerList)); } progress.HideProgressbar(); } }; Image moreImg = new Image(); moreImg.Source = "more.png"; moreImg.HorizontalOptions = LayoutOptions.End; moreImg.VerticalOptions = LayoutOptions.End; moreImg.GestureRecognizers.Add(moreTap); moreImg.ClassId = item.gem_id; #endregion StackLayout bottomAndLowerControllStack = new StackLayout { Orientation = StackOrientation.Vertical, BackgroundColor = Color.Transparent, Spacing = 1, Padding = new Thickness(0, 5, 0, 5), WidthRequest = App.screenWidth * 102 / 100 }; BoxView paddingBoxView = new BoxView(); paddingBoxView.WidthRequest = App.screenWidth * 3 / 100; paddingBoxView.BackgroundColor = Color.Transparent; bottomAndLowerControllStack.Children.Add(new StackLayout { Orientation = StackOrientation.Horizontal , WidthRequest = App.screenWidth * 102 / 100, Children = { paddingBoxView, description } }); #region MEDIA LIST if ( item.gem_media != null ) { GemMedia gemMedia = (item.gem_media.Count > 0) ? item.gem_media[0] : null; if( gemMedia != null ) { TapGestureRecognizer videoTap = new TapGestureRecognizer(); videoTap.Tapped += OnGemTapped; IDownload downloader = DependencyService.Get<IDownload>(); string fileName = Path.GetFileName( Constants.SERVICE_BASE_URL + gemMedia.gem_media ); string localFilePath = Device.OnPlatform( downloader.GetLocalFileName( fileName ), App.DownloadsPath + fileName, "" ); Image img = new Image(); bool isValidUrl = (gemMedia.gem_media != null && !string.IsNullOrEmpty(gemMedia.gem_media)) ? true : false; string source = (isValidUrl) ? localFilePath : null; string fileExtenstion = Path.GetExtension(source); bool isImage = (fileExtenstion == ".png" || fileExtenstion == ".jpg" || fileExtenstion == ".jpeg") ? true : false; img.WidthRequest = App.screenWidth * 102 / 100;// * 90 / 100; img.HeightRequest = App.screenWidth * 80 / 100; img.Aspect = Aspect.Fill; img.ClassId = null; if ( gemMedia.gem_media != null && gemMedia.media_type == "mp4") { img.ClassId = Constants.SERVICE_BASE_URL + gemMedia.gem_media ; source = Constants.SERVICE_BASE_URL + gemMedia.video_thumb; } else if ( gemMedia.gem_media != null && (gemMedia.media_type == "3gpp" || gemMedia.media_type == "aac" )) { img.ClassId = Constants.SERVICE_BASE_URL + gemMedia.gem_media; source = Device.OnPlatform("audio.png", "audio.png", "//Assets//audio.png"); } else if (gemMedia.gem_media != null && gemMedia.media_type == "wav") { img.ClassId = source; source = Device.OnPlatform("audio.png", "audio.png", "//Assets//audio.png"); } if( source != null ) { img.Source = source; img.GestureRecognizers.Add(videoTap); var indicator = new ActivityIndicator { Color = new Color(.5), }; indicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsLoading"); masterStack.AddChildToLayout(indicator, 45, 30); /* CustomLayout imgContainer = new CustomLayout(); imgContainer.WidthRequest = App.screenWidth * 90 / 100; imgContainer.HeightRequest = App.screenWidth * 90 / 100; imgContainer.Children.Add(img); if( item.gem_media != null && item.gem_media.Count > 1 ) imgContainer.AddChildToLayout(moreImg, 75, 75, (int)imgContainer.WidthRequest, (int)imgContainer.HeightRequest);*/ Grid grid = new Grid { WidthRequest = App.screenWidth * 102 / 100, // HeightRequest = App.screenWidth * 80 / 100, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition { Height = new GridLength( img.HeightRequest / 3 ) }, new RowDefinition { Height = new GridLength( img.HeightRequest / 3 ) }, new RowDefinition { Height = new GridLength( img.HeightRequest / 3 ) }, }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength( img.WidthRequest / 3 ) }, new ColumnDefinition { Width = new GridLength( img.WidthRequest / 3 ) }, new ColumnDefinition { Width = new GridLength( img.WidthRequest / 3 ) }, } }; if ( gemMedia != null && gemMedia.media_type == "mp4") { Image play = new Image(); play.Source = "video_play.png"; play.Aspect = Aspect.AspectFit; play.WidthRequest = 75; play.HeightRequest = 75; play.HorizontalOptions = LayoutOptions.Center; play.VerticalOptions = LayoutOptions.Center; play.ClassId = img.ClassId; play.GestureRecognizers.Add(videoTap); BoxView box = new BoxView(); box.BackgroundColor = Color.Red; box.WidthRequest = 100; box.HeightRequest = 100; grid.Children.Add( img, 0, 0 ); Grid.SetColumnSpan(img, 3); Grid.SetRowSpan( img, 3 ); grid.Children.Add(play, 1, 1); if( item.gem_media.Count > 1 ) grid.Children.Add(moreImg, 2, 2); bottomAndLowerControllStack.Children.Add(grid); } else { grid.Children.Add( img, 0, 0 ); Grid.SetColumnSpan(img, 3); Grid.SetRowSpan( img, 3 ); if( item.gem_media.Count > 1 ) grid.Children.Add(moreImg, 2, 2); bottomAndLowerControllStack.Children.Add(grid); } } } } #endregion bottomAndLowerControllStack.Children.Add(toolsLayout); masterStack.AddChildToLayout(bottomAndLowerControllStack, 0, 12); // masterStack.AddChildToLayout( moreImg, 65, Device.OnPlatform( 30, 20, 20 ) ); //masterStack.AddChildToLayout(spaceOffsetlayout, 1, 85); /// bottomAndLowerControllStack.Children.Add(spaceOffsetlayout); masterScroll.HeightRequest = App.screenHeight - 20; masterScroll.WidthRequest = App.screenWidth * 102 / 100;// * 90 / 100; masterStackLayout.Children.Add(masterStack); } if( prevButtonNeeded ) { Button backToTop = new Button(); backToTop.BackgroundColor = Color.Transparent; backToTop.TextColor = Constants.BLUE_BG_COLOR; backToTop.Text = "Go back to previous page"; backToTop.FontSize = 12; backToTop.BorderWidth = 0; backToTop.BorderColor = Color.Transparent; backToTop.ClassId = "prev page"; backToTop.Clicked += (object sender, EventArgs e) => { OnLoadPreviousGemsClicked( masterScroll, EventArgs.Empty ); }; masterStackLayout.Children.Add ( backToTop ); } /* Button loadMoreGems = new Button(); loadMoreGems.BackgroundColor = Color.Transparent; loadMoreGems.TextColor = Constants.BLUE_BG_COLOR; loadMoreGems.Text = "Load more gems"; loadMoreGems.FontSize = 12; loadMoreGems.BorderWidth = 0; loadMoreGems.BorderColor = Color.Transparent; loadMoreGems.Clicked += OnLoadMoreGemsClicked;*/ BoxView transBox = new BoxView(); transBox.HeightRequest = 125; transBox.WidthRequest = App.screenWidth * 80 / 100; transBox.BackgroundColor = Color.Transparent; //masterStackLayout.Children.Add(loadMoreGems); masterStackLayout.Children.Add(transBox); masterScroll.Content = masterStackLayout; } catch (Exception ex) { } }
public PurposeColorSubTitleBar(Color backGroundColor, string titleValue, bool nextButtonVisible = true, bool backButtonVisible = true ) { int titlebarHeight = (int)App.screenHeight * 7 / 100; int titlebarWidth = (int)App.screenWidth; this.BackgroundColor = backGroundColor; screenHeight = App.screenHeight; screenWidth = App.screenWidth; masterLayout = new CustomLayout(); masterLayout.HeightRequest = titlebarHeight; masterLayout.WidthRequest = titlebarWidth; masterLayout.BackgroundColor = backGroundColor; Image bgImage = new Image(); bgImage.Source = Device.OnPlatform("top_bg.png", "light_blue_bg.png", "//Assets//top_bg.png"); // bgImage.WidthRequest = spec.ScreenWidth; // bgImage.HeightRequest = titlebarHeight; bgImage.Aspect = Aspect.Fill; Image backArrow = new Image(); backArrow.Source = Device.OnPlatform("bckarow.png", "bckarow.png", "//Assets//bckarow.png"); BackButtonTapRecognizer = new TapGestureRecognizer(); backArrow.GestureRecognizers.Add(BackButtonTapRecognizer); Image imgDivider = new Image(); imgDivider.Source = Device.OnPlatform("icn_seperate.png", "icn_seperate.png", "//Assets//top_seperate.png"); // imgDivider.HeightRequest = spec.ScreenHeight * 4 / 100; title = new Label(); title.Text = titleValue; title.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; title.FontSize = Device.OnPlatform( 17, 20, 22 ); title.TextColor = Color.Black; Image logo = new Image(); logo.Source = Device.OnPlatform("logo.png", "logo.png", "//Assets//logo.png"); logo.WidthRequest = App.screenWidth; logo.HeightRequest = titlebarHeight; // logo.WidthRequest = spec.ScreenWidth * 70 / 100; // logo.HeightRequest = spec.ScreenHeight * 8 / 100; Image nextImage = new Image(); nextImage.Source = Device.OnPlatform("icon_tick.png", "icon_tick.png", "//Assets//icon_tick.png"); NextButtonTapRecognizer = new TapGestureRecognizer(); nextImage.GestureRecognizers.Add(NextButtonTapRecognizer); // nextImage.Aspect = Aspect.Fill; if( Device.OS == TargetPlatform.WinPhone ) { backArrow.HeightRequest = screenHeight * 4 / 100; backArrow.WidthRequest = screenWidth * 8 / 100; nextImage.HeightRequest = screenHeight * 2 / 100; nextImage.WidthRequest = screenWidth * 10 / 100; imgDivider.HeightRequest = screenHeight * 4 / 100; } // masterLayout.AddChildToLayout(bgImage, 0, 0, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); //masterLayout.AddChildToLayout(title, 20, 18, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); masterLayout.AddChildToLayout(title, Device.OnPlatform(20, 20, 28), Device.OnPlatform(18, 18, 32), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); if( nextButtonVisible ) { StackLayout touchArea = new StackLayout(); touchArea.WidthRequest = 100; touchArea.HeightRequest = App.screenHeight * 8 / 100; touchArea.BackgroundColor = Color.Transparent; touchArea.GestureRecognizers.Add(NextButtonTapRecognizer); if (Device.OS != TargetPlatform.iOS) { masterLayout.AddChildToLayout(imgDivider, 83, 26, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); } masterLayout.AddChildToLayout(nextImage, Device.OnPlatform(87, 89, 85), Device.OnPlatform(10, 40, 38), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); masterLayout.AddChildToLayout(touchArea, Device.OnPlatform(87, 80, 75), Device.OnPlatform(10, 2, 15), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); } if (backButtonVisible) { masterLayout.AddChildToLayout(backArrow, 5, Device.OnPlatform(25, 25,20), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); } Content = masterLayout; }
public CommunityMediaViewer ( List<PurposeColor.Constants.MediaDetails> mediaList ) { NavigationPage.SetHasNavigationBar (this, false); masterLayout = new CustomLayout (); masterLayout.BackgroundColor = Color.Black;// Color.FromRgb(244, 244, 244); masterScroll = new ScrollView (); masterScroll.BackgroundColor = Color.Black;//Color.FromRgb(244, 244, 244); progressBar = DependencyService.Get<IProgressBar> (); mainTitleBar = new PurposeColorTitleBar (Color.FromRgb (8, 135, 224), "Purpose Color", Color.Black, "back", true); subTitleBar = new PurposeColorSubTitleBar (Constants.SUB_TITLE_BG_COLOR, "Gem Media Viewer", false); subTitleBar.BackButtonTapRecognizer.Tapped += async (object sender, EventArgs e) => { try { await Navigation.PopAsync (); } catch (Exception) { } }; mainTitleBar.imageAreaTapGestureRecognizer.Tapped += (object sender, EventArgs e) => { App.masterPage.IsPresented = !App.masterPage.IsPresented; }; masterStack = new CustomLayout (); masterStack.BackgroundColor = Color.Transparent; masterStack.HorizontalOptions = LayoutOptions.Center; StackLayout bottomAndLowerControllStack = new StackLayout { Orientation = StackOrientation.Vertical, BackgroundColor = Color.Transparent, Spacing = 1, Padding = new Thickness (0, 5, 0, 5), WidthRequest = App.screenWidth, }; ScrollView imgScrollView = new ScrollView (); imgScrollView.Orientation = ScrollOrientation.Horizontal; StackLayout horizmgConatiner = new StackLayout (); horizmgConatiner.Orientation = StackOrientation.Horizontal; CustomImageButton nextImg = new CustomImageButton (); nextImg.ImageName = "next.png"; nextImg.WidthRequest = 40; nextImg.HeightRequest = 65; nextImg.Clicked += async (object sender, EventArgs e) => { double curX = imgScrollView.ScrollX; double imgWidth = App.screenWidth * 100 / 100; if( Device.OS == TargetPlatform.iOS ) { if( curX + imgWidth + 15 < imgScrollView.ContentSize.Width ) await imgScrollView.ScrollToAsync( curX + imgWidth , 0, true ); } else { await imgScrollView.ScrollToAsync( curX + imgWidth , 0, true ); } }; CustomImageButton prevImg = new CustomImageButton (); prevImg.ImageName = "prev.png"; prevImg.WidthRequest = 40; prevImg.HeightRequest = 65; prevImg.Clicked += async (object sender, EventArgs e) => { double curX = imgScrollView.ScrollX; double imgWidth = App.screenWidth * 90 / 100; if( curX > 0 ) await imgScrollView.ScrollToAsync( curX - App.screenWidth , 0, true ); }; #region MEDIA LIST if (mediaList != null) { foreach (var item in mediaList) { TapGestureRecognizer videoTap = new TapGestureRecognizer (); videoTap.Tapped += OnActionVideoTapped; Image img = new Image (); bool isValidUrl = ( item.Url != null && !string.IsNullOrEmpty ( item.Url )) ? true : false; string source = (isValidUrl) ? item.Url : Device.OnPlatform ("noimage.png", "noimage.png", "//Assets//noimage.png"); string fileExtenstion = Path.GetExtension (source); bool isImage = (fileExtenstion == ".png" || fileExtenstion == ".jpg" || fileExtenstion == ".jpeg") ? true : false; img.WidthRequest = App.screenWidth; img.HeightRequest = App.screenWidth; img.Aspect = Aspect.AspectFill; img.ClassId = null; if (item != null && item.MediaType == "mp4") { img.ClassId = source; source = Constants.SERVICE_BASE_URL + item.ImageName; } else if ( item != null && item.MediaType == "aac") { img.ClassId = source; source = Device.OnPlatform ("audio.png", "audio.png", "//Assets//audio.png"); } else if ( item != null && item.MediaType == "3gpp") { img.ClassId = source; source = Constants.SERVICE_BASE_URL + item.ImageName; } else if ( item != null && item.MediaType == "wav") { img.ClassId = source; source = Device.OnPlatform ("audio.png", "audio.png", "//Assets//audio.png"); } img.Source = source; img.GestureRecognizers.Add (videoTap); var indicator = new ActivityIndicator { Color = new Color (.5), }; indicator.SetBinding (ActivityIndicator.IsRunningProperty, "IsLoading"); indicator.BindingContext = img; masterStack.AddChildToLayout (indicator, 40, 30); if (item != null && ( item.MediaType == "mp4" || item.MediaType == "3gpp" ) ) { Grid grid = new Grid { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition { Height = new GridLength( img.WidthRequest / 3 ) }, new RowDefinition { Height = new GridLength( img.WidthRequest / 3 ) }, new RowDefinition { Height = new GridLength( img.WidthRequest / 3 ) }, }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength( img.WidthRequest / 3 ) }, new ColumnDefinition { Width = new GridLength( img.WidthRequest / 3 ) }, new ColumnDefinition { Width = new GridLength( img.WidthRequest / 3 ) }, } }; Image play = new Image(); play.Source = "video_play.png"; play.Aspect = Aspect.AspectFit; play.WidthRequest = 75; play.HeightRequest = 75; play.HorizontalOptions = LayoutOptions.Center; play.VerticalOptions = LayoutOptions.Center; play.ClassId = img.ClassId; play.GestureRecognizers.Add(videoTap); grid.Children.Add( img, 0, 0 ); Grid.SetColumnSpan(img, 3); Grid.SetRowSpan( img, 3 ); grid.Children.Add(play, 1, 1); horizmgConatiner.Children.Add(grid); } else { horizmgConatiner.Children.Add(img); } } imgScrollView.Content = horizmgConatiner; bottomAndLowerControllStack.Children.Add (imgScrollView); } #endregion masterStack.AddChildToLayout (bottomAndLowerControllStack, 0, Device.OnPlatform (5, 9, 12));//12 masterScroll.HeightRequest = App.screenHeight - 20; masterScroll.WidthRequest = App.screenWidth;// * 90 / 100; StackLayout masterStackLayout = new StackLayout (); masterStackLayout.HorizontalOptions = LayoutOptions.Center; masterStackLayout.BackgroundColor = Color.Black; masterStackLayout.Orientation = StackOrientation.Vertical; masterStackLayout.Children.Add (masterStack); masterScroll.Content = masterStackLayout; masterLayout.AddChildToLayout (mainTitleBar, 0, 0); masterLayout.AddChildToLayout (subTitleBar, 0, Device.OnPlatform (9, 10, 10)); masterLayout.AddChildToLayout (masterScroll, 0, 18); masterLayout.AddChildToLayout (prevImg, Device.OnPlatform( -2, -2, 0 ), 50); masterLayout.AddChildToLayout (nextImg, 90, 50); Content = masterLayout; }
//public GemsDetailsPage(List<EventMedia> mediaArray, List<ActionMedia> actionMediaArray, string pageTitleVal, string titleVal, string desc, string Media, string NoMedia, string gemId, GemType gemType) public CommunityGems(DetailsPageModel model) { NavigationPage.SetHasNavigationBar(this, false); masterLayout = new CustomLayout(); masterLayout.BackgroundColor = Color.FromRgb(244, 244, 244); masterScroll = new ScrollView(); masterScroll.IsClippedToBounds = true; masterScroll.BackgroundColor = Color.FromRgb(244, 244, 244); progressBar = DependencyService.Get<IProgressBar>(); currentUser = App.Settings.GetUser (); modelObject = model; CurrentGemId = model.gemId; CurrentGemType = model.gemType; cancelToken = new CancellationTokenSource (); mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), "Purpose Color", Color.Black, "back", false); mainTitleBar.imageAreaTapGestureRecognizer.Tapped += OnImageAreaTapGestureRecognizerTapped; subTitleBar = new CommunityGemSubTitleBar(Constants.SUB_TITLE_BG_COLOR, Constants.COMMUNITY_GEMS, true); subTitleBar.myGemsTapRecognizer.Tapped += async (object sender, EventArgs e) => { IProgressBar progress = DependencyService.Get<IProgressBar>(); progress.ShowProgressbar( "Loading Mygems.." ); CommunityGemsObject myGems = await ServiceHelper.GetMyGemsDetails(); if( myGems != null ) { //communityGems = null; Navigation.PushAsync( new MyGemsPage( myGems ) ); myGemsCount = myGems.resultarray.Count; } progress.HideProgressbar(); /* masterStack.Children.Clear(); masterStackLayout.Children.Clear(); masterScroll.Content = null; RenderGems( communityGems );*/ }; subTitleBar.BackButtonTapRecognizer.Tapped += async (object sender, EventArgs e) => { try { App.masterPage.IsPresented = !App.masterPage.IsPresented; } catch (Exception) { } }; this.Appearing += OnAppearing; Label pageTitle = new Label(); pageTitle.Text = model.pageTitleVal; pageTitle.TextColor = Color.Black; pageTitle.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; pageTitle.FontAttributes = FontAttributes.Bold; pageTitle.WidthRequest = App.screenWidth * 80 / 100; pageTitle.HeightRequest = 50; pageTitle.XAlign = TextAlignment.Start; pageTitle.YAlign = TextAlignment.Start; pageTitle.FontSize = Device.OnPlatform(15, 20, 15); BoxView emptyLayout = new BoxView(); emptyLayout.BackgroundColor = Color.Transparent; emptyLayout.WidthRequest = App.screenWidth * 90 / 100; emptyLayout.HeightRequest = 30; masterStackLayout = new StackLayout(); masterStackLayout.Orientation = StackOrientation.Vertical; TapGestureRecognizer chatTap = new TapGestureRecognizer (); Image chat = new Image (); chat.Source = "chat.png"; chat.Aspect = Aspect.Fill; chat.WidthRequest = App.screenWidth * 16 / 100; chat.HeightRequest = App.screenWidth * 12 / 100; chat.GestureRecognizers.Add ( chatTap ); chatTap.Tapped += async (object sender, EventArgs e) => { await Navigation.PushAsync( new ChatPage() ); }; masterLayout.AddChildToLayout(mainTitleBar, 0, 0); masterLayout.AddChildToLayout(chat, 80, 1); masterLayout.AddChildToLayout(subTitleBar, 0, Device.OnPlatform(9, 10, 10)); masterLayout.AddChildToLayout(masterScroll, -1, 18); masterScroll.Scrolled += OnMasterScrollScrolled; Content = masterLayout; }
public PurposeColorTitleBar(Color backGroundColor, string titleValue, Color titleColor, string backButtonTitle, bool imageRequired = false) { Cross.IDeviceSpec spec = DependencyService.Get<Cross.IDeviceSpec>(); int titlebarHeight = (int)spec.ScreenHeight * 10 / 100; int titlebarWidth = (int)spec.ScreenWidth; this.BackgroundColor = backGroundColor; masterLayout = new CustomLayout(); masterLayout.HeightRequest = titlebarHeight; masterLayout.WidthRequest = titlebarWidth; masterLayout.BackgroundColor = backGroundColor; Image menuButton = new Image(); menuButton.Source = Device.OnPlatform("menu.png", "menu.png", "//Assets//menu.png"); menuButton.HeightRequest = 30; menuButton.WidthRequest = 25; imageAreaTapGestureRecognizer = new TapGestureRecognizer(); menuButton.GestureRecognizers.Add(imageAreaTapGestureRecognizer); title = new Label(); title.Text = titleValue; title.FontSize = 20; title.TextColor = Color.Black; Image logo = new Image(); logo.Source = Device.OnPlatform("logo.png", "logo.png", "//Assets//logo.png"); logo.WidthRequest = spec.ScreenWidth; logo.HeightRequest = titlebarHeight; logo.WidthRequest = spec.ScreenWidth * 70 / 100; logo.HeightRequest = spec.ScreenHeight * 8 / 100; User curUser = App.Settings.GetUser (); if (curUser != null) { CircleImage userImg = new CircleImage { Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.Center, Source = Constants.SERVICE_BASE_URL + curUser.ProfileImageUrl }; userImg.WidthRequest = 30; userImg.HeightRequest = 30; if (imageRequired) { masterLayout.AddChildToLayout(userImg, 88, Device.OnPlatform( 17, 25, 17 ), (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); } TapGestureRecognizer profileImgTap = new TapGestureRecognizer (); profileImgTap.Tapped += ProfileImgTap_Tapped; userImg.GestureRecognizers.Add (profileImgTap); } masterLayout.AddChildToLayout(logo, 5, 5, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); masterLayout.AddChildToLayout(menuButton, 2, 25, (int)masterLayout.WidthRequest, (int)masterLayout.HeightRequest); Content = masterLayout; }
public ChangePassword() { NavigationPage.SetHasNavigationBar(this, false); CustomLayout masterLayout = new CustomLayout(); masterLayout.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY; PurposeColorBlueSubTitleBar subTitleBar = null; subTitleBar = new PurposeColorBlueSubTitleBar(Constants.SUB_TITLE_BG_COLOR, " Change Password", true, true); subTitleBar.BackButtonTapRecognizer.Tapped += (s, e) => { try { Navigation.PopAsync(); } catch (Exception ex) { } }; IDeviceSpec deviceSpec = DependencyService.Get<IDeviceSpec>(); PurposeColorTitleBar mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), "Purpose Color", Color.Black, "back", true); mainTitleBar.imageAreaTapGestureRecognizer.Tapped += imageAreaTapGestureRecognizer_Tapped; oldPaswordEntry = new CustomEntry { Placeholder = "Old password", HeightRequest = Device.OnPlatform(50, 50, 75), IsPassword = true }; newPaswordEntry = new CustomEntry { Placeholder = "New password", HeightRequest = Device.OnPlatform(50, 50, 75), IsPassword = true }; confirmPaswordEntry = new CustomEntry { Placeholder = "Confirm new password", HeightRequest = Device.OnPlatform(50, 50, 75), IsPassword = true }; submitButton = new Button { Text = "Submit", TextColor = Color.White, BorderColor = Color.Transparent, BorderWidth = 0, BackgroundColor = Constants.BLUE_BG_COLOR, HeightRequest = Device.OnPlatform(50, 50, 75), }; oldPaswordEntry.WidthRequest = deviceSpec.ScreenWidth * 80 / 100; newPaswordEntry.WidthRequest = deviceSpec.ScreenWidth * 80 / 100; confirmPaswordEntry.WidthRequest = deviceSpec.ScreenWidth * 80 / 100; submitButton.WidthRequest = deviceSpec.ScreenWidth * 80 / 100; masterLayout.AddChildToLayout(mainTitleBar, 0, 0); masterLayout.AddChildToLayout(subTitleBar, 0, 10); masterLayout.AddChildToLayout(oldPaswordEntry, 10, 25); masterLayout.AddChildToLayout(newPaswordEntry, 10, 35); masterLayout.AddChildToLayout(confirmPaswordEntry, 10, 45); masterLayout.AddChildToLayout(submitButton, 10, 55); submitButton.Clicked += OnSubmitButtonClicked; subTitleBar.NextButtonTapRecognizer.Tapped += (s, e) => { OnSubmitButtonClicked(submitButton, null); }; Content = masterLayout; }
async Task<bool> AddToScrollView(CustomGemItemModel gemModel) { try { CustomLayout gemLayout = null; Image image = null; StackLayout bgStack = null; Label detailsLabel = null; Label groupTitleLabel = null; gemLayout = new CustomLayout (); gemLayout.BackgroundColor = Color.FromRgb(219,221,221); gemLayout.WidthRequest = App.screenWidth; gemLayout.Padding = new Thickness(0,0,0,App.screenHeight * .04); detailsLabel = new Label (); detailsLabel.Text = gemModel.Description; detailsLabel.TextColor = Color.White; // Color.FromRgb(8, 135, 224);//Color.FromRgb(8, 159, 245); detailsLabel.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; detailsLabel.FontSize = 18; detailsLabel.WidthRequest = App.screenWidth - (App.screenWidth *.01); detailsLabel.HorizontalOptions = LayoutOptions.Center; detailsLabel.YAlign = TextAlignment.Center; detailsLabel.XAlign = TextAlignment.Center; bgStack = new StackLayout (); bgStack.WidthRequest = App.screenWidth; bgStack.HeightRequest = 85; bgStack.BackgroundColor = Color.Black;//Color.FromRgb(220, 220, 220); bgStack.Opacity = .2; bgStack.ClassId = gemModel.ID; if(!string.IsNullOrEmpty(detailsLabel.Text)) { int textleng = detailsLabel.Text.Length; } image = new Image { Aspect = Aspect.AspectFill, //Aspect.Fill, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, WidthRequest = App.screenWidth, HeightRequest = (App.screenHeight * .35), Rotation= 0, Source = gemModel.Source }; Image nextBtn = new Image { Source = "roundNextBtn.png", WidthRequest = App.screenWidth * .1, HeightRequest = App.screenWidth * .1, ClassId = gemModel.ID.ToString() }; TapGestureRecognizer DetailsTapgesture = null; DetailsTapgesture = new TapGestureRecognizer(); DetailsTapgesture.Tapped += DetailsTapgesture_Tapped; nextBtn.GestureRecognizers.Add(DetailsTapgesture); if (previousTitle == null || !string.IsNullOrEmpty(gemModel.GroupTitle) && gemModel.GroupTitle != previousTitle) { groupTitleLabel = new Label { FontFamily = Constants.HELVERTICA_NEUE_LT_STD, FontSize = 19, YAlign = TextAlignment.Start, VerticalOptions = LayoutOptions.Center, TextColor = Color.White, Text = " " + gemModel.GroupTitle.Trim() }; StackLayout titleHolder = new StackLayout{ Children={groupTitleLabel}, BackgroundColor = Color.FromRgb(111, 199, 251), //Color.FromRgb(59,164,222),//Color.FromRgb(88,168,6), // Color.FromRgb(111, 199, 251), Padding = 0, Orientation = StackOrientation.Horizontal, WidthRequest= App.screenWidth }; gemLayout.AddChildToLayout (titleHolder, 0, 0); gemLayout.AddChildToLayout (image, 0, 4); gemLayout.AddChildToLayout (bgStack, 0, 16);//16 - appear @ center of img. 26 - text appear at bottom corner of img. gemLayout.AddChildToLayout (detailsLabel, 1, 16); gemLayout.AddChildToLayout (nextBtn, 47, 23); // btn width = 1% of width. }else { gemLayout.AddChildToLayout (image, 0, 0); gemLayout.AddChildToLayout (bgStack, 0, 12);// 12 - aliended center to img. // 22 - align to bottom of img. gemLayout.AddChildToLayout (detailsLabel, 1, 12); gemLayout.AddChildToLayout (nextBtn, 47, 19); } gemLayout.ClassId = gemModel.ID; gemLayout.GestureRecognizers.Add(DetailsTapgesture); bgStack.GestureRecognizers.Add(DetailsTapgesture); if (!string.IsNullOrEmpty(gemModel.GroupTitle)) { previousTitle = gemModel.GroupTitle.Trim(); } listViewContainer.Children.Add(gemLayout); gemModel = null; // to clear mem. return true; } catch (Exception ex) { var test = ex.Message; } return false; }
public GemsDetailsPage( DetailsPageModel model ) { try { NavigationPage.SetHasNavigationBar(this, false); detailsPageModel = model; masterLayout = new CustomLayout(); masterLayout.BackgroundColor = Color.FromRgb(244, 244, 244); masterScroll = new ScrollView(); masterScroll.BackgroundColor = Color.FromRgb(244, 244, 244); masterScroll.IsClippedToBounds = true; progressBar = DependencyService.Get<IProgressBar>(); masterStack = new CustomLayout(); //masterStack.Orientation = StackOrientation.Vertical; masterStack.BackgroundColor = Color.FromRgb(244, 244, 244); mediaList = model.eventMediaArray; actionMediaList = model.actionMediaArray; CurrentGemId = model.gemId; CurrentGemType = model.gemType; User user = null; App.GemDeleted = false; try { user = App.Settings.GetUser(); } catch (Exception ex) { var test = ex.Message; } if (string.IsNullOrEmpty (model.pageTitleVal)) { model.pageTitleVal = "GEM Details"; } mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), "Purpose Color", Color.Black, "back", true); mainTitleBar.imageAreaTapGestureRecognizer.Tapped += OnImageAreaTapGestureRecognizerTapped; subTitleBar = new PurposeColorSubTitleBar(Constants.SUB_TITLE_BG_COLOR, model.pageTitleVal, false); subTitleBar.BackButtonTapRecognizer.Tapped += async (object sender, EventArgs e) => { try { await Navigation.PopAsync(); } catch (Exception){ } }; this.Appearing += GemsDetailsPage_Appearing; Label pageTitle = new Label(); pageTitle.Text = model.titleVal;//model.pageTitleVal; pageTitle.TextColor = Color.Black; pageTitle.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; pageTitle.FontAttributes = FontAttributes.Bold; pageTitle.WidthRequest = App.screenWidth * 80 / 100; pageTitle.HeightRequest = 50; pageTitle.XAlign = TextAlignment.Start; pageTitle.YAlign = TextAlignment.Start; pageTitle.FontSize = Device.OnPlatform(15, 20, 15); StackLayout emptyLayout = new StackLayout(); emptyLayout.BackgroundColor = Color.Transparent; emptyLayout.WidthRequest = App.screenWidth * 90 / 100; emptyLayout.HeightRequest = 30; #region TOOLS LAYOUT StackLayout toolsLayout = new StackLayout(); toolsLayout.Spacing = App.screenWidth * .10; toolsLayout.Orientation = StackOrientation.Horizontal; toolsLayout.HorizontalOptions = LayoutOptions.Center; toolsLayout.HeightRequest = App.screenHeight * .05; toolsLayout.Padding = new Thickness(10, 5, 10, 10); toolsLayout.ClassId = "ToolsLayout"; favoriteButton = new Image(); favoriteButton.Source = Device.OnPlatform("favoriteIcon.png", "favoriteIcon.png", "//Assets//favoriteIcon.png"); favoriteButton.WidthRequest = Device.OnPlatform(15, 15, 15); favoriteButton.HeightRequest = Device.OnPlatform(15, 15, 15); favoriteButton.VerticalOptions = LayoutOptions.Center; favoriteButtonTap = new TapGestureRecognizer(); favoriteButtonTap.Tapped += FavoriteButtonTapped; favoriteButton.GestureRecognizers.Add(favoriteButtonTap); favoriteLabel = new Label { Text = "Favorite", FontFamily = Constants.HELVERTICA_NEUE_LT_STD, TextColor = Color.Gray, VerticalOptions = LayoutOptions.Center, FontSize = Device.OnPlatform(12,12,15) }; favoriteLabel.GestureRecognizers.Add(favoriteButtonTap); toolsLayout.Children.Add( new StackLayout{Children = {favoriteButton,favoriteLabel}, Orientation = StackOrientation.Horizontal, Spacing = 5}); //toolsLayout.Children.Add(favoriteButton); //toolsLayout.Children.Add(favoriteLabel); if (user.AllowCommunitySharing) { shareButton = new Image(); shareButton.Source = Device.OnPlatform("share.png", "share.png", "//Assets//share.png"); shareButton.WidthRequest = Device.OnPlatform(15, 15, 15); shareButton.HeightRequest = Device.OnPlatform(15, 15, 15); shareButton.VerticalOptions = LayoutOptions.Center; shareLabel = new Label { Text = "Share", FontFamily = Constants.HELVERTICA_NEUE_LT_STD, TextColor = Color.Gray, VerticalOptions = LayoutOptions.Center, FontSize = Device.OnPlatform(12,12,15) }; shareButtonTap = new TapGestureRecognizer(); shareButtonTap.Tapped += ShareButtonTapped; shareButton.GestureRecognizers.Add(shareButtonTap); shareLabel.GestureRecognizers.Add(shareButtonTap); toolsLayout.Children.Add(new StackLayout{Children = {shareButton,shareLabel}, Orientation = StackOrientation.Horizontal, Spacing = 5}); //toolsLayout.Children.Add(shareLabel); } Image commentButton = new Image(); commentButton.Source = Device.OnPlatform("icon_cmnt.png", "icon_cmnt.png", "//Assets//icon_cmnt.png"); commentButton.WidthRequest = Device.OnPlatform(15, 15, 15); commentButton.HeightRequest = Device.OnPlatform(15, 15, 15); commentButton.VerticalOptions = LayoutOptions.Center; commentsLabel = new Label { Text = "Comments", VerticalOptions = LayoutOptions.Center, FontFamily = Constants.HELVERTICA_NEUE_LT_STD, TextColor = Color.Gray, FontSize = Device.OnPlatform(12,12,15), ClassId = "CommentLabel" }; commentButtonTap = new TapGestureRecognizer(); commentButtonTap.Tapped += CommentButtonTapped; commentButton.GestureRecognizers.Add(commentButtonTap); commentsLabel.GestureRecognizers.Add(commentButtonTap); toolsLayout.Children.Add( new StackLayout{Children = {commentButton,commentsLabel}, Orientation = StackOrientation.Horizontal, Spacing = 5}); //toolsLayout.Children.Add(commentButton); //toolsLayout.Children.Add(commentsLabel); #endregion #region title, description title = new Label (); title.Text = model.titleVal; title.TextColor = Color.Black; title.WidthRequest = App.screenWidth * 90 / 100; title.FontSize = Device.OnPlatform (12, 12, 12); title.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; description = new Label (); description.WidthRequest = App.screenWidth * .75; description.Text = model.description; description.TextColor = Color.Black; description.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; Image menuButton = new Image { Source = Device.OnPlatform("downarrow.png", "downarrow.png", "//Assets//downarrow.png"), HorizontalOptions = LayoutOptions.End, BackgroundColor = Color.Transparent, WidthRequest = Device.OnPlatform(25, 25, 60), HeightRequest = Device.OnPlatform(25, 25, 40), Aspect = Aspect.AspectFit }; TapGestureRecognizer editMenuGesture = new TapGestureRecognizer(); editMenuGesture.Tapped += GemMenuButton_Clicked; menuButton.GestureRecognizers.Add(editMenuGesture); masterStack.AddChildToLayout(pageTitle, 2, Device.OnPlatform(0,1,1)); masterStack.AddChildToLayout(menuButton, Device.OnPlatform(87, 90, 99), Device.OnPlatform(0,1,1)); //masterStack.AddChildToLayout(title,1,Device.OnPlatform(3,7,7)); #endregion StackLayout bottomAndLowerControllStack = new StackLayout { Orientation = StackOrientation.Vertical, BackgroundColor = Color.Transparent, Spacing = 1, Padding = 0,// new Thickness(0, 0, 0, 5), WidthRequest = App.screenWidth,// * .90, ClassId= "BottomNlowerStack" }; bottomAndLowerControllStack.Children.Add(new StackLayout { Padding = new Thickness(6, 0, 0, 5), Children = { description } }); #region MEDIA LIST if (mediaList != null) { for (int index = 0; index < mediaList.Count; index++) { TapGestureRecognizer videoTap = new TapGestureRecognizer(); videoTap.Tapped += OnEventVideoTapped; bool isValidUrl = (mediaList[index].event_media != null && !string.IsNullOrEmpty(mediaList[index].event_media)) ? true : false; string source = (isValidUrl) ? model.Media + mediaList[index].event_media : Device.OnPlatform("noimage.png", "noimage.png", "//Assets//noimage.png"); string fileExtenstion = Path.GetExtension(source); bool isImage = (fileExtenstion == ".png" || fileExtenstion == ".jpg" || fileExtenstion == ".jpeg") ? true : false; //img.WidthRequest = App.screenWidth;// * 50 / 100; Image img = new Image(); if(isImage) img.HeightRequest = App.screenWidth * 1.1; else { img.HeightRequest = App.screenWidth; } //img.MinimumHeightRequest = App.screenWidth; //img.MinimumWidthRequest = App.screenWidth; img.Aspect = Aspect.AspectFill; img.ClassId = null; if (mediaList[index] != null && mediaList[index].media_type == "mp4") { img.ClassId = source; source = Constants.SERVICE_BASE_URL + mediaList[index].video_thumb; } else if (mediaList[index] != null && (mediaList[index].media_type == "3gpp" || mediaList[index].media_type == "aac") ) { img.ClassId = source; source = Device.OnPlatform("audio.png", "audio.png", "//Assets//audio.png"); } else if (mediaList[index] != null && mediaList[index].media_type == "wav") { img.ClassId = source; source = Device.OnPlatform("audio.png", "audio.png", "//Assets//audio.png"); } img.Source = source; img.GestureRecognizers.Add(videoTap); var indicator = new ActivityIndicator { Color = new Color(.5), }; indicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsLoading"); indicator.BindingContext = img; masterStack.AddChildToLayout(indicator, 40, Device.OnPlatform(50,40,40)); if (isValidUrl) { if (mediaList[index] != null && mediaList[index].media_type == "mp4") { Grid grid = new Grid { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition { Height = new GridLength( App.screenWidth / 3 ) }, new RowDefinition { Height = new GridLength( App.screenWidth / 3 ) }, new RowDefinition { Height = new GridLength( App.screenWidth / 3 ) }, }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength( App.screenWidth / 3 ) }, new ColumnDefinition { Width = new GridLength( App.screenWidth / 3 ) }, new ColumnDefinition { Width = new GridLength( App.screenWidth / 3 ) }, } }; Image play = new Image(); play.Source = "video_play.png"; play.Aspect = Aspect.AspectFit; play.WidthRequest = 75; play.HeightRequest = 75; play.HorizontalOptions = LayoutOptions.Center; play.VerticalOptions = LayoutOptions.Center; play.ClassId = mediaList[index].event_media ; play.GestureRecognizers.Add(videoTap); BoxView box = new BoxView(); box.BackgroundColor = Color.Red; box.WidthRequest = 100; box.HeightRequest = 100; grid.Children.Add( img, 0, 0 ); Grid.SetColumnSpan(img, 3); Grid.SetRowSpan( img, 3 ); grid.Children.Add(play, 1, 1); bottomAndLowerControllStack.Children.Add(grid); } else { bottomAndLowerControllStack.Children.Add(img); } } } } if (actionMediaList != null) { for (int index = 0; index < actionMediaList.Count; index++) { TapGestureRecognizer videoTap = new TapGestureRecognizer(); videoTap.Tapped += OnActionVideoTapped; Image img = new Image(); bool isValidUrl = (actionMediaList[index].action_media != null && !string.IsNullOrEmpty(actionMediaList[index].action_media)) ? true : false; string source = (isValidUrl) ? model.Media + actionMediaList[index].action_media : Device.OnPlatform("noimage.png", "noimage.png", "//Assets//noimage.png"); string fileExtenstion = Path.GetExtension(source); bool isImage = (fileExtenstion == ".png" || fileExtenstion == ".jpg" || fileExtenstion == ".jpeg") ? true : false; //img.WidthRequest = App.screenWidth;// * 50 / 100; if(isImage) img.HeightRequest = App.screenWidth * 1.1; else { img.HeightRequest = App.screenWidth; } img.Aspect = Aspect.AspectFill; img.ClassId = null; if (actionMediaList[index] != null && actionMediaList[index].media_type == "mp4") { img.ClassId = source; source = Constants.SERVICE_BASE_URL + actionMediaList[index].video_thumb; } else if (actionMediaList[index] != null && (actionMediaList[index].media_type == "3gpp" || actionMediaList[index].media_type == "aac")) { img.ClassId = source; source = Device.OnPlatform("audio.png", "audio.png", "//Assets//audio.png"); } else if (actionMediaList[index] != null && actionMediaList[index].media_type == "wav") { img.ClassId = source; source = Device.OnPlatform("audio.png", "audio.png", "//Assets//audio.png"); } img.Source = source; img.GestureRecognizers.Add(videoTap); var indicator = new ActivityIndicator { Color = new Color(.5), }; indicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsLoading"); indicator.BindingContext = img; masterStack.AddChildToLayout(indicator, 40, Device.OnPlatform(50,40,40)); if (isValidUrl) { if (actionMediaList[index] != null && actionMediaList[index].media_type == "mp4") { Grid grid = new Grid { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition { Height = new GridLength( App.screenWidth / 3 ) }, new RowDefinition { Height = new GridLength( App.screenWidth / 3 ) }, new RowDefinition { Height = new GridLength( App.screenWidth / 3 ) }, }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength( App.screenWidth / 3 ) }, new ColumnDefinition { Width = new GridLength( App.screenWidth / 3 ) }, new ColumnDefinition { Width = new GridLength( App.screenWidth / 3 ) }, } }; Image play = new Image(); play.Source = "video_play.png"; play.Aspect = Aspect.AspectFit; play.WidthRequest = 75; play.HeightRequest = 75; play.HorizontalOptions = LayoutOptions.Center; play.VerticalOptions = LayoutOptions.Center; play.ClassId = actionMediaList[index].action_media ; play.GestureRecognizers.Add(videoTap); BoxView box = new BoxView(); box.BackgroundColor = Color.Red; box.WidthRequest = 100; box.HeightRequest = 100; grid.Children.Add( img, 0, 0 ); Grid.SetColumnSpan(img, 3); Grid.SetRowSpan( img, 3 ); grid.Children.Add(play, 1, 1); bottomAndLowerControllStack.Children.Add(grid); } else { bottomAndLowerControllStack.Children.Add(img); } } } } if (model.goal_media != null) { ScrollView imgScrollView = new ScrollView(); imgScrollView.Orientation = ScrollOrientation.Horizontal; //StackLayout horizmgConatiner = new StackLayout(); // horizmgConatiner.Orientation = StackOrientation.Horizontal; for (int index = 0; index < model.goal_media.Count; index++) { TapGestureRecognizer videoTap = new TapGestureRecognizer(); videoTap.Tapped += OnActionVideoTapped; Image img = new Image(); bool isValidUrl = (model.goal_media[index].goal_media != null && !string.IsNullOrEmpty(model.goal_media[index].goal_media)) ? true : false; string source = (isValidUrl) ? model.goal_media[index].goal_media : Device.OnPlatform("noimage.png", "noimage.png", "//Assets//noimage.png"); string fileExtenstion = Path.GetExtension(source); bool isImage = (fileExtenstion == ".png" || fileExtenstion == ".jpg" || fileExtenstion == ".jpeg") ? true : false; //img.WidthRequest = App.screenWidth;// * 50 / 100; if(isImage) img.HeightRequest = App.screenWidth * 1.1; else { img.HeightRequest = App.screenWidth; } img.Aspect = Aspect.AspectFill; img.ClassId = null; if (model.goal_media[index] != null && model.goal_media[index].media_type == "mp4") { source = Constants.SERVICE_BASE_URL + model.goal_media[index].video_thumb; img.ClassId = source; } else if (model.goal_media[index] != null && (model.goal_media[index].media_type == "3gpp" || model.goal_media[index].media_type == "aac")) { img.ClassId = source; source = Device.OnPlatform("audio.png", "audio.png", "//Assets//audio.png"); } else if (model.goal_media[index] != null && model.goal_media[index].media_type == "wav") { img.ClassId = source; source = Device.OnPlatform("audio.png", "audio.png", "//Assets//audio.png"); } img.Source = source; img.GestureRecognizers.Add(videoTap); var indicator = new ActivityIndicator { Color = new Color(.5), }; indicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsLoading"); indicator.BindingContext = img; masterStack.AddChildToLayout(indicator, 40, Device.OnPlatform(50,40,40)); // horizmgConatiner.Children.Add(img); if( isValidUrl ) { if ( model.goal_media[index]!= null && model.goal_media[index].media_type == "mp4") { Grid grid = new Grid { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition { Height = new GridLength( App.screenWidth / 3 ) }, new RowDefinition { Height = new GridLength( App.screenWidth / 3 ) }, new RowDefinition { Height = new GridLength( App.screenWidth / 3 ) }, }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength( App.screenWidth / 3 ) }, new ColumnDefinition { Width = new GridLength( App.screenWidth / 3 ) }, new ColumnDefinition { Width = new GridLength( App.screenWidth / 3 ) }, } }; Image play = new Image(); play.Source = "video_play.png"; play.Aspect = Aspect.AspectFit; play.WidthRequest = 75; play.HeightRequest = 75; play.HorizontalOptions = LayoutOptions.Center; play.VerticalOptions = LayoutOptions.Center; play.ClassId = Constants.SERVICE_BASE_URL + model.goal_media[index].goal_media ; play.GestureRecognizers.Add(videoTap); BoxView box = new BoxView(); box.BackgroundColor = Color.Red; box.WidthRequest = 100; box.HeightRequest = 100; grid.Children.Add( img, 0, 0 ); Grid.SetColumnSpan(img, 3); Grid.SetRowSpan( img, 3 ); grid.Children.Add(play, 1, 1); //horizmgConatiner.Children.Add(grid); bottomAndLowerControllStack.Children.Add(grid); } else { //horizmgConatiner.Children.Add(img); bottomAndLowerControllStack.Children.Add(img); } } } // imgScrollView.Content = horizmgConatiner; // bottomAndLowerControllStack.Children.Add(imgScrollView); } #endregion //masterStack.AddChildToLayout(toolsLayout,1,65); //masterStack.AddChildToLayout(emptyLayout,1,75); bottomAndLowerControllStack.Children.Add(toolsLayout); bottomAndLowerControllStack.Children.Add(emptyLayout); if (model.titleVal.Length < 25) { masterStack.AddChildToLayout (bottomAndLowerControllStack, 0, 8); } else { masterStack.AddChildToLayout (bottomAndLowerControllStack, 0, 11); } StackLayout spaceOffsetlayout = new StackLayout(); spaceOffsetlayout.WidthRequest = App.screenWidth * 50 / 100; spaceOffsetlayout.HeightRequest = Device.OnPlatform(100, 100, 250); spaceOffsetlayout.BackgroundColor = Color.Transparent; //masterStack.AddChildToLayout(spaceOffsetlayout, 1, 85); bottomAndLowerControllStack.Children.Add(spaceOffsetlayout); masterScroll.HeightRequest = App.screenHeight - 20; masterScroll.WidthRequest = App.screenWidth; //App.screenWidth * 90 / 100; masterScroll.Content = masterStack; masterLayout.AddChildToLayout(mainTitleBar, 0, 0); masterLayout.AddChildToLayout(subTitleBar, 0, Device.OnPlatform(9, 10, 10)); masterLayout.AddChildToLayout(masterScroll,0, Device.OnPlatform(16,18,18)); #region CUSTOM LIST MENU //new CustomListViewItem { EmotionID = item.EmotionId.ToString(), Name = item.EmpotionName, SliderValue = item.EmotionValue } #endregion Content = masterLayout; } catch (Exception ex) { Debug.WriteLine ( ex.Message ); } }