コード例 #1
0
 void CreateView()
 {
     grid = new GridWithSelectedImageString();
     UIBuilder.BuildProfilePicGrid(grid, new string[] { "brownhairblackcollarmale.png", "brownhaircaucasian.png", "orangeeyes.png", "stormtrooper.png" });
     this.BackgroundColor = Color.FromHex(Values.BACKGROUNDLIGHTSILVER);
     Content = new StackLayout {
         BackgroundColor = Color.White,
         Padding         = new Thickness(20),
         Children        =
         {
             new Label      {
                 Text = "Choose an anonymous profile pic!",
                 HorizontalTextAlignment = TextAlignment.Center,
                 HorizontalOptions       = LayoutOptions.Center,
                 FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label))
             },
             new Label      {
                 Text = "To keep Secret Files and its community anonymous, we don't allow users to upload profile pictures. \nHave fun choosing a Secret Face!",
                 HorizontalTextAlignment = TextAlignment.Center,
                 HorizontalOptions       = LayoutOptions.Center,
                 FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label))
             },
             new ScrollView {
                 Content = grid
             }
         }
     };
 }
コード例 #2
0
ファイル: UIBuilder.cs プロジェクト: ctverceles/SF_Forms
        public static void BuildGroupPicGrid(GridWithSelectedImageString grid, string[] pics)
        {
            if (grid == null)
            {
                return;
            }

            if (pics.Length <= 0 || pics == null)
            {
                return;
            }

            for (int c = 0; c < pics.Length; c++)
            {
                grid.Children.AddHorizontal(UIBuilder.CreateTappableGroupImage(grid, pics [c]));
            }
        }
コード例 #3
0
ファイル: Client.cs プロジェクト: ctverceles/SF_Forms
        public async Task ListenForNewComments(PostItemStackLayout parentPost, StackLayout container, PostItem post)
        {
            App.ChatClient.OnCommentReceived += async(sender, message) => {
                if (message is CommentItem)
                {
                    Debug.WriteLine("Recieved Comment from SignalR: comment by {0}, comment body: {1}, in group {2}, in post {3}", message.UserCommentName, message.CommentText, message.GroupID, message.PostID);

                    if (string.Equals(message.PostID, post.ID))
                    {
                        Debug.WriteLine("Found post where comment was typed, adding it in");
                        //post comment
                        Device.BeginInvokeOnMainThread(() => {
                            UIBuilder.ReplaceTransparentCommentOrAdd(container, message, parentPost, post);
                        });
                    }
                }
            };
        }
コード例 #4
0
ファイル: AdminView.cs プロジェクト: ctverceles/SF_Forms
        async void CreateView()
        {
            this.Title = "Admins";

            Content = new ScrollView {
                Content = new StackLayout {
                    Orientation       = StackOrientation.Vertical,
                    HorizontalOptions = LayoutOptions.Fill,
                    VerticalOptions   = LayoutOptions.StartAndExpand,
                    BackgroundColor   = Color.White,
                    Children          =
                    {
                        UIBuilder.CreateSeparator(Color.Gray,                     0.5),
                        UIBuilder.CreateSetting("",           "Add admins",
                                                new TapGestureRecognizer {
                            Command = new Command(() =>
                                                  {}
                                                  )
                        }),
                        UIBuilder.CreateSeparator(Color.Gray,                     0.5),
                        UIBuilder.CreateSetting("",           "Send anonymous invites",
                                                new TapGestureRecognizer {
                            Command = new Command(() =>
                            {
                                //send to non app users
                                //send to existing users
                            }
                                                  )
                        }),
                        UIBuilder.CreateSeparator(Color.Gray,                     0.5),
                        UIBuilder.CreateSetting("",           "Delete",
                                                new TapGestureRecognizer {
                            Command = new Command(() =>
                            {
                                //check how many members first
                            }
                                                  )
                        }),
                        UIBuilder.CreateSeparator(Color.Gray,                     0.5),
                    }
                }
            };
        }
コード例 #5
0
        void CreateUI()
        {
            grid = new GridWithSelectedImageString();
            UIBuilder.BuildGroupPicGrid(grid, new string[] { "ic_cake_amber_500_24dp.png", "ic_cake_blue_700_24dp.png", "ic_cake_deep_orange_700_24dp.png", "ic_cake_green_600_24dp.png", "ic_cake_pink_400_24dp.png" });           //add images
            Debug.WriteLine("{0} elements in grid", grid.Children.Count);

            this.BackgroundColor = Color.White;

            img = new Image {
                Source            = "ic_camera_alt_grey_500_24dp.png",
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };

            tapHandler = new TapGestureRecognizer {
                NumberOfTapsRequired = 1
            };
            tapHandler.Tapped += async(sender, e) => {
                var file = await App.Camera.ChooseImage(this);

                if (!string.IsNullOrEmpty(file))
                {
                    img.Source = file;
                    //upload to cloud
                }
            };
            img.GestureRecognizers.Add(tapHandler);

            desc = new Editor {
                Text = "Enter something to tell your followers what this secret file is for...",
                HorizontalOptions = LayoutOptions.CenterAndExpand
                                    //TextColor = Color.Silver
            };
            desc.Focused += (sender, e) => {
                if (string.Equals(desc.Text, "Enter something to tell your followers what this secret file is for..."))
                {
                    desc.Text = "";
                }
            };
            desc.Unfocused += (sender, e) => {
                if (string.IsNullOrWhiteSpace(desc.Text))
                {
                    desc.Text = "Enter something to tell your followers what this secret file is for...";
                }
            };

            groupNameEntry = new Entry {
                Text              = "What do you want to call this secret file?",
                TextColor         = Color.Silver,
                Keyboard          = Keyboard.Create(KeyboardFlags.All),
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };
            groupNameEntry.Focused += (sender, e) => {
                if (string.Equals(groupNameEntry.Text, "What do you want to call this secret file?"))
                {
                    groupNameEntry.Text = "";
                }
                groupNameEntry.TextColor = Color.Default;
            };
            groupNameEntry.Unfocused += (sender, e) => {
                if (string.IsNullOrWhiteSpace(groupNameEntry.Text))
                {
                    groupNameEntry.Text      = "What do you want to call this secret file?";
                    groupNameEntry.TextColor = Color.Silver;
                }
            };
            groupNameEntry.Focus();

            Done = new ToolbarItem("Done", "ic_done_white_24dp.png", async() => {
                //save to table
                if (string.IsNullOrWhiteSpace(groupNameEntry.Text))
                {
                    UserDialogs.Instance.WarnToast("Oops! Can't make a secret file without a name!", null, 2000);
                }
                else if (string.IsNullOrWhiteSpace(grid.StringImageSelected))
                {
                    UserDialogs.Instance.WarnToast("Please don't forget to choose a secret file picture", null, 2000);
                }
                else
                {
                    if (!RegexHelper.MatchesOfficialSecretFilesThreadName(groupNameEntry.Text))
                    {
                        await App.DataDB.SaveGroupsItemsTaskAsync(new GroupItem {
                            groupName = groupNameEntry.Text,
                            groupDesc = desc.Text, adminuserID = Settings.UserId, groupImage = grid.StringImageSelected
                        });
                        Util.NewGroupNotif(this);
                        await Navigation.PopAsync();
                    }
                    else
                    {
                        await this.DisplayAlert("A Secret File with that name already exists", "To avoid confusion we don't allow new threads named 'Secret Files' or anything similar. Please think of a different name", "OK");
                    }
                }
            });
            Cancel = new ToolbarItem("Cancel", "ic_clear_white_24dp.png", () => {
                Navigation.PopAsync();
            });
            this.ToolbarItems.Add(Done);
            //this.ToolbarItems.Add (Cancel);

            Content = new StackLayout {
                Orientation = StackOrientation.Vertical,
                Padding     = new Thickness(20),
                Children    =
                {
                    //img, no option to upload custom pics yet. minimize server costs
                    new StackLayout   {
                        Orientation = StackOrientation.Vertical,
                        Children    =
                        {
                            new Label {
                                Text = "Choose a Secret Files Pic",
                                HorizontalTextAlignment = TextAlignment.Center,
                                HorizontalOptions       = LayoutOptions.Center,
                                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label))
                            },

                            /*new Label{
                             *      Text = "To keep Secret Files and its community anonymous, we don't allow users to upload profile pictures. So have fun choosing your new face!",
                             *      HorizontalTextAlignment = TextAlignment.Center,
                             *      HorizontalOptions = LayoutOptions.Center,
                             *      FontSize = Device.GetNamedSize (NamedSize.Small, typeof(Label))
                             * },*/
                            UIBuilder.CreateSeparatorWithTopBottomSpacing(Color.Gray, 0.5),
                            grid,
                            UIBuilder.CreateWhiteSpacing(10),
                        }
                    },
                    new StackLayout   {
                        Orientation       = StackOrientation.Horizontal,
                        HorizontalOptions = LayoutOptions.Center,
                        Children          = { groupNameEntry }
                    }, desc
                }
            };
        }
コード例 #6
0
ファイル: GroupFeed.cs プロジェクト: ctverceles/SF_Forms
        public StackLayout CreateScrollableFeedView(List <PostItemStackLayout> PostsContent, string placeholder, string scopeName, string groupid = null)
        {
            StackLayout stack = new StackLayout();

            if (PostsContent != null && PostsContent.Count > 0)
            {
                Debug.WriteLine("Posts found");
                feedPosts  = Util.CreateFeed(PostsContent);
                ScrollFeed = new ScrollView {
                    Content = feedPosts
                };

                refreshView = new PullToRefreshLayout {
                    VerticalOptions        = LayoutOptions.FillAndExpand,
                    HorizontalOptions      = LayoutOptions.FillAndExpand,
                    Content                = ScrollFeed,
                    RefreshColor           = Color.FromHex("#3498db"),
                    IsPullToRefreshEnabled = true
                };
                refreshView.SetBinding(PullToRefreshLayout.IsRefreshingProperty, new Xamarin.Forms.Binding()
                {
                    Path = "IsBusy", Mode = BindingMode.OneWay
                });
                refreshView.SetBinding(PullToRefreshLayout.RefreshCommandProperty, new Xamarin.Forms.Binding()
                {
                    Path = "RefreshCommand"
                });

                stack = new StackLayout {
                    Orientation = StackOrientation.Vertical,
                    Children    = { refreshView }
                };
            }
            else
            {
                Label NoPostsLabel = new Label {
                    Text              = "Be the first to start this secret file!",
                    TextColor         = Color.Silver,
                    FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                    VerticalOptions   = LayoutOptions.Fill,
                    HorizontalOptions = LayoutOptions.Fill
                };
                refreshView = new PullToRefreshLayout {
                    VerticalOptions        = LayoutOptions.Center,
                    HorizontalOptions      = LayoutOptions.Center,
                    Content                = NoPostsLabel,
                    RefreshColor           = Color.FromHex("#3498db"),
                    IsPullToRefreshEnabled = true
                };
                stack = new StackLayout {
                    Orientation       = StackOrientation.Vertical,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    Children          =
                    {
                        refreshView
                    }
                };
            }

            return(UIBuilder.AddFloatingActionButtonToStackLayout(stack, "ic_add_white_24dp.png", new Command(async() => {
                Navigation.PushAsync(new CreatePostPage(refreshHandler, "Add a Secret to " + this.Title, groupname, groupid));
            }), Color.FromHex(Values.PURPLE), Color.FromHex(Values.GOOGLEBLUE)));
        }
コード例 #7
0
        ScrollView createView()
        {
            privacytext = "How does Secret Files ensure that the information or posts you provide stay secret?\n\n" +
                          "Privacy is a common and major concern in social media nowadays. We at Secret Files are committed to providing a secure platform " +
                          "that allows anyone to speak their mind no matter where or who you are. " +
                          "Secret Files aims to keep you and your data as anonymous as possible by;\n\n\n" +
                          "\t1.\tNot storing your data in the first place. \n\nOther social networks and organizations make it their mission to protect their users data " +
                          "stored on their servers. We, however, avoid that hurdle completely by not even asking for your email address. All you need to use Secret Files " +
                          "is... Absolutely nothing! That's it. Simple right? No email, no phone number, nothing. We can't even read what you post unless we're in the same" +
                          " Secret Files thread (just like any user). \n\n\t2.\tEncrypting your data! \n\n" +
                          "While not even we know who you are, we also don't have access to anything you post! We employ state of the art encryption algorithms to ensure " +
                          "that no one at Secret Files can even read your content unless that person is already a part of the same Secret Files thread it was posted in" +
                          ".\n\n\n\n\nContingency plans: \n\n\n\tIn the event that someone's taken A LOT (seriously, A LOT)" +
                          " of time and effort to find out who you are (pretty determined if you ask us), " +
                          "we got you covered by;\n\n\t1.\tProviding the anonymous user with self destruct tools. \nIf at anytime you realize that your identity might be discovered " +
                          "from something you post, you have the ability to self destruct any content you may have posted anywhere on Secret Files." +
                          " You may also self destruct your entire profile at anytime.\n\n2.\tIn the event you feel that #2 isn't enough to protect your anonymity, " +
                          "then after self destructing your posts, you may simply make another account by going to the Settings and tapping 'Reincarnate Me'.\n" +
                          "\n\t3.\tIf for some reason, you have reason to believe someone is stalking you for something you posted or said, we have a decoy feature!! (More on this)\n\n\n" +
                          "FAQ:\n\nQ: Can't someone track my IP address or that meta deta stuff I read about online?\n\nA: Secret Files doesn't store your IP address or even any " +
                          "\"extra\" data. When you download the Secret Files mobile app, it records nothing from you or your phone except your posts (which are encrypted, " +
                          "but even if someone does happen to hack our servers, they still won't know who you are because not even we know!). ";

            whatis = "";

            return(new ScrollView {
                Content = new StackLayout {
                    Orientation = StackOrientation.Vertical,
                    HorizontalOptions = LayoutOptions.Fill,
                    VerticalOptions = LayoutOptions.StartAndExpand,
                    BackgroundColor = Color.White,
                    Children =
                    {
                        UIBuilder.CreateSetting("ic_vpn_key_grey_500_24dp.png",                    "Protecting Your Privacy",
                                                new TapGestureRecognizer {
                            Command = new Command(() =>
                                                  Navigation.PushAsync(new InfoPage(privacytext))
                                                  )
                        }),
                        UIBuilder.CreateSeparator(Color.Gray,                                                              0.5),
                        UIBuilder.CreateSetting("ic_person_pin_grey_500_24dp.png",                 "Change Profile Pic",
                                                new TapGestureRecognizer {
                            Command = new Command(() =>
                                                  Navigation.PushAsync(new ProfilePicChooser())
                                                  )
                        }),
                        UIBuilder.CreateSetting("ic_person_grey_500_24dp.png",                     "Change Username",
                                                new TapGestureRecognizer {
                            Command = new Command(() =>
                                                  Util.SaveNewUserName()
                                                  )
                        }),
                        UIBuilder.CreateSetting("",                                                "Change Colors",
                                                new TapGestureRecognizer {
                            Command = new Command(() =>
                                                  Util.SaveNewUserName()
                                                  )
                        }),
                        UIBuilder.CreateSetting("ic_sentiment_very_satisfied_orange_500_24dp.png", "Contact Team Secret Files!",
                                                new TapGestureRecognizer {
                            Command = new Command(() =>
                                                  {}
                                                  )
                        }),

                        /*UIBuilder.CreateSetting ("ic_phonelink_erase_grey_500_24dp.png", "Wipe me",
                         *      new TapGestureRecognizer{Command = new Command(() =>
                         *
                         *      )}),*/
                        //listView
                    }
                }
            });
        }
コード例 #8
0
ファイル: GroupsPage.cs プロジェクト: ctverceles/SF_Forms
        async void CreateView()
        {
            this.BackgroundColor = Color.White;
            Title = "Groups";
            SubscribeToRefreshListener();

            CreateGroup = new ToolbarItem("Add", "ic_group_add_white_24dp.png", async() => {
                await Navigation.PushAsync(new CreateNewGroupPage());
            });
            //this.ToolbarItems.Add (CreateGroup);

            //setup list of groups that allows for pull-to-refresh functionality
            listView = new ListView();
            if (App.GroupsContent != null)
            {
                listView.ItemsSource = App.GroupsContent;
            }
            listView.IsPullToRefreshEnabled = true;
            listView.RefreshCommand         = RefreshCommand;
            listView.SetBinding(ListView.IsRefreshingProperty, new Xamarin.Forms.Binding()
            {
                Path = "IsBusy", Mode = BindingMode.OneWay
            });
            //IsBusy = false;

            groupCell = new DataTemplate(() => {
                return(new ContextImageCell(this));
            });
            groupCell.SetBinding(ContextImageCell.TextProperty, new Xamarin.Forms.Binding()
            {
                Path = "groupName"
            });
            groupCell.SetBinding(ContextImageCell.DetailProperty, new Xamarin.Forms.Binding()
            {
                Path = "groupDesc"
            });
            groupCell.SetBinding(ContextImageCell.ImageSourceProperty, new Xamarin.Forms.Binding()
            {
                Path = "groupImage"
            });
            listView.ItemTemplate = groupCell;

            listView.ItemSelected += async(sender, e) => {
                if (e.SelectedItem == null)
                {
                    return;
                }

                GroupSelected = (GroupItem)e.SelectedItem;
                await Navigation.PushAsync(new GroupFeed(GroupSelected.groupName, GroupSelected.ID));

                ((ListView)sender).SelectedItem = null;
            };

            searchBar = Util.CreateSearchBar(this);
            var stack = new StackLayout {
                Orientation = StackOrientation.Vertical,
                Padding     = new Thickness(0, 0, 0, 15),
                Children    =
                {
                    Util.CreateSeparator(Color.Gray, 1),
                    searchBar,
                    listView
                }
            };

            Content = UIBuilder.AddFloatingActionButtonToStackLayout(stack, "ic_add_white_24dp.png", new Command(async() => {
                await Navigation.PushAsync(new CreateNewGroupPage());
            }), Color.FromHex(Values.GOOGLEBLUE), Color.FromHex(Values.PURPLE));

            ExecuteRefreshCommand();
        }