Beispiel #1
0
        public override void ViewDidLayoutSubviews() //called after ViewWillTransitionToSize
        {
            dpWidth  = UIScreen.MainScreen.Bounds.Width;
            dpHeight = UIScreen.MainScreen.Bounds.Height;

            UIWindow window = UIApplication.SharedApplication.KeyWindow;

            safeAreaLeft  = window.SafeAreaInsets.Left;
            safeAreaRight = window.SafeAreaInsets.Right;

            ImagesUploaded.SetTileSize();
            ImagesUploaded.Reposition();
            ImagesUploaded.RefitImagesContainer();

            base.ViewDidLayoutSubviews();
        }
Beispiel #2
0
        private void ResetForm()
        {
            if (File.Exists(regSaveFile))
            {
                File.Delete(regSaveFile);
            }

            Sex.Select(0, 0, true);
            Email.Text           = "";
            Password.Text        = "";
            ConfirmPassword.Text = "";
            Username.Text        = "";
            Name.Text            = "";
            DescriptionText.Text = "";

            rc.uploadedImages = new List <string>();

            for (int i = ImagesUploaded.Subviews.Length - 1; i >= 0; i--)
            {
                ImagesUploaded.Subviews[i].RemoveFromSuperview();
            }
            ImagesUploaded.RefitImagesContainer();

            DescriptionText.Text = "";

            ImagesProgressText.Text = "";
            ImagesProgress.Progress = 0;

            UseLocationSwitch.On = false;

            LocationShareAll.On    = false;
            LocationShareLike.On   = false;
            LocationShareMatch.On  = false;
            LocationShareFriend.On = false;
            LocationShareNone.On   = true;

            DistanceShareAll.On    = false;
            DistanceShareLike.On   = false;
            DistanceShareMatch.On  = false;
            DistanceShareFriend.On = false;
            DistanceShareNone.On   = true;

            rc.EnableLocationSwitches(false);

            UIView.Animate(Constants.tweenTime, () => { RegisterScroll.ContentOffset = new CGPoint(0, 0); }, () => { });
        }
        private void ResetForm()
        {
            if (File.Exists(regSaveFile))
            {
                File.Delete(regSaveFile);
            }

            Sex.SetSelection(0);
            Email.Text           = "";
            Password.Text        = "";
            ConfirmPassword.Text = "";
            Username.Text        = "";
            Name.Text            = "";
            Description.Text     = "";
            uploadedImages       = new List <string>();
            ImagesUploaded.RemoveAllViews();             //shadow is removed too, but after selecting an image, it is added in OnResume.
            ImagesUploaded.RefitImagesContainer();

            Description.Text = "";

            ImagesProgressText.Text = "";
            ImagesProgress.Progress = 0;

            UseLocationSwitch.Checked = false;

            LocationShareAll.Checked    = false;
            LocationShareLike.Checked   = false;
            LocationShareMatch.Checked  = false;
            LocationShareFriend.Checked = false;
            LocationShareNone.Checked   = true;

            DistanceShareAll.Checked    = false;
            DistanceShareLike.Checked   = false;
            DistanceShareMatch.Checked  = false;
            DistanceShareFriend.Checked = false;
            DistanceShareNone.Checked   = true;

            rc.EnableLocationSwitches(false);

            Timer t = new Timer();             //when removing uploaded images, form does not scroll up

            t.Interval = 1;
            t.Elapsed += T_Elapsed0;
            t.Start();
        }
Beispiel #4
0
        public override void ViewDidLoad()
        {
            try
            {
                base.ViewDidLoad();

                Images.SetTitle(LangEnglish.Images, UIControlState.Normal);
                ImagesProgressText.Text = "";
                DescriptionLabel.Text   = LangEnglish.Description;
                SexLabel.Text           = LangEnglish.EditSex;
                WomenLabel.Text         = LangEnglish.Women;
                MenLabel.Text           = LangEnglish.Men;

                AccountData.SetTitle(LangEnglish.EditAccountData, UIControlState.Normal);
                ChangePassword.SetTitle(LangEnglish.EditChangePassword, UIControlState.Normal);
                LocationSettings.SetTitle(LangEnglish.EditLocationSettings, UIControlState.Normal);

                Save.SetTitle(LangEnglish.EditSave, UIControlState.Normal);
                Cancel.SetTitle(LangEnglish.Cancel, UIControlState.Normal);

                MoreOptions.SetTitle(LangEnglish.EditMoreOptions, UIControlState.Normal);

                EmailLabel.Text    = LangEnglish.Email;
                UsernameLabel.Text = LangEnglish.Username;
                CheckUsername.SetTitle(LangEnglish.CheckAvailability, UIControlState.Normal);
                NameLabel.Text = LangEnglish.Name;

                OldPasswordLabel.Text     = LangEnglish.EditOldPassword;
                NewPasswordLabel.Text     = LangEnglish.EditNewPassword;
                ConfirmPasswordLabel.Text = LangEnglish.EditConfirmPassword;

                UseLocationLabel.Text         = LangEnglish.UseLocation;
                LocationShareLabel.Text       = LangEnglish.LocationShare;
                LocationShareAllLabel.Text    = LangEnglish.LocationShareAll;
                LocationShareLikeLabel.Text   = LangEnglish.LocationShareLike;
                LocationShareMatchLabel.Text  = LangEnglish.LocationShareMatch;
                LocationShareFriendLabel.Text = LangEnglish.LocationShareFriend;
                LocationShareNoneLabel.Text   = LangEnglish.LocationShareNone;
                DistanceShareLabel.Text       = LangEnglish.DistanceShare;
                DistanceShareAllLabel.Text    = LangEnglish.DistanceShareAll;
                DistanceShareLikeLabel.Text   = LangEnglish.DistanceShareLike;
                DistanceShareMatchLabel.Text  = LangEnglish.DistanceShareMatch;
                DistanceShareFriendLabel.Text = LangEnglish.DistanceShareFriend;
                DistanceShareNoneLabel.Text   = LangEnglish.DistanceShareNone;
                ImageEditorLabel.Text         = LangEnglish.ImageEditorLabel;

                DeactivateAccount.SetTitle(LangEnglish.DeactivateAccount, UIControlState.Normal);
                DeleteAccount.SetTitle(LangEnglish.DeleteAccount, UIControlState.Normal);

                DescriptionText.Delegate = this;

                Images.Layer.MasksToBounds            = true;
                CheckUsername.Layer.MasksToBounds     = true;
                Save.Layer.MasksToBounds              = true;
                Cancel.Layer.MasksToBounds            = true;
                DeactivateAccount.Layer.MasksToBounds = true;
                DeleteAccount.Layer.MasksToBounds     = true;

                c.DrawBorder(DescriptionText);

                c.CollapseY(AccountDataSection);
                c.CollapseY(ChangePasswordSection);
                c.CollapseY(LocationSettingsSection);
                c.CollapseY(MoreOptionsSection);
                LoaderCircle.Hidden = true;

                ImageEditorFrameBorder.Layer.BorderColor = UIColor.FromName("PrimaryDark").CGColor;
                ImageEditorFrameBorder.Layer.BorderWidth = 1;

                rc = new RegisterCommonMethods(this, c, ImagesUploaded, Email, Username, Name, DescriptionText, CheckUsername, Images,
                                               ImagesProgressText, LoaderCircle, ImagesProgress, UseLocationSwitch, LocationShareAll, LocationShareLike, LocationShareMatch, LocationShareFriend, LocationShareNone,
                                               DistanceShareAll, DistanceShareLike, DistanceShareMatch, DistanceShareFriend, DistanceShareNone, ImageEditorControls, TopSeparator, RippleImageEditor, ImageEditorStatus, ImageEditorCancel, ImageEditorOK, ImageEditor, ImageEditorFrame, ImageEditorFrameBorder);

                c.AddViews(Snackbar, Snackbar.SnackText, Snackbar.SnackButton);
                ProfileEditScroll.SetContext(this);

                ImagesUploaded.SetContext(this);
                ImagesUploaded.numColumns  = 3; //it does not get passed in the layout file
                ImagesUploaded.tileSpacing = 2;

                AccountData.TouchUpInside      += AccountData_Click;
                ChangePassword.TouchUpInside   += ChangePassword_Click;
                LocationSettings.TouchUpInside += LocationSettings_Click;

                Save.TouchUpInside              += Save_Click;
                Cancel.TouchUpInside            += Cancel_Click;
                MoreOptions.TouchUpInside       += MoreOptions_Click;
                DeactivateAccount.TouchUpInside += DeactivateAccount_Click;
                DeleteAccount.TouchUpInside     += DeleteAccount_Click;

                ImageEditorCancel.TouchUpInside += rc.CancelImageEditing;
                ImageEditorOK.TouchUpInside     += rc.OKImageEditing;

                RoundBottom_Base                 = RoundBottom;
                Snackbar_Base                    = Snackbar;
                BottomConstraint_Base            = BottomConstraint;
                SnackTopConstraint_Base          = SnackTopConstraint;
                SnackBottomConstraint_Base       = SnackBottomConstraint;
                ScrollBottomConstraint_Base      = ScrollBottomConstraint;
                ScrollBottomOuterConstraint_Base = ScrollBottomOuterConstraint;
                ViewportConstraint_Base          = ViewportConstraint;
            }
            catch (Exception ex)
            {
                c.ReportErrorSilent(ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }
Beispiel #5
0
        public override void ViewWillAppear(bool animated)
        {
            try
            {
                base.ViewWillAppear(animated);

                SetSexChoice();
                Email.Text        = Session.Email;
                Username.Text     = Session.Username;
                Name.Text         = Session.Name;
                rc.uploadedImages = new List <string>(Session.Pictures);

                int i;
                for (i = ImagesUploaded.Subviews.Length - 1; i >= 0; i--)
                {
                    ImagesUploaded.Subviews[i].RemoveFromSuperview();
                }
                ImagesUploaded.RefitImagesContainer();

                i = 0;
                foreach (string image in rc.uploadedImages)
                {
                    ImagesUploaded.AddPicture(image, i);
                    i++;
                }

                if (rc.uploadedImages.Count > 1)
                {
                    ImagesProgressText.Text = LangEnglish.ImagesRearrange;
                }
                else
                {
                    ImagesProgressText.Text = "";
                }

                //works only if activity is resuming. It is recreated when pressing cancel and coming here again. Can it happen?
                if (rc.imagesUploading)
                {
                    rc.StartAnim();
                }

                DescriptionText.Text = Session.Description;

                UseLocationSwitch.On = (bool)Session.UseLocation;
                rc.EnableLocationSwitches((bool)Session.UseLocation);
                rc.SetLocationShareLevel((byte)Session.LocationShare);
                rc.SetDistanceShareLevel((byte)Session.DistanceShare);

                if ((bool)Session.ActiveAccount)
                {
                    DeactivateAccount.SetTitle(LangEnglish.DeactivateAccount, UIControlState.Normal);
                }
                else
                {
                    DeactivateAccount.SetTitle(LangEnglish.ActivateAccount, UIControlState.Normal);
                }
            }
            catch (Exception ex)
            {
                c.ReportErrorSilent(ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }
Beispiel #6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try {
                base.OnCreate(savedInstanceState);

                //c.CW("OnCreate savedInstanceState is null " + (savedInstanceState is null));

                //Test reset

                /*
                 * ListActivity.initialized = false;
                 * savedInstanceState = new Bundle();
                 * savedInstanceState.PutString("Session", c.SerializeSession());
                 *
                 * ListActivity.initialized = false;
                 * Type type = typeof(Session);
                 * FieldInfo[] fieldInfo = type.GetFields();
                 * foreach (FieldInfo field in fieldInfo)
                 * {
                 *      field.SetValue(null, null);
                 * }
                 */

                if (!ListActivity.initialized && !(savedInstanceState is null))
                {
                    c.Log("ProfileEditActivity not initialized, restoring");

                    ListActivity.initialized       = true;
                    IntentData.profileViewPageType = Constants.ProfileViewType_Self;
                    GetScreenMetrics(true);
                    c.LoadSettings(false);
                    c.DeSerializeSession(savedInstanceState.GetString("Session"));
                    imageEditorFrameBorderWidth = savedInstanceState.GetInt("imageEditorFrameBorderWidth");
                }
                else if (!ListActivity.initialized && savedInstanceState is null)
                {
                    c.Log(LocalClassName.Split(".")[1] + " Not initialized");

                    c.ReportErrorSilent("Initialization error");

                    Intent i = new Intent(this, typeof(ListActivity));
                    i.SetFlags(ActivityFlags.ReorderToFront);
                    StartActivity(i);
                }

                if (Settings.DisplaySize == 1)
                {
                    SetContentView(Resource.Layout.activity_profileedit_normal);
                }
                else
                {
                    SetContentView(Resource.Layout.activity_profileedit_small);
                }

                //ProfilePage start

                MainScroll         = FindViewById <TouchScrollView>(Resource.Id.MainScroll);
                MainLayout         = FindViewById <ConstraintLayout>(Resource.Id.MainLayout);
                Email              = FindViewById <EditText>(Resource.Id.Email);
                Username           = FindViewById <EditText>(Resource.Id.Username);
                CheckUsername      = FindViewById <Button>(Resource.Id.CheckUsername);
                Name               = FindViewById <EditText>(Resource.Id.Name);
                ImagesUploaded     = FindViewById <ImageFrameLayout>(Resource.Id.ImagesUploaded);
                Images             = FindViewById <Button>(Resource.Id.Images);
                ImagesProgressText = FindViewById <TextView>(Resource.Id.ImagesProgressText);
                LoaderCircle       = FindViewById <ImageView>(Resource.Id.LoaderCircle);
                ImagesProgress     = FindViewById <ProgressBar>(Resource.Id.ImagesProgress);
                Description        = FindViewById <EditText>(Resource.Id.Description);

                UseLocationSwitch   = FindViewById <Switch>(Resource.Id.UseLocationSwitch);
                LocationShareAll    = FindViewById <Switch>(Resource.Id.LocationShareAll);
                LocationShareLike   = FindViewById <Switch>(Resource.Id.LocationShareLike);
                LocationShareMatch  = FindViewById <Switch>(Resource.Id.LocationShareMatch);
                LocationShareFriend = FindViewById <Switch>(Resource.Id.LocationShareFriend);
                LocationShareNone   = FindViewById <Switch>(Resource.Id.LocationShareNone);

                DistanceShareAll    = FindViewById <Switch>(Resource.Id.DistanceShareAll);
                DistanceShareLike   = FindViewById <Switch>(Resource.Id.DistanceShareLike);
                DistanceShareMatch  = FindViewById <Switch>(Resource.Id.DistanceShareMatch);
                DistanceShareFriend = FindViewById <Switch>(Resource.Id.DistanceShareFriend);
                DistanceShareNone   = FindViewById <Switch>(Resource.Id.DistanceShareNone);

                ImageEditorFrame       = FindViewById <View>(Resource.Id.ImageEditorFrame);
                ImageEditorFrameBorder = FindViewById <View>(Resource.Id.ImageEditorFrameBorder);
                ImageEditor            = FindViewById <ScaleImageView>(Resource.Id.ImageEditor);
                ImageEditorControls    = FindViewById <LinearLayout>(Resource.Id.ImageEditorControls);
                ImageEditorCancel      = FindViewById <ImageButton>(Resource.Id.ImageEditorCancel);
                ImageEditorOK          = FindViewById <ImageButton>(Resource.Id.ImageEditorOK);
                TopSeparator           = FindViewById <View>(Resource.Id.TopSeparator);

                //ProfilePage end

                Women = FindViewById <Switch>(Resource.Id.Women);
                Men   = FindViewById <Switch>(Resource.Id.Men);

                EditAccountData             = FindViewById <TextView>(Resource.Id.EditAccountData);
                EditChangePassword          = FindViewById <TextView>(Resource.Id.EditChangePassword);
                EditLocationSettings        = FindViewById <TextView>(Resource.Id.EditLocationSettings);
                EditMoreOptions             = FindViewById <TextView>(Resource.Id.EditMoreOptions);
                EditAccountDataSection      = FindViewById <ConstraintLayout>(Resource.Id.EditAccountDataSection);
                EditChangePasswordSection   = FindViewById <ConstraintLayout>(Resource.Id.EditChangePasswordSection);
                EditLocationSettingsSection = FindViewById <ConstraintLayout>(Resource.Id.EditLocationSettingsSection);

                EditOldPassword     = FindViewById <EditText>(Resource.Id.EditOldPassword);
                EditNewPassword     = FindViewById <EditText>(Resource.Id.EditNewPassword);
                EditConfirmPassword = FindViewById <EditText>(Resource.Id.EditConfirmPassword);

                Save   = FindViewById <Button>(Resource.Id.Save);
                Cancel = FindViewById <Button>(Resource.Id.Cancel);

                DeactivateAccount = FindViewById <Button>(Resource.Id.DeactivateAccount);
                DeleteAccount     = FindViewById <Button>(Resource.Id.DeleteAccount);

                ImagesUploaded.numColumns  = 3;                //it does not get passed in the layout file
                ImagesUploaded.tileSpacing = 2;
                ImagesUploaded.SetTileSize();

                c.view = MainLayout;
                rc     = new RegisterCommonMethods(this);
                imm    = (InputMethodManager)GetSystemService(InputMethodService);

                Women.Click += Women_Click;
                Men.Click   += Men_Click;

                EditAccountData.Click      += EditAccountData_Click;
                EditChangePassword.Click   += EditChangePassword_Click;
                EditLocationSettings.Click += EditLocationSettings_Click;
                EditMoreOptions.Click      += EditMoreOptions_Click;

                Save.Click              += Save_Click;
                Cancel.Click            += Cancel_Click;
                DeactivateAccount.Click += DeactivateAccount_Click;
                DeleteAccount.Click     += DeleteAccount_Click;
            }
            catch (Exception ex)
            {
                c.ReportErrorSilent(ex.Message + System.Environment.NewLine + ex.StackTrace);
            }
        }
Beispiel #7
0
        protected override void OnResume()         //will be called after opening the file selector too
        {
            try {
                base.OnResume();

                if (!ListActivity.initialized)
                {
                    return;
                }

                if (!c.IsLoggedIn())                 //pressing back button after deleting account
                {
                    Intent intent = new Intent(this, typeof(ListActivity));
                    intent.SetFlags(ActivityFlags.ReorderToFront);
                    StartActivity(intent);
                    return;
                }

                EditAccountDataSection.Visibility      = ViewStates.Gone;
                EditChangePasswordSection.Visibility   = ViewStates.Gone;
                EditLocationSettingsSection.Visibility = ViewStates.Gone;
                DeactivateAccount.Visibility           = ViewStates.Gone;
                DeleteAccount.Visibility = ViewStates.Gone;
                ImagesProgress.Progress  = 0;
                MainScroll.ScrollY       = 0;

                MainLayout.RequestFocus();
                Images.Enabled = true;
                SetSexChoice();
                Email.Text     = Session.Email;
                Username.Text  = Session.Username;
                Name.Text      = Session.Name;
                uploadedImages = new List <string>(Session.Pictures);

                ImagesUploaded.RemoveAllViews();
                ImagesUploaded.drawOrder = new List <int>();

                ImageCache.imagesInProgress     = new List <string>();
                ImageCache.imageViewToLoadLater = new Dictionary <ImageView, string>();

                ImagesUploaded.AddShadow();
                int i = 0;
                foreach (string image in uploadedImages)
                {
                    ImagesUploaded.AddPicture(image, i);
                    i++;
                }
                ImagesUploaded.RefitImagesContainer();

                if (!imagesUploading)
                {
                    if (uploadedImages.Count > 1)
                    {
                        ImagesProgressText.Text = res.GetString(Resource.String.ImagesRearrange);
                    }
                    else
                    {
                        ImagesProgressText.Text = "";
                    }
                }

                Description.Text = Session.Description;

                UseLocationSwitch.Checked = (bool)Session.UseLocation;
                rc.EnableLocationSwitches((bool)Session.UseLocation);
                rc.SetLocationShareLevel((byte)Session.LocationShare);
                rc.SetDistanceShareLevel((byte)Session.DistanceShare);

                if ((bool)Session.ActiveAccount)
                {
                    DeactivateAccount.Text = res.GetString(Resource.String.DeactivateAccount);
                }
                else
                {
                    DeactivateAccount.Text = res.GetString(Resource.String.ActivateAccount);
                }

                if (selectedFile != null)
                {
                    OnResumeEnd();
                }

                c.Log("OnResume end");
            }
            catch (Exception ex)
            {
                c.ReportErrorSilent(ex.Message + System.Environment.NewLine + ex.StackTrace);
            }
        }
        protected async override void OnResume()         //will be called after opening the file selector and permission results
        {
            try
            {
                base.OnResume();

                if (!ListActivity.initialized)
                {
                    return;
                }

                GetScreenMetrics(false);
                ImagesUploaded.SetTileSize();
                MainLayout.RequestFocus();
                Images.Enabled = true;

                if (!(ListActivity.listProfiles is null))
                {
                    ListActivity.listProfiles.Clear();
                    ListActivity.totalResultCount = null;
                }
                Session.LastDataRefresh = null;
                Session.LocationTime    = null;

                registerCompleted = false;

                if (File.Exists(regSaveFile))
                {
                    string[] arr = File.ReadAllLines(regSaveFile);
                    Sex.SetSelection(int.Parse(arr[0]));
                    Email.Text           = arr[1];
                    Password.Text        = arr[2];
                    ConfirmPassword.Text = arr[3];
                    Username.Text        = arr[4];
                    Name.Text            = arr[5];
                    if (arr[6] != "")                     //it would give one element
                    {
                        string[] images = arr[6].Split("|");
                        uploadedImages = new List <string>(images);
                    }
                    else
                    {
                        uploadedImages = new List <string>();
                    }

                    if (uploadedImages.Count > 1)
                    {
                        ImagesProgressText.Text = res.GetString(Resource.String.ImagesRearrange);
                    }
                    else
                    {
                        ImagesProgressText.Text = "";
                    }

                    ImagesUploaded.RemoveAllViews();
                    ImagesUploaded.drawOrder = new List <int>();

                    ImageCache.imagesInProgress     = new List <string>();
                    ImageCache.imageViewToLoadLater = new Dictionary <ImageView, string>();

                    ImagesUploaded.AddShadow();
                    int i = 0;
                    foreach (string image in uploadedImages)
                    {
                        ImagesUploaded.AddPicture(image, i);
                        i++;
                    }
                    ImagesUploaded.RefitImagesContainer();

                    if (imagesUploading)
                    {
                        rc.StartAnim();
                    }

                    Description.Text = arr[7].Replace("[newline]", "\n");

                    UseLocationSwitch.Checked = bool.Parse(arr[8]);
                    rc.EnableLocationSwitches(UseLocationSwitch.Checked);
                    rc.SetLocationShareLevel(byte.Parse(arr[9]));
                    rc.SetDistanceShareLevel(byte.Parse(arr[10]));
                }
                else                 //in case we are stepping back from a successful registration
                {
                    ResetForm();
                }

                if (!eulaLoaded)
                {
                    string responseString = await c.MakeRequest("action=eula&ios=0");                     //deleting images from server

                    if (responseString.Substring(0, 2) == "OK")
                    {
                        eulaLoaded = true;
                        if (Build.VERSION.SdkInt >= BuildVersionCodes.N)
                        {
                            EulaText.TextFormatted = Html.FromHtml(responseString.Substring(3), FromHtmlOptions.ModeLegacy);
                        }
                        else
                        {
#pragma warning disable CS0618 // Type or member is obsolete
                            EulaText.TextFormatted = Html.FromHtml(responseString.Substring(3));
#pragma warning restore CS0618 // Type or member is obsolete
                        }
                    }
                    else
                    {
                        c.ReportError(responseString);
                    }
                }

                if (selectedFile != null)
                {
                    OnResumeEnd();
                }

                c.Log("OnResume end");
            }
            catch (Exception ex)
            {
                c.ReportErrorSilent(ex.Message + System.Environment.NewLine + ex.StackTrace);
            }
        }
Beispiel #9
0
        public override void ViewDidLoad()
        {
            try
            {
                base.ViewDidLoad();

                c.AddViews(Snackbar, Snackbar.SnackText, Snackbar.SnackButton);

                SexLabel.Text              = LangEnglish.Sex;
                EmailLabel.Text            = LangEnglish.Email;
                EmailExplanationLabel.Text = LangEnglish.EmailExplanation;
                PasswordLabel.Text         = LangEnglish.Password;
                ConfirmPasswordLabel.Text  = LangEnglish.ConfirmPassword;
                UsernameLabel.Text         = LangEnglish.Username;
                CheckUsername.SetTitle(LangEnglish.CheckAvailability, UIControlState.Normal);
                NameLabel.Text = LangEnglish.Name;
                Images.SetTitle(LangEnglish.Images, UIControlState.Normal);
                ImagesProgressText.Text       = "";
                DescriptionLabel.Text         = LangEnglish.Description;
                UseLocationLabel.Text         = LangEnglish.UseLocation;
                LocationExplanation.Text      = LangEnglish.LocationExplanation;
                LocationShareLabel.Text       = LangEnglish.LocationShare;
                LocationShareAllLabel.Text    = LangEnglish.LocationShareAll;
                LocationShareLikeLabel.Text   = LangEnglish.LocationShareLike;
                LocationShareMatchLabel.Text  = LangEnglish.LocationShareMatch;
                LocationShareFriendLabel.Text = LangEnglish.LocationShareFriend;
                LocationShareNoneLabel.Text   = LangEnglish.LocationShareNone;
                DistanceShareLabel.Text       = LangEnglish.DistanceShare;
                DistanceShareAllLabel.Text    = LangEnglish.DistanceShareAll;
                DistanceShareLikeLabel.Text   = LangEnglish.DistanceShareLike;
                DistanceShareMatchLabel.Text  = LangEnglish.DistanceShareMatch;
                DistanceShareFriendLabel.Text = LangEnglish.DistanceShareFriend;
                DistanceShareNoneLabel.Text   = LangEnglish.DistanceShareNone;
                Register.SetTitle(LangEnglish.Register, UIControlState.Normal);
                Reset.SetTitle(LangEnglish.Reset, UIControlState.Normal);
                RegisterCancel.SetTitle(LangEnglish.Cancel, UIControlState.Normal);
                ImageEditorLabel.Text = LangEnglish.ImageEditorLabel;

                DescriptionText.Delegate = this;

                CheckUsername.Layer.MasksToBounds  = true; //required for presevering corner radius for highlighted state
                Images.Layer.MasksToBounds         = true;
                Register.Layer.MasksToBounds       = true;
                Reset.Layer.MasksToBounds          = true;
                RegisterCancel.Layer.MasksToBounds = true;

                Sex.Model = new DropDownList(LangEnglish.SexEntries, "Sex", 120, this);
                c.DrawBorder(DescriptionText);
                c.DrawBorder(EulaText);

                EulaLabel.Text = LangEnglish.EulaLabel;
                EulaText.Text  = LangEnglish.EulaText;

                LoaderCircle.Hidden = true;

                ImageEditorFrameBorder.Layer.BorderColor = UIColor.FromName("PrimaryDark").CGColor;
                ImageEditorFrameBorder.Layer.BorderWidth = 1;

                rc = new RegisterCommonMethods(this, c, ImagesUploaded, Email, Username, Name, DescriptionText, CheckUsername, Images,
                                               ImagesProgressText, LoaderCircle, ImagesProgress, UseLocationSwitch, LocationShareAll, LocationShareLike, LocationShareMatch, LocationShareFriend, LocationShareNone,
                                               DistanceShareAll, DistanceShareLike, DistanceShareMatch, DistanceShareFriend, DistanceShareNone, ImageEditorControls, TopSeparator, RippleImageEditor, ImageEditorStatus, ImageEditorCancel, ImageEditorOK, ImageEditor, ImageEditorFrame, ImageEditorFrameBorder);

                RegisterScroll.SetContext(this);

                ImagesUploaded.SetContext(this);
                ImagesUploaded.numColumns  = 5; //it does not get passed in the layout file
                ImagesUploaded.tileSpacing = 2;

                if (!File.Exists(regSessionFile))
                {
                    regsessionid = "";
                }
                else
                {
                    regsessionid = File.ReadAllText(regSessionFile);
                }

                Register.TouchUpInside       += Register_Click;
                Reset.TouchUpInside          += Reset_Click;
                RegisterCancel.TouchUpInside += RegisterCancel_Click;

                ImageEditorCancel.TouchUpInside += rc.CancelImageEditing;
                ImageEditorOK.TouchUpInside     += rc.OKImageEditing;

                RoundBottom_Base                 = RoundBottom;
                Snackbar_Base                    = Snackbar;
                BottomConstraint_Base            = BottomConstraint;
                SnackTopConstraint_Base          = SnackTopConstraint;
                SnackBottomConstraint_Base       = SnackBottomConstraint;
                ScrollBottomConstraint_Base      = ScrollBottomConstraint;
                ScrollBottomOuterConstraint_Base = ScrollBottomOuterConstraint;
            }
            catch (Exception ex)
            {
                c.ReportErrorSilent(ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }
Beispiel #10
0
        public async override void ViewWillAppear(bool animated)
        {
            try
            {
                base.ViewWillAppear(animated);

                if (!(ListActivity.listProfiles is null))
                {
                    ListActivity.listProfiles.Clear();
                    ListActivity.totalResultCount = null;
                }

                Session.LastDataRefresh = null;
                Session.LocationTime    = null;

                registerCompleted = false;

                if (File.Exists(regSaveFile))
                {
                    string[] arr = File.ReadAllLines(regSaveFile);
                    Sex.Select(int.Parse(arr[0]), 0, false);
                    Email.Text           = arr[1];
                    Password.Text        = arr[2];
                    ConfirmPassword.Text = arr[3];
                    Username.Text        = arr[4];
                    Name.Text            = arr[5];
                    if (arr[6] != "") //it would give one element
                    {
                        string[] images = arr[6].Split("|");
                        rc.uploadedImages = new List <string>(images);
                    }
                    else
                    {
                        rc.uploadedImages = new List <string>();
                    }

                    int i;
                    for (i = ImagesUploaded.Subviews.Length - 1; i >= 0; i--)
                    {
                        ImagesUploaded.Subviews[i].RemoveFromSuperview();
                    }
                    ImagesUploaded.RefitImagesContainer();
                    //ImagesUploaded.drawOrder = new List<int>();

                    i = 0;
                    foreach (string image in rc.uploadedImages)
                    {
                        ImagesUploaded.AddPicture(image, i);
                        i++;
                    }

                    if (rc.uploadedImages.Count > 1)
                    {
                        ImagesProgressText.Text = LangEnglish.ImagesRearrange;
                    }
                    else
                    {
                        ImagesProgressText.Text = "";
                    }

                    //works only if activity is resuming. It is recreaed when pressing cancel and coming here again.
                    if (rc.imagesUploading)
                    {
                        rc.StartAnim();
                    }

                    DescriptionText.Text = arr[7].Replace("[newline]", "\n");

                    UseLocationSwitch.On = bool.Parse(arr[8]);
                    rc.EnableLocationSwitches(UseLocationSwitch.On);
                    rc.SetLocationShareLevel(byte.Parse(arr[9]));
                    rc.SetDistanceShareLevel(byte.Parse(arr[10]));
                }
                else //in case we are stepping back from a successful registration
                {
                    ResetForm();
                }

                string responseString = await c.MakeRequest("action=eula"); //deleting images from server

                if (responseString.Substring(0, 2) == "OK")
                {
                    NSError error      = null;
                    string  s          = "<span style=\"font-family: '-apple-system', 'HelveticaNeue'; font-size: 12px\">" + responseString.Substring(3) + "</span>";
                    var     htmlString = new NSAttributedString(s, new NSAttributedStringDocumentAttributes {
                        DocumentType = NSDocumentType.HTML
                    }, ref error);
                    EulaText.AttributedText = htmlString;
                    EulaText.TextColor      = UIColor.FromName("PrimaryDark");
                }
                else
                {
                    c.ReportError(responseString);
                }
            }
            catch (Exception ex)
            {
                c.ReportErrorSilent(ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }