public override void ViewDidLoad( ) { base.ViewDidLoad( ); OrientationState = -1; UIScrollView = new CustomScrollView( ); UIScrollView.Interceptor = this; UIScrollView.Frame = View.Frame; UIScrollView.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(0x1C1C1CFF); UIScrollView.Delegate = new NavBarRevealHelperDelegate(Task.NavToolbar); UIScrollView.Layer.AnchorPoint = new CGPoint(0, 0); UITapGestureRecognizer tapGesture = new UITapGestureRecognizer( ); tapGesture.NumberOfTapsRequired = 2; tapGesture.AddTarget(this, new ObjCRuntime.Selector("DoubleTapSelector:")); UIScrollView.AddGestureRecognizer(tapGesture); View.BackgroundColor = UIScrollView.BackgroundColor; View.AddSubview(UIScrollView); // add a busy indicator Indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White); UIScrollView.AddSubview(Indicator); // add a refresh button for debugging RefreshButton = UIButton.FromType(UIButtonType.System); RefreshButton.SetTitle("Refresh", UIControlState.Normal); RefreshButton.SizeToFit( ); // if they tap the refresh button, refresh the list RefreshButton.TouchUpInside += (object sender, EventArgs e) => { DeleteNote( ); PrepareCreateNotes(0, true); }; ResultView = new UIResultView(UIScrollView, View.Frame.ToRectF( ), OnResultViewDone); ResultView.Hide( ); // setup the tutorial overlay TutorialBacker = new UIView( ); TutorialBacker.Layer.AnchorPoint = CGPoint.Empty; TutorialBacker.Alpha = 0.00f; TutorialBacker.BackgroundColor = UIColor.Black; TutorialBacker.Hidden = true; View.AddSubview(TutorialBacker); AnimatingTutorial = false; TutorialOverlay = new UIImageView( ); TutorialOverlay.Layer.AnchorPoint = CGPoint.Empty; TutorialOverlay.Frame = View.Frame; TutorialOverlay.Alpha = 0.00f; View.AddSubview(TutorialOverlay); KeyboardAdjustManager = new Rock.Mobile.PlatformSpecific.iOS.UI.KeyboardAdjustManager(View); }
public override void ViewDidLoad() { base.ViewDidLoad(); // setup our table NotesTableView = new UITableView( ); NotesTableView.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor); NotesTableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; View.AddSubview(NotesTableView); ActivityIndicator = new UIActivityIndicatorView(new CGRect(View.Frame.Width / 2, View.Frame.Height / 2, 0, 0)); ActivityIndicator.StartAnimating( ); ActivityIndicator.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.White; ActivityIndicator.SizeToFit( ); ResultView = new UIResultView(View, View.Frame.ToRectF( ), delegate { TrySetupSeries( ); }); ResultView.Hide( ); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { // Currently in a layout without a container, so no reason to create our view. return(null); } View view = inflater.Inflate(Resource.Layout.Profile, container, false); view.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor)); RelativeLayout navBar = view.FindViewById <RelativeLayout>(Resource.Id.navbar_relative_layout); navBar.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor)); // setup the name section NickNameLayer = view.FindViewById <RelativeLayout>(Resource.Id.firstname_background); ControlStyling.StyleBGLayer(NickNameLayer); NickNameText = NickNameLayer.FindViewById <EditText>(Resource.Id.nickNameText); ControlStyling.StyleTextField(NickNameText, RegisterStrings.NickNamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); NickNameBGColor = ControlStylingConfig.BG_Layer_Color; NickNameText.InputType |= InputTypes.TextFlagCapWords; NickNameText.AfterTextChanged += (sender, e) => { Dirty = true; }; View borderView = NickNameLayer.FindViewById <View>(Resource.Id.middle_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); LastNameLayer = view.FindViewById <RelativeLayout>(Resource.Id.lastname_background); ControlStyling.StyleBGLayer(LastNameLayer); LastNameText = LastNameLayer.FindViewById <EditText>(Resource.Id.lastNameText); ControlStyling.StyleTextField(LastNameText, RegisterStrings.LastNamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); LastNameBGColor = ControlStylingConfig.BG_Layer_Color; LastNameText.InputType |= InputTypes.TextFlagCapWords; LastNameText.AfterTextChanged += (sender, e) => { Dirty = true; }; // setup the contact section EmailLayer = view.FindViewById <RelativeLayout>(Resource.Id.email_background); ControlStyling.StyleBGLayer(EmailLayer); EmailBGColor = ControlStylingConfig.BG_Layer_Color; EmailField = EmailLayer.FindViewById <EditText>(Resource.Id.emailAddressText); ControlStyling.StyleTextField(EmailField, ProfileStrings.EmailPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); EmailField.AfterTextChanged += (sender, e) => { Dirty = true; }; View backgroundView = view.FindViewById <RelativeLayout>(Resource.Id.cellphone_background); ControlStyling.StyleBGLayer(backgroundView); borderView = backgroundView.FindViewById <View>(Resource.Id.middle_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); CellPhoneField = backgroundView.FindViewById <EditText>(Resource.Id.cellPhoneText); ControlStyling.StyleTextField(CellPhoneField, ProfileStrings.CellPhonePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); CellPhoneField.AfterTextChanged += (sender, e) => { Dirty = true; }; CellPhoneField.AddTextChangedListener(new PhoneNumberFormattingTextWatcher()); // setup the address section backgroundView = view.FindViewById <RelativeLayout>(Resource.Id.address_background); ControlStyling.StyleBGLayer(backgroundView); StreetField = backgroundView.FindViewById <EditText>(Resource.Id.streetAddressText); ControlStyling.StyleTextField(StreetField, ProfileStrings.StreetPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); StreetField.AfterTextChanged += (sender, e) => { Dirty = true; }; StreetField.InputType |= InputTypes.TextFlagCapWords; borderView = backgroundView.FindViewById <View>(Resource.Id.street_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); CityField = backgroundView.FindViewById <EditText>(Resource.Id.cityAddressText); ControlStyling.StyleTextField(CityField, ProfileStrings.CityPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); CityField.AfterTextChanged += (sender, e) => { Dirty = true; }; CityField.InputType |= InputTypes.TextFlagCapWords; borderView = backgroundView.FindViewById <View>(Resource.Id.city_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); StateField = backgroundView.FindViewById <EditText>(Resource.Id.stateAddressText); ControlStyling.StyleTextField(StateField, ProfileStrings.StatePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); StateField.AfterTextChanged += (sender, e) => { Dirty = true; }; StateField.InputType |= InputTypes.TextFlagCapWords; borderView = backgroundView.FindViewById <View>(Resource.Id.state_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); ZipField = backgroundView.FindViewById <EditText>(Resource.Id.zipAddressText); ControlStyling.StyleTextField(ZipField, ProfileStrings.ZipPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ZipField.AfterTextChanged += (sender, e) => { Dirty = true; }; // personal backgroundView = view.FindViewById <RelativeLayout>(Resource.Id.personal_background); ControlStyling.StyleBGLayer(backgroundView); BirthdateField = backgroundView.FindViewById <EditText>(Resource.Id.birthdateText); ControlStyling.StyleTextField(BirthdateField, ProfileStrings.BirthdatePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); BirthdateField.FocusableInTouchMode = false; BirthdateField.Focusable = false; Button birthdateButton = backgroundView.FindViewById <Button>(Resource.Id.birthdateButton); birthdateButton.Click += (object sender, EventArgs e) => { // setup the initial date to use ( either now, or the date in the field ) DateTime initialDateTime = DateTime.Now; if (string.IsNullOrWhiteSpace(BirthdateField.Text) == false) { initialDateTime = DateTime.Parse(BirthdateField.Text); } // build our LayoutInflater dateInflate = LayoutInflater.From(Activity); DatePicker newPicker = (DatePicker)dateInflate.Inflate(Resource.Layout.DatePicker, null); newPicker.Init(initialDateTime.Year, initialDateTime.Month - 1, initialDateTime.Day, this); Dialog dialog = new Dialog(Activity); dialog.AddContentView(newPicker, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)); dialog.Show( ); }; borderView = backgroundView.FindViewById <View>(Resource.Id.middle_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); // Gender GenderField = view.FindViewById <EditText>(Resource.Id.genderText); ControlStyling.StyleTextField(GenderField, ProfileStrings.GenderPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); GenderField.FocusableInTouchMode = false; GenderField.Focusable = false; Button genderButton = backgroundView.FindViewById <Button>(Resource.Id.genderButton); genderButton.Click += (object sender, EventArgs e) => { AlertDialog.Builder builder = new AlertDialog.Builder(Activity); Java.Lang.ICharSequence [] strings = new Java.Lang.ICharSequence[] { new Java.Lang.String(RockLaunchData.Instance.Data.Genders[1]), new Java.Lang.String(RockLaunchData.Instance.Data.Genders[2]), }; builder.SetItems(strings, delegate(object s, DialogClickEventArgs clickArgs) { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { GenderField.Text = RockLaunchData.Instance.Data.Genders[clickArgs.Which + 1]; Dirty = true; }); }); builder.Show( ); }; borderView = backgroundView.FindViewById <View>(Resource.Id.campus_middle_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); // Campus CampusField = view.FindViewById <EditText>(Resource.Id.campusText); ControlStyling.StyleTextField(CampusField, ProfileStrings.CampusPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); CampusField.FocusableInTouchMode = false; CampusField.Focusable = false; Button campusButton = backgroundView.FindViewById <Button>(Resource.Id.campusButton); campusButton.Click += (object sender, EventArgs e) => { // build an alert dialog containing all the campus choices AlertDialog.Builder builder = new AlertDialog.Builder(Activity); builder.SetTitle(ProfileStrings.SelectCampus_SourceTitle); Java.Lang.ICharSequence [] campusStrings = new Java.Lang.ICharSequence[RockLaunchData.Instance.Data.Campuses.Count]; for (int i = 0; i < RockLaunchData.Instance.Data.Campuses.Count; i++) { campusStrings[i] = new Java.Lang.String(RockLaunchData.Instance.Data.Campuses[i].Name); } // launch the dialog, and on selection, update the viewing campus text. builder.SetItems(campusStrings, delegate(object s, DialogClickEventArgs clickArgs) { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { int campusIndex = clickArgs.Which; CampusField.Text = RockLaunchData.Instance.Data.Campuses[campusIndex].Name; Dirty = true; }); }); builder.Show( ); }; // Done buttons DoneButton = view.FindViewById <Button>(Resource.Id.doneButton); ControlStyling.StyleButton(DoneButton, ProfileStrings.DoneButtonTitle, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); LogoutButton = view.FindViewById <Button>(Resource.Id.logoutButton); ControlStyling.StyleButton(LogoutButton, ProfileStrings.LogoutButtonTitle, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); LogoutButton.Background = null; DoneButton.Click += (object sender, EventArgs e) => { if (Dirty == true) { if (ValidateInput( )) { // Since they made changes, confirm they want to save them. AlertDialog.Builder builder = new AlertDialog.Builder(Activity); builder.SetTitle(ProfileStrings.SubmitChangesTitle); Java.Lang.ICharSequence [] strings = new Java.Lang.ICharSequence[] { new Java.Lang.String(GeneralStrings.Yes), new Java.Lang.String(GeneralStrings.No), new Java.Lang.String(GeneralStrings.Cancel) }; builder.SetItems(strings, delegate(object s, DialogClickEventArgs clickArgs) { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { switch (clickArgs.Which) { case 0: SubmitChanges( ); SpringboardParent.ModalFragmentDone(null); break; case 1: SpringboardParent.ModalFragmentDone(null); break; case 2: break; } }); }); builder.Show( ); } } else { SpringboardParent.ModalFragmentDone(null); } }; LogoutButton.Click += (object sender, EventArgs e) => { // Since they made changes, confirm they want to save them. AlertDialog.Builder builder = new AlertDialog.Builder(Activity); builder.SetTitle(ProfileStrings.LogoutTitle); Java.Lang.ICharSequence [] strings = new Java.Lang.ICharSequence[] { new Java.Lang.String(GeneralStrings.Yes), new Java.Lang.String(GeneralStrings.No) }; builder.SetItems(strings, delegate(object s, DialogClickEventArgs clickArgs) { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { switch (clickArgs.Which) { case 0: RockMobileUser.Instance.LogoutAndUnbind( ); SpringboardParent.ModalFragmentDone(null); break; case 1: break; } }); }); builder.Show( ); }; // blocker and result views ScrollView = view.FindViewById <LockableScrollView>(Resource.Id.scroll_view); ScrollView.ScrollEnabled = false; // scroll to the top ScrollView.Post(new Action(delegate { ScrollView.ForceScrollTo(0, 0); })); RelativeLayout parentLayout = view.FindViewById <RelativeLayout>(Resource.Id.relative_layout); RectangleF bounds = new System.Drawing.RectangleF(0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels); BlockerView = new UIBlockerView(parentLayout, bounds); BlockerView.Hide( ); ResultView = new UIResultView(parentLayout, bounds, delegate { SpringboardParent.ModalFragmentDone(null); }); ResultView.Hide( ); return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); // get the root control from our .axml var layout = inflater.Inflate(Resource.Layout.Notes, container, false) as RelativeLayout; // get the refresh button from the layout RefreshButton = layout.FindViewById <Button>(Resource.Id.refreshButton); // create our overridden lockable scroll view ScrollView = new LockableScrollView(Rock.Mobile.PlatformSpecific.Android.Core.Context); ScrollView.ScrollBarStyle = ScrollbarStyles.InsideInset; ScrollView.OverScrollMode = OverScrollMode.Always; ScrollView.VerticalScrollbarPosition = ScrollbarPosition.Default; ScrollView.LayoutParameters = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent); ScrollView.OnTouchIntercept = OnInterceptTouchEvent; ScrollView.OnChangedScroll = OnScrollChanged; ((RelativeLayout.LayoutParams)ScrollView.LayoutParameters).AddRule(LayoutRules.CenterHorizontal); ((RelativeLayout.LayoutParams)ScrollView.LayoutParameters).AddRule(LayoutRules.Below, Resource.Id.refreshButton); // add it to our main layout. layout.AddView(ScrollView); Indicator = layout.FindViewById <ProgressBar>(Resource.Id.progressBar); Indicator.Visibility = ViewStates.Gone; Indicator.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(0)); Indicator.BringToFront(); // create the layout that will contain the notes ScrollViewLayout = new RelativeLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context); ScrollView.AddView(ScrollViewLayout); ScrollViewLayout.SetOnTouchListener(this); RefreshButton.Click += (object sender, EventArgs e) => { DeleteNote( ); PrepareCreateNotes( ); }; // if the refresh button isn't enabled, hide it if (MobileApp.Shared.Network.RockLaunchData.Instance.Data.DeveloperModeEnabled == false) { RefreshButton.Visibility = ViewStates.Gone; } // get our power management control PowerManager pm = PowerManager.FromContext(Rock.Mobile.PlatformSpecific.Android.Core.Context); WakeLock = pm.NewWakeLock(WakeLockFlags.Full, "Notes"); ResultView = new UIResultView(layout, new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels), OnResultViewDone); ResultView.Hide( ); // setup the tutorial overlay TutorialBacker = new View(Rock.Mobile.PlatformSpecific.Android.Core.Context); TutorialBacker.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); TutorialBacker.Alpha = 0; TutorialBacker.SetBackgroundColor(Android.Graphics.Color.Black); layout.AddView(TutorialBacker); AnimatingTutorial = false; TutorialOverlay = new ImageView(Rock.Mobile.PlatformSpecific.Android.Core.Context); TutorialOverlay.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); ((RelativeLayout.LayoutParams)TutorialOverlay.LayoutParameters).AddRule(LayoutRules.CenterInParent); TutorialOverlay.Alpha = 0; TutorialOverlay.SetBackgroundColor(Android.Graphics.Color.Transparent); layout.AddView(TutorialOverlay); NavBarRevealTracker = new NavBarReveal( ); return(layout); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView( inflater, container, savedInstanceState ); // get the root control from our .axml var layout = inflater.Inflate(Resource.Layout.Notes, container, false) as RelativeLayout; // get the refresh button from the layout RefreshButton = layout.FindViewById<Button>( Resource.Id.refreshButton ); // create our overridden lockable scroll view ScrollView = new LockableScrollView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); ScrollView.ScrollBarStyle = ScrollbarStyles.InsideInset; ScrollView.OverScrollMode = OverScrollMode.Always; ScrollView.VerticalScrollbarPosition = ScrollbarPosition.Default; ScrollView.LayoutParameters = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent); ScrollView.Notes = this; ((RelativeLayout.LayoutParams)ScrollView.LayoutParameters).AddRule(LayoutRules.CenterHorizontal); ((RelativeLayout.LayoutParams)ScrollView.LayoutParameters).AddRule(LayoutRules.Below, Resource.Id.refreshButton); // add it to our main layout. layout.AddView( ScrollView ); Indicator = layout.FindViewById<ProgressBar>( Resource.Id.progressBar ); Indicator.Visibility = ViewStates.Gone; Indicator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( 0 ) ); Indicator.BringToFront(); // create the layout that will contain the notes ScrollViewLayout = new RelativeLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context ); ScrollView.AddView( ScrollViewLayout ); ScrollViewLayout.SetOnTouchListener( this ); RefreshButton.Click += (object sender, EventArgs e ) => { DeleteNote( ); PrepareCreateNotes( ); }; // if the refresh button isn't enabled, hide it if ( App.Shared.Network.RockGeneralData.Instance.Data.RefreshButtonEnabled == false ) { RefreshButton.Visibility = ViewStates.Gone; } // get our power management control PowerManager pm = PowerManager.FromContext( Rock.Mobile.PlatformSpecific.Android.Core.Context ); WakeLock = pm.NewWakeLock(WakeLockFlags.Full, "Notes"); ResultView = new UIResultView( layout, new System.Drawing.RectangleF( 0, 0, NavbarFragment.GetContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels ), OnResultViewDone ); ResultView.Hide( ); // setup the tutorial overlay AnimatingTutorial = false; TutorialOverlay = new ImageView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); TutorialOverlay.LayoutParameters = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent ); TutorialOverlay.Alpha = 0; TutorialOverlay.SetBackgroundColor( Android.Graphics.Color.Black ); layout.AddView( TutorialOverlay ); NavBarRevealTracker = new NavBarReveal( ParentTask.NavbarFragment.NavToolbar ); return layout; }