public TrendsChartSettingsService(AnalyticsService analyticsService) => _analyticsService = analyticsService;
protected BaseOnboardingContentPage(AnalyticsService analyticsService, in Color backgroundColor, in string nextButtonText, in int carouselPositionIndex) : base(analyticsService)
public NotificationService(AnalyticsService analyticsService, DeepLinkingService deepLinkingService) => (_analyticsService, _deepLinkingService) = (analyticsService, deepLinkingService);
public ReferringSitesPage(DeepLinkingService deepLinkingService, ReferringSitesViewModel referringSitesViewModel, Repository repository, AnalyticsService analyticsService, ThemeService themeService, ReviewService reviewService) : base(referringSitesViewModel, analyticsService, PageTitles.ReferringSitesPage) { _deepLinkingService = deepLinkingService; _reviewService = reviewService; ViewModel.PullToRefreshFailed += HandlePullToRefreshFailed; reviewService.ReviewCompleted += HandleReviewCompleted; var collectionView = new CollectionView { AutomationId = ReferringSitesPageAutomationIds.CollectionView, BackgroundColor = Color.Transparent, ItemTemplate = new ReferringSitesDataTemplate(), SelectionMode = SelectionMode.Single, ItemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Vertical), //Set iOS Header to `new BoxView { HeightRequest = titleRowHeight + titleTopMargin }` following this bug fix: https://github.com/xamarin/Xamarin.Forms/issues/9879 Header = Device.RuntimePlatform is Device.Android ? new BoxView { HeightRequest = ReferringSitesDataTemplate.BottomPadding } : null, Footer = Device.RuntimePlatform is Device.Android ? new BoxView { HeightRequest = ReferringSitesDataTemplate.TopPadding } : null, EmptyView = new EmptyDataView("EmptyReferringSitesList", ReferringSitesPageAutomationIds.EmptyDataView) .Bind(IsVisibleProperty, nameof(ReferringSitesViewModel.IsEmptyDataViewEnabled)) .Bind(EmptyDataView.TextProperty, nameof(ReferringSitesViewModel.EmptyDataViewText)) }; collectionView.SelectionChanged += HandleCollectionViewSelectionChanged; collectionView.SetBinding(CollectionView.ItemsSourceProperty, nameof(ReferringSitesViewModel.MobileReferringSitesList)); _refreshView = new RefreshView { AutomationId = ReferringSitesPageAutomationIds.RefreshView, CommandParameter = (repository.OwnerLogin, repository.Name, repository.Url, _refreshViewCancelltionTokenSource.Token), Content = collectionView }; _refreshView.SetDynamicResource(RefreshView.RefreshColorProperty, nameof(BaseTheme.PullToRefreshColor)); _refreshView.SetBinding(RefreshView.CommandProperty, nameof(ReferringSitesViewModel.RefreshCommand)); _refreshView.SetBinding(RefreshView.IsRefreshingProperty, nameof(ReferringSitesViewModel.IsRefreshing)); var relativeLayout = new RelativeLayout(); //Add Title and Close Button to UIModalPresentationStyle.FormSheet if (Device.RuntimePlatform is Device.iOS) { const int titleTopMargin = 10; const int titleRowHeight = 50; var closeButton = new Button { Text = "Close", FontFamily = FontFamilyConstants.RobotoRegular, HeightRequest = titleRowHeight * 3 / 5, HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center, AutomationId = ReferringSitesPageAutomationIds.CloseButton, Padding = new Thickness(5, 0), }; closeButton.Clicked += HandleCloseButtonClicked; closeButton.SetDynamicResource(Button.TextColorProperty, nameof(BaseTheme.NavigationBarTextColor)); closeButton.SetDynamicResource(Button.BorderColorProperty, nameof(BaseTheme.BorderButtonBorderColor)); closeButton.SetDynamicResource(BackgroundColorProperty, nameof(BaseTheme.NavigationBarBackgroundColor)); var titleLabel = new Label { FontSize = 30, Text = PageTitles.ReferringSitesPage, FontFamily = FontFamilyConstants.RobotoMedium, }.Center().TextCenterVertical(); titleLabel.SetDynamicResource(Label.TextColorProperty, nameof(BaseTheme.TextColor)); closeButton.Margin = titleLabel.Margin = new Thickness(0, titleTopMargin, 0, 0); var titleShadow = new BoxView(); titleShadow.SetDynamicResource(BackgroundColorProperty, nameof(BaseTheme.PageBackgroundColor)); if (isLightTheme(themeService.Preference)) { titleShadow.On <iOS>().SetIsShadowEnabled(true) .SetShadowColor(Color.Gray) .SetShadowOffset(new Size(0, 1)) .SetShadowOpacity(0.5) .SetShadowRadius(4); } relativeLayout.Children.Add(_refreshView, Constraint.Constant(0), Constraint.Constant(titleRowHeight), //Set to `0` following this bug fix: https://github.com/xamarin/Xamarin.Forms/issues/9879 Constraint.RelativeToParent(parent => parent.Width), Constraint.RelativeToParent(parent => parent.Height - titleRowHeight)); //Set to `parent => parent.Height` following this bug fix: https://github.com/xamarin/Xamarin.Forms/issues/9879 relativeLayout.Children.Add(titleShadow, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent(parent => parent.Width), Constraint.Constant(titleRowHeight)); relativeLayout.Children.Add(titleLabel, Constraint.Constant(10), Constraint.Constant(0)); relativeLayout.Children.Add(closeButton, Constraint.RelativeToParent(parent => parent.Width - closeButton.GetWidth(parent) - 10), Constraint.Constant(0), Constraint.RelativeToParent(parent => closeButton.GetWidth(parent))); } else { relativeLayout.Children.Add(_refreshView, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent(parent => parent.Width), Constraint.RelativeToParent(parent => parent.Height)); } relativeLayout.Children.Add(_storeRatingRequestView, Constraint.Constant(0), Constraint.RelativeToParent(parent => parent.Height - _storeRatingRequestView.GetHeight(parent)), Constraint.RelativeToParent(parent => parent.Width)); Content = relativeLayout;
public GitHubApiV3Service(AnalyticsService analyticsService) : base(analyticsService) { }
async void HandleInitializationComplete(object sender, InitializationCompleteEventArgs e) { _animationCancellationToken?.Cancel(); #if DEBUG await ChangeLabelText(new FormattedString { Spans = { new Span { FontAttributes = FontAttributes.Bold, Text = "Preview Mode" }, new Span { Text = "\nCertain license warnings may appear" } } }); //Display Text await Task.Delay(500); await NavigateToRepositoryPage(); #else if (e.IsInitializationSuccessful) { await ChangeLabelText("Let's go!"); await NavigateToRepositoryPage(); } else { await ChangeLabelText(new FormattedString { Spans = { new Span { FontAttributes = FontAttributes.Bold, Text = "Initialization Failed" }, new Span { Text = "\nPlease Ensure Internet Connection Is Available" } } }); AnalyticsService.Track("Initialization Failed"); } #endif Task NavigateToRepositoryPage() { return(MainThread.InvokeOnMainThreadAsync(async() => { //Explode & Fade Everything var explodeImageTask = Task.WhenAll(Content.ScaleTo(100, 250, Easing.CubicOut), Content.FadeTo(0, 250, Easing.CubicIn)); BackgroundColor = (Color)Application.Current.Resources[nameof(BaseTheme.PageBackgroundColor)]; await explodeImageTask; using var scope = ContainerService.Container.BeginLifetimeScope(); Application.Current.MainPage = new BaseNavigationPage(scope.Resolve <RepositoryPage>()); })); } }
public ConnectToGitHubOnboardingPage(GitHubAuthenticationService gitHubAuthenticationService, AnalyticsService analyticsService) : base(analyticsService, Color.FromHex(BaseTheme.CoralColorHex), OnboardingConstants.TryDemoText, 3) { gitHubAuthenticationService.AuthorizeSessionCompleted += HandleAuthorizeSessionCompleted; }
public SyncFusionService(AzureFunctionsApiService azureFunctionsApiService, AnalyticsService analyticsService) => (_azureFunctionsApiService, _analyticsService) = (azureFunctionsApiService, analyticsService);
public ThemeService(AnalyticsService analyticsService) { _analyticsService = analyticsService; Application.Current.RequestedThemeChanged += HandleRequestedThemeChanged; }
public SplashScreenViewModel(SyncFusionService syncfusionService, AnalyticsService analyticsService) : base(analyticsService) { _syncFusionService = syncfusionService; InitializeAppCommand = new AsyncCommand(ExecuteInitializeAppCommand); }
protected BaseMobileApiService(AnalyticsService analyticsService) => AnalyticsService = analyticsService;
public ReferringSitesViewModel(GitHubApiV3Service gitHubApiV3Service, AnalyticsService analyticsService) : base(analyticsService) { _gitHubApiV3Service = gitHubApiV3Service; RefreshCommand = new AsyncCommand <(string Owner, string Repository)>(repo => ExecuteRefreshCommand(repo.Owner, repo.Repository)); }
public GitTrendsOnboardingPage(AnalyticsService analyticsService) : base(analyticsService, Color.FromHex(BaseTheme.LightTealColorHex), OnboardingConstants.SkipText, 0) { }
void HandleSkipButtonTapped(object sender, EventArgs e) { AnalyticsService.Track("Skip Button Tapped"); MainThread.BeginInvokeOnMainThread(() => CurrentPage = Children.Last()); }
public NotificationsOnboardingPage(AnalyticsService analyticsService) : base(analyticsService, Color.FromHex(BaseTheme.LightTealColorHex), OnboardingConstants.SkipText, 2) { }
public BaseViewModel(AnalyticsService analyticsService) => AnalyticsService = analyticsService;
public GitHubGraphQLApiService(AnalyticsService analyticsService) : base(analyticsService) { }
public ChartOnboardingPage(AnalyticsService analyticsService) : base(analyticsService, Color.FromHex(BaseTheme.CoralColorHex), OnboardingConstants.SkipText, 1) { }
Task CreatedByLabelTapped() { AnalyticsService.Track("CreatedBy Label Tapped"); return(_deepLinkingService.OpenApp("twitter://user?id=3418408341", "https://twitter.com/intent/user?user_id=3418408341")); }
public ReferringSitesPage(ReferringSitesViewModel referringSitesViewModel, Repository repository, AnalyticsService analyticsService) : base(PageTitles.ReferringSitesPage, referringSitesViewModel, analyticsService) { const int titleRowHeight = 50; const int titleTopMargin = 15; var collectionView = new CollectionView { AutomationId = ReferringSitesPageAutomationIds.CollectionView, ItemTemplate = new ReferringSitesDataTemplateSelector(), SelectionMode = SelectionMode.Single }; collectionView.SelectionChanged += HandleCollectionViewSelectionChanged; collectionView.SetBinding(CollectionView.ItemsSourceProperty, nameof(ReferringSitesViewModel.MobileReferringSitesList)); _refreshView = new RefreshView { AutomationId = ReferringSitesPageAutomationIds.RefreshView, CommandParameter = (repository.OwnerLogin, repository.Name), Content = collectionView }; _refreshView.SetDynamicResource(RefreshView.RefreshColorProperty, nameof(BaseTheme.RefreshControlColor)); _refreshView.SetBinding(RefreshView.CommandProperty, nameof(ReferringSitesViewModel.RefreshCommand)); _refreshView.SetBinding(RefreshView.IsRefreshingProperty, nameof(ReferringSitesViewModel.IsRefreshing)); //Add Title and Back Button to UIModalPresentationStyle.FormSheet if (Device.RuntimePlatform is Device.iOS) { var closeButton = new Button { AutomationId = ReferringSitesPageAutomationIds.CloseButton, Text = "Close", HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center, HeightRequest = titleRowHeight * 3 / 5, Padding = new Thickness(5, 0) }; closeButton.Clicked += HandleCloseButtonClicked; closeButton.SetDynamicResource(Button.TextColorProperty, nameof(BaseTheme.NavigationBarTextColor)); closeButton.SetDynamicResource(Button.BorderColorProperty, nameof(BaseTheme.TrendsChartSettingsBorderColor)); closeButton.SetDynamicResource(Button.BackgroundColorProperty, nameof(BaseTheme.NavigationBarBackgroundColor)); var titleRowBlurView = new BoxView { Opacity = 0.5 }; titleRowBlurView.SetDynamicResource(BackgroundColorProperty, nameof(BaseTheme.PageBackgroundColor)); collectionView.Header = new BoxView { HeightRequest = titleRowHeight + titleTopMargin }; var titleLabel = new Label { FontAttributes = FontAttributes.Bold, Text = PageTitles.ReferringSitesPage, FontSize = 30 }; titleLabel.SetDynamicResource(Label.TextColorProperty, nameof(BaseTheme.TextColor)); closeButton.Margin = titleLabel.Margin = new Thickness(0, titleTopMargin, 0, 0); var activityIndicator = new ActivityIndicator { AutomationId = ReferringSitesPageAutomationIds.ActivityIndicator, }; activityIndicator.SetDynamicResource(ActivityIndicator.ColorProperty, nameof(BaseTheme.RefreshControlColor)); activityIndicator.SetBinding(IsVisibleProperty, nameof(ReferringSitesViewModel.IsActivityIndicatorVisible)); activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, nameof(ReferringSitesViewModel.IsActivityIndicatorVisible)); var relativeLayout = new RelativeLayout(); relativeLayout.Children.Add(_refreshView, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent(parent => parent.Width), Constraint.RelativeToParent(parent => parent.Height)); relativeLayout.Children.Add(titleRowBlurView, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent(parent => parent.Width), Constraint.Constant(titleRowHeight)); relativeLayout.Children.Add(titleLabel, Constraint.Constant(10), Constraint.Constant(0)); relativeLayout.Children.Add(closeButton, Constraint.RelativeToParent(parent => parent.Width - GetWidth(parent, closeButton) - 10), Constraint.Constant(0), Constraint.RelativeToParent(parent => GetWidth(parent, closeButton))); relativeLayout.Children.Add(activityIndicator, Constraint.RelativeToParent(parent => parent.Width / 2 - GetWidth(parent, activityIndicator) / 2), Constraint.RelativeToParent(parent => parent.Height / 2 - GetHeight(parent, activityIndicator) / 2)); Content = relativeLayout; } else { Content = _refreshView; } }
public DeepLinkingService(AnalyticsService analyticsService) => _analyticsService = analyticsService;