public void SetContext(BaseActivity context) { this.context = context; if (context is RegisterActivity) { rc = ((RegisterActivity)context).rc; } else { rc = ((ProfileEditActivity)context).rc; } }
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); } }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); //Test reset /*ListActivity.initialized = false; * Type type = typeof(Settings); * FieldInfo[] fieldInfo = type.GetFields(); * foreach (FieldInfo field in fieldInfo) * { * field.SetValue(null, null); * }*/ if (!ListActivity.initialized) //Huawei Y6 after selecting image. OnCreate is called, with static variables from other activities being cleared out. //Honor 20 Pro does not call OnCreate, but will call ListActvity after onResume ends anyway. ProfileEditActivity will call ProfileViewActivity, which is gets the Not initialized error, and be therefore redirected to ListActivity. { c.Log("RegisterActivity not initialized, restoring"); ListActivity.initialized = true; GetScreenMetrics(true); c.LoadSettings(false); if (!(savedInstanceState is null)) { imageEditorFrameBorderWidth = savedInstanceState.GetInt("imageEditorFrameBorderWidth"); } } if (Settings.DisplaySize == 1) { SetContentView(Resource.Layout.activity_register_normal); spinnerItem = Resource.Layout.spinner_item_normal; spinnerItemDropdown = Resource.Layout.spinner_item_dropdown_normal; } else { SetContentView(Resource.Layout.activity_register_small); spinnerItem = Resource.Layout.spinner_item_small; spinnerItemDropdown = Resource.Layout.spinner_item_dropdown_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 Sex = FindViewById <Spinner>(Resource.Id.Sex); Password = FindViewById <EditText>(Resource.Id.Password); ConfirmPassword = FindViewById <EditText>(Resource.Id.ConfirmPassword); EulaText = FindViewById <EditText>(Resource.Id.EulaText); Register = FindViewById <Button>(Resource.Id.Register); Reset = FindViewById <Button>(Resource.Id.Reset); Cancel = FindViewById <Button>(Resource.Id.Cancel); ImagesUploaded.numColumns = 5; //it does not get passed in the layout file ImagesUploaded.tileSpacing = 2; ImagesProgress.Progress = 0; c.view = MainLayout; rc = new RegisterCommonMethods(this); imm = (InputMethodManager)GetSystemService(InputMethodService); var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.SexEntries, spinnerItem); adapter.SetDropDownViewResource(spinnerItemDropdown); Sex.Adapter = adapter; if (!File.Exists(regSessionFile)) { regsessionid = ""; } else { regsessionid = File.ReadAllText(regSessionFile); } eulaLoaded = false; EulaText.Touch += EulaText_Touch; Register.Click += Register_Click; Reset.Click += Reset_Click; Cancel.Click += Cancel_Click; } catch (Exception ex) { c.ReportErrorSilent(ex.Message + System.Environment.NewLine + ex.StackTrace); } }
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); } }
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); } }