public AlphaCircleImageCell() : base() { View = new Grid().SetSingleChild ( new StackLayout { Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.Center, Padding = new Thickness(20, 2, 0, 2), Children = { Image, TextLabel, OptionImage, }, } ); Image.IsVisible = null != Image.Source; Image.VerticalOptions = LayoutOptions.Center; TextLabel.VerticalOptions = LayoutOptions.Center; TextLabel.HorizontalOptions = LayoutOptions.StartAndExpand; OptionImage.VerticalOptions = LayoutOptions.Center; OptionImage.HorizontalOptions = LayoutOptions.End; OptionImage.Source = AlphaFactory.GetApp().GetRightImageSource(); OptionImage.IsVisible = null != CommandValue; }
public AlphaSettingsPage() { Title = L["Settings"]; UserNameCell = AlphaFactory.MakeEntryCell(); UserNameCell.Label = L["User ID"]; LanguageCell = AlphaFactory.MakePickerCell(); }
public AlphaActivityIndicatorTextCell() : base() { View = new Grid().SetSingleChild ( new StackLayout { Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.Center, Padding = new Thickness(20, 0, 0, 0), Children = { Indicator, TextLabel, RefreshImage, }, } ); Indicator.VerticalOptions = LayoutOptions.Center; Indicator.HorizontalOptions = LayoutOptions.Center; TextLabel.VerticalOptions = LayoutOptions.Center; TextLabel.HorizontalOptions = LayoutOptions.StartAndExpand; RefreshImage.VerticalOptions = LayoutOptions.Center; RefreshImage.HorizontalOptions = LayoutOptions.End; RefreshImage.Source = AlphaFactory.GetApp().GetRefreshImageSource(); RefreshImage.IsVisible = null != CommandValue; Indicator.IsVisible = false; ApplyTheme(AlphaTheme.Get()); }
public AlphaCircleGraph() { // ※iOS 版では Font だけ残して他はこの場で Dispose() して構わないが Android 版では遅延処理が行われるようでそれだと disposed object へのアクセスが発生してしまう。 FontSource = AlphaFactory.GetApp().GetFontStream(); FontStream = new SKManagedStream(FontSource); Font = SKTypeface.FromStream(FontStream); }
public void AddUser(string NewUser) { DeleteUser(NewUser); Settings.SetFriend(Settings.GetFriendCount(), NewUser); IsChanged = true; UpdateList(); AlphaFactory.MakeSureDomain().UpdateLastPublicActivityCoreAsync(NewUser).LeavingThrown(); }
public AlphaInfoPage() { AlphaApp Root = AlphaFactory.MakeSureApp(); Languages.AlphaLanguage L = AlphaFactory.MakeSureLanguage(); Title = L["Information"]; Content = new StackLayout { Children = { new TableView { Root = new TableRoot { new TableSection(L["Version"]) { AlphaFactory.MakeCircleImageCell ( ImageSource: Root.GetApplicationImageSource(), Text: "1.00.000", Command: new Command ( o => Device.OpenUri ( AlphaFactory.MakeSureDomain().GetApplicationStoreUri() ) ), OptionImageSource: Root.GetExportImageSource() ), }, new TableSection(L["Auther"]) { AlphaFactory.MakeCircleImageCell ( ImageSource: Root.GetWraithImageSource(), Text: "@wraith13", Command: new Command(o => Device.OpenUri(new Uri("https://twitter.com/wraith13"))), OptionImageSource: Root.GetExportImageSource() ), }, new TableSection(L["Github Repository"]) { AlphaFactory.MakeCircleImageCell ( ImageSource: Root.GetGitHubImageSource(), Text: "wraith13/keep.grass", Command: new Command(o => Device.OpenUri(new Uri("https://github.com/wraith13/keep.grass"))), OptionImageSource: Root.GetExportImageSource() ), }, } }, }, }; }
public void OnEndQuery() { Device.BeginInvokeOnMainThread ( () => { AlphaFactory.GetApp()?.Main?.OnEndQuery(); } ); }
public AlphaApp() { AlphaFactory.SetApp(this); MainPage = Navigation = new NavigationPage ( Main = AlphaFactory.MakeMainPage() ); MainPage.Title = "keep.grass"; }
public void OnUpdateIcon(string User, byte[] Binary) { Device.BeginInvokeOnMainThread ( () => { AlphaFactory.GetApp()?.Main?.OnUpdateIcon(User, Binary); } ); }
public void ShowSettingsPage() { // Mobile Center .Analytics にデータ送信 Analytics.TrackEvent( name: "[Clicked] Setting Button", properties: new Dictionary <string, string> { { "Category", "ButtonClick" }, { "Screen", "MainPage" } } ); // ページ遷移処理 Navigation.PushAsync(AlphaFactory.MakeSettingsPage()); }
public AlphaApp() { MobileCenter.Start(typeof(Analytics), typeof(Crashes)); AlphaFactory.SetApp(this); MainPage = Navigation = new NavigationPage ( Main = AlphaFactory.MakeMainPage() ); MainPage.Title = "keep.grass"; }
public AlphaMainPage() { Title = "keep.grass"; UserLabel.Command = new Command(o => AlphaFactory.MakeSureApp().ShowSettingsPage()); LastActivityStampLabel.Command = new Command(async o => await Domain.ManualUpdateLastPublicActivityAsync()); //LeftTimeLabel.Command = new Command(async o => await Domain.ManualUpdateLastPublicActivityAsync()); #if WITH_PROGRESSBAR ProgressBar.Margin = new Thickness(0, 0, 0, 0); #endif //Build(); }
public void OnUpdateLastPublicActivity(string User, DateTime LastPublicActivity) { Device.BeginInvokeOnMainThread ( () => { if (User == Settings.UserName) { UpdateAlerts(LastPublicActivity); } AlphaFactory.GetApp()?.Main?.OnUpdateLastPublicActivity(User, LastPublicActivity); } ); }
public AlphaFriendsPage() { Title = L["Rivals"]; List = new ListView { ItemTemplate = new DataTemplateEx(AlphaFactory.GetGitHubUserCellType()) .SetBindingList("ImageSourceUrl", "Text"), }; List.ItemTapped += (sender, e) => { DeleteButton.IsEnabled = null != e.Item; }; AddButton = new Button { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.FillAndExpand, Text = L["Add"], Command = new Command ( o => AlphaFactory .MakeSureApp() .ShowSelectUserPage ( NewUser => AddUser(NewUser), Settings.GetFriendList() .Concat(Settings.UserName) .Where(i => !string.IsNullOrWhiteSpace(i)) .ToList() ) ), }; DeleteButton = new Button { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.FillAndExpand, Text = L["Delete"], Command = new Command ( o => { var User = List.SelectedItem.GetValue <string>("Text"); if (null != User) { DeleteUser(User); } } ), }; }
public AlphaDetailPage(string UserName) { Title = User = UserName; LastActivityStampLabel.Command = new Command(o => AlphaFactory.MakeSureApp().ShowFeedPage(User)); LeftTimeLabel.Command = new Command(async o => await Domain.ManualUpdateLastPublicActivityAsync()); //Build(); CircleGraph.IsVisibleSatelliteTexts = true; CircleGraph.IsDoughnut = false; CircleGraph.ActiveWait = TimeSpan.FromMilliseconds(100); CircleGraph.AnimationSpan = TimeSpan.FromMilliseconds(500); CircleGraph.Now = DateTime.Now; }
public AlphaFeedEntryCell() : base() { Image.IsVisible = null != Image.Source; Image.VerticalOptions = LayoutOptions.Center; Image.HeightRequest = 40; Image.WidthRequest = 40; TitleLabel.VerticalOptions = LayoutOptions.Start; TitleLabel.HorizontalOptions = LayoutOptions.Start; TitleLabel.LineBreakMode = LineBreakMode.TailTruncation; TitleLabel.FontSize = 16; UpdatedLabel.VerticalOptions = LayoutOptions.Start; UpdatedLabel.HorizontalOptions = LayoutOptions.StartAndExpand; UpdatedLabel.FontSize = 13; OptionImage.VerticalOptions = LayoutOptions.Center; OptionImage.HorizontalOptions = LayoutOptions.End; OptionImage.Source = AlphaFactory.GetApp().GetExportImageSource(); OptionImage.IsVisible = null != CommandValue; OptionImage.HeightRequest = 40; OptionImage.WidthRequest = 40; View = new Grid().SetSingleChild ( new StackLayout { Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.Center, Padding = new Thickness(10, 4, 0, 4), Children = { Image, new StackLayout { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.StartAndExpand, Children = { TitleLabel, DetailStack, UpdatedLabel, } }, OptionImage, }, } ); }
public AlphaLeftTimeSettingsPage() { Title = L["Alert by Left Time"]; LeftTimeAlertSwitchCellList = Settings.AlertTimeSpanTable.Select ( i => new KeyValuePair <TimeSpan, VoidSwitchCell> ( i, AlphaFactory.MakeSwitchCell ( Text: Settings.AlertTimeSpanToDisplayName(L, i), On: Settings.GetAlert(i) ) ) ) .ToArray(); }
public AlphaDailyAlertSettingsPage() { Title = L["Daily Alert"]; DailyAlertSwitchCellList = Settings.AlertDailyTimeTable.Select ( i => new KeyValuePair <TimeSpan, VoidSwitchCell> ( i, AlphaFactory.MakeSwitchCell ( Text: Settings.AlertDailyTimeToDisplayName(L, i), On: Settings.GetDailyAlert(i) ) ) ) .ToArray(); }
public void UpdateInfoAsync() { Debug.WriteLine("AlphaDetailPage::UpdateInfoAsync"); if (!String.IsNullOrWhiteSpace(User)) { if (UserLabel.Text != User) { AlphaFactory.MakeImageSourceFromUrl(GitHub.GetIconUrl(User)) .ContinueWith(t => Xamarin.Forms.Device.BeginInvokeOnMainThread(() => UserLabel.ImageSource = t.Result)); UserLabel.Text = User; UserLabel.TextColor = Theme.ForegroundColor; UserLabel.Command = new Command ( o => { Analytics.TrackEvent( name: "[Clicked] User", properties: new Dictionary <string, string> { { "Category", "ColumnClick" }, { "Screen", "DetailPage" } } ); Xamarin.Forms.Device.OpenUri ( new Uri(GitHub.GetProfileUrl(User)) ); } ); UserLabel.OptionImageSource = Root.GetExportImageSource(); if (default(DateTime) == Domain.GetLastPublicActivity(User)) { ClearActiveInfo(); Task.Run(() => Domain.ManualUpdateLastPublicActivityAsync()); } } } else { UserLabel.ImageSource = null; UserLabel.Text = L["unspecified"]; UserLabel.TextColor = Color.Gray; UserLabel.Command = null; UserLabel.OptionImageSource = null; ClearActiveInfo(); } }
public AlphaSettingsPage() { Title = L["Settings"]; LanguageCell = AlphaFactory.MakePickerCell(); UserLabel.Command = new Command ( o => AlphaFactory .MakeSureApp() .ShowSelectUserPage ( NewUser => { Settings.UserName = NewUser; Root.OnChangeSettings(); } ) ); }
public void ApplyUser(string User) { if (!String.IsNullOrWhiteSpace(User)) { if (UserLabel.Text != User || null == UserLabel.ImageSource) { AlphaFactory.MakeImageSourceFromUrl(GitHub.GetIconUrl(User)) .ContinueWith(t => Device.BeginInvokeOnMainThread(() => UserLabel.ImageSource = t.Result)); UserLabel.Text = User; //UserLabel.TextColor = Color.Default; } } else { UserLabel.ImageSource = null; UserLabel.Text = L["unspecified"]; } ApplyUserLabelTheme(User); }
public AlphaSettingsPage() { Title = L["Settings"]; UserLabel.Command = new Command ( o => AlphaFactory .MakeSureApp() .ShowSelectUserPage ( NewUser => { Settings.UserName = NewUser; Domain.UpdateLastPublicActivityCoreAsync(NewUser).LeavingThrown(); Root.OnChangeSettings(); ApplyUser(Settings.UserName); } ) ); }
public void InitCircleGraph(AlphaUserCircleGraph i, string User) { //i.BackgroundColor = Color.White; i.IsDoughnut = true; i.Now = DateTime.Now; i.User = User; i.GestureRecognizers.Clear(); i.LastPublicActivity = default(DateTime); if (!string.IsNullOrWhiteSpace(User)) { i.LastPublicActivity = Domain.GetLastPublicActivity(User); i.GestureRecognizers .Add ( new TapGestureRecognizer() { Command = new Command(o => AlphaFactory.MakeSureApp().ShowDetailPage(User)), } ); } }
public void UpdateInfoAsync() { Debug.WriteLine("AlphaDetailPage::UpdateInfoAsync"); if (!String.IsNullOrWhiteSpace(User)) { if (UserLabel.Text != User) { AlphaFactory.MakeImageSourceFromUrl(GitHub.GetIconUrl(User)) .ContinueWith(t => Device.BeginInvokeOnMainThread(() => UserLabel.ImageSource = t.Result)); UserLabel.Text = User; UserLabel.TextColor = Color.Default; UserLabel.Command = new Command ( o => Device.OpenUri ( new Uri(GitHub.GetProfileUrl(User)) ) ); UserLabel.OptionImageSource = Root.GetExportImageSource(); if (!Settings.GetIsValidUserName(User)) { ClearActiveInfo(); } if (default(DateTime) == Domain.GetLastPublicActivity(User)) { Task.Run(() => Domain.ManualUpdateLastPublicActivityAsync()); } } } else { UserLabel.ImageSource = null; UserLabel.Text = L["unspecified"]; UserLabel.TextColor = Color.Gray; UserLabel.Command = null; UserLabel.OptionImageSource = null; ClearActiveInfo(); } }
public override void Build() { base.Build(); Debug.WriteLine("AlphaFeedPage.Rebuild();"); if (null == Feed) { Content = new ActivityIndicator { VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, IsRunning = true, }; } else { Content = new ListView { HasUnevenRows = true, ItemTemplate = new DataTemplateEx(AlphaFactory.GetFeedEntryCellType()).SetBindingList("Entry"), ItemsSource = Feed?.EntryList?.Select(i => new { Entry = i, }), }; } }
public AlphaFeedPage(string User) { Title = L["Activity"]; Domain.GetFeed(User).ContinueWith ( t => Device.BeginInvokeOnMainThread ( () => { if (null == t.Exception) { Feed = t.Result; Build(); } else { Debug.WriteLine(t.Exception); AlphaFactory.MakeSureApp().Navigation.PopAsync(); } } ) ); }
public override void Build() { base.Build(); Debug.WriteLine("AlphaSettingsPage.Rebuild();"); if (Width <= Height) { Content = new StackLayout { Children = { new TableView { Root = new TableRoot { new TableSection(L["Github Account"]) { UserNameCell.AsCell(), }, new TableSection(L["Notifications"]) { AlphaFactory.MakeCircleImageCell ( Text: L["Alert by Left Time"], Command: new Command(o => Root.Navigation.PushAsync(new AlphaLeftTimeSettingsPage())) ), AlphaFactory.MakeCircleImageCell ( Text: L["Daily Alert"], Command: new Command(o => Root.Navigation.PushAsync(new AlphaDailyAlertSettingsPage())) ) }, new TableSection(L["Language"]) { LanguageCell }, new TableSection(L["Information"]) { AlphaFactory.MakeCircleImageCell ( ImageSource: Root.GetApplicationImageSource(), Text: L["keep.grass"], Command: new Command(o => Root.Navigation.PushAsync(AlphaFactory.MakeInfoPage())) ), }, }, }, }, }; } else { Content = new StackLayout { Children = { new StackLayout { Orientation = StackOrientation.Horizontal, Spacing = 0.5, BackgroundColor = Color.Gray, Children = { new TableView { Root = new TableRoot { new TableSection(L["Github Account"]) { UserNameCell.AsCell(), }, new TableSection(L["Language"]) { LanguageCell }, }, }, new TableView { Root = new TableRoot { new TableSection(L["Notifications"]) { AlphaFactory.MakeCircleImageCell ( Text: L["Alert by Left Time"], Command: new Command(o => Root.Navigation.PushAsync(new AlphaLeftTimeSettingsPage())) ), AlphaFactory.MakeCircleImageCell ( Text: L["Daily Alert"], Command: new Command(o => Root.Navigation.PushAsync(new AlphaDailyAlertSettingsPage())) ) }, new TableSection(L["Information"]) { AlphaFactory.MakeCircleImageCell ( ImageSource: Root.GetApplicationImageSource(), Text: L["keep.grass"], Command: new Command(o => Root.Navigation.PushAsync(AlphaFactory.MakeInfoPage())) ), }, }, }, }, }, }, }; } }
public void ShowSelectUserPage(Action <string> Reciever, IEnumerable <string> ExistUsers = null) { Navigation.PushAsync(AlphaFactory.MakeSelectUserPage(Reciever, ExistUsers)); }
public override void Build() { base.Build(); Debug.WriteLine("AlphaMainPage.Rebuild();"); AlphaApp Root = AlphaFactory.MakeSureApp(); if (null == Friends || Settings.GetFriendCount() != Friends.Count()) { Friends = Settings.GetFriendList().Select(i => AlphaFactory.MakeUserCircleGraph()).ToArray(); for (var i = 0; i < Friends?.Count(); ++i) { var Friend = Settings.GetFriend(i); var FriendCircle = Friends[i]; InitCircleGraph(FriendCircle, Friend); FriendCircle.HorizontalOptions = LayoutOptions.Center; FriendCircle.VerticalOptions = LayoutOptions.Center; FriendCircle.IsVisibleLeftTimeBar = false; FriendCircle.IsVisibleSatelliteTexts = false; FriendCircle.FontSize *= 0.5f; FriendCircle.CircleMargin = new Thickness(2.0); } } UpdateButton.Text = L["Update"]; var SettingsButton = new Button { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.FillAndExpand, Text = L["Settings"], Command = new Command(o => Root.ShowSettingsPage()), }; var ButtonFrame = new Grid() { VerticalOptions = LayoutOptions.End, HorizontalOptions = LayoutOptions.CenterAndExpand, } .HorizontalJustificate ( UpdateButton, SettingsButton ); if (Width <= Height) { CircleGraph.WidthRequest = Width; CircleGraph.HeightRequest = Math.Floor(Height * 0.10); foreach (var Friend in Friends) { Friend.WidthRequest = Math.Floor(Width / Math.Min(Math.Max(Friends.Count(), 2), 4)); Friend.HeightRequest = Friend.WidthRequest; } var StackContent = new StackLayout { Spacing = 0.0, }; StackContent.Children.Add(CircleGraph); BuildFriends(StackContent, StackOrientation.Horizontal); StackContent.Children.Add(ButtonFrame); Content = StackContent; } else { CircleGraph.WidthRequest = Math.Floor(Width * 0.10); CircleGraph.HeightRequest = Math.Floor(Height * 0.60); foreach (var Friend in Friends) { Friend.HeightRequest = Math.Floor(Height / Math.Min(Math.Max(Friends.Count(), 2), 4)); Friend.WidthRequest = Friend.HeightRequest; } var StackContent = new StackLayout { Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.FillAndExpand, Spacing = 0.0, }; StackContent.Children.Add(CircleGraph); BuildFriends(StackContent, StackOrientation.Vertical); Content = new StackLayout { Spacing = 0.0, //BackgroundColor = Color.White, Children = { StackContent, ButtonFrame, }, }; } // Indicator を表示中にレイアウトを変えてしまうと簡潔かつ正常に Indicator を再表示できないようなので、問答無用でテキストを表示してしまう。 UpdateButton.ShowText(); ApplyCircleGraph(i => i.IsInvalidCanvas = true); OnUpdateLastPublicActivity(Settings.UserName, Domain.GetLastPublicActivity(Settings.UserName)); var SettingsButtonAnimation = "DefaultButtn"; if (SettingsButton.AnimationIsRunning(SettingsButtonAnimation)) { SettingsButton.AbortAnimation(SettingsButtonAnimation); } AlphaTheme.Apply(this); if (string.IsNullOrWhiteSpace(CircleGraph.User)) { var Theme = AlphaTheme.Get(); SettingsButton.Animate ( SettingsButtonAnimation, d => { var Rate = Math.Abs(Math.Sin(d)); SettingsButton.TextColor = ColorEx.MergeWithRate(Theme.AccentColor, Theme.BackgroundColor, Rate); SettingsButton.BackgroundColor = ColorEx.MergeWithRate(Theme.BackgroundColor, Theme.AccentColor, Rate); }, 0.0, 1000.0, 16, (uint)2000000, Easing.Linear ); } }
public void OnChangeSettings() { AlphaFactory.MakeSureLanguage().Update(); Main.UpdateInfoAsync(); Domain.UpdateAlerts(Domain.GetLastPublicActivity(Settings.UserName)); }