Ejemplo n.º 1
0
        private void LoadUser()
        {
            AppStatus.UserLogged = UserApiService.GetUserLogged();

            if (AppStatus.UserLogged == null)
            {
                StartActivity(typeof(LoginActivity));
            }
            else
            {
                MyTrapDroidFunctions.OpenHome(this);
            }
        }
Ejemplo n.º 2
0
        public void CheckUserLogged()
        {
            try
            {
                StartLoading();

                if (AppStatus.UserLogged != null)
                {
                    MyTrapDroidFunctions.OpenHome(this);
                }

                StopLoading();
            }
            catch (Exception exception)
            {
                InsightsUtils.LogException(exception);
            }
        }
Ejemplo n.º 3
0
        private void UpdateInfoProfile()
        {
            try
            {
                img_home_profile.SetBackgroundResource(Resource.Drawable.profile_picture_background);

                Bitmap profileBitmap = null;

                if (AppStatus.UserLogged.ProfilePicture != null && AppStatus.UserLogged.ContainsProfilePictureBase64())
                {
                    profileBitmap = MyTrapDroidFunctions.GetImageFromBase64(AppStatus.UserLogged.ProfilePicture.Base64);
                }
                else
                {
                    profileBitmap = BitmapFactory.DecodeResource(Resources, Resource.Drawable.user_empty);
                }

                profileBitmap = MyTrapDroidFunctions.GetCroppedBitmap(profileBitmap);

                img_home_profile.SetImageBitmap(profileBitmap);

                lbl_home_name.SetText(AppStatus.UserLogged.Name, TextView.BufferType.Normal);
                lbl_home_points_value.SetText(AppStatus.UserLogged.Points.ToString(), TextView.BufferType.Normal);
                lbl_home_traps_value.SetText(AppStatus.UserLogged.GetAmountTraps().ToString(), TextView.BufferType.Normal);

                lbl_home_other_msg.Visibility = ViewStates.Visible;

                if (AppStatus.UserLogged.GetAmountTraps() == 0)
                {
                    lbl_home_other_msg.SetText(Resource.String.buy_a_trap_msg);
                }
                else
                {
                    lbl_home_other_msg.SetText(Resource.String.arm_a_trap_msg);
                }

                ShowHideButtons(AppStatus.UserLogged);
            }
            catch (Exception exception)
            {
                InsightsUtils.LogException(exception);
            }
        }
Ejemplo n.º 4
0
        private void UpdateInterface()
        {
            img_notification_other_user.SetBackgroundResource(MyTrap.Droid.Resource.Drawable.profile_picture_background);

            Bitmap profileBitmap = null;

            if (!string.IsNullOrEmpty(otherUserImage))
            {
                string base64 = Functions.GetBase64ImageFromUrl(otherUserImage);

                profileBitmap = MyTrapDroidFunctions.GetImageFromBase64(base64);
            }
            else
            {
                profileBitmap = BitmapFactory.DecodeResource(Resources, MyTrap.Droid.Resource.Drawable.user_empty);
            }

            profileBitmap = MyTrapDroidFunctions.GetCroppedBitmap(profileBitmap);

            img_notification_other_user.SetImageBitmap(profileBitmap);

            if (isOwner)
            {
                string msg = Resources.GetString(MyTrap.Droid.Resource.String.you_caught_other_user);

                msg = string.Format(msg, otherUserName, pointsEarned);

                lbl_notification_msg.Text = msg;
            }
            else
            {
                string msg = Resources.GetString(MyTrap.Droid.Resource.String.you_caught_by_user);

                msg = string.Format(msg, otherUserName);

                lbl_notification_msg.Text = msg;
            }
        }