コード例 #1
0
ファイル: PrivateBusiness.cs プロジェクト: JFPenguin/CookTime
        /// <summary>
        /// This method is called when the activity is starting.
        /// It contains the logic for the buttons shown in this activity.
        /// </summary>
        /// <param name="savedInstanceState"> a Bundle that contains the data the activity most recently
        /// supplied if the activity is being re-initialized after previously being shut down. </param>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.PrivBusiness);

            loggedId = Intent.GetStringExtra("LoggedId");
            bsnsJson = Intent.GetStringExtra("Bsns");
            bsns     = JsonConvert.DeserializeObject <Business>(bsnsJson);

            bsnsNameTV     = FindViewById <TextView>(Resource.Id.bsnsName);
            _bsnsHoursTV   = FindViewById <TextView>(Resource.Id.businessHoursPView);
            _bsnsContactTV = FindViewById <TextView>(Resource.Id.contactPView);
            scoreView      = FindViewById <TextView>(Resource.Id.scorePView);
            _locationText  = FindViewById <TextView>(Resource.Id.locationView);
            _btnFollowers  = FindViewById <Button>(Resource.Id.btnPBFollowers);
            _btnFollow     = FindViewById <Button>(Resource.Id.btnPBFollow);

            _logo = FindViewById <ImageView>(Resource.Id.businessLogo);

            _btnRate      = FindViewById <Button>(Resource.Id.btnPBRate);
            _btnDate      = FindViewById <Button>(Resource.Id.btnBDate);
            _btnScore     = FindViewById <Button>(Resource.Id.btnBScore);
            _btnDiff      = FindViewById <Button>(Resource.Id.btnBDiff);
            _menuListView = FindViewById <ListView>(Resource.Id.menuListView);

            bsnsNameTV.Text     = bsns.name;
            _bsnsHoursTV.Text   = "Business hours: " + bsns.businessHours;
            _bsnsContactTV.Text = "Contact: " + bsns.contact;
            _btnFollowers.Text  = "Followers: " + bsns.followers.Count;
            scoreView.Text      = "Score: " + bsns.rating;
            _locationText.Text  = "Location: " + bsns.location;

            // sets the business logo to the imageView
            if (!string.IsNullOrEmpty(bsns.photo))
            {
                logoUrl = $"http://{MainActivity.Ipv4}:8080/CookTime_war/cookAPI/resources/getPicture?id={bsns.photo}";
                Bitmap bitmap = GetImageBitmapFromUrl(logoUrl);
                _logo.SetImageBitmap(bitmap);
            }

            using var webClient = new WebClient { BaseAddress = "http://" + MainActivity.Ipv4 + ":8080/CookTime_war/cookAPI/" };

            var url = "resources/isFollowingBusiness?email=" + loggedId + "&id=" + bsns.id;

            webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
            var response = webClient.DownloadString(url);

            _btnFollow.Text = response == "0" ? "FOLLOW" : "UNFOLLOW";

            url = "resources/businessPublic?id=" + bsns.id + "&filter=date";
            webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
            var send = webClient.DownloadString(url);

            _menuList = JsonConvert.DeserializeObject <IList <string> >(send);

            _adapter = new RecipeAdapter(this, _menuList);
            _menuListView.Adapter    = _adapter;
            _menuListView.ItemClick += ListClick;

            _btnFollowers.Click += (sender, args) =>
            {
                var intent = new Intent(this, typeof(FollowActivity));
                intent.PutExtra("Title", "Followers");
                intent.PutExtra("LoggedId", loggedId);
                intent.PutStringArrayListExtra("FollowList", bsns.followers);
                StartActivity(intent);
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
            };

            _btnFollow.Click += (sender, args) =>
            {
                using var webClient2 = new WebClient { BaseAddress = "http://" + MainActivity.Ipv4 + ":8080/CookTime_war/cookAPI/" };
                var followUrl = "resources/followBusiness?email=" + loggedId + "&id=" + bsns.id;
                webClient2.Headers[HttpRequestHeader.ContentType] = "application/json";
                var answer = webClient2.DownloadString(followUrl);

                followUrl = "resources/getUser?id=" + loggedId;
                webClient2.Headers[HttpRequestHeader.ContentType] = "application/json";
                var userJson = webClient2.DownloadString(followUrl);

                _btnFollow.Text = answer == "0" ? "FOLLOW" : "UNFOLLOW";

                var toastText = answer == "0" ? "unfollowed" : "followed";

                var toast = Toast.MakeText(this, "User " + toastText + ". Redirecting to MyProfile...", ToastLength.Short);
                toast.Show();

                var intent = new Intent(this, typeof(MyProfileActivity));
                intent.PutExtra("User", userJson);
                intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask);
                StartActivity(intent);
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
            };

            _btnDate.Click += (sender, args) =>
            {
                sortStr = "date";
                SortMenu();
            };

            _btnScore.Click += (sender, args) =>
            {
                sortStr = "score";
                SortMenu();
            };

            _btnDiff.Click += (sender, args) =>
            {
                sortStr = "difficulty";
                SortMenu();
            };

            _btnRate.Click += (sender, args) =>
            {
                //Brings dialog fragment forward
                var transaction = SupportFragmentManager.BeginTransaction();
                var dialogRate  = new DialogRate();

                dialogRate.Show(transaction, "rate");
                dialogRate.LoggedId = loggedId;
                dialogRate.BsnsId   = bsns.id;
                dialogRate.Type     = 2;

                dialogRate.EventHandlerRate += RateResult;
            };

            _logo.Click += (sender, args) =>
            {
                if (!string.IsNullOrEmpty(bsns.photo))
                {
                    var transaction = SupportFragmentManager.BeginTransaction();
                    var dialogPShow = new DialogPShow();

                    dialogPShow.Url      = logoUrl;
                    dialogPShow.TypeText = "Business logo";
                    dialogPShow.Show(transaction, "privBsns");
                }
                else
                {
                    string toastText = "Business has set no logo you can view.";
                    Toast  _toast    = Toast.MakeText(this, toastText, ToastLength.Short);
                    _toast.Show();
                }
            };
        }
コード例 #2
0
        /// <summary>
        /// This method is called when the activity is starting.
        /// It contains the logic for the buttons shown in this activity.
        /// </summary>
        /// <param name="savedInstanceState"> a Bundle that contains the data the activity most recently
        /// supplied if the activity is being re-initialized after previously being shut down. </param>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.MyProfile);

            userJson    = Intent.GetStringExtra("User");
            _loggedUser = JsonConvert.DeserializeObject <User>(userJson);

            _nameView  = FindViewById <TextView>(Resource.Id.myNameView);
            _ageView   = FindViewById <TextView>(Resource.Id.myAgeView);
            _chefView  = FindViewById <TextView>(Resource.Id.chefText);
            _scoreText = FindViewById <TextView>(Resource.Id.scoreText);

            _pfp = FindViewById <ImageView>(Resource.Id.profilePic);

            _btnFollowers = FindViewById <Button>(Resource.Id.btnMyFollowers);
            _btnFollowing = FindViewById <Button>(Resource.Id.btnMyFollowing);
            _btnSettings  = FindViewById <Button>(Resource.Id.btnSettings);
            _btnNewsfeed  = FindViewById <Button>(Resource.Id.btnNewsfeed);
            _btnNotif     = FindViewById <Button>(Resource.Id.btnNotif);
            _btnDate      = FindViewById <Button>(Resource.Id.btnDate);
            _btnScore     = FindViewById <Button>(Resource.Id.btnScore);
            _btnDiff      = FindViewById <Button>(Resource.Id.btnDiff);
            _btnRecipe    = FindViewById <Button>(Resource.Id.btnRecipe);
            _btnChef      = FindViewById <Button>(Resource.Id.btnChef);
            _btnBusiness  = FindViewById <Button>(Resource.Id.btnCreateBsns);

            _myMenuListView = FindViewById <ListView>(Resource.Id.myMenuListView);

            _nameView.Text = "Name: " + _loggedUser.firstName + " " + _loggedUser.lastName;
            _ageView.Text  = "Age: " + _loggedUser.age;

            if (!string.IsNullOrEmpty(_loggedUser.photo))
            {
                pictureUrl = $"http://{MainActivity.Ipv4}:8080/CookTime_war/cookAPI/resources/getPicture?id={_loggedUser.photo}";
                Bitmap bitmap = GetImageBitmapFromUrl(pictureUrl);
                _pfp.SetImageBitmap(bitmap);
            }

            if (_loggedUser.chef)
            {
                _chefView.Text  = "Chef: yes";
                _scoreText.Text = "Score : " + _loggedUser.chefScore;
            }
            else
            {
                _chefView.Text  = "Chef: no";
                _scoreText.Text = "";
            }

            _btnFollowers.Text = "FOLLOWERS: " + _loggedUser.followerEmails.Count;
            _btnFollowing.Text = "FOLLOWING: " + _loggedUser.followingEmails.Count;

            using var webClient = new WebClient { BaseAddress = "http://" + MainActivity.Ipv4 + ":8080/CookTime_war/cookAPI/" };

            var url = "resources/myMenu?email=" + _loggedUser.email + "&filter=date";

            webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
            var send = webClient.DownloadString(url);

            _myMenuList = JsonConvert.DeserializeObject <IList <string> >(send);

            _adapter = new RecipeAdapter(this, _myMenuList);
            _myMenuListView.Adapter    = _adapter;
            _myMenuListView.ItemClick += ListClick;

            _btnNewsfeed.Click += (sender, args) =>
            {
                using var webClient2 = new WebClient { BaseAddress = "http://" + MainActivity.Ipv4 + ":8080/CookTime_war/cookAPI/" };

                var url2 = "resources/getUser?id=" + _loggedUser.email;
                webClient2.Headers[HttpRequestHeader.ContentType] = "application/json";
                var request = webClient2.DownloadString(url2);

                var intent = new Intent(this, typeof(NewsfeedActivity));
                intent.PutExtra("User", request);

                StartActivity(intent);
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
                Finish();
            };

            _btnSettings.Click += (sender, args) =>
            {
                //Brings dialog fragment forward
                var transaction    = SupportFragmentManager.BeginTransaction();
                var dialogSettings = new DialogSettings();
                dialogSettings.Show(transaction, "settings");

                dialogSettings.Email             = _loggedUser.email;
                dialogSettings.EventHandlerPass += PassResult;
            };

            _btnFollowers.Click += (sender, args) =>
            {
                var intent = new Intent(this, typeof(FollowActivity));
                intent.PutExtra("Title", "Followers");
                intent.PutExtra("LoggedId", _loggedUser.email);
                intent.PutStringArrayListExtra("FollowList", _loggedUser.followerEmails);

                StartActivity(intent);
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
            };

            _btnFollowing.Click += (sender, args) =>
            {
                var intent = new Intent(this, typeof(FollowActivity));
                intent.PutExtra("Title", "Following");
                intent.PutExtra("LoggedId", _loggedUser.email);
                intent.PutStringArrayListExtra("FollowList", _loggedUser.followingEmails);

                StartActivity(intent);
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
            };

            _btnNotif.Click += (sender, args) =>
            {
                var intent = new Intent(this, typeof(NotifActivity));
                intent.PutStringArrayListExtra("NotifList", _loggedUser.notifications);
                intent.PutExtra("LoggedId", _loggedUser.email);

                StartActivity(intent);
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
            };

            _btnDate.Click += (sender, args) =>
            {
                sortStr = "date";
                SortMenu();
            };

            _btnScore.Click += (sender, args) =>
            {
                sortStr = "score";
                SortMenu();
            };

            _btnDiff.Click += (sender, args) =>
            {
                sortStr = "difficulty";
                SortMenu();
            };

            _btnRecipe.Click += (sender, args) =>
            {
                var intent = new Intent(this, typeof(CreateRActivity));
                intent.PutExtra("LoggedId", _loggedUser.email);

                StartActivity(intent);
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
            };

            _btnChef.Click += (sender, args) =>
            {
                if (_loggedUser.chef)
                {
                    var toast = Toast.MakeText(this, "You're already a chef", ToastLength.Short);
                    toast.Show();
                }
                else
                {
                    //Brings dialog fragment forward
                    var transaction = SupportFragmentManager.BeginTransaction();
                    var dialogChef  = new DialogChef();
                    dialogChef.LoggedId = _loggedUser.email;
                    dialogChef.Show(transaction, "chef");

                    dialogChef.EventHandlerChef += ChefResult;
                }
            };

            _btnBusiness.Click += (sender, args) =>
            {
                if (_loggedUser.business == 0)
                {
                    var intent = new Intent(this, typeof(CreateBActivity));
                    intent.PutExtra("LoggedId", _loggedUser.email);

                    StartActivity(intent);
                    OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
                }
                else
                {
                    using var webClient3 = new WebClient { BaseAddress = "http://" + MainActivity.Ipv4 + ":8080/CookTime_war/cookAPI/" };
                    var url3 = "resources/getBusiness?id=" + _loggedUser.business;
                    webClient3.Headers[HttpRequestHeader.ContentType] = "application/json";
                    var bsnsJson = webClient3.DownloadString(url3);

                    var intent = new Intent(this, typeof(MyBusiness));
                    intent.PutExtra("Bsns", bsnsJson);
                    intent.PutExtra("LoggedId", _loggedUser.email);
                    StartActivity(intent);
                    OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
                }
            };
            _pfp.Click += (sender, args) =>
            {
                var transaction   = SupportFragmentManager.BeginTransaction();
                var dialogPicture = new DialogPicture();
                dialogPicture.Photo = _loggedUser.photo;
                dialogPicture.Show(transaction, "choice");
                dialogPicture.EventHandlerChoice += PictureAction;
            };
        }
コード例 #3
0
ファイル: MyBusiness.cs プロジェクト: JFPenguin/CookTime
        /// <summary>
        /// This method is called when the activity is starting.
        /// It contains the logic for the buttons shown in this activity.
        /// </summary>
        /// <param name="savedInstanceState"> a Bundle that contains the data the activity most recently
        /// supplied if the activity is being re-initialized after previously being shut down. </param>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Business);

            loggedId = Intent.GetStringExtra("LoggedId");
            bsnsJson = Intent.GetStringExtra("Bsns");
            bsns     = JsonConvert.DeserializeObject <Business>(bsnsJson);

            bsnsNameTV     = FindViewById <TextView>(Resource.Id.bsnsName);
            _bsnsHoursTV   = FindViewById <TextView>(Resource.Id.businessHoursView);
            _bsnsContactTV = FindViewById <TextView>(Resource.Id.contactView);
            scoreView      = FindViewById <TextView>(Resource.Id.scoreView);
            _location      = FindViewById <TextView>(Resource.Id.locationView);
            _logo          = FindViewById <ImageView>(Resource.Id.businessLogo);
            _btnMyProfile  = FindViewById <Button>(Resource.Id.btnMyProfile);
            _btnFollowers  = FindViewById <Button>(Resource.Id.btnBFollowers);
            _btnSettings   = FindViewById <Button>(Resource.Id.btnBSettings);
            _btnPrivMenu   = FindViewById <Button>(Resource.Id.btnPrivMenu);
            _btPost        = FindViewById <Button>(Resource.Id.btnBRecipe);
            _btnDate       = FindViewById <Button>(Resource.Id.btnBDate);
            _btnScore      = FindViewById <Button>(Resource.Id.btnBScore);
            _btnDiff       = FindViewById <Button>(Resource.Id.btnBDiff);
            _menuListView  = FindViewById <ListView>(Resource.Id.myMenuListView);

            bsnsNameTV.Text     = bsns.name;
            _bsnsHoursTV.Text   = "Business hours: " + bsns.businessHours;
            _bsnsContactTV.Text = "Contact: " + bsns.contact;
            _btnFollowers.Text  = "Followers: " + bsns.followers.Count;
            scoreView.Text      = "Score: " + bsns.rating;
            _location.Text      = "Location: " + bsns.location;

            using var webClient = new WebClient { BaseAddress = "http://" + MainActivity.Ipv4 + ":8080/CookTime_war/cookAPI/" };

            var url = "resources/businessPublic?id=" + bsns.id + "&filter=date";

            webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
            var send = webClient.DownloadString(url);

            _menuList = JsonConvert.DeserializeObject <IList <string> >(send);

            _adapter = new RecipeAdapter(this, _menuList);
            _menuListView.Adapter    = _adapter;
            _menuListView.ItemClick += ListClick;

            if (!string.IsNullOrEmpty(bsns.photo))
            {
                logoUrl = $"http://{MainActivity.Ipv4}:8080/CookTime_war/cookAPI/resources/getPicture?id={bsns.photo}";
                Bitmap bitmap = GetImageBitmapFromUrl(logoUrl);
                _logo.SetImageBitmap(bitmap);
            }

            _btnMyProfile.Click += (sender, args) =>
            {
                using var webClient2 = new WebClient
                      { BaseAddress = "http://" + MainActivity.Ipv4 + ":8080/CookTime_war/cookAPI/" };

                var url2 = "resources/getUser?id=" + loggedId;
                webClient2.Headers[HttpRequestHeader.ContentType] = "application/json";
                var request = webClient2.DownloadString(url2);

                var intent = new Intent(this, typeof(MyProfileActivity));
                intent.PutExtra("User", request);
                intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask);
                StartActivity(intent);
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft,
                                          Android.Resource.Animation.SlideOutRight);
                Finish();
            };

            _btnSettings.Click += (sender, args) =>
            {
                //Brings dialog fragment forward
                var transaction = SupportFragmentManager.BeginTransaction();
                var dialogAdd   = new DialogAdd();
                dialogAdd.Show(transaction, "settings");
                dialogAdd.BsnsId           = bsns.id;
                dialogAdd.EventHandlerAdd += AddResult;
            };

            _btnFollowers.Click += (sender, args) =>
            {
                var intent = new Intent(this, typeof(FollowActivity));
                intent.PutExtra("Title", "Followers");
                intent.PutExtra("LoggedId", loggedId);
                intent.PutStringArrayListExtra("FollowList", bsns.followers);
                StartActivity(intent);
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
            };

            _btnDate.Click += (sender, args) =>
            {
                sortStr = "date";
                SortMenu();
            };

            _btnScore.Click += (sender, args) =>
            {
                sortStr = "score";
                SortMenu();
            };

            _btnDiff.Click += (sender, args) =>
            {
                sortStr = "difficulty";
                SortMenu();
            };

            _btPost.Click += (sender, args) =>
            {
                var intent = new Intent(this, typeof(CreateRBActivity));
                intent.PutExtra("LoggedId", loggedId);
                intent.PutExtra("BsnsId", bsns.id);
                StartActivity(intent);
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
            };

            _btnPrivMenu.Click += (sender, args) =>
            {
                var intent = new Intent(this, typeof(PrivateMenuActivity));
                intent.PutExtra("LoggedId", loggedId);
                intent.PutExtra("BsnsId", bsns.id);
                StartActivity(intent);
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
            };

            _logo.Click += (sender, args) =>
            {
                var transaction   = SupportFragmentManager.BeginTransaction();
                var dialogPicture = new DialogPicture();
                dialogPicture.Photo = bsns.photo;
                dialogPicture.Show(transaction, "choice");
                dialogPicture.EventHandlerChoice += PictureAction;
            };
        }
コード例 #4
0
        /// <summary>
        /// This method is called when the activity is starting.
        /// It contains the logic for the buttons shown in this activity.
        /// </summary>
        /// <param name="savedInstanceState"> a Bundle that contains the data the activity most recently
        /// supplied if the activity is being re-initialized after previously being shut down. </param>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.PrivateProfile);

            _loggedId = Intent.GetStringExtra("LoggedId");

            var json = Intent.GetStringExtra("User");

            _user = JsonConvert.DeserializeObject <User>(json);

            _nameView  = FindViewById <TextView>(Resource.Id.nameView);
            _ageView   = FindViewById <TextView>(Resource.Id.ageView);
            _chefView  = FindViewById <TextView>(Resource.Id.chefPText);
            _scoreView = FindViewById <TextView>(Resource.Id.scorePText);

            _pfp          = FindViewById <ImageView>(Resource.Id.profilePic);
            _btnFollowers = FindViewById <Button>(Resource.Id.btnFollowers);
            _btnFollowing = FindViewById <Button>(Resource.Id.btnFollowing);
            _btnFollow    = FindViewById <Button>(Resource.Id.btnCFollow);
            _btnDate      = FindViewById <Button>(Resource.Id.btnPDate);
            _btnScore     = FindViewById <Button>(Resource.Id.btnPScore);
            _btnDiff      = FindViewById <Button>(Resource.Id.btnPDiff);
            _btnRateChef  = FindViewById <Button>(Resource.Id.btnRateChef);

            _menuListView = FindViewById <ListView>(Resource.Id.menuListView);

            _nameView.Text = "Name: " + _user.firstName + " " + _user.lastName;
            _ageView.Text  = "Age: " + _user.age;


            if (!string.IsNullOrEmpty(_user.photo))
            {
                pictureUrl = $"http://{MainActivity.Ipv4}:8080/CookTime_war/cookAPI/resources/getPicture?id={_user.photo}";
                Bitmap bitmap = GetImageBitmapFromUrl(pictureUrl);
                _pfp.SetImageBitmap(bitmap);
            }
            if (_user.chef)
            {
                _chefView.Text          = "Chef: yes";
                _scoreView.Text         = "Score: " + _user.chefScore;
                _btnRateChef.Visibility = ViewStates.Visible;
            }
            else
            {
                _chefView.Text          = "Chef: no";
                _scoreView.Text         = "";
                _btnRateChef.Visibility = ViewStates.Gone;
            }

            _btnFollowers.Text = "FOLLOWERS: " + _user.followerEmails.Count;
            _btnFollowing.Text = "FOLLOWING: " + _user.followingEmails.Count;

            using var webClient = new WebClient { BaseAddress = "http://" + MainActivity.Ipv4 + ":8080/CookTime_war/cookAPI/" };

            var url = "resources/isFollowing?ownEmail=" + _loggedId + "&followingEmail=" + _user.email;

            webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
            var response = webClient.DownloadString(url);

            _btnFollow.Text = response == "0" ? "FOLLOW" : "UNFOLLOW";

            url = "resources/myMenu?email=" + _user.email + "&filter=date";
            var send = webClient.DownloadString(url);

            _menuList                = JsonConvert.DeserializeObject <IList <string> >(send);
            _adapter                 = new RecipeAdapter(this, _menuList);
            _menuListView.Adapter    = _adapter;
            _menuListView.ItemClick += ListClick;

            _btnFollow.Click += (sender, args) =>
            {
                using var webClient2 = new WebClient { BaseAddress = "http://" + MainActivity.Ipv4 + ":8080/CookTime_war/cookAPI/" };
                var followUrl = "resources/followUser?ownEmail=" + _loggedId + "&followingEmail=" + _user.email;
                webClient2.Headers[HttpRequestHeader.ContentType] = "application/json";
                var answer = webClient2.DownloadString(followUrl);

                followUrl = "resources/getUser?id=" + _loggedId;
                webClient2.Headers[HttpRequestHeader.ContentType] = "application/json";
                var userJson = webClient2.DownloadString(followUrl);

                _btnFollow.Text = answer == "0" ? "FOLLOW" : "UNFOLLOW";

                var toastText = answer == "0" ? "unfollowed" : "followed";

                var toast = Toast.MakeText(this, "User " + toastText + ". Redirecting to MyProfile...", ToastLength.Short);
                toast.Show();

                var intent = new Intent(this, typeof(MyProfileActivity));
                intent.PutExtra("User", userJson);
                intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask);
                StartActivity(intent);
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
            };

            _btnFollowers.Click += (sender, args) =>
            {
                var intent = new Intent(this, typeof(FollowActivity));
                intent.PutExtra("Title", "Followers");
                intent.PutExtra("LoggedId", _loggedId);
                intent.PutStringArrayListExtra("FollowList", _user.followerEmails);

                StartActivity(intent);
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
            };

            _btnFollowing.Click += (sender, args) =>
            {
                var intent = new Intent(this, typeof(FollowActivity));
                intent.PutExtra("Title", "Following");
                intent.PutExtra("LoggedId", _loggedId);
                intent.PutStringArrayListExtra("FollowList", _user.followingEmails);

                StartActivity(intent);
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
            };

            _btnDate.Click += (sender, args) =>
            {
                sortStr = "date";
                SortMenu();
            };

            _btnScore.Click += (sender, args) =>
            {
                sortStr = "score";
                SortMenu();
            };

            _btnDiff.Click += (sender, args) =>
            {
                sortStr = "difficulty";
                SortMenu();
            };

            _btnRateChef.Click += (sender, args) =>
            {
                //Brings dialog fragment forward
                var transaction = SupportFragmentManager.BeginTransaction();
                var dialogRate  = new DialogRate();

                dialogRate.Show(transaction, "rate");
                dialogRate.LoggedId = _loggedId;
                dialogRate.ChefId   = _user.email;
                dialogRate.Type     = 1;

                dialogRate.EventHandlerRate += RateResult;
            };

            _pfp.Click += (sender, args) =>
            {
                if (!string.IsNullOrEmpty(_user.photo))
                {
                    var transaction = SupportFragmentManager.BeginTransaction();
                    var dialogPShow = new DialogPShow();

                    dialogPShow.Url      = pictureUrl;
                    dialogPShow.TypeText = "Profile Picture";
                    dialogPShow.Show(transaction, "privPfp");
                }
                else
                {
                    string toastText = "user has not set a profile picture you can view.";
                    Toast  _toast    = Toast.MakeText(this, toastText, ToastLength.Short);
                    _toast.Show();
                }
            };
        }