Example #1
0
 public static void SetupStepView(RelativeLayout rLayout, ScrollView helpSv, StackLayout questionContainer, Command questionTappedCmd)
 {
     var tgr = new TapGestureRecognizer()
     {
         Command = new Command((obj) =>
         {
             var oldBound = helpSv.Bounds;
             if (oldBound.Height == 40)
             {
                 // Need to show.
                 var newBound = new Rectangle(0, rLayout.Height - 200, rLayout.Width, 200);
                 helpSv.LayoutTo(newBound, 250, Easing.CubicInOut);
             }
             else
             {
                 // Need to hide.
                 var newBound = new Rectangle(0, rLayout.Height - 40, rLayout.Width, 40);
                 helpSv.LayoutTo(newBound, 250, Easing.CubicInOut);
             }
         })
     };
     helpSv.GestureRecognizers.Add(tgr);
     var qControls = questionContainer.Children.Where(x => x is QuestionLayout).Cast<QuestionLayout>();
     var currIdx = 0;
     foreach (var qControl in qControls)
     {
         var questionTgr = new TapGestureRecognizer()
         {
             Command = questionTappedCmd,
             CommandParameter = currIdx,
         };
         qControl.GestureRecognizers.Add(questionTgr);
         currIdx++;
     }
 }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            RelativeLayout view = (RelativeLayout)inflater.Inflate (Resource.Layout.raffledetail_gettemppass, container, false);
            rootview = view;

            TextView hinttextview=(TextView)view.FindViewById (Resource.Id.gettemppass_hinttext_textview);
            hinttextview.Text = RequestTPScreenData.ProvideClientInfoTextViewText;

            emailorphone = (EditText)view.FindViewById (Resource.Id.gettemppass_emailorphone_edittext);
            emailorphone.Hint = RequestTPScreenData.ClientInfoTextFieldPlaceholder;

            requesttemppass = (Button)view.FindViewById (Resource.Id.gettemppass_requesttemppass_button);
            requesttemppass.Text = RequestTPScreenData.RequestTPBtnTitle;
            //send web request
            requesttemppass.Click+=OnRequestTempPassClick;

            TextView signuptextview=view.FindViewById<TextView> (Resource.Id.gettemppass_register_textview);
            nn_activity.SetClickAbleText (signuptextview,RequestTPScreenData.DontHaveAccountLabelText+RequestTPScreenData.SignUpBtnTitle,RequestTPScreenData.SignUpBtnTitle,()=>{

                if(FormatManager.chechinput(emailorphone.Text,FormatManager.FormatOption.Email)){
                    (nn_activity as HomeScreen).ShowBuyerSignUp(emailorphone.Text);
                }
                else{
                    (nn_activity as HomeScreen).ShowBuyerSignUp("");
                }

            });

            return view;
        }
		public override View GetView (Context context, View convertView, ViewGroup parent)
		{
			var view = new RelativeLayout(context);
						
            var parms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                        ViewGroup.LayoutParams.WrapContent);

            view.SetMinimumHeight(150);
            parms.SetMargins(5, 3, 5, 0);
            parms.AddRule(LayoutRules.AlignParentLeft);

			_caption = new TextView (context);
			SetCaption (Caption);
            view.AddView(_caption, parms);
			
			if (!String.IsNullOrWhiteSpace (Indicator)) {
	            var tparms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
	                                                         ViewGroup.LayoutParams.WrapContent);
	            tparms.SetMargins(5, 3, 5, 5);
	            tparms.AddRule(LayoutRules.CenterVertical);
				tparms.AddRule(LayoutRules.AlignParentRight);
	
	            _text = new TextView (context) {
					Text = Indicator,
					TextSize = 22f
				};
	            view.AddView(_text, tparms);
			}
			return view;
		}
Example #4
0
        public OrderListHeaderView()
        {
            HeightRequest = Sizes.LargeRowHeight;

            #region add new order image
            AddNewOrderImage = new Image()
            {
                Aspect = Aspect.AspectFit
            };
            Device.OnPlatform(
                iOS: () => AddNewOrderImage.Source = new FileImageSource(){ File = "add_ios_blue" }, 
                Android: () => AddNewOrderImage.Source = new FileImageSource() { File = "add_android_blue" }
            );

            AddNewOrderImage.IsVisible = Device.OS != TargetPlatform.Android;
            #endregion

            #region add new order label
            AddNewOrderTextLabel = new Label
            {
                Text = TextResources.Customers_Orders_NewOrder.ToUpper(),
                TextColor = Palette._004,
                XAlign = TextAlignment.Start,
                YAlign = TextAlignment.Center,
            };
            #endregion

            #region compose view hierarchy
            BoxView bottomBorder = new BoxView() { BackgroundColor = Palette._013, HeightRequest = 1 };

            const double imagePaddingPercent = .35;

            RelativeLayout relativeLayout = new RelativeLayout();

            relativeLayout.Children.Add(
                view: AddNewOrderImage,
                yConstraint: Constraint.RelativeToParent(parent => parent.Height * imagePaddingPercent),
                xConstraint: Constraint.RelativeToParent(parent => parent.Height * imagePaddingPercent),
                widthConstraint: Constraint.RelativeToParent(parent => parent.Height - (parent.Height * imagePaddingPercent * 2)),
                heightConstraint: Constraint.RelativeToParent(parent => parent.Height - (parent.Height * imagePaddingPercent * 2)));

            relativeLayout.Children.Add(
                view: AddNewOrderTextLabel,
                xConstraint: Constraint.RelativeToView(AddNewOrderImage, (parent, view) => view.X + (view.Width / 2) + parent.Height * imagePaddingPercent),
                widthConstraint: Constraint.RelativeToView(AddNewOrderImage, (parent, view) => parent.Width - view.Width),
                heightConstraint: Constraint.RelativeToParent(parent => parent.Height)
            );

            relativeLayout.Children.Add(
                view: bottomBorder,
                yConstraint: Constraint.RelativeToParent(parent => parent.Height - 1),
                widthConstraint: Constraint.RelativeToParent(parent => parent.Width),
                heightConstraint: Constraint.Constant(1)
            );
            #endregion

           
            Content = relativeLayout;

        }
		public override View GetView(Context context, View convertView, ViewGroup parent)
        {
			var view = convertView as RelativeLayout;
			
			if (view == null)
				view = new RelativeLayout(context);
						
            var parms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                        ViewGroup.LayoutParams.WrapContent);
            parms.SetMargins(5, 3, 5, 0);
            parms.AddRule((int) LayoutRules.AlignParentLeft);

            _caption = new TextView(context) {Text = Caption, TextSize = 16f};
            view.AddView(_caption, parms);

            if (!string.IsNullOrEmpty(Value))
            {
                var tparms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                             ViewGroup.LayoutParams.WrapContent);
                tparms.SetMargins(5, 3, 5, 0);
                tparms.AddRule((int) LayoutRules.AlignParentRight);

                _text = new TextView(context) {Text = Value, TextSize = 16f};
                view.AddView(_text, tparms);
            }

            return view;
        }
        public override View GetView(Context context, View convertView, ViewGroup parent)
		{
            this.Click = delegate { SelectImage(); };

            Bitmap scaledBitmap = Bitmap.CreateScaledBitmap(_image, dimx, dimy, true);

            var view = convertView as RelativeLayout;
            if (view == null)
            {
                view = new RelativeLayout(context);
                _imageView = new ImageView(context);
            }
            else
            {
                _imageView = (ImageView)view.GetChildAt(0);
            }
            _imageView.SetImageBitmap(scaledBitmap);
            
            var parms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
            parms.SetMargins(5, 2, 5, 2);
            parms.AddRule( LayoutRules.AlignParentLeft);
			if(_imageView.Parent != null && _imageView.Parent is ViewGroup)
				((ViewGroup)_imageView.Parent).RemoveView(_imageView);
			view.AddView(_imageView, parms);

            return view;
		}
Example #7
0
		void Initialize ()
		{
			this.LayoutParameters = new RelativeLayout.LayoutParams(-1,Configuration.getHeight (412));// LinearLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));
			this.SetGravity(GravityFlags.Center);


			image = new RelativeLayout(context);
			txtDescription = new TextView (context);
			txtTitle = new TextView (context);
			background = new LinearLayout (context);

			image.SetGravity (GravityFlags.Center);
			background.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (530), Configuration.getHeight (356));
			background.Orientation = Orientation.Vertical;
			background.SetBackgroundColor (Color.ParseColor ("#50000000"));

			image.LayoutParameters = new RelativeLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));

			txtTitle.SetTextColor (Color.ParseColor("#ffffff"));
			txtDescription.SetTextColor(Color.ParseColor("#ffffff"));
			txtTitle.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (40));
			txtDescription.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (30));

			background.AddView (txtTitle);
			background.AddView (txtDescription);



			image.AddView (background);

			this.AddView (image);
			//this.AddView (background);


		}
        public ModuleButton(string title, string backgroundImageSource)
        {
            Label titleLabel = new Label {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions = LayoutOptions.Fill,
                BackgroundColor = Color.FromRgba(255, 255, 255, 100),
                TextColor = Color.White,
                Text = title,
                FontSize = 14,

            };

            Image backgroundImage = new Image {
                Source = backgroundImageSource,
                Aspect = Aspect.AspectFill,
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions = LayoutOptions.Fill
            };

            RelativeLayout layout = new RelativeLayout ();

            layout.Children.Add (titleLabel,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => parent.Width),
                Constraint.RelativeToParent ((parent) => parent.Height));
            layout.Children.Add (backgroundImage,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => parent.Width),
                Constraint.RelativeToParent ((parent) => parent.Height));

            Content = layout;
        }
		public RelativeLayoutDemoCode ()
		{
			Title = "Relative Layout Demo - C#";
			outerLayout = new AbsoluteLayout ();
			layout = new RelativeLayout ();
			centerLabel = new Label { FontSize = 20, Text = "RelativeLayout Demo"};
			buttonLayout = new AbsoluteLayout ();
			box = new BoxView { Color = Color.Blue, HeightRequest = 50, WidthRequest = 50 };
			layout.Children.Add (box, Constraint.RelativeToParent ((parent) => {
				return (parent.Width * .5) - 50;
			}), Constraint.RelativeToParent ((parent) => {
				return (parent.Height * .1) - 50;
			}));
			layout.Children.Add (centerLabel, Constraint.RelativeToParent ((parent) => {
				return (parent.Width * .5) - 50;
			}), Constraint.RelativeToParent ((parent) => {
				return (parent.Height * .5) - 50;
			}));
			moveButton = new Button { BackgroundColor = Color.White, FontSize = 20, TextColor = Color.Lime, Text = "Move", BorderRadius = 0};
			buttonLayout.Children.Add (moveButton, new Rectangle(0,1,1,1), AbsoluteLayoutFlags.All);
			outerLayout.Children.Add (layout, new Rectangle(0,0,1,1), AbsoluteLayoutFlags.All);
			outerLayout.Children.Add (buttonLayout, new Rectangle(0,1,1,50), AbsoluteLayoutFlags.PositionProportional|AbsoluteLayoutFlags.WidthProportional);

			moveButton.Clicked += MoveButton_Clicked;
			x = 0f;
			y = 0f;
			Content = outerLayout;
		}
Example #10
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            rootview = (RelativeLayout)inflater.Inflate (Resource.Layout.raffleroot, container, false);
            locationcontainerlayout=(LinearLayout)rootview.FindViewById (Resource.Id.raffleroot_locationcontainer_linerlayout);

            TextView locationtext=new TextView(nn_activity);
            locationtext.Text=nn_location;
            LinearLayout.LayoutParams param=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent,LinearLayout.LayoutParams.WrapContent);
            param.Gravity=global::Android.Views.GravityFlags.Center;
            param.LeftMargin=TapUtil.dptodx(5);
            locationtext.LayoutParameters=param;
            locationcontainerlayout.AddView (locationtext);

            //initialize listview
            listview=(ListView)rootview.FindViewById(Resource.Id.raffleroot_eventlist_listview);
            listview.Divider = null;
            adapter = new EventListAdapter (nn_activity,eventcards);
            listview.Adapter = adapter;
            //adapter.NotifyListChange ();

            listview.ItemClick+= (object sender, AdapterView.ItemClickEventArgs e) => {
                (nn_activity as HomeScreen).ShowRaffleDetailFragment(e.Position);

            };

            return rootview;
        }
        public ContentDemo()
        {
            Button button = new Button
            {
                Text = "Edit Profile",
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.CenterAndExpand
            };
            button.Clicked += OnButtonClicked;

            Image myImage = new Image
            {
                Aspect = Aspect.Fill,
                Source = ImageSource.FromUri( new Uri(@"https://4e72eb44013d543eb0c67f8fbddf2ed30743ec8d.googledrive.com/host/0B70CO9lnNPfceHNFLXh2Wm8yMHc/List-Most-Expensive-Cars-photo-OdYL.jpg"))
            };
            this.Title = "Content Page";

            RelativeLayout relativeLayout = new RelativeLayout ();

            relativeLayout.Children.Add (myImage,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => { return parent.Width; }),
                Constraint.RelativeToParent ((parent) => { return parent.Height; }));

            relativeLayout.Children.Add (button,
                Constraint.RelativeToParent ((parent) => {return parent.Width/2;} ),
                Constraint.RelativeToParent ((parent) => {return parent.Height/2;} ),
                Constraint.RelativeToParent ((parent) => { return 75.0; }),
                Constraint.RelativeToParent ((parent) => { return 75.0; }));

            Content = relativeLayout;
        }
Example #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NControlDemo.FormsApp.Controls.ProgressControl"/> class.
        /// </summary>
        public ProgressControl()
        {
            BackgroundColor = Xamarin.Forms.Color.Gray;

            var cog1 = new FontAwesomeLabel{ 
                Text = FontAwesomeLabel.FACog,
                FontSize = 39,
                TextColor = Xamarin.Forms.Color.FromHex("#CECECE"),
                XAlign = Xamarin.Forms.TextAlignment.Center,
                YAlign = Xamarin.Forms.TextAlignment.Center,
            };

            var cog2 = new FontAwesomeLabel{ 
                Text = FontAwesomeLabel.FACog,
                FontSize = 18,
                TextColor = Xamarin.Forms.Color.FromHex("#CECECE"),
                XAlign = Xamarin.Forms.TextAlignment.Center,
                YAlign = Xamarin.Forms.TextAlignment.Center,
            };
                
            _animation = new Animation((val) => {
                cog1.Rotation = val;
                cog2.Rotation = -val;
            }, 0, 360, Easing.Linear);

            var layout = new RelativeLayout();
            layout.Children.Add(cog1, () => new Xamarin.Forms.Rectangle((-layout.Width/4) + 8, (layout.Height/4) - 8, 
                layout.Width, layout.Height));
            
            layout.Children.Add(cog2, () => new Xamarin.Forms.Rectangle(layout.Width -36, -13, 
                layout.Width, layout.Width));

            Content = layout;
        }
Example #13
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            ActionBar.Hide();
            SetContentView(Resource.Layout.Main);
            cover = FindViewById<RelativeLayout>(Resource.Id.titleScreen);
            player = MediaPlayer.Create(this, Resource.Raw.avril_14th);
            toggleMusic = FindViewById<ToggleButton>(Resource.Id.toggleMusic);
            player.Start();
            player.Looping = true;

            cover.Click += delegate
            {
                StartActivity(typeof(Login));
            };


            toggleMusic.Click += (o, s) =>

            {
                if (toggleMusic.Checked)
                {
                    player.Start();
                    toggleMusic.SetBackgroundResource(Android.Resource.Drawable.IcMediaPause);

                }
                else
                {
                    toggleMusic.SetBackgroundResource(Android.Resource.Drawable.IcMediaPlay);
                    player.Pause();
                }
            };


        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.SplashScreenLayout);

            _splashLayout = FindViewById<RelativeLayout>(Resource.Id.SplashScreenLayout);
            _splashLayout.Visibility = ViewStates.Invisible;
            _fadeIn = AnimationUtils.LoadAnimation(this, Resource.Animation.splash_fade_in);
            _fadeOut = AnimationUtils.LoadAnimation(this, Resource.Animation.splash_fade_out);

            _fadeIn.AnimationEnd += (sender, e) =>
            {
                _splashLayout.StartAnimation(_fadeOut);
            };

            _fadeOut.AnimationEnd += (sender, e) =>
            {
                var intent = new Intent(this, typeof(MainActivity));
                StartActivity(intent);
                _splashLayout.Visibility = ViewStates.Gone;

                ThreadPool.QueueUserWorkItem(_ =>
                {
                    Finish();
                });
            };
        }
Example #15
0
        public void AddSpinner(ViewGroup rootview,string loadingtext)
        {
            loading = true;
            if(loadingcontainer==null||(loadingcontainer!=null&&!loadingcontainer.IsShown)){
                loadingcontainer = new RelativeLayout (nn_activity);
                loadingcontainer.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
                loadingcontainer.SetBackgroundColor (Color.White);

                var detailcontainer = new LinearLayout (nn_activity);

                detailcontainer.Orientation = Orientation.Vertical;
                RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams ((int)TapUtil.dptodx (100), RelativeLayout.LayoutParams.WrapContent);
                param.AddRule (LayoutRules.CenterInParent);
                detailcontainer.LayoutParameters = param;

                LinearLayout.LayoutParams linearlayoutparm = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
                linearlayoutparm.Gravity = GravityFlags.CenterHorizontal;

                ProgressBar progressbar = new ProgressBar (nn_activity);
                progressbar.LayoutParameters = linearlayoutparm;

                TextView tectview = new TextView (nn_activity);
                tectview.LayoutParameters = linearlayoutparm;
                tectview.Text = loadingtext;
                tectview.Gravity = GravityFlags.CenterHorizontal;

                detailcontainer.AddView (progressbar);
                detailcontainer.AddView (tectview);

                loadingcontainer.AddView (detailcontainer);
                rootview.AddView (loadingcontainer);
            }
        }
Example #16
0
		public Page4 ()
        {
            #region All controls with click

            var prev = new Button
			{ 
				Text = "Pre Page",
				BackgroundColor=Xamarin.Forms.Color.Transparent,
				TextColor=Xamarin.Forms.Color.FromRgb(219,63,0),
			};
			prev.Clicked += async (sender, e) => {
				await Navigation.PopAsync();
			};		
              #endregion

            #region Main Layout


            Title = "Page 4";
			BackgroundImage="Page4.png";

            var mainLayout = new RelativeLayout
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions = LayoutOptions.Fill,
            };
            //Initialization of this popview already on base page. Here we just add this popview in current page.
            mainLayout.Children.Add(PopupsView, Constraint.Constant(App.ScreenWidth), Constraint.Constant(0));
            mainLayout.Children.Add(prev, Constraint.Constant(5), Constraint.Constant(15));
            this.Content = mainLayout;		
		    #endregion

		}
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			
			_timestamp = DateTime.Now.ToLongTimeString ();
			
			// create a layout
			var rl = new RelativeLayout (this);
			var layoutParams = new RelativeLayout.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent);
			rl.LayoutParameters = layoutParams;
			
			// get the initial orientation
			var surfaceOrientation = this.WindowManager.DefaultDisplay.Rotation;
			
			// create the portrait and landscape layout
			_layoutParamsPortrait = new RelativeLayout.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent);		
			_layoutParamsLandscape = new RelativeLayout.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent);
			_layoutParamsLandscape.LeftMargin = 100;
			_layoutParamsLandscape.TopMargin = 100;
			
			// create the TextView an assign the initial layout params
			_tv = new TextView (this);
			
			if (surfaceOrientation == SurfaceOrientation.Rotation0 || surfaceOrientation == SurfaceOrientation.Rotation180) {
				_tv.LayoutParameters = _layoutParamsPortrait;
			} else {
				_tv.LayoutParameters = _layoutParamsLandscape;
			}
			
			_tv.Text = "Programmatic layout. Timestamp = " + _timestamp;
			
			rl.AddView (_tv);
	
			SetContentView (rl);
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="NControl.Controls.ExpandableActionButton"/> class.
		/// </summary>
		public ExpandableActionButton ()
		{
		    // Set direction
			Direction = ExpandDirection.Up;

			// Layout
			Content = new RelativeLayout();

			// Main button
			_mainButton = new ToggleActionButton {
				ButtonIcon = FontAwesomeLabel.FAEllipsisV,
			};
				
			// Create buttons layout
			_buttonsLayout = new RelativeLayout ();
			(Content as RelativeLayout).Children.Add (_buttonsLayout, () => (Content as RelativeLayout).Bounds);

			AddButtonToLayout (_mainButton, Content as RelativeLayout);

			_mainButton.PropertyChanged += async (object sender, System.ComponentModel.PropertyChangedEventArgs e) => {
				if(e.PropertyName == ToggleActionButton.IsToggledProperty.PropertyName)
				{
					// Show/Hide buttons
					if(_mainButton.IsToggled)
						await ShowButtonsAsync();
					else
						await HideButtonsAsync();
				}
			};
		}
		protected override void OnAppearing ()
		{
			base.OnAppearing ();
		
			var layout = new RelativeLayout ();

			var border1 = new RoundCornerView {
				BackgroundColor = Color.Red,
				CornerRadius = 4,
			};

			var border2 = new RoundCornerView {
				BackgroundColor = Color.Blue,
				CornerRadius = 14,
			};

			var border3 = new RoundCornerView {
				BackgroundColor = Color.Green,
				CornerRadius = 12,
			};

			var border4 = new RoundCornerView {
				BackgroundColor = Color.Yellow,
				CornerRadius = 42,
			};

			layout.Children.Add (border1, () => new Rectangle (10, 10, (layout.Width / 2) - 20, (layout.Height / 2) - 20));
			layout.Children.Add (border2, () => new Rectangle ((layout.Width / 2) + 10, 10, (layout.Width / 2) - 20, (layout.Height / 2) - 20));
			layout.Children.Add (border3, () => new Rectangle (10, (layout.Height / 2) + 10, (layout.Width / 2) - 20, (layout.Height / 2) - 20));
			layout.Children.Add (border4, () => new Rectangle ((layout.Width / 2) + 10, (layout.Height / 2) + 10, (layout.Width / 2) - 20, (layout.Height / 2) - 20));

			Content = layout;
		}
Example #20
0
		public Page1 ()
        {
            int o = App.ScreenHeight;
            int ov = App.ScreenWidth;
            #region All controls with click
            
            var b = new Button
			{ 
				Text = "Next Page",
				BackgroundColor=Xamarin.Forms.Color.Transparent,
				TextColor=Xamarin.Forms.Color.Pink,
			};
            b.Clicked += async (sender, e) =>
            {
                await Navigation.PushAsync(new Page2());
            };
            #endregion

            #region Main Layout 

            Title = "Page 1";
			BackgroundImage="Page1.png";
            var mainLayout = new RelativeLayout
            { 
                HorizontalOptions=LayoutOptions.Fill,
                VerticalOptions = LayoutOptions.Fill,                
			};
            //Initialization of this popview already on base page. Here we just add this popview in current page.
            mainLayout.Children.Add(PopupsView, Constraint.Constant(App.ScreenWidth), Constraint.Constant(0));
            mainLayout.Children.Add(b, Constraint.Constant(10), Constraint.Constant(15));           
           this. Content= mainLayout;
            #endregion

        }
Example #21
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            mainLayout = FindViewById<RelativeLayout> (Resource.Id.MainLayout);

            disclaimer = FindViewById<RelativeLayout> (Resource.Id.rlDisclaimer);
            RelativeLayout.LayoutParams rlp = (RelativeLayout.LayoutParams)disclaimer.LayoutParameters;
            diff = rlp.Height + rlp.BottomMargin;
            TextView label1 = FindViewById<TextView> (Resource.Id.label1);
            label1.Text = "bla bla bla qsf qsdf qdsf qsdf qsd\n sdfqsf qs\n sdf qsdf qsf qs\n";
            float width = label1.Paint.MeasureText (label1.Text);
            text = disclaimer.FindViewById<TextView> (Resource.Id.disclaimerText);
            //SetText in OnCreate ()
            RunOnUiThread (() => {
                text.Text = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
            });
            LinearLayout lin = FindViewById<LinearLayout> (Resource.Id.llTestLayout);
            lin.LayoutParameters.Width = (int)width;

            RelativeLayout test = FindViewById<RelativeLayout> (Resource.Id.clickLayout);
            test.SetOnTouchListener (this);
        }
Example #22
0
		public Footer (ExtendedMap map, double pageHeight, double minimizedFooterY, double expandedFooterY)
		{
			_extendedMap = map;
			_uiHelper = new UIHelper ();
			_pageHeight = pageHeight;
			_minimizedFooterY = minimizedFooterY;
			_expandedFooterY = expandedFooterY;
			FooterMode = FooterMode.Hidden;

			var footerLayout = new RelativeLayout ();

			footerLayout.Children.Add (
				new FooterMaster(_extendedMap, _uiHelper, this),
				Constraint.RelativeToParent ((parent) => (parent.Width * 0)),
				Constraint.RelativeToParent ((parent) => (parent.Height * 0)),
				Constraint.RelativeToParent ((parent) => (parent.Width * 1)),
				Constraint.RelativeToParent ((parent) => (parent.Height * 0.15))
			);

			footerLayout.Children.Add (
				new FooterDetail(_uiHelper, _extendedMap, this),
				Constraint.RelativeToParent ((parent) => (parent.Width * 0)),
				Constraint.RelativeToParent ((parent) => (parent.Height * 0.149)),
				Constraint.RelativeToParent ((parent) => (parent.Width * 1)),
				Constraint.RelativeToParent ((parent) => (parent.Height * 1))
			);

			Content = footerLayout;
		}
		public MyRelativeLayout ()
		{
			var red = new Label {
				Text = "Stop", 
				BackgroundColor = Color.Red,
				Font = Font.SystemFontOfSize (20), 
				WidthRequest = 200, HeightRequest = 30
			};
			var yellow = new Label {
				Text = "Slow down", 
				BackgroundColor = Color.Yellow,
				Font = Font.SystemFontOfSize (20),
				WidthRequest = 160, HeightRequest = 160
			};
			var green = new Label {
				Text = "Go", 
				BackgroundColor = Color.Green,
				Font = Font.SystemFontOfSize (20),
				WidthRequest = 50, HeightRequest = 50
			};

			var relLayout = new RelativeLayout (); 
//			relLayout.Children.Add (red, new Point (20, 20));
//			relLayout.Children.Add (yellow, new Point (40, 60));
//			relLayout.Children.Add (green, new Point (80, 180));
//
			Content = relLayout;
		}
		public NavigationInfoButtonLayout ()
		{
			Image = new Image {
				Source = "vraagteken.png",
				Aspect = Aspect.AspectFill,
				Scale = 0.5
			};

			Button = new Button {
				BackgroundColor = Color.Transparent
			};

			var relativeLayout = new RelativeLayout {
				HeightRequest = 50,
				WidthRequest = 50
			};

			relativeLayout.Children.Add (Image,
				Constraint.Constant (0),
				Constraint.Constant (0),
				Constraint.RelativeToParent ((parent) => parent.Width),
				Constraint.RelativeToParent ((parent) => parent.Height));

			relativeLayout.Children.Add (Button,
				Constraint.Constant (0),
				Constraint.Constant (0),
				Constraint.RelativeToParent ((parent) => parent.Width),
				Constraint.RelativeToParent ((parent) => parent.Height));
			
			Children.Add (relativeLayout);
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="NControl.Controls.RippleButton"/> class.
		/// </summary>
		public RippleButton()
		{            
            _layout = new RelativeLayout {IsClippedToBounds = true};

			// Add ripple thing
			_rippler = new RippleControl{
				InputTransparent = true,
			};
			_layout.Children.Add (_rippler, () => _layout.Bounds);

			// Add title and icon
            _labelText = new Label{ 
				BackgroundColor = Color.Transparent,
				XAlign = TextAlignment.Center,
				YAlign = TextAlignment.Center,
				TextColor = Color.Black,				
				InputTransparent = true,
			};
			
			_layout.Children.Add (_labelText, ()=> GetTextRectangleForImagePosition(_layout));

            _iconLabel = new FontAwesomeLabel{ 
				BackgroundColor = Color.Transparent,
				FontSize = 18,
				TextColor = (Color)IconColorProperty.DefaultValue,
				InputTransparent = true,
			};
			
			_layout.Children.Add (_iconLabel, () => GetIconRectangleForImagePosition(_layout));

			Content = _layout;
		}
Example #26
0
        public HomeButton(string iconText, string title, Color iconBGColor, Color titleBGColor)
        {
            IconLabel iconLabel = new IconLabel {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions = LayoutOptions.Fill,
                BackgroundColor = iconBGColor,
                TextColor = Color.White,
                Text = iconText,
                FontSize = 60
            };

            Label titleLabel = new Label {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions = LayoutOptions.Fill,
                BackgroundColor = titleBGColor,
                TextColor = Color.White,
                Text = title,
                FontSize = 14
            };

            RelativeLayout layout = new RelativeLayout ();
            layout.Children.Add (iconLabel,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => parent.Width),
                Constraint.RelativeToParent ((parent) => parent.Height));

            layout.Children.Add (titleLabel,
                Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => parent.Height * 0.75),
                Constraint.RelativeToParent ((parent) => parent.Width),
                Constraint.RelativeToParent ((parent) => parent.Height * 0.25));

            Content = layout;
        }
Example #27
0
        public XFPage3()
        {
            var layout = new RelativeLayout();
            var label = new Label()
            {
                Text = "This is a line of text!"
            };
            layout.Children.Add(label, Constraint.Constant(0),
                Constraint.RelativeToParent(parent => parent.Height / 2));

            var label2 = new Label() { Text = "More text over here!" };

            layout.Children.Add(label2, Constraint.RelativeToView(label, (parent, otherView) => otherView.X + otherView.Width), Constraint.RelativeToView(label, (parent, otherView) => otherView.Y - otherView.Height));

            var label3 = new Label() { Text = "Final text" };

            layout.Children.Add(label3, Constraint.RelativeToView(label2, (parent, otherView) =>
            {
                return (otherView.X + otherView.Width) - label3.Width;
            }),
                Constraint.RelativeToView(label, (parent, otherView) => { return otherView.Y; }));

            label3.SizeChanged += (o, e) => { layout.ForceLayout(); };

            Content = layout;
        }
		public MainViewModel (RelativeLayout mainLayout, Context context)
		{
			_webService = ColorWebServices.Instance;
			_shapeFactory = ShapeFactory.Instance;
			_mainLayout = mainLayout;
			_context = context;
		}
Example #29
0
		public CardView()
		{
			HeightRequest = 6*UiConst.LINE_HEIGHT;
			WidthRequest = 320;
			BackgroundColor = Color.Maroon;
			Padding = new Thickness(2);

			var t = new TapGestureRecognizer();
			t.Tapped += new DenyAction<object, EventArgs>(MAnimation, 800).OnEvent;
			GestureRecognizers.Add(t);

			Content = (_rootLayout = new RelativeLayout()
			{
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.FillAndExpand,
				BackgroundColor = UiConst.COLOR_DF_BG
			});

			Content.GestureRecognizers.Add(t);

			// init component
			_rootLayout.Children.Add(new MyLabel
			{
				BackgroundColor = Color.Pink
			}, null, null, null, Constraint.Constant(UiConst.LINE_HEIGHT));
		}
Example #30
0
        public MyPage()
        {
            BackgroundColor = Color.White;

            var imgBackgrndImage = new Image () {
                //Source = ImageSource.FromResource ("EmbedImageEx.HomeBg.png"),
                // This one don't work which is from referenced PCL project MyImages used only for string embedded Images.
                Source = ImageSource.FromResource ("MyImages.HomeBg.png"),
                Aspect = Aspect.Fill
            };
            RelativeLayout lytMain = new RelativeLayout () {
                HeightRequest = 100,
            };

            lytMain.Children.Add (
                imgBackgrndImage,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Height;
                })
            );
            Content = lytMain;
        }
Example #31
0
        protected override void LayoutChild()
        {
            if (!layoutChanged)
            {
                return;
            }
            if (itemLabel == null)
            {
                return;
            }

            layoutChanged = false;

            if (itemIcon != null)
            {
                RelativeLayout.SetLeftTarget(itemIcon, this);
                RelativeLayout.SetLeftRelativeOffset(itemIcon, 0.0F);
                RelativeLayout.SetRightTarget(itemIcon, this);
                RelativeLayout.SetRightRelativeOffset(itemIcon, 0.0F);
                RelativeLayout.SetTopTarget(itemIcon, this);
                RelativeLayout.SetTopRelativeOffset(itemIcon, 0.0F);
                RelativeLayout.SetBottomTarget(itemIcon, this);
                RelativeLayout.SetBottomRelativeOffset(itemIcon, 1.0F);
                RelativeLayout.SetVerticalAlignment(itemIcon, RelativeLayout.Alignment.Center);
                RelativeLayout.SetHorizontalAlignment(itemIcon, RelativeLayout.Alignment.Start);
            }

            if (itemExtra != null)
            {
                RelativeLayout.SetLeftTarget(itemExtra, this);
                RelativeLayout.SetLeftRelativeOffset(itemExtra, 1.0F);
                RelativeLayout.SetRightTarget(itemExtra, this);
                RelativeLayout.SetRightRelativeOffset(itemExtra, 1.0F);
                RelativeLayout.SetTopTarget(itemExtra, this);
                RelativeLayout.SetTopRelativeOffset(itemExtra, 0.0F);
                RelativeLayout.SetBottomTarget(itemExtra, this);
                RelativeLayout.SetBottomRelativeOffset(itemExtra, 1.0F);
                RelativeLayout.SetVerticalAlignment(itemExtra, RelativeLayout.Alignment.Center);
                RelativeLayout.SetHorizontalAlignment(itemExtra, RelativeLayout.Alignment.End);
            }

            if (itemSubLabel != null)
            {
                if (itemIcon != null)
                {
                    RelativeLayout.SetLeftTarget(itemSubLabel, itemIcon);
                    RelativeLayout.SetLeftRelativeOffset(itemSubLabel, 1.0F);
                }
                else
                {
                    RelativeLayout.SetLeftTarget(itemSubLabel, this);
                    RelativeLayout.SetLeftRelativeOffset(itemSubLabel, 0.0F);
                }
                if (itemExtra != null)
                {
                    RelativeLayout.SetRightTarget(itemSubLabel, itemExtra);
                    RelativeLayout.SetRightRelativeOffset(itemSubLabel, 0.0F);
                }
                else
                {
                    RelativeLayout.SetRightTarget(itemSubLabel, this);
                    RelativeLayout.SetRightRelativeOffset(itemSubLabel, 1.0F);
                }

                RelativeLayout.SetTopTarget(itemSubLabel, this);
                RelativeLayout.SetTopRelativeOffset(itemSubLabel, 1.0F);
                RelativeLayout.SetBottomTarget(itemSubLabel, this);
                RelativeLayout.SetBottomRelativeOffset(itemSubLabel, 1.0F);
                RelativeLayout.SetVerticalAlignment(itemSubLabel, RelativeLayout.Alignment.End);

                RelativeLayout.SetHorizontalAlignment(itemSubLabel, RelativeLayout.Alignment.Center);
                RelativeLayout.SetFillHorizontal(itemSubLabel, true);
            }

            if (itemIcon != null)
            {
                RelativeLayout.SetLeftTarget(itemLabel, itemIcon);
                RelativeLayout.SetLeftRelativeOffset(itemLabel, 1.0F);
            }
            else
            {
                RelativeLayout.SetLeftTarget(itemLabel, this);
                RelativeLayout.SetLeftRelativeOffset(itemLabel, 0.0F);
            }
            if (itemExtra != null)
            {
                RelativeLayout.SetRightTarget(itemLabel, itemExtra);
                RelativeLayout.SetRightRelativeOffset(itemLabel, 0.0F);
            }
            else
            {
                RelativeLayout.SetRightTarget(itemLabel, this);
                RelativeLayout.SetRightRelativeOffset(itemLabel, 1.0F);
            }

            RelativeLayout.SetTopTarget(itemLabel, this);
            RelativeLayout.SetTopRelativeOffset(itemLabel, 0.0F);

            if (itemSubLabel != null)
            {
                RelativeLayout.SetBottomTarget(itemLabel, itemSubLabel);
                RelativeLayout.SetBottomRelativeOffset(itemLabel, 0.0F);
            }
            else
            {
                RelativeLayout.SetBottomTarget(itemLabel, this);
                RelativeLayout.SetBottomRelativeOffset(itemLabel, 1.0F);
            }
            RelativeLayout.SetVerticalAlignment(itemLabel, RelativeLayout.Alignment.Center);
            RelativeLayout.SetHorizontalAlignment(itemLabel, RelativeLayout.Alignment.Center);
            RelativeLayout.SetFillHorizontal(itemLabel, true);

            if (prevSize != Size)
            {
                prevSize = Size;
                if (itemSeperator)
                {
                    var margin = itemSeperator.Margin;
                    itemSeperator.SizeWidth  = SizeWidth - margin.Start - margin.End;
                    itemSeperator.SizeHeight = itemSeperator.HeightSpecification;
                    itemSeperator.Position   = new Position(margin.Start, SizeHeight - margin.Bottom - itemSeperator.SizeHeight);
                }
            }
        }
Example #32
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container,
                                          Bundle savedInstanceState)
        {
            // Inflate the layout for this fragment
            View view = inflater.Inflate(Resource.Layout.fragment_cart, container, false);

            recyclerView = (RecyclerView)view.FindViewById(Resource.Id.recyclerCart);
            btn_ShopNOw  = (Button)view.FindViewById(Resource.Id.btn_ShopNOw);
            viewCart     = (RelativeLayout)view.FindViewById(Resource.Id.viewCartItems);
            tv_total     = (TextView)view.FindViewById(Resource.Id.txt_totalamount);
            totalItems   = (TextView)view.FindViewById(Resource.Id.txt_totalQuan);
            noData       = (RelativeLayout)view.FindViewById(Resource.Id.noData);
            ((MainActivity)this.Activity).Title = (GetString(Resource.String.cart));
            sessionManagement = new Session_management(Activity);
            sessionManagement.cleardatetime();

            ll_Checkout = (LinearLayout)view.FindViewById(Resource.Id.ll_Checkout);
            getCartData();

            btn_ShopNOw.Click += delegate
            {
                Intent intent = new Intent(Activity, typeof(MainActivity));
                StartActivity(intent);
            };

            ll_Checkout.Click += async delegate
            {
                if (isOnline())
                {
                    if (sessionManagement.isLoggedIn())
                    {
                        if (StoreCartData.Count == 0)
                        {
                            noData.Visibility   = ViewStates.Visible;
                            viewCart.Visibility = ViewStates.Gone;
                        }
                        else
                        {
                            progressDialog = new Android.App.ProgressDialog(this.Context);
                            progressDialog.Indeterminate = true;
                            progressDialog.SetProgressStyle(ProgressDialogStyle.Spinner);
                            progressDialog.SetMessage("Loading...");
                            progressDialog.SetCancelable(false);
                            progressDialog.Show();
                            int UserId = 0;
                            if (sessionManagement.isLoggedIn())
                            {
                                UserId = Convert.ToInt32(sessionManagement.getUserDetails().Get(BaseURL.KEY_ID).ToString());
                            }
                            var processCheckout = BaseURL.ProcessToCheckout + UserId;

                            using (var client = new HttpClient())
                            {
                                StringContent content  = new StringContent("");
                                var           response = await client.PostAsync(processCheckout, content);

                                if (response.StatusCode == HttpStatusCode.OK)
                                {
                                    Intent intent = new Intent(this.Activity, typeof(OrderSummary));
                                    StartActivity(intent);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (StoreCartData.Count == 0)
                        {
                            noData.Visibility   = ViewStates.Visible;
                            viewCart.Visibility = ViewStates.Gone;
                        }
                        else
                        {
                            Intent intent = new Intent(this.Activity, typeof(OrderSummary));
                            StartActivity(intent);
                        }
                    }
                }
                ;
            };

            recyclerView.SetLayoutManager(new LinearLayoutManager(Activity));

            updateData();


            return(view);
        }
        //Button icons provided by www.flaticon.com
        public GateGridView(string pageTitle)
        {
            //Initialie the ContentTitle field
            ContentTitle = pageTitle;
            #region Create the Lanes StackLayout
            var lanesLabel = new Label
            {
                Text  = "Lanes",
                Style = Styles_Constants.LabelStyle
            };
            LanesButton = new Button
            {
                Image = "Road",
                Style = Styles_Constants.ButtonStyle
            };
            LanesButton.Clicked += OnLanesButtonClick;
            var lanesStack = new StackLayout
            {
                Children =
                {
                    lanesLabel,
                    LanesButton
                },
                Style = Styles_Constants.StackLayoutStyle
            };
            #endregion

            #region Create the About StackLayout
            var aboutLabel = new Label
            {
                Text  = "About",
                Style = Styles_Constants.LabelStyle
            };
            AboutButton = new Button
            {
                Image = "About",
                Style = Styles_Constants.ButtonStyle
            };
            AboutButton.Clicked += OnAboutButtonClick;
            var aboutStack = new StackLayout
            {
                Children =
                {
                    aboutLabel,
                    AboutButton
                },
                Style = Styles_Constants.StackLayoutStyle
            };
            #endregion

            var titleLabel = new Label
            {
                Text  = pageTitle,
                Style = Styles_Constants.LabelStyle
            };

            #region Create the Relative Layout
            var gateRelativeLayout = new RelativeLayout();
            gateRelativeLayout.Children.Add(lanesStack,
                                            Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width / 8);
            }),
                                            Constraint.RelativeToParent((parent) =>
            {
                return(parent.Y + relativeLayoutPadding);
            }),
                                            Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width / 4);
            })
                                            );
            gateRelativeLayout.Children.Add(aboutStack,
                                            Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 5 / 8);
            }),
                                            Constraint.RelativeToParent((parent) =>
            {
                return(parent.Y + relativeLayoutPadding);
            }),
                                            Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width / 4);
            })
                                            );
            #endregion

            #region Create Enable Button
            var enableSwitchText = new Label
            {
                Text  = "Disable Buttons",
                Style = Styles_Constants.LabelStyle
            };
            var enableSwitchButton = new Switch
            {
                Style = Styles_Constants.ButtonStyle
            };
            enableSwitchButton.Toggled += ToggleAllButtons;

            var switchStackHorizontal = new StackLayout
            {
                Style       = Styles_Constants.StackLayoutStyle,
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    enableSwitchText,
                    enableSwitchButton
                }
            };
            #endregion

            #region Create Stack Layout to include the title
            var pageStack = new StackLayout
            {
                VerticalOptions = LayoutOptions.Center,
                Children        =
                {
                    gateRelativeLayout,
                    switchStackHorizontal,
                    titleLabel
                }
            };
            #endregion

            Content = pageStack;
        }
        async void ListView_OnItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            ResetUIToBeginState(false);


            SslValidator.CertificateErrorRaised = false;

            //Set selected local box
            Waardes.Instance.GeselecteerdeBox = foundLocalBoxes[e.Position].Id;

            //Reset certificate validation check to default behavior

            /*
             * ServicePointManager.ServerCertificateValidationCallback = null;
             *
             * if (foundLocalBoxes[e.Position].OriginalSslCertificate != null) { //Selected localbox does have a ssl certificate
             *      //Set ssl validator for selected LocalBox
             *      SslValidator sslValidator = new SslValidator ();
             *      ServicePointManager.ServerCertificateValidationCallback = sslValidator.ValidateServerCertficate;
             * }*/

            //Change action bar color to color of selected localbox
            if (DataLayer.Instance.GetSelectedOrDefaultBox().BackColor != null &&
                DataLayer.Instance.GetSelectedOrDefaultBox().BackColor.StartsWith("#"))
            {
                HomeActivity.colorOfSelectedLocalBox = DataLayer.Instance.GetSelectedOrDefaultBox().BackColor;
            }
            else
            {
                HomeActivity.colorOfSelectedLocalBox = Constants.lightblue;
            }
            SetCustomActionBarColor();

            //Change logo image to logo of selected local box
            if (DataLayer.Instance.GetSelectedOrDefaultBox().LogoUrl != null)
            {
                string logoUrl = DataLayer.Instance.GetSelectedOrDefaultBox().LogoUrl;

                string documentsPath = DocumentConstants.DocumentsPath;
                string pathToLogo    = System.IO.Path.Combine(documentsPath, logoUrl.Substring(logoUrl.LastIndexOf("/") + 1));

                if (File.Exists(pathToLogo))
                {                 //Verander logo
                    Android.Net.Uri uriLogo = Android.Net.Uri.Parse(pathToLogo);
                    //imageViewLogo.SetImageURI (uriLogo);
                }
                else                 //Default logo
                {
                    //imageViewLogo.SetImageResource (Resource.Drawable.beeldmerk_belastingdienst);
                }
            }

            //Update fragment data
            Android.Support.V4.App.FragmentTransaction fragmentTransaction = Activity.SupportFragmentManager.BeginTransaction();
            fragmentTransaction.SetCustomAnimations(Resource.Animation.enter, Resource.Animation.exit);

            //Show progress dialog while loading
            ShowProgressDialog(Activity, null);

            try {
                HomeActivity homeActivity = (HomeActivity)Activity;

                ExplorerFragment explorerFragment = new ExplorerFragment(await DataLayer.Instance.GetFolder("/"), homeActivity);

                HomeActivity.openedExplorerFragments = new List <ExplorerFragment>();
                HomeActivity.openedExplorerFragments.Add(explorerFragment);

                //Add new directory to opened directories list
                ExplorerFragment.openedDirectories = new List <string>();
                ExplorerFragment.openedDirectories.Add("/");

                fragmentTransaction.Replace(Resource.Id.fragment_container_explorer, explorerFragment, "explorerFragment");

                //Clear fragment back stack
                int entryCount = Activity.SupportFragmentManager.BackStackEntryCount;

                while (entryCount > 0)
                {
                    Activity.SupportFragmentManager.PopBackStackImmediate();
                    entryCount = Activity.SupportFragmentManager.BackStackEntryCount;
                }

                //Add fragment to stack - needed for back button functionality
                fragmentTransaction.AddToBackStack(null);

                // Start the animated transition.
                fragmentTransaction.Commit();

                //Show hidden buttons
                RelativeLayout fragmentContainerExplorerBottom = Activity.FindViewById <RelativeLayout> (Resource.Id.fragment_container_explorer_blank);
                fragmentContainerExplorerBottom.Visibility = ViewStates.Visible;

                //Show shadow
                View shadowContainerExplorer = Activity.FindViewById <View> (Resource.Id.shadow_container_explorer);
                shadowContainerExplorer.Visibility = ViewStates.Visible;

                //Hide back button
                ImageButton buttonBackExplorer = Activity.FindViewById <ImageButton> (Resource.Id.button_back_explorer);
                buttonBackExplorer.Visibility = ViewStates.Invisible;

                HideProgressDialog();
            }
            catch (Exception ex) {
                Insights.Report(ex);
                HideProgressDialog();
                Toast.MakeText(Activity, "Er is iets fout gegaan", ToastLength.Short).Show();
            }
        }
Example #35
0
        public UpcomingEventsPage()
        {
            Title = "Events";
            List <upcomingEvent> events = new List <upcomingEvent>();

            DateTime dt = new DateTime(2016, 6, 11, 8, 0, 0);
            //Placeholder newsEvents until news can be read from online DB***************************
            int i = 0;

            events.Add(new upcomingEvent("Save 100 ducks", "Georgia key club got together to save over 99 ducks last weekend, in an renewed effort that's been gaining traction recently to save our furry brothers.", "Johnny Appleseed Memorial Park, 1500 Coliseum Blvd E, Fort Wayne, IN 46805", dt.AddDays(i += 7)));
            events.Add(new upcomingEvent("Angel Aguilar, Liuetenant Governor of Key Club USA", "Comrade Angel Aguilar has been privately elected to the position of supreme leader of USA Key Clubs.", "Johnny Appleseed Memorial Park, 1500 Coliseum Blvd E, Fort Wayne, IN 46805", dt.AddDays(i += 3)));
            events.Add(new upcomingEvent("More news", "Get your jaw dropping news here!", "Johnny Appleseed Memorial Park, 1500 Coliseum Blvd E, Fort Wayne, IN 46805", dt.AddDays(i += 3)));
            events.Add(new upcomingEvent("Even More news", "Get your less exciting, just mouth-opening news here.", "Johnny Appleseed Memorial Park, 1500 Coliseum Blvd E, Fort Wayne, IN 46805", dt.AddDays(i += 5)));
            events.Add(new upcomingEvent("I need more sleep", "I've come to the realization, at 1am Sunday, 5 hours before I have to wake up for church, that I'm not giving my health any attention.", "Johnny Appleseed Memorial Park, 1500 Coliseum Blvd E, Fort Wayne, IN 46805", dt.AddDays(i += 3)));
            events.Add(new upcomingEvent("I don't have to write these", "I'm glad I don't have to actually make these things. Once this thing works, I get paid, and I'm outta here.", "Johnny Appleseed Memorial Park, 1500 Coliseum Blvd E, Fort Wayne, IN 46805", dt.AddDays(i += 5)));


            //************************************************** old scrollview - to be replaced with calendar
            ListView listView = new ListView
            {
                RowHeight   = 100,
                ItemsSource = events,

                ItemTemplate = new DataTemplate(() =>
                {
                    Label titleLabel     = new Label();
                    titleLabel.TextColor = Color.Black;
                    titleLabel.FontSize  = 18;
                    titleLabel.SetBinding(Label.TextProperty, "title");

                    Label descriptionLabel = new Label();
                    descriptionLabel.SetBinding(Label.TextProperty, "description");

                    //Image eventImage = new Image();
                    //eventImage.Source = "@drawable/Icon"; //TEMPORARY

                    Label dayLabel             = new Label();
                    dayLabel.TextColor         = Color.Black;
                    dayLabel.FontSize          = 20;
                    dayLabel.HorizontalOptions = LayoutOptions.Center;
                    dayLabel.SetBinding(Label.TextProperty, "dayOfWeek");

                    Label dateLabel             = new Label();
                    dateLabel.TextColor         = Color.Black;
                    dateLabel.FontSize          = 20;
                    dateLabel.HorizontalOptions = LayoutOptions.Center;
                    dateLabel.SetBinding(Label.TextProperty, "formattedDate");

                    Image calendarImage  = new Image();
                    calendarImage.Source = "@Drawable/calendar";
                    calendarImage.Aspect = Aspect.AspectFill;

                    StackLayout imageSTL = new StackLayout
                    {
                        //WidthRequest = 400,
                        Children =
                        {
                            calendarImage
                        }
                    };

                    StackLayout dateSTL = new StackLayout
                    {
                        VerticalOptions   = LayoutOptions.Center,
                        HorizontalOptions = LayoutOptions.Center,
                        Spacing           = 0,
                        Children          =
                        {
                            dayLabel,
                            dateLabel
                        }
                    };

                    RelativeLayout rl = new RelativeLayout();
                    //rl.WidthRequest = 400;
                    rl.Children.Add(imageSTL, Constraint.Constant(0), Constraint.Constant(0), Constraint.Constant(90), Constraint.Constant(300));
                    rl.Children.Add(dateSTL, Constraint.Constant(0), Constraint.Constant(20), Constraint.Constant(90), Constraint.Constant(300));


                    return(new ViewCell
                    {
                        View = new StackLayout
                        {
                            HeightRequest = 300,
                            Padding = new Thickness(5, 5),
                            Orientation = StackOrientation.Horizontal,

                            Children =
                            {
                                //rl,
                                new StackLayout
                                {
                                    MinimumWidthRequest = 410,
                                    Children ={ rl                }
                                },

                                new StackLayout
                                {
                                    //VerticalOptions = LayoutOptions.Center,
                                    HorizontalOptions = LayoutOptions.StartAndExpand,
                                    Spacing = 0,
                                    Children =
                                    {
                                        titleLabel,
                                        descriptionLabel
                                    }
                                }
                            }
                        }
                    });
                })
            };

            listView.ItemTapped += (sender, e) => {
                upcomingEvent Event = (upcomingEvent)((ListView)sender).SelectedItem;
                Navigation.PushModalAsync(new EventDetailsPage(Event));
                ((ListView)sender).SelectedItem = null;
            };
            //***************************************************************

            StackLayout calendarContainer = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    new ListView
                    {
                        //ItemTemplate = new DataTemplate() //you are here
                    }
                }
            };



            // Accomodate iPhone status bar.
            this.Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0);

            // Build the page.
            this.Content = new ScrollView
            {
                Content = new StackLayout
                {
                    Children =
                    {
                        listView //replace with calendar...
                    }
                }
            };
        }
Example #36
0
        /// <summary>
        /// To initialize UI Components of an application information page
        /// </summary>
        private void InitializeComponent()
        {
            Title = "ApplicationInfo";

            /// The mainLayout consists of several parts to display application information.
            var mainLayout = new RelativeLayout {
            };

            /// To display an image as the background
            var background = new Background
            {
                Image = new FileImageSource {
                    File = "background_app.png"
                },
                Option = BackgroundOptions.Stretch,
            };

            mainLayout.Children.Add(
                background,
                Constraint.RelativeToParent((parent) =>
            {
                return(0);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(0);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height);
            }));

            /// To display an application icon path
            var icon = new Image
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            mainLayout.Children.Add(
                icon,
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.0556);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0537);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.1319);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0774);
            }));

            /// To display an application name
            var applicationName = new Label {
            };

            applicationName.Style = ApplicationInformationStyle.ContentStyle;

            mainLayout.Children.Add(
                applicationName,
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.2472);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0961);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.7389);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0293);
            }));

            /// To display an application ID
            var applicationID = new Label {
            };

            applicationID.Style = ApplicationInformationStyle.ContentStyle;

            mainLayout.Children.Add(
                applicationID,
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.0375);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.3014);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.4486);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0519);
            }));

            /// To display an application version
            var applicationVersion = new Label {
            };

            applicationVersion.Style = ApplicationInformationStyle.ContentStyle;

            mainLayout.Children.Add(
                applicationVersion,
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.5416);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.3014);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.4486);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0319);
            }));

            /// To display the device memory status
            var memoryLED = new Image
            {
                Source = "led.png"
            };

            mainLayout.Children.Add(
                memoryLED,
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.0375);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.4661);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.0236);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0152);
            }));

            /// To display the device battery status
            var batteryLED = new Image
            {
                Source = "led.png"
            };

            mainLayout.Children.Add(
                batteryLED,
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.5416);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.4661);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.0236);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0152);
            }));

            /// To display the language setting on the device
            var language = new Label {
            };

            language.Style = ApplicationInformationStyle.ContentStyle;

            mainLayout.Children.Add(
                language,
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.0375);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.7032);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.4486);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0319);
            }));

            /// To display the region format setting on the device
            var regionFormat = new Label {
            };

            regionFormat.Style = ApplicationInformationStyle.ContentStyle;

            mainLayout.Children.Add(
                regionFormat,
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.5416);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.7032);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.4486);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0319);
            }));

            /// To display the orientation of the device
            var deviceOrienation = new Label {
            };

            deviceOrienation.Style = ApplicationInformationStyle.ContentStyle;

            mainLayout.Children.Add(
                deviceOrienation,
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.0375);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.9109);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.4661);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0321);
            }));

            /// To display the orientation degree of the device
            var rotationDegree = new Label {
            };

            rotationDegree.Style = ApplicationInformationStyle.LargerContentStyle;

            mainLayout.Children.Add(
                rotationDegree,
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.5416);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.8254);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.4486);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.1276);
            }));

            BindingContextChanged += (s, e) =>
            {
                if (BindingContext == null)
                {
                    return;
                }

                icon.Source             = ((ApplicationInformationViewModel)BindingContext).IconPath;
                applicationName.Text    = ((ApplicationInformationViewModel)BindingContext).Name;
                applicationID.Text      = ((ApplicationInformationViewModel)BindingContext).ID;
                applicationVersion.Text = ((ApplicationInformationViewModel)BindingContext).Version;

                memoryLED.BindingContext        = BindingContext;
                batteryLED.BindingContext       = BindingContext;
                language.BindingContext         = BindingContext;
                regionFormat.BindingContext     = BindingContext;
                deviceOrienation.BindingContext = BindingContext;
                rotationDegree.BindingContext   = BindingContext;

                language.SetBinding(Label.TextProperty, "Language");
                regionFormat.SetBinding(Label.TextProperty, "RegionFormat");
                deviceOrienation.SetBinding(Label.TextProperty, "DeviceOrientation");
                rotationDegree.SetBinding(Label.TextProperty, "RotationDegree");

                memoryLED.SetBinding(ImageAttributes.BlendColorProperty, "LowMemoryLEDColor");
                batteryLED.SetBinding(ImageAttributes.BlendColorProperty, "LowBatteryLEDColor");
            };

            /// Set mainLayout as Content of the page
            Content = mainLayout;
        }
Example #37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PopupLayout" /> class.
 /// </summary>
 public PopupLayout()
 {
     base.Content = layout = new RelativeLayout();
 }
        public RelativeLayoutExample()
        {
            RelativeLayout relativeLayout = new RelativeLayout();

            Label upperLeft = new Label
            {
                Text     = "Upper Left",
                FontSize = 20
            };

            relativeLayout.Children.Add(upperLeft,
                                        Constraint.Constant(0),
                                        Constraint.Constant(0));

            Label below = new Label
            {
                Text     = "Below Upper Left",
                FontSize = 15
            };

            relativeLayout.Children.Add(below,
                                        Constraint.Constant(0),
                                        Constraint.RelativeToView(upperLeft, (parent, sibling) =>
            {
                return(sibling.Y + sibling.Height);
            })
                                        );


            Label constantLabel = new Label
            {
                Text     = "Constants are Absolute",
                FontSize = 20
            };

            relativeLayout.Children.Add(constantLabel,
                                        Constraint.Constant(100),
                                        Constraint.Constant(100),
                                        Constraint.Constant(50),
                                        Constraint.Constant(200));

            Label halfwayDown = new Label
            {
                Text     = "Halfway down and across",
                FontSize = 15
            };

            relativeLayout.Children.Add(halfwayDown,
                                        Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width / 2);
            }),
                                        Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height / 2);
            })
                                        );


            BoxView boxView = new BoxView {
                Color             = Color.Accent,
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.StartAndExpand
            };

            relativeLayout.Children.Add(boxView,
                                        Constraint.Constant(0),
                                        Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height / 2);
            }),
                                        Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width / 2);
            }),
                                        Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height / 2);
            })
                                        );


            Content = relativeLayout;
        }
Example #39
0
        public ColorLinesNG(RelativeLayout mainLayout, View [] hackyViews = null)
        {
            this.Bottom   = -1.0f;
            this.Top      = 1.0f;
            this.Left     = -1.0f;
            this.Right    = 1.0f;
            this.time     = new Stopwatch();
            this.GameView = new SKGLView()
            {
                HasRenderLoop     = true,
                EnableTouchEvents = false
            };
            this.GameView.PaintSurface += (sender, ev) => {
#if __IOS__
                if (this.Sleeping)
                {
                    if (!this.wentSleeping)
                    {
                        this.GameView.HasRenderLoop = false;
                        this.wentSleeping           = true;
                    }
                    return;
                }
                else if (this.wentSleeping)
                {
                    this.wentSleeping = false;
                }
                this.Sleeping = false;

                if (App.iPhoneX)
                {
                    this.X      = 0;
                    this.Y      = (int)(44.0f * UIKit.UIScreen.MainScreen.Scale);
                    this.Width  = ev.RenderTarget.Width;
                    this.Height = ev.RenderTarget.Height - (int)(88.0f * UIKit.UIScreen.MainScreen.Scale);
                }
                else
#endif
                if (Device.Idiom == TargetIdiom.Desktop)
                {
                    int width  = ev.RenderTarget.Width;
                    int height = ev.RenderTarget.Height;
                    if ((height * App.MinDesktopRatio) > width)
                    {
                        this.Width  = width;
                        this.Height = (int)(width / App.MinDesktopRatio);
                    }
                    else
                    {
                        this.Width  = (int)(height * App.MinDesktopRatio);
                        this.Height = height;
                    }
                    this.X = (int)(width * 0.5f - this.Width * 0.5f);
                    this.Y = (int)(height * 0.5f - this.Height * 0.5f);
                }
                else
                {
                    this.X      = 0;
                    this.Y      = 0;
                    this.Width  = ev.RenderTarget.Width;
                    this.Height = ev.RenderTarget.Height;
                }
                if (this.field == null)
                {
                    this.Init(mainLayout, hackyViews);
                }
                this.Render(ev.Surface.Canvas);
            };
        }
Example #40
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Xamarin.Insights.Initialize(XamarinInsights.ApiKey, this);
            base.OnCreate(savedInstanceState);

            RequestWindowFeature(WindowFeatures.NoTitle);
            Window.AddFlags(WindowManagerFlags.KeepScreenOn);
            locMgr = GetSystemService(Context.LocationService) as LocationManager;

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            upPanel       = FindViewById <RelativeLayout> (Resource.Id.maUpPanelRL);
            botPanel      = FindViewById <RelativeLayout> (Resource.Id.maDownPanelRL);
            beforeSignIn  = FindViewById <RelativeLayout> (Resource.Id.sifBeforeSignInRL);
            content       = FindViewById <FrameLayout> (Resource.Id.maContentFL);
            pharamcyTable = FindViewById <TableLayout> (Resource.Id.maPharmacyTable);
            bSignIn       = FindViewById <Button> (Resource.Id.maSignInButton);
            next          = FindViewById <ImageView> (Resource.Id.maNextImage);
            prev          = FindViewById <ImageView> (Resource.Id.maPrevImage);
            pageNum       = FindViewById <TextView> (Resource.Id.maPageText);

            // Up Panel
            upNextBlock        = FindViewById <ImageView> (Resource.Id.maNextBockIV);
            upNextBlock.Click += (object sender, EventArgs e) => {
                if (fragmentNum < 3)
                {
                    fragmentNum++;
                    RefreshContent();
                }
            };
            upPrevBlock        = FindViewById <ImageView> (Resource.Id.maPrevBlockIV);
            upPrevBlock.Click += (object sender, EventArgs e) => {
                if (fragmentNum > 1)
                {
                    fragmentNum--;
                    RefreshContent();
                }
            };
            upInfo          = FindViewById <TextView> (Resource.Id.maInfoText);
            upLogout        = FindViewById <ImageView> (Resource.Id.maLogOut);
            upLogout.Click += (object sender, EventArgs e) => {
                Common.SetCurrentUser(null);
                RefreshMainView();
            };
            upSync        = FindViewById <ImageView> (Resource.Id.maSync);
            upSync.Click += (object sender, EventArgs e) => {
                StartActivity(typeof(SyncActivity));
            };
            upStartAttendance        = FindViewById <Button> (Resource.Id.maStartAttendance);
            upStartAttendance.Click += UpStartAttendance_Click;
            upEndAttendance          = FindViewById <Button> (Resource.Id.maEndAttendance);
            upEndAttendance.Click   += UpEndAttendance_Click;
            upClose        = FindViewById <Button> (Resource.Id.maClose);
            upClose.Click += UpRightB_Click;

            next.Click += (object sender, EventArgs e) => {
                page++;
                if (page == 1)
                {
                    prev.Enabled = false;
                }
                else
                {
                    prev.Enabled = true;
                }
                RefreshPharmacyTable();
            };

            prev.Click += (object sender, EventArgs e) => {
                page--;
                if (page == 1)
                {
                    prev.Enabled = false;
                }
                else
                {
                    prev.Enabled = true;
                }
                RefreshPharmacyTable();
            };

            bSignIn.Click += (object sender, EventArgs e) => {
                //rlBeforeSignIn.Visibility = ViewStates.Gone;
                FragmentTransaction trans        = FragmentManager.BeginTransaction();
                SigninDialog        signinDialog = new SigninDialog(this);
                signinDialog.Show(trans, "dialog fragment");
                signinDialog.SuccessSignedIn += SigninDialog_SuccessSignedIn;

                Log.Info("maSignInButton", "Click");
            };

//			Common.SetCurrentUser (null);
            RefreshMainView();

//			List<Attendance> atts =(List<Attendance>) AttendanceManager.GetAttendances ();
//			foreach (var item in atts) {
//				SyncQueueManager.AddToQueue (item);
//			}
        }
Example #41
0
        public LoginPage()
        {
            Cores coresPadrao = new Cores();

            BackgroundColor = coresPadrao.VermelhoPadrao;

            var logo = new Image
            {
                Source = ImageSource.FromFile("Images/logo.png")
            };

            Entry entryLogin = new Entry
            {
                TextColor        = Color.White,
                Placeholder      = "Login",
                PlaceholderColor = coresPadrao.BrancoOpaco,
                Keyboard         = Keyboard.Email
            };

            Entry entrySenha = new Entry
            {
                TextColor        = Color.White,
                Placeholder      = "Senha",
                PlaceholderColor = coresPadrao.BrancoOpaco,
                IsPassword       = true,
                Keyboard         = Keyboard.Text
            };

            Label dicaLogin = new Label
            {
                Text      = "Email ou número de telefone",
                TextColor = Color.White,
                FontSize  = Device.GetNamedSize(NamedSize.Small, typeof(Label))
            };

            Label dicaSenha = new Label
            {
                Text      = "Mínimo de 6 caracteres",
                TextColor = Color.White,
                FontSize  = Device.GetNamedSize(NamedSize.Small, typeof(Label))
            };

            Button btnEntrar = new Button
            {
                Text            = "Entrar",
                TextColor       = Color.White,
                BackgroundColor = coresPadrao.VerdePadrao
            };

            Label lblCriarConta = new Label
            {
                Text                    = "Ainda não tem uma conta no Bon'App Pizza? Crie uma agora... É rápido!",
                TextColor               = Color.White,
                LineBreakMode           = LineBreakMode.WordWrap,
                HorizontalTextAlignment = TextAlignment.Center
            };


            StackLayout stackLayout = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    logo,
                    entryLogin,
                    dicaLogin,
                    entrySenha,
                    dicaSenha,
                    btnEntrar,
                    lblCriarConta
                }
            };

            RelativeLayout relativeLayout = new RelativeLayout();

            relativeLayout.Children.Add(stackLayout,
                                        Constraint.RelativeToParent((parent) =>
            {
                return(parent.X + parent.Width / 3);
            }
                                                                    ),
                                        Constraint.Constant(15),
                                        Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width / 2);
            }
                                                                    ),
                                        Constraint.Constant(200)
                                        );


            this.Content = relativeLayout;
        }
Example #42
0
        public async Task LoadControl()
        {
            this.topicVM = new TopicViewModel(TopicUrl, "Topic");
            await this.topicVM.PopulateDataAsync(true);

            var scrollableContent = new StackLayout()
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.StartAndExpand
            };

            var padding = new Thickness(5, 5, 0, 5);

            if (this.topicVM.ModelCollection != null &&
                this.topicVM.ModelCollection.Count >= 0)
            {
                foreach (var topic in this.topicVM.ModelCollection)
                {
                    var label = new Label()
                    {
                        TextColor               = Colors.TextColor,
                        BackgroundColor         = Color.Transparent,
                        VerticalOptions         = LayoutOptions.Center,
                        HorizontalOptions       = LayoutOptions.Center,
                        LineBreakMode           = LineBreakMode.WordWrap,
                        HorizontalTextAlignment = TextAlignment.Center
                    };
                    label.Text = topic.Description;
                    var boxView = new RelativeLayout()
                    {
                        BackgroundColor   = Colors.BoxColor,
                        WidthRequest      = 120,
                        HeightRequest     = 120,
                        VerticalOptions   = LayoutOptions.CenterAndExpand,
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                    };

                    boxView.Children.Add(
                        label,
                        xConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return((parent.Width - label.Width) / 2);
                    }),
                        yConstraint: Constraint.RelativeToParent((parent) =>
                    {
                        return((parent.Height - label.Height) / 2);
                    })
                        );
                    var    boxViewTap = new TapGestureRecognizer();
                    string children   = topic.Children;
                    boxViewTap.Command = new Command(() => {
                        var navigation = Application.Current.MainPage.Navigation;
                        string url     = string.Format("https://onehundredcommon.herokuapp.com/api/content/{0}", children);
                        navigation.PushAsync(new ContentScreen(url));
                    });
                    boxView.GestureRecognizers.Add(boxViewTap);
                    scrollableContent.Children.Add(boxView);
                }
            }
            else
            {
                padding = new Thickness(0);
            }


            this.Content = new ScrollView()
            {
                Padding           = padding,
                BackgroundColor   = Colors.PaddingColor,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = ScrollOrientation.Horizontal,
                Content           = scrollableContent,
            };
        }
Example #43
0
        public RegistrationView()
        {
            var backgroundImage = new Image()
            {
                Source = new FileImageSource()
                {
                    File = "blurredBackground.jpg"
                },
                Aspect = Aspect.AspectFill
            };

            this.Children.Add(
                backgroundImage,
                Constraint.Constant(0),
                Constraint.Constant(0),
                Constraint.RelativeToParent((parent) => {
                return(parent.Width);
            }),
                Constraint.RelativeToParent((parent) => {
                return(parent.Height);
            })
                );

            double textEntriesPadding = 40;
            double textEntriesHeight  = 40;

            HeaderView generalInfoHeader = new HeaderView()
            {
                Title         = "General Info",
                ImagesName    = "circle.png",
                HeightRequest = textEntriesHeight
            };

            emailEntry = new InputView();
            emailEntry.entry.TextColor            = Color.White;
            emailEntry.entry.PlaceholderColor     = Color.White;
            emailEntry.entry.Keyboard             = Keyboard.Email;
            emailEntry.bottomLine.BackgroundColor = Color.White;
            emailEntry.image.Source = new FileImageSource()
            {
                File = "inbox.png"
            };
            emailEntry.entry.Placeholder = "Email";
            emailEntry.HeightRequest     = textEntriesHeight;

            firstNameEntry = new InputView();
            firstNameEntry.entry.TextColor            = Color.White;
            firstNameEntry.entry.PlaceholderColor     = Color.White;
            firstNameEntry.bottomLine.BackgroundColor = Color.White;
            firstNameEntry.image.Source = new FileImageSource()
            {
                File = "user_white.png"
            };
            firstNameEntry.entry.Placeholder = "First Name";
            firstNameEntry.HeightRequest     = textEntriesHeight;

            lastNameEntry = new InputView();
            lastNameEntry.entry.TextColor            = Color.White;
            lastNameEntry.entry.PlaceholderColor     = Color.White;
            lastNameEntry.bottomLine.BackgroundColor = Color.White;
            lastNameEntry.image.Source = new FileImageSource()
            {
                File = "many_user.png"
            };
            lastNameEntry.entry.Placeholder = "Last Name";
            lastNameEntry.HeightRequest     = textEntriesHeight;

            passwordEntry = new InputView();
            passwordEntry.entry.TextColor            = Color.White;
            passwordEntry.entry.PlaceholderColor     = Color.White;
            passwordEntry.entry.IsPassword           = true;
            passwordEntry.bottomLine.BackgroundColor = Color.White;
            passwordEntry.image.Source = new FileImageSource()
            {
                File = "lock_white.png"
            };
            passwordEntry.entry.Placeholder = "Password";
            passwordEntry.HeightRequest     = textEntriesHeight;

            HeaderView addressHeader = new HeaderView()
            {
                Title         = "Address Info",
                ImagesName    = "circle.png",
                HeightRequest = textEntriesHeight
            };

            countryEntry = new InputView();
            countryEntry.entry.TextColor            = Color.White;
            countryEntry.entry.PlaceholderColor     = Color.White;
            countryEntry.bottomLine.BackgroundColor = Color.White;
            countryEntry.image.Source = new FileImageSource()
            {
                File = "country.png"
            };
            countryEntry.entry.Placeholder = "Country";
            countryEntry.HeightRequest     = textEntriesHeight;


            cityEntry = new InputView();
            cityEntry.entry.TextColor            = Color.White;
            cityEntry.entry.PlaceholderColor     = Color.White;
            cityEntry.bottomLine.BackgroundColor = Color.White;
            cityEntry.image.Source = new FileImageSource()
            {
                File = "city.png"
            };
            cityEntry.entry.Placeholder = "City";
            cityEntry.HeightRequest     = textEntriesHeight;

            addressEntry = new InputView();
            addressEntry.entry.TextColor            = Color.White;
            addressEntry.entry.PlaceholderColor     = Color.White;
            addressEntry.bottomLine.BackgroundColor = Color.White;
            addressEntry.image.Source = new FileImageSource()
            {
                File = "address.png"
            };
            addressEntry.entry.Placeholder = "Address";
            addressEntry.HeightRequest     = textEntriesHeight;

            phoneNumber = new InputView();
            phoneNumber.entry.TextColor            = Color.White;
            phoneNumber.entry.PlaceholderColor     = Color.White;
            phoneNumber.entry.Keyboard             = Keyboard.Telephone;
            phoneNumber.bottomLine.BackgroundColor = Color.White;
            phoneNumber.image.Source = new FileImageSource()
            {
                File = "phone.png"
            };
            phoneNumber.entry.Placeholder = "Phone";
            phoneNumber.HeightRequest     = textEntriesHeight;

            var bottomSeparatorView = new RelativeLayout()
            {
                HeightRequest = 5
            };

            registrationButton = new Button()
            {
                BackgroundColor = ColorMap.BlackTransparentBackground,
                TextColor       = Color.White,
                BorderRadius    = 3,
                BorderColor     = Color.White,
                BorderWidth     = 2,
                FontSize        = 16,
                FontAttributes  = FontAttributes.Bold,
                Text            = "REGISTER",
                HeightRequest   = textEntriesHeight
            };

            var stackContentView = new StackLayout()
            {
                Padding         = new Thickness(textEntriesPadding, 125, textEntriesPadding, 25),
                Spacing         = 5,
                VerticalOptions = LayoutOptions.Start,
                Children        =
                {
                    generalInfoHeader,
                    this.emailEntry,
                    this.firstNameEntry,
                    this.lastNameEntry,
                    this.passwordEntry,
                    addressHeader,
                    this.countryEntry,
                    this.cityEntry,
                    this.addressEntry,
                    this.phoneNumber,
                    bottomSeparatorView,
                    this.registrationButton
                }
            };

            var scrollView = new ScrollView()
            {
                Content = stackContentView,
            };

            this.Children.Add(
                scrollView,
                Constraint.Constant(0),
                Constraint.Constant(0),
                Constraint.RelativeToParent((parent) => {
                return(parent.Width);
            }),
                Constraint.RelativeToParent((parent) => {
                return(parent.Height);
            })
                );

            var circleView = new RoundedBoxView()
            {
                Color         = ColorMap.OrangeColor,
                OutlineColor  = ColorMap.OrangeColor,
                OutlineWidth  = 1,
                CornerRadius  = 2000,
                WidthRequest  = 100,
                HeightRequest = 100
            };

            double circleDiametre         = 700;
            double visibleCirclePropotion = 0.15;

            this.Children.Add(
                circleView,
                Constraint.RelativeToParent((parent) => {
                return(-(circleDiametre - parent.Width) / 2);
            }),
                Constraint.Constant(-circleDiametre * (1 - visibleCirclePropotion)),
                Constraint.Constant(circleDiametre),
                Constraint.Constant(circleDiametre)
                );

            showLogInButton = new Button()
            {
                BackgroundColor = Color.Transparent,
                TextColor       = Color.White,
                BorderRadius    = 0,
                BorderColor     = Color.Transparent,
                BorderWidth     = 0,
                FontSize        = 16,
                FontAttributes  = FontAttributes.Italic,
                Text            = "Already have an account ?"
            };

            double showLoginButtonWidth  = 250;
            double showLoginButtonHeight = 30;

            this.Children.Add(
                showLogInButton,
                Constraint.RelativeToParent((parent) => {
                return((parent.Width - showLoginButtonWidth) / 2);
            }),
                Constraint.Constant(20),
                Constraint.Constant(showLoginButtonWidth),
                Constraint.Constant(showLoginButtonHeight)
                );
        }
Example #44
0
        private void Init(RelativeLayout mainLayout, View [] hackyViews = null)
        {
            float textureScale = this.Width * 0.00087f;

            this.SetScreenVirtualCoords(this.Width, this.Height);

            var textureIdsDouble = new int[embeddedTextures.Length][];
            int i = 0, size = 0;

            foreach (var texturesArray in embeddedTextures)
            {
                textureIdsDouble[i] = new int[texturesArray.Length];
                int j = 0;
                foreach (var texture in texturesArray)
                {
                    embeddedTextures[i][j].Name = string.Format("CLNG_{0}.png", texture.Name);
                    j++;
                    size++;
                }
                i++;
            }
            this.textureIds = new int[size];
            bool loadTexture =             /*!embeddedTextures[j][k].InitIgnore || */
                               Device.RuntimePlatform == Device.Android ||
                               Device.RuntimePlatform == Device.iOS ||
                               Device.Idiom == TargetIdiom.Desktop;

            //when the app is restarted (Android only for now)
            //then we cannot reload embedded resources
            //so we store them static and won't reload afterward
            if (ColorLinesNG.images == null)
            {
                ColorLinesNG.images = new SKImage[size];
            }
            else
            {
                loadTexture = false;
            }
            int [] specialBgTextureIds = new int[2];
            for (i = 0; i < size; i++)
            {
                int j = 0, sum = 0;
                foreach (var texturesArray in embeddedTextures)
                {
                    int k = 0;
                    foreach (var texture in texturesArray)
                    {
                        if (i == sum)
                        {
                            if (loadTexture)
                            {
                                ColorLinesNG.images[i] = LoadTexture(embeddedTextures[j][k], textureScale);
                            }
                            textureIdsDouble[j][k] = i;
                            if (embeddedTextures[j][k].Name.Equals("CLNG_Stars.png"))
                            {
                                specialBgTextureIds[0] = i;
                            }
                            else if (embeddedTextures[j][k].Name.Equals("CLNG_Nebula.png"))
                            {
                                specialBgTextureIds[1] = i;
                            }
                        }
                        else if (i < sum)
                        {
                            break;
                        }
                        k++;
                        sum++;
                    }
                    j++;
                }
            }
            this.field = new CLField(textureIdsDouble);
            this.field.InitVisuals(this.Left, this.Right, this.Bottom, this.Top, this.time.ElapsedMilliseconds, hackyViews);
            this.reQueue = new CLReQueue(mainLayout, ColorLinesNG.images, specialBgTextureIds);

            this.time.Start();

            this.Inited?.Invoke(this, new EventArgs());
        }
Example #45
0
        public CameraPage()
        {
            BindingContext = captureModel = new CaptureViewModel();
            Title          = "Camera";
            layout         = new RelativeLayout();

            if (CrossMedia.Current.IsCameraAvailable)
            {
                BackgroundColor = Color.Black;

                // Camera Preview
                cameraPreview = new XCameraView();
                //cameraPreview.CameraOption = Settings.CameraOption;
                cameraPreview.CaptureBytesCallback = new Action <byte[]>(ProcessCameraPhoto);
                cameraPreview.CameraReady         += (s, e) => StartCamera();

                layout.Children.Add(cameraPreview,
                                    Constraint.Constant(0),
                                    Constraint.RelativeToParent((parent) =>
                {
                    var viewHeight = MathUtils.FitSize4X3(parent.Width, parent.Height).Height;
                    return(parent.Height / 2 - viewHeight / 2);
                }),
                                    Constraint.RelativeToParent((parent) =>
                {
                    return(MathUtils.FitSize4X3(parent.Width, parent.Height).Width);
                }),
                                    Constraint.RelativeToParent((parent) =>
                {
                    return(MathUtils.FitSize4X3(parent.Width, parent.Height).Height);
                }));

                // Capture Button
                var buttonSize    = 60;
                var captureButton = new Button();
                captureButton.Clicked          += CaptureButton_Clicked;
                captureButton.BackgroundColor   = Color.LightGray.MultiplyAlpha(.5);
                captureButton.WidthRequest      = buttonSize;
                captureButton.HeightRequest     = buttonSize;
                captureButton.CornerRadius      = buttonSize / 2;
                captureButton.BorderWidth       = 1;
                captureButton.BorderColor       = Color.DarkGray;
                captureButton.HorizontalOptions = LayoutOptions.Center;

                layout.Children.Add(captureButton,
                                    Constraint.RelativeToParent((parent) => { return((parent.Width * .5) - (buttonSize * .5)); }),
                                    Constraint.RelativeToParent((parent) => { return((parent.Height * .9) - (buttonSize * .5)); }));

                // Last Capture
                cachedCapture                 = new CachedImage();
                cachedCapture.Aspect          = Aspect.AspectFill;
                cachedCapture.BackgroundColor = Color.White;

                layout.Children.Add(cachedCapture,
                                    Constraint.Constant(20),
                                    Constraint.RelativeToView(captureButton, (parent, sibling) => { return(sibling.Y); }),
                                    Constraint.Constant(buttonSize),
                                    Constraint.Constant(buttonSize));

                this.ToolbarItems.Add(
                    new ToolbarItem("Toggle", null, () => ToggleCamera())
                {
                    Icon = "toggle.png"
                }
                    );
            }

            else
            {
                messageLabel = new Label()
                {
                    WidthRequest            = 300,
                    TextColor               = Color.SlateGray,
                    HorizontalOptions       = LayoutOptions.Center,
                    HorizontalTextAlignment = TextAlignment.Center
                };
                messageLabel.Text = "The camera not supported on this device.";

                layout.Children.Add(messageLabel,
                                    Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Width * .5 - messageLabel.Width * .5);
                }),
                                    Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Height * .4);
                })
                                    );

                titleLabel = new Label()
                {
                    WidthRequest            = 300,
                    HeightRequest           = 20,
                    FontAttributes          = FontAttributes.Bold,
                    TextColor               = Color.Black,
                    HorizontalOptions       = LayoutOptions.Center,
                    HorizontalTextAlignment = TextAlignment.Center
                };
                titleLabel.Text = "No Camera";
                layout.Children.Add(titleLabel,
                                    Constraint.RelativeToParent((parent) =>
                {
                    return(parent.Width * .5 - titleLabel.Width * .5);
                }),
                                    Constraint.RelativeToView(messageLabel, (parent, sibling) =>
                {
                    return(sibling.Y - titleLabel.Height - 10);
                })
                                    );
            }

            Content = layout;
        }
        public RelativeLayoutDemoPage()
        {
            Label header = new Label
            {
                Text                    = "RelativeLayout",
                FontSize                = 40,
                FontAttributes          = FontAttributes.Bold,
                HorizontalTextAlignment = TextAlignment.Center
            };

            // Create the RelativeLayout
            RelativeLayout relativeLayout = new RelativeLayout
            {
                Margin = new Thickness(10)
            };

            // A Label whose upper-left is centered vertically.
            Label referenceLabel = new Label
            {
                Text     = "Not visible",
                Opacity  = 0,
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
            };

            relativeLayout.Children.Add(referenceLabel,
                                        Constraint.Constant(0),
                                        Constraint.RelativeToParent((parent) => {
                return(parent.Height / 2);
            }));

            // A Label centered vertically.
            Label centerLabel = new Label
            {
                Text     = "Center",
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
            };

            relativeLayout.Children.Add(centerLabel,
                                        Constraint.Constant(0),
                                        Constraint.RelativeToView(referenceLabel, (parent, sibling) => {
                return(sibling.Y - sibling.Height / 2);
            }));

            // A Label above the centered Label.
            Label aboveLabel = new Label
            {
                Text     = "Above",
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
            };

            relativeLayout.Children.Add(aboveLabel,
                                        Constraint.RelativeToView(centerLabel, (parent, sibling) => {
                return(sibling.X + sibling.Width);
            }),
                                        Constraint.RelativeToView(centerLabel, (parent, sibling) => {
                return(sibling.Y - sibling.Height);
            }));

            // A Label below the centered Label.
            Label belowLabel = new Label
            {
                Text     = "Below",
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
            };

            relativeLayout.Children.Add(belowLabel,
                                        Constraint.RelativeToView(centerLabel, (parent, sibling) => {
                return(sibling.X + sibling.Width);
            }),
                                        Constraint.RelativeToView(centerLabel, (parent, sibling) => {
                return(sibling.Y + sibling.Height);
            }));

            // Finish with another on top...
            Label furtherAboveLabel = new Label
            {
                Text     = "Further Above",
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
            };

            relativeLayout.Children.Add(furtherAboveLabel,
                                        Constraint.RelativeToView(aboveLabel, (parent, sibling) => {
                return(sibling.X + sibling.Width);
            }),
                                        Constraint.RelativeToView(aboveLabel, (parent, sibling) => {
                return(sibling.Y - sibling.Height);
            }));

            // ...and another on the bottom.
            Label furtherBelowLabel = new Label
            {
                Text     = "Further Below",
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
            };

            relativeLayout.Children.Add(furtherBelowLabel,
                                        Constraint.RelativeToView(belowLabel, (parent, sibling) => {
                return(sibling.X + sibling.Width);
            }),
                                        Constraint.RelativeToView(belowLabel, (parent, sibling) => {
                return(sibling.Y + sibling.Height);
            }));

            // Four BoxView's
            relativeLayout.Children.Add(
                new BoxView {
                Color = Color.Red
            },
                Constraint.Constant(0),
                Constraint.Constant(0));

            relativeLayout.Children.Add(
                new BoxView {
                Color = Color.Green
            },
                Constraint.RelativeToParent((parent) => {
                return(parent.Width - 40);
            }),
                Constraint.Constant(0));

            relativeLayout.Children.Add(
                new BoxView {
                Color = Color.Blue
            },
                Constraint.Constant(0),
                Constraint.RelativeToParent((parent) => {
                return(parent.Height - 40);
            }));

            relativeLayout.Children.Add(
                new BoxView {
                Color = Color.Yellow
            },
                Constraint.RelativeToParent((parent) => {
                return(parent.Width - 40);
            }),
                Constraint.RelativeToParent((parent) => {
                return(parent.Height - 40);
            }));

            // Build the page.
            Title = "RelativeLayout Demo";
            Grid grid = new Grid
            {
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

            grid.Children.Add(header, 0, 0);
            grid.Children.Add(relativeLayout, 0, 1);

            Content = grid;
        }
Example #47
0
        public RelativeLayoutPageCode()
        {
            Title           = "RelativeLayout - C#";
            BackgroundImage = "deer.jpg";

            var outerLayout = new RelativeLayout();

            outerLayout.Children.Add(new BoxView {
                BackgroundColor = Color.FromHex("#AA1A7019")
            }, Constraint.RelativeToParent((parent) => {
                return(0);
            }), Constraint.RelativeToParent((parent) => {
                return(0);
            }), Constraint.RelativeToParent((parent) => {
                return(parent.Width);
            }), Constraint.RelativeToParent((parent) => {
                return(parent.Height);
            }));

            var scrollView = new ScrollView();

            outerLayout.Children.Add(scrollView, Constraint.RelativeToParent((parent) => {
                return(0);
            }), Constraint.RelativeToParent((parent) => {
                return(0);
            }), Constraint.RelativeToParent((parent) => {
                return(parent.Width);
            }), Constraint.RelativeToParent((parent) => {
                return(parent.Height - 60);
            }));

            var innerLayout = new RelativeLayout();

            scrollView.Content = innerLayout;
            var imageDeer = new Image {
                Source = "deer.jpg"
            };

            innerLayout.Children.Add(imageDeer, Constraint.RelativeToParent((parent) => {
                return(parent.Width * .1);
            }), Constraint.RelativeToParent((parent) => {
                return(10);
            }), Constraint.RelativeToParent((parent) => {
                return(parent.Width * .8);
            }), null);

            innerLayout.Children.Add(new Label {
                Text = "deer,jpg", HorizontalTextAlignment = TextAlignment.Center
            }, Constraint.RelativeToParent((parent) => {
                return(0);
            }), Constraint.RelativeToView(imageDeer, ((parent, sibling) => {
                return(sibling.Height + 20);
            })), Constraint.RelativeToParent((parent) => {
                return(parent.Width);
            }), Constraint.RelativeToParent((parent) => {
                return(75);
            }));

            outerLayout.Children.Add(new Button {
                Text            = "Previous",
                BackgroundColor = Color.White,
                TextColor       = Color.Green,
                BorderRadius    = 0
            }, Constraint.RelativeToParent((parent) => {
                return(0);
            }), Constraint.RelativeToParent((parent) => {
                return(parent.Height - 60);
            }), Constraint.RelativeToParent((parent) => {
                return(parent.Width * .5);
            }), Constraint.RelativeToParent((parent) => {
                return(60);
            }));
            outerLayout.Children.Add(new Button {
                Text            = "Next",
                BackgroundColor = Color.White,
                TextColor       = Color.Green,
                BorderRadius    = 0
            }, Constraint.RelativeToParent((parent) => {
                return(parent.Width * .5);
            }), Constraint.RelativeToParent((parent) => {
                return(parent.Height - 60);
            }), Constraint.RelativeToParent((parent) => {
                return(parent.Width * .5);
            }), Constraint.RelativeToParent((parent) => {
                return(60);
            }));
            Content = outerLayout;
        }
Example #48
0
        /* After pushing CalendarPage() into the NavigationPage stack (App.cs:33), constructor is invoked. Here, an instance of a calendar is created, some of its properties and event are
         * set up. All the buttons shown in CalendarPage() are instances of ToolbarItems. The business logic of this page can be found in CalendarViewModel(). */
        public CalendarPage()
        {
            DependencyService.Get <IStatusBar>().ShowStatusBar();

            calendar = new RadCalendar
            {
                WeekNumbersDisplayMode = DisplayMode.Hide,
                DayNamesDisplayMode    = DisplayMode.Show,
                GridLinesWidth         = 0,
            };

            this.BindingContext          = new CalendarViewModel(this, this.Navigation, calendar);
            calendar.ViewChanged        += ((CalendarViewModel)this.BindingContext).calendarViewChanged;
            calendar.DisplayDateChanged += ((CalendarViewModel)this.BindingContext).dateChanged;

            if (Device.RuntimePlatform == Device.iOS)
            {
                calendar.DayNameCellStyle = new CalendarCellStyle {
                    FontSize = 12
                };
                var layout = new RelativeLayout();
                this.changeLayout(calendar, layout);
                layout.SizeChanged += (sender, e) =>
                {
                    this.changeLayout(calendar, layout);
                };
            }
            else
            {
                Content = calendar;
            }

            var addAppointmentButton = new ToolbarItem
            {
                Icon     = Device.RuntimePlatform == Device.Android ? "add_ic" : "",
                Text     = "Add",
                Order    = ToolbarItemOrder.Primary,
                Priority = 1
            };

            addAppointmentButton.SetBinding(MenuItem.CommandProperty, new Binding("AddAppointmentCommand"));

            var changeViewButton = new ToolbarItem
            {
                Icon     = Device.RuntimePlatform == Device.Android ? "day_ic" : "",
                Text     = "BarButton",
                Order    = ToolbarItemOrder.Primary,
                Priority = 0,
                Command  = new Command(() =>
                {
                    var selectedDate = calendar.SelectedDate;
                    if (calendar.ViewMode != CalendarViewMode.Day)
                    {
                        calendar.TrySetViewMode(CalendarViewMode.Day, true);
                        if (selectedDate.HasValue)
                        {
                            calendar.DisplayDate  = selectedDate.Value;
                            calendar.SelectedDate = selectedDate;
                        }
                    }
                    else
                    {
                        calendar.TrySetViewMode(CalendarViewMode.Month, true);
                    }
                })
            };

            ToolbarItems.Add(changeViewButton);
            ToolbarItems.Add(addAppointmentButton);

            string date = string.Empty;

            if (calendar.ViewMode == CalendarViewMode.Month)
            {
                if (Device.RuntimePlatform == Device.iOS)
                {
                    date = calendar.DisplayDate.Date.ToString("MMMM");
                }
                else
                {
                    date = calendar.DisplayDate.Year.ToString();
                }
            }
            else if (calendar.ViewMode == CalendarViewMode.MonthNames)
            {
                date = calendar.DisplayDate.Year.ToString();
            }

            ((CalendarViewModel)this.BindingContext).ChangeViewButton = new ToolbarItem
            {
                Text    = date == string.Empty ? string.Empty : string.Concat("Go to ", date),
                Command = new Command(() =>
                {
                    switch (calendar.ViewMode)
                    {
                    case CalendarViewMode.Month:
                        {
                            if (Device.RuntimePlatform == Device.iOS)
                            {
                                calendar.TrySetViewMode(CalendarViewMode.MonthNames);
                            }
                            else
                            {
                                calendar.TrySetViewMode(CalendarViewMode.Year);
                            }
                            break;
                        }

                    case CalendarViewMode.MonthNames:
                        {
                            if (Height > Width)
                            {
                                calendar.TrySetViewMode(CalendarViewMode.Year);
                            }
                            else
                            {
                                calendar.TrySetViewMode(CalendarViewMode.YearNumbers);
                            }
                            break;
                        }

                    case CalendarViewMode.YearNumbers:
                        break;
                    }
                }),
                Icon     = Device.RuntimePlatform == Device.Android ? "goto_ic" : "",
                Order    = ToolbarItemOrder.Primary,
                Priority = 1
            };
            ToolbarItems.Add(((CalendarViewModel)this.BindingContext).ChangeViewButton);

            string[]      secondaryButtonTitles = new string[] { "Today", "Settings", "Tickets", "Logout" };
            ToolbarItem[] secondaryToolbar      = new ToolbarItem[secondaryButtonTitles.Length];
            for (int i = 0; i < secondaryButtonTitles.Length; i++)
            {
                secondaryToolbar[i] = new ToolbarItem
                {
                    Text  = secondaryButtonTitles[i],
                    Order = ToolbarItemOrder.Secondary
                };
                secondaryToolbar[i].SetBinding(MenuItem.CommandProperty, new Binding(string.Concat(secondaryButtonTitles[i], "Command")));
                ToolbarItems.Add(secondaryToolbar[i]);
            }
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            try
            {
                SetContentView(Resource.Layout.YourSpecialization);
                inputMethodManager = Application.GetSystemService(Context.InputMethodService) as InputMethodManager;
                InputMethodManager    imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
                SpecializationMethods specializationMethods = new SpecializationMethods();
                searchET                = FindViewById <EditText>(Resource.Id.searchET);
                backRelativeLayout      = FindViewById <RelativeLayout>(Resource.Id.backRelativeLayout);
                back_button             = FindViewById <ImageButton>(Resource.Id.back_button);
                activityIndicator       = FindViewById <ProgressBar>(Resource.Id.activityIndicator);
                recyclerView            = FindViewById <RecyclerView>(Resource.Id.recyclerView);
                activityIndicatorSearch = FindViewById <ProgressBar>(Resource.Id.activityIndicatorSearch);
                searchLL                = FindViewById <LinearLayout>(Resource.Id.searchLL);
                search_recyclerView     = FindViewById <RecyclerView>(Resource.Id.search_recyclerView);
                nothingTV               = FindViewById <TextView>(Resource.Id.nothingTV);
                nothingIV               = FindViewById <ImageView>(Resource.Id.nothingIV);
                headerTV                = FindViewById <TextView>(Resource.Id.headerTV);
                searchBn                = FindViewById <Button>(Resource.Id.searchBn);
                close_searchBn          = FindViewById <ImageButton>(Resource.Id.close_searchBn);
                activityIndicator.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply);
                activityIndicatorSearch.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply);
                layoutManager        = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false);
                search_layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false);
                search_recyclerView.SetLayoutManager(search_layoutManager);
                recyclerView.SetLayoutManager(layoutManager);
                searchET.Visibility = ViewStates.Gone;

                Typeface tf = Typeface.CreateFromAsset(Assets, "Roboto-Regular.ttf");
                headerTV.SetTypeface(tf, TypefaceStyle.Bold);
                nothingTV.SetTypeface(tf, TypefaceStyle.Normal);
                searchET.SetTypeface(tf, TypefaceStyle.Normal);
                searchBn.SetTypeface(tf, TypefaceStyle.Normal);

                searchBn.Click += (s, e) =>
                {
                    close_searchBn.Visibility = ViewStates.Visible;
                    searchET.Visibility       = ViewStates.Visible;
                    searchBn.Visibility       = ViewStates.Gone;
                    headerTV.Visibility       = ViewStates.Gone;

                    searchET.RequestFocus();
                    showKeyboard();
                };

                searchET.EditorAction += (object sender, EditText.EditorActionEventArgs e) =>
                {
                    imm.HideSoftInputFromWindow(searchET.WindowToken, 0);
                };

                close_searchBn.Click += (s, e) =>
                {
                    searchET.Text = null;
                    imm.HideSoftInputFromWindow(searchET.WindowToken, 0);
                    searchLL.Visibility       = ViewStates.Gone;
                    headerTV.Visibility       = ViewStates.Visible;
                    searchET.Visibility       = ViewStates.Gone;
                    close_searchBn.Visibility = ViewStates.Gone;
                    searchBn.Visibility       = ViewStates.Visible;
                };

                searchET.TextChanged += async(s, e) =>
                {
                    if (!String.IsNullOrEmpty(searchET.Text))
                    {
                        nothingIV.Visibility               = ViewStates.Gone;
                        nothingTV.Visibility               = ViewStates.Gone;
                        searchLL.Visibility                = ViewStates.Visible;
                        close_searchBn.Visibility          = ViewStates.Visible;
                        activityIndicatorSearch.Visibility = ViewStates.Visible;
                        search_recyclerView.Visibility     = ViewStates.Gone;
                        activityIndicatorSearch.Visibility = ViewStates.Visible;
                        var search_content = await specializationMethods.SearchCategory(searchET.Text);

                        if (!search_content.ToLower().Contains("пошло не так".ToLower()) && !search_content.Contains("null"))
                        {
                            search_recyclerView.Visibility = ViewStates.Visible;
                            deserialized_search            = JsonConvert.DeserializeObject <List <SearchCategory> >(search_content.ToString());
                            List <SearchDisplaying> searchDisplayings = new List <SearchDisplaying>();
                            foreach (var item in deserialized_search)
                            {
                                if (item.hasSubcategory)
                                {
                                    searchDisplayings.Add(new SearchDisplaying {
                                        id = item.id, name = item.name, iconUrl = item.iconUrl, isRoot = true, hasSubcategory = true, rootId = item.id
                                    });
                                    if (item.subcategories != null)
                                    {
                                        foreach (var item1 in item.subcategories)
                                        {
                                            if (item1.hasSubcategory)
                                            {
                                                searchDisplayings.Add(new SearchDisplaying {
                                                    id = item1.id, name = item1.name, iconUrl = null, isRoot = false, hasSubcategory = true, rootId = item.id
                                                });
                                                if (item1.subcategories != null)
                                                {
                                                    foreach (var item2 in item1.subcategories)
                                                    {
                                                        if (item2.hasSubcategory)
                                                        {
                                                            searchDisplayings.Add(new SearchDisplaying {
                                                                id = item2.id, name = item2.name, iconUrl = null, isRoot = false, hasSubcategory = true, rootId = item.id
                                                            });
                                                            if (item2.subcategories != null)
                                                            {
                                                                foreach (var item3 in item2.subcategories)
                                                                {
                                                                    if (item3.subcategories != null)
                                                                    {
                                                                        searchDisplayings.Add(new SearchDisplaying {
                                                                            id = item3.id, name = item3.name, iconUrl = null, isRoot = false, hasSubcategory = true, rootId = item.id
                                                                        });
                                                                        foreach (var item4 in item3.subcategories)
                                                                        {
                                                                            searchDisplayings.Add(new SearchDisplaying {
                                                                                id = item4.id, name = item4.name, iconUrl = null, isRoot = false, hasSubcategory = true, rootId = item.id
                                                                            });
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        searchDisplayings.Add(new SearchDisplaying {
                                                                            id = item3.id, name = item3.name, iconUrl = null, isRoot = false, hasSubcategory = false, rootId = item.id
                                                                        });
                                                                    }
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            searchDisplayings.Add(new SearchDisplaying {
                                                                id = item2.id, name = item2.name, iconUrl = null, isRoot = false, hasSubcategory = false, rootId = item.id
                                                            });
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                searchDisplayings.Add(new SearchDisplaying {
                                                    id = item1.id, name = item1.name, iconUrl = null, isRoot = false, hasSubcategory = false, rootId = item.id
                                                });
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    searchDisplayings.Add(new SearchDisplaying {
                                        id = item.id, name = item.name, iconUrl = item.iconUrl, isRoot = true, hasSubcategory = false, rootId = item.id
                                    });
                                }
                            }

                            subCategorySearchAdapter = new SubCategorySearchAdapter(searchDisplayings, this, tf);
                            subCategorySearchAdapter.NotifyDataSetChanged();
                            search_recyclerView.SetAdapter(subCategorySearchAdapter);

                            subCategorySearchAdapter.NotifyDataSetChanged();
                        }
                        //catch
                        else
                        {
                            search_recyclerView.Visibility = ViewStates.Gone;
                            nothingIV.Visibility           = ViewStates.Visible;
                            nothingTV.Visibility           = ViewStates.Visible;
                        }

                        activityIndicatorSearch.Visibility = ViewStates.Gone;
                    }
                    else
                    {
                        close_searchBn.Visibility = ViewStates.Gone;
                        searchLL.Visibility       = ViewStates.Visible;
                    }
                };
                backRelativeLayout.Click += (s, e) =>
                {
                    OnBackPressed();
                };
                back_button.Click += (s, e) =>
                {
                    OnBackPressed();
                };
                var specs = await specializationMethods.GetUpperSpecializations();

                activityIndicator.Visibility = ViewStates.Gone;
                if (specs != "null")
                {
                    var deserialized_specs = JsonConvert.DeserializeObject <UpperSpecializationsRootObject>(specs.ToString());
                    if (!userMethods.UserExists())
                    {
                        deserialized_specs.categories.Insert(0, new UpperSpecializations {
                            name = GetString(Resource.String.skip_choosing_specialization)
                        });
                    }
                    var upperSpecializationAdapter = new UpperSpecializationAdapter(deserialized_specs.categories, this, tf);

                    recyclerView.SetAdapter(upperSpecializationAdapter);
                }
            }
            catch
            {
                StartActivity(typeof(MainActivity));
            }
        }
Example #50
0
        private void InitComponent()
        {
            try
            {
                MainView = FindViewById <CoordinatorLayout>(Resource.Id.main_content);

                SecondReactionButton = FindViewById <TextView>(Resource.Id.SecondReactionText);
                MainSectionButton    = FindViewById <LinearLayout>(Resource.Id.linerSecondReaction);

                LikeButton = FindViewById <ReactButton>(Resource.Id.ReactButton);

                CommentCount = FindViewById <TextView>(Resource.Id.Commentcount);
                LikeCount    = FindViewById <TextView>(Resource.Id.Likecount);

                TimeText        = FindViewById <AppCompatTextView>(Resource.Id.time_text);
                PrivacyPostIcon = FindViewById <AppCompatTextView>(Resource.Id.privacyPost);
                MoreIcon        = FindViewById <ImageView>(Resource.Id.moreicon);

                Username    = FindViewById <TextViewWithImages>(Resource.Id.username);
                UserAvatar  = FindViewById <CircleImageView>(Resource.Id.userAvatar);
                Description = FindViewById <SuperTextView>(Resource.Id.description);

                PostExtrasLayout = FindViewById <RelativeLayout>(Resource.Id.postExtras);

                ShareLinearLayout          = FindViewById <LinearLayout>(Resource.Id.ShareLinearLayout);
                CommentLinearLayout        = FindViewById <LinearLayout>(Resource.Id.CommentLinearLayout);
                SecondReactionLinearLayout = FindViewById <LinearLayout>(Resource.Id.SecondReactionLinearLayout);

                if (SecondReactionButton != null)
                {
                    switch (AppSettings.PostButton)
                    {
                    case PostButtonSystem.ReactionDefault:
                    case PostButtonSystem.ReactionSubShine:
                    case PostButtonSystem.Like:
                        MainSectionButton.WeightSum           = 3;
                        SecondReactionLinearLayout.Visibility = ViewStates.Gone;
                        break;

                    case PostButtonSystem.Wonder:
                        MainSectionButton.WeightSum           = 4;
                        SecondReactionLinearLayout.Visibility = ViewStates.Visible;

                        SecondReactionButton.SetCompoundDrawablesWithIntrinsicBounds(Resource.Drawable.icon_post_wonder_vector, 0, 0, 0);
                        SecondReactionButton.Text = Application.Context.GetText(Resource.String.Btn_Wonder);
                        break;

                    case PostButtonSystem.DisLike:
                        MainSectionButton.WeightSum           = 4;
                        SecondReactionLinearLayout.Visibility = ViewStates.Visible;
                        SecondReactionButton.SetCompoundDrawablesWithIntrinsicBounds(Resource.Drawable.ic_action_dislike, 0, 0, 0);
                        SecondReactionButton.Text = Application.Context.GetText(Resource.String.Btn_Dislike);
                        break;
                    }
                }

                LikeButton.SetTextColor(Color.White);
                //if (LikeButton?.GetCurrentReaction()?.GetReactType() == ReactConstants.Default)
                //{
                //    LikeButton.CompoundDrawableTintList = ColorStateList.ValueOf(Color.White);
                //}

                YouTubePlayerView youTubeView = new YouTubePlayerView(this);

                var youtubeView = FindViewById <FrameLayout>(Resource.Id.root);
                youtubeView.RemoveAllViews();
                youtubeView.AddView(youTubeView);

                youTubeView.Initialize(GetText(Resource.String.google_key), this);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Example #51
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            RequestWindowFeature(WindowFeatures.NoTitle);
            bool cameraPreviewCallbackWithBuffer = false;

            SetContentView(Resource.Layout.CameraPreviewLayout);

            _bgrBuffers           = new ImageBufferFactory <Mat>(size => new Mat(size.Height, size.Width, DepthType.Cv8U, 3));
            _previewBitmapBuffers = new ImageBufferFactory <Android.Graphics.Bitmap>(s => Android.Graphics.Bitmap.CreateBitmap(s.Width, s.Height, Android.Graphics.Bitmap.Config.Rgb565));

            _topLayer = new ProcessedCameraPreview(this, cameraPreviewCallbackWithBuffer);
            _topLayer.PictureTaken += this.PictureTaken;
            _topLayer.ImagePreview += this.ImagePreview;

            _preview = new CameraPreview(this, _topLayer, cameraPreviewCallbackWithBuffer);

            RelativeLayout mainLayout = FindViewById <RelativeLayout>(Resource.Id.CameraPreiewRelativeLayout);

            mainLayout.AddView(_preview, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent));
            mainLayout.AddView(_topLayer, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent));

#if GL_VIEW
            _topLayer.SetZOrderOnTop(true);
#endif
            RequestedOrientation = Android.Content.PM.ScreenOrientation.Landscape;

            ImageButton switchCameraButton = FindViewById <ImageButton>(Resource.Id.CameraPreviewSwitchCameraImageButton);
            if (Camera.NumberOfCameras <= 1)
            {
                switchCameraButton.Visibility = ViewStates.Invisible;
            }
            else
            {
                switchCameraButton.BringToFront();
            }
            switchCameraButton.Click += delegate
            {
                _preview.SwitchCamera();
            };

            ImageButton captureImageButton = FindViewById <ImageButton>(Resource.Id.CameraPreviewCaptureImageButton);
            captureImageButton.Click += delegate
            {
                Camera camera = _preview.Camera;

                if (camera != null)
                {
                    Camera.Parameters p = camera.GetParameters();
                    p.PictureFormat = Android.Graphics.ImageFormatType.Jpeg;
                    //p.PictureFormat = Android.Graphics.ImageFormatType.Rgb565;
                    camera.SetParameters(p);
                    camera.TakePicture(null, null, _topLayer);
                }
            };

            _lastCapturedImageButton        = FindViewById <ImageButton>(Resource.Id.capturedImageButton);
            _lastCapturedImageButton.Click += delegate
            {
                if (_lastSavedImageFile != null)
                {
                    Intent intent = new Intent(Intent.ActionView, Android.Net.Uri.FromFile(new Java.IO.File(_lastSavedImageFile.FullName)));
                    intent.SetType("image/jpeg");
                    StartActivity(intent);
                }
            };
            _lastCapturedImageButton.BringToFront();

            _previewButtons           = new ImageButton[4];
            _previewFilters           = new ImageFilter[4];
            _previewButtons[0]        = FindViewById <ImageButton>(Resource.Id.previewImageButton);
            _previewFilters[0]        = null;
            _previewButtons[0].Click += delegate
            {
                if (_imageFilter != null)
                {
                    _imageFilter.Dispose();
                    _imageFilter = null;
                }
            };
            _previewButtons[1] = FindViewById <ImageButton>(Resource.Id.cannyImageButton);
            _previewFilters[1] = new CannyFilter(100, 60, 3);
            //_previewFilters[1] = new ColorMapFilter(Emgu.CV.CvEnum.ColorMapType.Autumn);
            _previewButtons[2] = FindViewById <ImageButton>(Resource.Id.colorMapImageButton);
            //_previewFilters[2] = new ColorMapFilter(Emgu.CV.CvEnum.ColorMapType.Summer);
            _previewFilters[2] = null;
            _previewButtons[3] = FindViewById <ImageButton>(Resource.Id.distorImageButton);
            _previewFilters[3] = new DistorFilter(0.5, 0.5, -1.5);
            for (int i = 1; i < _previewButtons.Length; ++i)
            {
                ImageFilter f = _previewFilters[i];
                _previewButtons[i].Click += delegate
                {
                    if (_imageFilter != null)
                    {
                        _imageFilter.Dispose();
                    }
                    _imageFilter = f.Clone() as ImageFilter;
                };
            }
        }
Example #52
0
        public ContraseniaDTViewModel()
        {
            MessagingCenter.Subscribe <MainPage>(this, "DisplayAlert", (sender) =>
            {
                SetFocus();
                control = -1;
            });
            contrasenia = new ExtendedEntry
            {
                TextColor        = Color.FromHex("3F3F3F"),
                HasBorder        = false,
                IsPassword       = true,
                Placeholder      = "Toca para ingresar",
                PlaceholderColor = Color.FromHex("B2B2B2"),
                XAlign           = TextAlignment.End,
                FontFamily       = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                FontSize         = 14,
                Margin           = new Thickness(0, 0, 35, 0)
            };
            contrasenia.TextChanged += (sender, e) =>
            {
                if (!String.IsNullOrEmpty(contraseniaConfirmacion.Text) && !contraseniaConfirmacion.Text.Equals(contrasenia.Text))
                {
                    contraseniaConfirmacion.TextColor = Color.FromHex("E9242A");
                    contrasenia.TextColor             = Color.FromHex("3F3F3F");
                }
                else
                {
                    contrasenia.TextColor             = Color.FromHex("53A946");
                    contraseniaConfirmacion.TextColor = Color.FromHex("53A946");
                }
            };

            contraseniaConfirmacion = new ExtendedEntry
            {
                TextColor        = Color.FromHex("3F3F3F"),
                HasBorder        = false,
                IsPassword       = true,
                Placeholder      = "Toca para confirmar contraseña",
                PlaceholderColor = Color.FromHex("B2B2B2"),
                XAlign           = TextAlignment.End,
                FontFamily       = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                FontSize         = 14,
                Margin           = new Thickness(0, 0, 35, 0)
            };
            contraseniaConfirmacion.TextChanged += (sender, e) =>
            {
                if (!contraseniaConfirmacion.Text.Equals(contrasenia.Text))
                {
                    contraseniaConfirmacion.TextColor = Color.FromHex("E9242A");
                    contrasenia.TextColor             = Color.FromHex("3F3F3F");
                }
                else
                {
                    contrasenia.TextColor             = Color.FromHex("53A946");
                    contraseniaConfirmacion.TextColor = Color.FromHex("53A946");
                }
            };

            IconView contraseniaView = new IconView
            {
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Center,
                Source            = "iPassView.png",
                Foreground        = Color.FromHex("B2B2B2"),
                WidthRequest      = 25
            };
            IconView contraseniaConfirmacionView = new IconView
            {
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Center,
                Source            = "iPassView.png",
                Foreground        = Color.FromHex("B2B2B2"),
                WidthRequest      = 25
            };

            TapGestureRecognizer contraseniaViewTAP             = new TapGestureRecognizer();
            TapGestureRecognizer contraseniaConfirmacionViewTAP = new TapGestureRecognizer();

            contraseniaViewTAP.Tapped += (sender, e) =>
            {
                if (contrasenia.IsPassword)
                {
                    contrasenia.IsPassword     = false;
                    contraseniaView.Foreground = Color.FromHex("007D8C");
                }
                else
                {
                    contrasenia.IsPassword     = true;
                    contraseniaView.Foreground = Color.FromHex("B2B2B2");
                }
            };

            contraseniaConfirmacionViewTAP.Tapped += (sender, e) =>
            {
                if (contraseniaConfirmacion.IsPassword)
                {
                    contraseniaConfirmacion.IsPassword     = false;
                    contraseniaConfirmacionView.Foreground = Color.FromHex("007D8C");
                }
                else
                {
                    contraseniaConfirmacion.IsPassword     = true;
                    contraseniaConfirmacionView.Foreground = Color.FromHex("B2B2B2");
                }
            };

            contraseniaView.GestureRecognizers.Add(contraseniaViewTAP);
            contraseniaConfirmacionView.GestureRecognizers.Add(contraseniaConfirmacionViewTAP);

            contraseniaAnterior = new ExtendedEntry
            {
                TextColor        = Color.FromHex("3F3F3F"),
                HasBorder        = false,
                IsPassword       = true,
                Placeholder      = "Toca para ingresar",
                PlaceholderColor = Color.FromHex("B2B2B2"),
                XAlign           = TextAlignment.End,
                FontFamily       = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                FontSize         = 14,
                Margin           = new Thickness(0, 0, 35, 0)
            };


            IconView contraseniaAnteriorView = new IconView
            {
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Center,
                Source            = "iPassView.png",
                Foreground        = Color.FromHex("B2B2B2"),
                WidthRequest      = 25
            };


            TapGestureRecognizer contraseniaAnteriorViewTAP = new TapGestureRecognizer();

            contraseniaAnteriorViewTAP.Tapped += (sender, e) =>
            {
                if (contraseniaAnterior.IsPassword)
                {
                    contraseniaAnterior.IsPassword     = false;
                    contraseniaAnteriorView.Foreground = Color.FromHex("007D8C");
                }
                else
                {
                    contraseniaAnterior.IsPassword     = true;
                    contraseniaAnteriorView.Foreground = Color.FromHex("B2B2B2");
                }
            };

            contraseniaAnteriorView.GestureRecognizers.Add(contraseniaAnteriorViewTAP);


            StackLayout datosGenerales = new StackLayout
            {
                Padding         = new Thickness(15, 15, 15, 20),
                Spacing         = 15,
                BackgroundColor = Color.FromHex("E5E5E5"),
                Children        =
                {
                    new StackLayout
                    {
                        Orientation       = StackOrientation.Horizontal,
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        Children          =
                        {
                            new IconView
                            {
                                Source          = "iSeguridad.png",
                                WidthRequest    = 15,
                                HeightRequest   = 15,
                                Foreground      = Color.FromHex("007D8C"),
                                VerticalOptions = LayoutOptions.Center
                            },
                            new Label
                            {
                                Text = "Ingresa y confirma\r\ntu nueva contraseña",
                                HorizontalTextAlignment = TextAlignment.Center,
                                TextColor       = Color.FromHex("007D8C"),
                                FontFamily      = Device.OnPlatform("OpenSans-ExtraBold", "OpenSans-ExtraBold", null),
                                FontSize        = 18,
                                VerticalOptions = LayoutOptions.Center
                            }
                        }
                    },
                    new StackLayout
                    {
                        Spacing  = 0,
                        Children =
                        {
                            new Label
                            {
                                Text           = "CONTRASEÑA ANTERIOR:*",
                                FontSize       = 13,
                                TextColor      = Color.FromHex("007D8C"),
                                FontAttributes = FontAttributes.Bold,
                                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
                            },
                            new StackLayout
                            {
                                Spacing  = 1,
                                Children =
                                {
                                    new Grid
                                    {
                                        Children =
                                        {
                                            contraseniaAnterior,
                                            contraseniaAnteriorView
                                        }
                                    },
                                    new BoxView {
                                        BackgroundColor = Color.FromHex("007D8C"), HeightRequest = 2
                                    },
                                    new BoxView {
                                        HeightRequest = 0
                                    }
                                }
                            }
                        }
                    },
                    new StackLayout
                    {
                        Spacing  = 0,
                        Children =
                        {
                            new Label
                            {
                                Text           = "NUEVA CONTRASEÑA:*",
                                FontSize       = 13,
                                TextColor      = Color.FromHex("007D8C"),
                                FontAttributes = FontAttributes.Bold,
                                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
                            },
                            new StackLayout
                            {
                                Spacing  = 1,
                                Children =
                                {
                                    new Grid
                                    {
                                        Children =
                                        {
                                            contrasenia,
                                            contraseniaView
                                        }
                                    },
                                    new BoxView {
                                        BackgroundColor = Color.FromHex("007D8C"), HeightRequest = 2
                                    },
                                    new BoxView {
                                        HeightRequest = 0
                                    }
                                }
                            }
                        }
                    },
                    new StackLayout
                    {
                        Spacing  = 0,
                        Children =
                        {
                            new Label
                            {
                                Text           = "CONFIRMAR CONTRASEÑA:*",
                                FontSize       = 13,
                                TextColor      = Color.FromHex("007D8C"),
                                FontAttributes = FontAttributes.Bold,
                                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
                            },
                            new StackLayout
                            {
                                Spacing  = 1,
                                Children =
                                {
                                    new Grid
                                    {
                                        Children =
                                        {
                                            contraseniaConfirmacion,
                                            contraseniaConfirmacionView
                                        }
                                    },
                                    new BoxView {
                                        BackgroundColor = Color.FromHex("007D8C"), HeightRequest = 2
                                    },
                                    new BoxView {
                                        HeightRequest = 0
                                    }
                                }
                            }
                        }
                    }
                }
            };

            guardar = new Button
            {
                Text            = "CONFIRMAR",
                FontSize        = 18,
                TextColor       = Color.White,
                FontAttributes  = FontAttributes.Bold,
                FontFamily      = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                VerticalOptions = LayoutOptions.Start,
                BackgroundColor = Color.FromHex("53A946"),
                WidthRequest    = 128,
                HeightRequest   = 38,
            };
            guardar.Clicked += Guardar_Clicked;


            RelativeLayout gridBoton = new RelativeLayout
            {
                WidthRequest      = 130,
                HeightRequest     = 42,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.End,
            };

            gridBoton.Children.Add(
                new RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView
            {
                BackgroundColor = Color.FromHex("B2B2B2"),
                CornerRadius    = 6,
                HeightRequest   = 40,
                WidthRequest    = 128,
            }, Constraint.Constant(2), Constraint.Constant(2));
            gridBoton.Children.Add(guardar, Constraint.Constant(0), Constraint.Constant(0));



            this.BackgroundColor = Color.White;

            contenidoCreacionEdicion = new ScrollView
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Padding         = 0,
                Content         = new StackLayout
                {
                    Spacing  = 10,
                    Children =
                    {
                        new StackLayout
                        {
                            Spacing  = 0,
                            Children =
                            {
                                datosGenerales,
                                new BoxView {
                                    VerticalOptions = LayoutOptions.FillAndExpand,BackgroundColor                                     = Color.FromHex("B3B3B3"), HeightRequest = 4
                                },
                            }
                        }
                    }
                }
            };


            EdicionCreacion = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Padding         = new Thickness(0, 15),
                Children        = { contenidoCreacionEdicion, gridBoton }
            };
            Content = EdicionCreacion;
        }
        private void ini()
        {
            mainLayout = new RelativeLayout(context);
            mainLayout.LayoutParameters = new RelativeLayout.LayoutParams(-1, -1);
            mainLayout.SetBackgroundColor(Color.ParseColor("#ffffff"));

            linearContainer = new LinearLayout(context);
            linearImageLO   = new LinearLayout(context);
            linearTextLO    = new LinearLayout(context);
            linearLike      = new LinearLayout(context);

            linearUsers = new LinearLayout(context);

            txtAuthor  = new TextView(context);
            txtChapter = new TextView(context);
            txtNameLO  = new TextView(context);
            txtLike    = new TextView(context);


            txtAuthor.Typeface  = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
            txtChapter.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
            txtNameLO.Typeface  = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
            txtLike.Typeface    = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");


            imgHeart = new ImageView(context);

            commentList = new ListView(context);

            linearContainer.LayoutParameters = new LinearLayout.LayoutParams(-1, -1);
            linearImageLO.LayoutParameters   = new LinearLayout.LayoutParams(-1, Configuration.getHeight(372));
            linearTextLO.LayoutParameters    = new LinearLayout.LayoutParams(-1, Configuration.getHeight(250));
            linearLike.LayoutParameters      = new LinearLayout.LayoutParams(Configuration.getWidth(120), Configuration.getHeight(80));
            linearUsers.LayoutParameters     = new LinearLayout.LayoutParams(-1, -2);

            linearTextLO.Orientation = Orientation.Vertical;
            linearTextLO.SetGravity(GravityFlags.Right);

            linearLike.Orientation = Orientation.Vertical;
            linearLike.SetGravity(GravityFlags.Center);

            linearUsers.Orientation = Orientation.Horizontal;
            linearUsers.SetGravity(GravityFlags.Center);

            linearContainer.Orientation = Orientation.Vertical;
            //linearContainer.SetGravity (GravityFlags.Center);

            //Drawable d = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("images/fondounidad.png"), 480, 640, true));
            //linearImageLO.SetBackgroundDrawable (d);

            imgHeart.SetImageBitmap(Bitmap.CreateScaledBitmap(getBitmapFromAsset("images/like.png"), Configuration.getWidth(43), Configuration.getHeight(43), true));


            txtAuthor.Text  = "Author : David Spencer";
            txtChapter.Text = "Flora y Fauna";
            txtNameLO.Text  = "Camino Inca";
            txtLike.Text    = "10";

            //txtChapter.SetMaxWidth (Configuration.getWidth (580));
            //txtChapter.Ellipsize = TextUtils.TruncateAt.End;
            //txtChapter.SetMaxLines(1);



            txtAuthor.SetTextColor(Color.ParseColor("#ffffff"));
            txtChapter.SetTextColor(Color.ParseColor("#ffffff"));
            txtNameLO.SetTextColor(Color.ParseColor("#ffffff"));
            txtLike.SetTextColor(Color.ParseColor("#ffffff"));

            txtNameLO.SetTextSize(Android.Util.ComplexUnitType.Px, Configuration.getHeight(30));
            txtChapter.SetTextSize(Android.Util.ComplexUnitType.Px, Configuration.getHeight(50));
            txtAuthor.SetTextSize(Android.Util.ComplexUnitType.Px, Configuration.getHeight(30));
            txtNameLO.Typeface = Typeface.DefaultBold;

            txtAuthor.Gravity  = GravityFlags.Right;
            txtChapter.Gravity = GravityFlags.Right;
            txtNameLO.Gravity  = GravityFlags.Right;
            txtLike.Gravity    = GravityFlags.Center;

            linearTextLO.AddView(txtNameLO);
            linearTextLO.AddView(txtChapter);
            linearTextLO.AddView(txtAuthor);

            linearTextLO.SetPadding(0, 0, Configuration.getWidth(30), 0);

            linearLike.AddView(imgHeart);
            linearLike.AddView(txtLike);


            _mCommentData = new List <CommentDataRow> ();

            /*
             * _mCommentData.Add (new CommentDataRow (){im_profile="images/e1.jpg" , name="Ryan Elliot", date = "10:00pm", comment = "Esto es un comentario" });
             * _mCommentData.Add (new CommentDataRow (){im_profile="images/e1.jpg" , name="Ryan Elliot", date = "10:00pm", comment = "Esto es un comentario" });
             * _mCommentData.Add (new CommentDataRow (){im_profile="images/e1.jpg" , name="Ryan Elliot", date = "10:00pm", comment = "Esto es un comentario" });
             * _mCommentData.Add (new CommentDataRow (){im_profile="images/e1.jpg" , name="Ryan Elliot", date = "10:00pm", comment = "Esto es un comentario" });
             * _mCommentData.Add (new CommentDataRow (){im_profile="images/e1.jpg" , name="Ryan Elliot", date = "10:00pm", comment = "Esto es un comentario" });
             * _mCommentData.Add (new CommentDataRow (){im_profile="images/e1.jpg" , name="Ryan Elliot", date = "10:00pm", comment = "Esto es un comentario" });
             * _mCommentData.Add (new CommentDataRow (){im_profile="images/e1.jpg" , name="Ryan Elliot", date = "10:00pm", comment = "Esto es un comentario" });
             * _mCommentData.Add (new CommentDataRow (){im_profile="images/e1.jpg" , name="Ryan Elliot", date = "10:00pm", comment = "Esto es un comentario" });
             */
//			commentList.Adapter = new CommentListViewAdapter (context, _mCommentData);
            commentList.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(654));


            commentList.SetX(0); commentList.SetY(Configuration.getHeight(530));

            linearTextLO.SetX(0); linearTextLO.SetY(Configuration.getHeight(200));
            //linearImageLO.SetX (0); linearImageLO.SetY (0);
            linearLike.SetX(0); linearLike.SetY(Configuration.getHeight(256));
            linearContainer.SetX(0); linearContainer.SetY(0);

            linearContainer.AddView(linearImageLO);
            linearContainer.AddView(linearUsers);
            mainLayout.AddView(linearContainer);

            //mainLayout.AddView (linearImageLO);
            mainLayout.AddView(linearTextLO);

            mainLayout.AddView(linearLike);
            mainLayout.AddView(commentList);

            this.AddView(mainLayout);

            /*linearImageLO.Click += delegate {
             *      var com = ((LOViewModel)context.DataContext).SignUpCommand;
             *      com.Execute(null);
             * };
             */
        }
Example #54
0
                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.Prayer_Create, container, false);

                    view.SetOnTouchListener(this);

                    view.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor));

                    // setup the first name background
                    FirstNameBGLayer = view.FindViewById <RelativeLayout>(Resource.Id.first_name_background);
                    ControlStyling.StyleBGLayer(FirstNameBGLayer);
                    //

                    LastNameBGLayer = view.FindViewById <RelativeLayout>(Resource.Id.last_name_background);
                    ControlStyling.StyleBGLayer(LastNameBGLayer);

                    EmailBGLayer = view.FindViewById <RelativeLayout>(Resource.Id.email_background);
                    ControlStyling.StyleBGLayer(EmailBGLayer);

                    // setup the prayer request background
                    RequestBGLayer = view.FindViewById <RelativeLayout>(Resource.Id.prayerRequest_background);
                    ControlStyling.StyleBGLayer(RequestBGLayer);
                    //

                    // setup the switch background
                    RelativeLayout backgroundLayout = view.FindViewById <RelativeLayout>(Resource.Id.switch_background);

                    ControlStyling.StyleBGLayer(backgroundLayout);

                    // setup the category background
                    backgroundLayout = view.FindViewById <RelativeLayout>(Resource.Id.spinner_background);
                    ControlStyling.StyleBGLayer(backgroundLayout);

                    // setup the text views
                    FirstNameText = (EditText)view.FindViewById <EditText>(Resource.Id.prayer_create_firstNameText);
                    ControlStyling.StyleTextField(FirstNameText, PrayerStrings.CreatePrayer_FirstNamePlaceholderText, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
                    FirstNameBGColor         = ControlStylingConfig.BG_Layer_Color;
                    FirstNameText.InputType |= Android.Text.InputTypes.TextFlagCapWords;

                    LastNameText = (EditText)view.FindViewById <EditText>(Resource.Id.prayer_create_lastNameText);
                    ControlStyling.StyleTextField(LastNameText, PrayerStrings.CreatePrayer_LastNamePlaceholderText, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
                    LastNameBGColor         = ControlStylingConfig.BG_Layer_Color;
                    LastNameText.InputType |= Android.Text.InputTypes.TextFlagCapWords;

                    EmailText = (EditText)view.FindViewById <EditText>(Resource.Id.prayer_create_emailText);
                    ControlStyling.StyleTextField(EmailText, PrayerStrings.CreatePrayer_EmailPlaceholderText, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
                    EmailBGColor         = ControlStylingConfig.BG_Layer_Color;
                    EmailText.InputType |= Android.Text.InputTypes.TextFlagCapWords;

                    RequestText = (EditText)view.FindViewById <EditText>(Resource.Id.prayer_create_requestText);
                    ControlStyling.StyleTextField(RequestText, PrayerStrings.CreatePrayer_PrayerRequest, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
                    RequestBGColor         = ControlStylingConfig.BG_Layer_Color;
                    RequestText.InputType |= Android.Text.InputTypes.TextFlagCapSentences;


                    /*AnonymousSwitch = (Switch)view.FindViewById<Switch>( Resource.Id.postAnonymousSwitch );
                     * AnonymousSwitch.Checked = false;
                     * AnonymousSwitch.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e ) =>
                     * {
                     *      if( AnonymousSwitch.Checked == false )
                     *      {
                     *          FirstNameText.Enabled = true;
                     *          LastNameText.Enabled = true;
                     *
                     *          FirstNameText.Text = string.Empty;
                     *          LastNameText.Text = string.Empty;
                     *      }
                     *      else
                     *      {
                     *          FirstNameText.Enabled = false;
                     *          LastNameText.Enabled = false;
                     *
                     *          FirstNameText.Text = PrayerStrings.CreatePrayer_Anonymous;
                     *          LastNameText.Text = PrayerStrings.CreatePrayer_Anonymous;
                     *      }
                     *
                     *      // set the colors back to neutral
                     *      Rock.Mobile.PlatformSpecific.Android.UI.Util.AnimateViewColor( FirstNameBGColor, ControlStylingConfig.BG_Layer_Color, FirstNameBGLayer, delegate { FirstNameBGColor = ControlStylingConfig.BG_Layer_Color; } );
                     *      Rock.Mobile.PlatformSpecific.Android.UI.Util.AnimateViewColor( LastNameBGColor, ControlStylingConfig.BG_Layer_Color, LastNameBGLayer, delegate { LastNameBGColor = ControlStylingConfig.BG_Layer_Color; } );
                     * };*/

                    PublicSwitch         = (Switch)view.FindViewById <Switch>(Resource.Id.makePublicSwitch);
                    PublicSwitch.Checked = false;

                    //TextView postAnonymousLabel = view.FindViewById<TextView>( Resource.Id.postAnonymous );
                    //ControlStyling.StyleUILabel( postAnonymousLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize );

                    TextView publicLabel = view.FindViewById <TextView>(Resource.Id.makePublic);

                    ControlStyling.StyleUILabel(publicLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);

                    // setup our category spinner
                    Spinner = (Spinner)view.FindViewById <Spinner>(Resource.Id.categorySpinner);
                    ArrayAdapter adapter = new SpinnerArrayAdapter(Rock.Mobile.PlatformSpecific.Android.Core.Context, Android.Resource.Layout.SimpleListItem1);

                    adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                    Spinner.Adapter = adapter;

                    // populate the category
                    foreach (KeyValuePair <string, int> category in MobileApp.Shared.Network.RockLaunchData.Instance.Data.PrayerCategories)
                    {
                        adapter.Add(category.Key);
                    }

                    Button submitButton = (Button)view.FindViewById <Button>(Resource.Id.prayer_create_submitButton);

                    ControlStyling.StyleButton(submitButton, PrayerStrings.CreatePrayer_SubmitButtonText, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
                    submitButton.Click += (object sender, EventArgs e) =>
                    {
                        SubmitPrayerRequest( );
                    };

                    return(view);
                }
        void SetupUserInterface()
        {
            mainLayout = new RelativeLayout(Context);
            liveView   = new TextureView(Context);

            RelativeLayout.LayoutParams liveViewParams = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.MatchParent,
                RelativeLayout.LayoutParams.MatchParent);
            liveView.LayoutParameters = liveViewParams;
            mainLayout.AddView(liveView);

            progressBar = new ProgressBar(Context);
            RelativeLayout.LayoutParams progresBarParams = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.WrapContent,
                RelativeLayout.LayoutParams.WrapContent);
            progresBarParams.Height      = 120;
            progresBarParams.Width       = 120;
            progressBar.LayoutParameters = progresBarParams;
            progressBar.Indeterminate    = true;
            progressBar.KeepScreenOn     = true;

            capturePhotoButton            = new Button(Context);
            capturePhotoInspectionButton  = new Button(Context);
            capturePhotoInspectionButton1 = new Button(Context);
            scanPhotoButton = new Button(Context);
            if (((CameraPage)Element).TypeCamera == null || ((CameraPage)Element).TypeCamera == "Photo")
            {
                capturePhotoButton.SetBackgroundDrawable(ContextCompat.GetDrawable(Context, Resource.Drawable.Take));
                RelativeLayout.LayoutParams captureButtonParams = new RelativeLayout.LayoutParams(
                    RelativeLayout.LayoutParams.WrapContent,
                    RelativeLayout.LayoutParams.WrapContent);
                captureButtonParams.Height          = 120;
                captureButtonParams.Width           = 120;
                capturePhotoButton.LayoutParameters = captureButtonParams;

                mainLayout.AddView(capturePhotoButton);
                mainLayout.AddView(progressBar);
            }
            else if (((CameraPage)Element).TypeCamera == "DetectText")
            {
                //scanPlate.png
                scanPhotoButton.SetBackgroundDrawable(ContextCompat.GetDrawable(Context, Resource.Drawable.scanPlate));
                RelativeLayout.LayoutParams captureButtonParams = new RelativeLayout.LayoutParams(
                    RelativeLayout.LayoutParams.WrapContent,
                    RelativeLayout.LayoutParams.WrapContent);
                captureButtonParams.Height       = 120;
                captureButtonParams.Width        = 120;
                scanPhotoButton.LayoutParameters = captureButtonParams;
                mainLayout.AddView(scanPhotoButton);
            }
            else if (type == "PhotoIspection")
            {
                capturePhotoInspectionButton1.SetBackgroundDrawable(ContextCompat.GetDrawable(Context, Resource.Drawable.AddDamege));
                RelativeLayout.LayoutParams captureButtonParams1 = new RelativeLayout.LayoutParams(
                    RelativeLayout.LayoutParams.WrapContent,
                    RelativeLayout.LayoutParams.WrapContent);
                captureButtonParams1.Height = 120;
                captureButtonParams1.Width  = 120;
                capturePhotoInspectionButton1.LayoutParameters = captureButtonParams1;
                mainLayout.AddView(capturePhotoInspectionButton1);

                capturePhotoInspectionButton.SetBackgroundDrawable(ContextCompat.GetDrawable(Context, Resource.Drawable.NotDamage));
                RelativeLayout.LayoutParams captureButtonParams = new RelativeLayout.LayoutParams(
                    RelativeLayout.LayoutParams.WrapContent,
                    RelativeLayout.LayoutParams.WrapContent);
                captureButtonParams.Height = 120;
                captureButtonParams.Width  = 120;
                capturePhotoInspectionButton.LayoutParameters = captureButtonParams;
                mainLayout.AddView(capturePhotoInspectionButton);
                mainLayout.AddView(progressBar);
            }
            else
            {
                capturePhotoButton.SetBackgroundDrawable(ContextCompat.GetDrawable(Context, Resource.Drawable.Take));
                RelativeLayout.LayoutParams captureButtonParams = new RelativeLayout.LayoutParams(
                    RelativeLayout.LayoutParams.WrapContent,
                    RelativeLayout.LayoutParams.WrapContent);
                captureButtonParams.Height          = 120;
                captureButtonParams.Width           = 120;
                capturePhotoButton.LayoutParameters = captureButtonParams;
                mainLayout.AddView(capturePhotoButton);
                mainLayout.AddView(progressBar);
            }



            AddView(mainLayout);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            try
            {
                SetContentView(Resource.Layout.DisplayPortfolioPhoto);

                activityIndicatorDel = FindViewById <ProgressBar>(Resource.Id.activityIndicatorDel);
                tint_DelLL           = FindViewById <RelativeLayout>(Resource.Id.tint_DelLL);
                noTV              = FindViewById <TextView>(Resource.Id.noTV);
                yesTV             = FindViewById <TextView>(Resource.Id.yesTV);
                activityIndicator = FindViewById <ProgressBar>(Resource.Id.activityIndicator);
                activityIndicator.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply);
                activityIndicatorDel.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply);
                removeBn           = FindViewById <Button>(Resource.Id.removeBn);
                backRelativeLayout = FindViewById <RelativeLayout>(Resource.Id.backRelativeLayout);
                back_button        = FindViewById <ImageButton>(Resource.Id.back_button);
                fullIV             = FindViewById <ImageView>(Resource.Id.fullIV);

                Typeface tf = Typeface.CreateFromAsset(Assets, "Roboto-Regular.ttf");
                FindViewById <TextView>(Resource.Id.headerTV).SetTypeface(tf, TypefaceStyle.Bold);
                removeBn.SetTypeface(tf, TypefaceStyle.Normal);
                FindViewById <TextView>(Resource.Id.textView5).SetTypeface(tf, TypefaceStyle.Normal);
                FindViewById <TextView>(Resource.Id.your_city_valueTV).SetTypeface(tf, TypefaceStyle.Normal);
                yesTV.SetTypeface(tf, TypefaceStyle.Normal);
                noTV.SetTypeface(tf, TypefaceStyle.Normal);

                tint_DelLL.Click += (s, e) =>
                {
                    tint_DelLL.Visibility = ViewStates.Gone;
                };
                yesTV.Click += async(s, e) =>
                {
                    activityIndicatorDel.Visibility = ViewStates.Visible;
                    var res = await profileAndExpertMethods.DeletePhoto(userMethods.GetUsersAuthToken(), image_url);

                    image_url = null;
                    activityIndicatorDel.Visibility = ViewStates.Gone;
                    tint_DelLL.Visibility           = ViewStates.Gone;
                    StartActivity(typeof(UserProfileActivity));
                };

                noTV.Click += (s, e) =>
                {
                    tint_DelLL.Visibility = ViewStates.Gone;
                };

                backRelativeLayout.Click += (s, e) =>
                {
                    OnBackPressed();
                };
                back_button.Click += (s, e) =>
                {
                    OnBackPressed();
                };

                Thread backgroundThread = new Thread(new ThreadStart(() =>
                {
                    Glide.Get(Application.Context).ClearDiskCache();
                }));
                backgroundThread.IsBackground = true;
                backgroundThread.Start();
                Glide.Get(this).ClearMemory();
                Glide.With(Application.Context)
                .Load(image_url)
                .Apply(new Com.Bumptech.Glide.Request.RequestOptions()
                       .SkipMemoryCache(true))
                //.Placeholder(Resource.Drawable.specialization_imageIV)
                .Into(fullIV);

                removeBn.Click += (s, e) =>
                {
                    tint_DelLL.Visibility = ViewStates.Visible;
                };
            }
            catch
            {
                StartActivity(typeof(MainActivity));
            }
        }
Example #57
0
        public IncidenciasPage()
        {
            Title = "Incidencias";
            var opcionesToolBar = new ToolbarItem
            {
                Icon = "mas.png",
                Text = "Más"
            };

            refrescar = new Button
            {
                Text            = "Refrescar",
                BackgroundColor = Color.Transparent,
                WidthRequest    = 130,
                HeightRequest   = 40,
                FontFamily      = Device.OnPlatform("OpenSans", "OpenSans-Regular", null)
            };

            refrescar.Clicked += async(sender, e) =>
            {
                /*var stack = Navigation.NavigationStack;
                 * if (!VistaModelo.IsBusy && refrescar.IsEnabled && filtrar.IsEnabled && filtrarGesture.IsEnabled && isContextual && MenuContextual.IsVisible && !Constantes.ModalAbierto && (stack[stack.Count - 1].GetType() != typeof(Indicador)) && (stack[stack.Count - 1].GetType() != typeof(CajaDetalleModeloVista)))
                 * {
                 *  refrescar.IsEnabled = false;
                 *  VistaModelo.IsBusy = true;
                 *  MenuContextual.IsVisible = false;
                 *  isContextual = false;
                 *  BusquedaActiva = false;
                 *  mostrar_MenuContextual(false);
                 *  BusquedaActiva = true;
                 *  await ActualizarCaja();
                 *  VistaModelo.IsBusy = false;
                 *  refrescar.IsEnabled = true;
                 * }
                 * else
                 *  System.Diagnostics.Debug.WriteLine("Actualizacion activa.");*/
            };

            MenuContextual = new StackLayout
            {
                Padding         = new Thickness(0, 0),
                Spacing         = 0,
                BackgroundColor = Color.White,
                Children        =
                {
                    refrescar,
                }
            };
            MenuContextual.IsVisible = false;

            opcionesToolBar.Clicked += OpcionesToolBar_Clicked;

            this.ToolbarItems.Add(opcionesToolBar);

            /*MessagingCenter.Subscribe<CajaDetalleModeloVista>(this, "deseleccionado", (sender) =>
             * {
             *  isSelected = false;
             *  Constantes.ModalAbierto = false;
             * });
             * MessagingCenter.Subscribe<CajaAgrupacionModeloVista>(this, "seleccionado", async (sender) =>
             * {
             *  var stack = Navigation.NavigationStack;
             *  if (!VistaModelo.IsBusy && ContenidoCaja.IsEnabled && filtrar.IsEnabled && filtrarGesture.IsEnabled && refrescar.IsEnabled && !isSelected && (stack[stack.Count - 1].GetType() != typeof(Indicador)) && (stack[stack.Count - 1].GetType() != typeof(CajaDetalleModeloVista)))
             *  {
             *      ContenidoCaja.IsEnabled = false;
             *      isSelected = true;
             *      if (string.IsNullOrEmpty(sender.transaccionSeleccionada.Paciente.expediente))
             *      {
             *          await Navigation.PushPopupAsync(new Indicador("Obteniendo datos", Color.White));
             *          SelectByID peticion = new SelectByID
             *          {
             *              PatientID = sender.transaccionSeleccionada.Patient_ID.ToString()
             *          };
             *          await App.ManejadorDatos.SelectByIDAsync(peticion);
             *          sender.transaccionSeleccionada.Patient_ID = sender.transaccionSeleccionada.Patient_ID;
             *          await Navigation.PopAllPopupAsync();
             *      }
             *      await Navigation.PushPopupAsync(new CajaDetalleModeloVista(sender.transaccionSeleccionada));
             *      ContenidoCaja.IsEnabled = true;
             *  }
             *  else
             *      System.Diagnostics.Debug.WriteLine("Modal abierto actualmente");
             * });*/



            notificacionCajaVacia =
                new Label
            {
                FontFamily = Device.OnPlatform("OpenSans", "OpenSans-Regular", null),
                FontSize   = 11,
                HorizontalTextAlignment = TextAlignment.Center,
                HorizontalOptions       = LayoutOptions.CenterAndExpand,
                VerticalOptions         = LayoutOptions.Center,
                TextColor = Color.FromHex("3F3F3F"),
                Text      = "NO SE HA ENCONTRADO CONTENIDO PARA MOSTRAR",
                IsVisible = false
            };
            notificacionFiltrado =
                new Label
            {
                FontFamily = Device.OnPlatform("OpenSans", "OpenSans-Regular", null),
                FontSize   = 11,
                HorizontalTextAlignment = TextAlignment.Center,
                HorizontalOptions       = LayoutOptions.CenterAndExpand,
                VerticalOptions         = LayoutOptions.Center,
                TextColor = Color.FromHex("B2B2B2"),
                Text      = "FILTRANDO POR PACIENTE",
                IsVisible = false
            };
            if (Device.OS == TargetPlatform.Android)
            {
                notificacionFiltrado.IsVisible = true;
            }

            BusquedaRapida =
                new ExtendedEntry
            {
                Placeholder      = "Filtrar por empleado",
                HasBorder        = false,
                BackgroundColor  = Color.Transparent,
                Margin           = new Thickness(10, 0),
                PlaceholderColor = Color.FromHex("808080"),
                FontSize         = 14,
                TextColor        = Color.FromHex("3F3F3F"),
                FontFamily       = Device.OnPlatform("OpenSans", "OpenSans-Regular", null)
            };
            BusquedaRapida.TextChanged += BusquedaRapida_TextChanged;

            Grid PacientesHeader = new Grid
            {
                Padding           = new Thickness(10, 0, 10, 0),
                ColumnSpacing     = 5,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Auto)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Auto)
                    },
                }
            };
            IconView cancelar = new IconView
            {
                Foreground    = Color.FromHex("F7B819"),
                Source        = "iCancelarA.png",
                HeightRequest = 25,
                WidthRequest  = 25,
            };
            TapGestureRecognizer cancelarTAP = new TapGestureRecognizer();

            cancelarTAP.Tapped += async(sender, e) =>
            {
                cancelar.Source     = "iCancelarB.png";
                BusquedaRapida.Text = "";
                await Task.Delay(500);

                cancelar.Source = "iCancelarA";
            };
            cancelar.GestureRecognizers.Add(cancelarTAP);
            IconView buscar = new IconView
            {
                Foreground    = Color.FromHex("F7B819"),
                Source        = "iDropdownA.png",
                HeightRequest = 25,
                WidthRequest  = 25,
            };
            TapGestureRecognizer buscarTAP = new TapGestureRecognizer();

            buscarTAP.Tapped += async(sender, e) =>
            {
                if (!FiltradoActionSheet)
                {
                    FiltradoActionSheet = true;
                    buscar.Source       = "iDropdownB.png";
                    var action = await DisplayActionSheet("Seleccione filtro", "Cancelar", null, "Empleado", "Evento");

                    if (action == null)
                    {
                        buscar.Source       = "iDropdownA.png";
                        FiltradoActionSheet = false;
                        return;
                    }
                    switch (action)
                    {
                    case "Empleado":
                        filtro = "Patient_ID";
                        notificacionFiltrado.IsVisible = true;
                        notificacionFiltrado.Text      = "FILTRANDO POR EMPLEADO";
                        BusquedaRapida.Placeholder     = "Filtrar por empleado";
                        break;

                    case "Evento":
                        notificacionFiltrado.IsVisible = true;
                        notificacionFiltrado.Text      = "FILTRANDO POR EVENTO";
                        BusquedaRapida.Placeholder     = "Filtrar por evento";
                        filtro = "DocumentNo";
                        break;

                    case "Cancelar":
                        buscar.Source       = "iDropdownA.png";
                        FiltradoActionSheet = false;
                        return;
                    }
                    await FiltrarTransacciones();

                    buscar.Source       = "iDropdownA.png";
                    FiltradoActionSheet = false;
                }
            };
            buscar.GestureRecognizers.Add(buscarTAP);


            filtrar = new IconView
            {
                Foreground    = Color.White,
                Source        = "iContinuar.png",
                HeightRequest = 25,
                WidthRequest  = 25,
            };
            filtrarGesture = new StackLayout
            {
                BackgroundColor   = Color.Transparent,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand
            };
            TapGestureRecognizer filtrarTAP = new TapGestureRecognizer();

            filtrarTAP.Tapped += async(sender, e) =>
            {
                /*var stack = Navigation.NavigationStack;
                 * if (!VistaModelo.IsBusy && filtrar.IsEnabled && filtrarGesture.IsEnabled && refrescar.IsEnabled && !Constantes.ModalAbierto && (stack[stack.Count - 1].GetType() != typeof(Indicador)) && (stack[stack.Count - 1].GetType() != typeof(CajaDetalleModeloVista)))
                 * {
                 *  filtrar.IsEnabled = false;
                 *  filtrarGesture.IsEnabled = false;
                 *  VistaModelo.IsBusy = true;
                 *  await ActualizarCaja();
                 *  VistaModelo.IsBusy = false;
                 *  filtrar.IsEnabled = true;
                 *  filtrarGesture.IsEnabled = true;
                 * }
                 * else
                 *  System.Diagnostics.Debug.WriteLine("Actualizando o modal abierto actualmente");*/
            };
            filtrar.GestureRecognizers.Add(filtrarTAP);
            filtrarGesture.GestureRecognizers.Add(filtrarTAP);

            PacientesHeader.Children.Add(
                new RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView
            {
                BackgroundColor = Color.FromHex("E5E5E5"),
                CornerRadius    = 6,
                HeightRequest   = 20,
                //WidthRequest = 128,
            }, 0, 0);
            PacientesHeader.Children.Add(BusquedaRapida, 0, 0);
            PacientesHeader.Children.Add(cancelar, 1, 0);
            PacientesHeader.Children.Add(buscar, 2, 0);



            Grid Header = new Grid
            {
                Padding           = 0,
                HeightRequest     = 120,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

            Header.Children.Add(
                new Image()
            {
                Source = "headerIncidencias.png",
                Aspect = Aspect.AspectFill
            });

            Grid Filtrado = new Grid
            {
                ColumnSpacing     = 5,
                RowSpacing        = 0,
                HorizontalOptions = LayoutOptions.Center,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Auto)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(15, GridUnitType.Absolute)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Auto)
                    }
                }
            };

            globalizacion = new System.Globalization.CultureInfo("es-GT");
            fechaInicial  = new ExtendedDatePicker
            {
                HasBorder   = false,
                TextColor   = Color.White,
                MaximumDate = DateTime.Now,
                Format      = globalizacion.DateTimeFormat.ShortDatePattern,
                XAlign      = TextAlignment.Center,
                Font        = Device.OnPlatform <Font>(Font.OfSize("OpenSans-Bold", 14), Font.OfSize("OpenSans-Bold", 14), Font.Default)
            };
            fechaFinal = new ExtendedDatePicker
            {
                HasBorder   = false,
                TextColor   = Color.White,
                MaximumDate = DateTime.Now,
                Format      = globalizacion.DateTimeFormat.ShortDatePattern,
                XAlign      = TextAlignment.Center,
                Font        = Device.OnPlatform <Font>(Font.OfSize("OpenSans-Bold", 14), Font.OfSize("OpenSans-Bold", 14), Font.Default)
            };
            fechaInicial.Focused += (sender, e) =>
            {
                if (fechaFinal.IsFocused)
                {
                    fechaInicial.Unfocus();
                    return;
                }
                fechaInicial.TextColor = Color.FromHex("00ffff");
            };
            fechaFinal.Focused += (sender, e) =>
            {
                if (fechaInicial.IsFocused)
                {
                    fechaFinal.Unfocus();
                    return;
                }
                fechaFinal.TextColor = Color.FromHex("00ffff");
            };
            fechaInicial.Unfocused += (sender, e) =>
            {
                fechaInicial.TextColor = Color.White;
            };
            fechaFinal.Unfocused += (sender, e) =>
            {
                fechaFinal.TextColor = Color.White;
            };
            fechaInicial.PropertyChanged += (sender, e) =>
            {
                if (e.PropertyName == DatePicker.DateProperty.PropertyName)
                {
                    if (fechaInicial.Date.Date > fechaFinal.Date.Date)
                    {
                        fechaFinal.Date = fechaInicial.Date;
                    }
                }
            };
            fechaFinal.PropertyChanged += async(sender, e) =>
            {
                if (e.PropertyName == DatePicker.DateProperty.PropertyName)
                {
                    if (fechaInicial.Date.Date > fechaFinal.Date.Date)
                    {
                        await DisplayAlert("¡Advertencia!", "La fecha final de filtrado debe ser mayor a la inicial.", "Aceptar");

                        fechaFinal.Date = fechaInicial.Date;
                        return;
                    }
                }
            };

            Filtrado.Children.Add(fechaInicial, 0, 0);
            Filtrado.Children.Add(
                new Label
            {
                TextColor               = Color.White,
                FontSize                = 12,
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalOptions         = LayoutOptions.CenterAndExpand,
                VerticalTextAlignment   = TextAlignment.Center,
                Opacity    = 0.90,
                FontFamily = Device.OnPlatform("OpenSans", "OpenSans-Regular", null),
                Text       = "a"
            }, 1, 0);
            Filtrado.Children.Add(fechaFinal, 2, 0);
            Filtrado.Children.Add(new BoxView {
                BackgroundColor = Color.White, Opacity = 0.80, HeightRequest = 0.5
            }, 0, 1);
            Filtrado.Children.Add(new BoxView {
                BackgroundColor = Color.White, Opacity = 0.80, HeightRequest = 0.5
            }, 2, 1);
            Header.Children.Add(
                new StackLayout
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                Spacing           = 0,
                Children          =
                {
                    new Label
                    {
                        TextColor               = Color.White,
                        FontSize                = 12,
                        HorizontalOptions       = LayoutOptions.Center,
                        HorizontalTextAlignment = TextAlignment.Center,
                        Opacity    = 0.80,
                        FontFamily = Device.OnPlatform("OpenSans", "OpenSans-Regular", null),
                        Text       = "MOSTRANDO DE"
                    },
                    Filtrado
                }
            });



            HeaderPacientes = new StackLayout
            {
                Padding           = new Thickness(0, 0, 0, 5),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Spacing           = 10,
                Children          =
                {
                    Header,
                    PacientesHeader,
                    notificacionFiltrado
                }
            };


            Modal           = new Grid();
            ModalBackground = new Grid
            {
                BackgroundColor = Color.Black,
                Padding         = new Thickness(0, 0, 0, 0),
                WidthRequest    = 200,
                HeightRequest   = 200,
            };
            Modal.Children.Add(ModalBackground);

            var GestoModal = new TapGestureRecognizer();

            GestoModal.Tapped += (s, e) =>
            {
                if (BusquedaActiva)
                {
                    BusquedaRapida.Text = "";
                }
                OcultarModal();
            };
            Modal.GestureRecognizers.Add(GestoModal);
            ModalBackground.GestureRecognizers.Add(GestoModal);

            ContenidoCaja = new ScrollView
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand
            };
            refreshView = new PullToRefreshLayout()
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                RefreshColor      = Color.Accent,
                Content           = ContenidoCaja
            };
            refreshView.RefreshCommand = RefreshCommand;;
            //refreshView.SetBinding<CajaModeloVista>(PullToRefreshLayout.IsRefreshingProperty, vm => vm.IsBusy, BindingMode.OneWay);


            Contenido = new RelativeLayout();
            Contenido.Children.Add(HeaderPacientes,
                                   xConstraint: Constraint.Constant(0),
                                   yConstraint: Constraint.Constant(0),
                                   widthConstraint: Constraint.RelativeToParent(parent => parent.Width));

            Contenido.Children.Add(MenuContextual,
                                   xConstraint: Constraint.Constant(0),
                                   yConstraint: Constraint.Constant(0));

            Contenido.Children.Add(
                filtrarGesture,
                Constraint.RelativeToView(HeaderPacientes, (parent, view) => { return((view.Width / 5) * 3.95); }),
                Constraint.Constant(20),
                Constraint.RelativeToView(HeaderPacientes, (parent, view) => { return((view.Width / 5) * 2); }),
                Constraint.Constant(80)
                );
            Contenido.Children.Add(
                filtrar,
                Constraint.RelativeToView(HeaderPacientes, (parent, view) => { return((view.Width / 6.2) * 5); }),
                Constraint.Constant((120 / 2.2))
                );
            Contenido.Children.Add(notificacionCajaVacia,
                                   xConstraint: Constraint.Constant(0),
                                   yConstraint: Constraint.RelativeToView(HeaderPacientes, (parent, view) => { return(view.Y + view.Height); }),
                                   widthConstraint: Constraint.RelativeToParent(parent => parent.Width),
                                   heightConstraint: Constraint.RelativeToView(HeaderPacientes, (parent, view) => { return(parent.Height - view.Height); })
                                   );

            Content = Contenido;
            PacientesVistaVisible = false;
            CajaVistaPresentado   = true;
        }
Example #58
0
        public UserRegistrationView()
        {
            BindingContext = new UserViewModel(this.Navigation);

            indicator = new ActivityIndicator
            {
                Color             = Colors.DarkGray.ToFormsColor(),
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
            };
            //indicator.SetBinding (ActivityIndicator.IsRunningProperty, "IsLoading");
            //indicator.SetBinding (ActivityIndicator.IsVisibleProperty, "IsLoading");
            stack_CoverPage = new StackLayout
            {
                WidthRequest  = Width,
                HeightRequest = Width / 4,
                //BackgroundColor=Color.Red,
                BackgroundColor = Colors.DarkGray.ToFormsColor(),
            };
            img_User = new CircleImage
            {
                WidthRequest  = Width / 4,
                HeightRequest = Width / 4,

                HorizontalOptions = LayoutOptions.Center,
                //BackgroundColor=Color.Yellow,
                TranslationY = -((Width / 4) / 2 + 10),
                Aspect       = Aspect.Fill,
                Source       = "CircleImage.png",
            };
            img_User.SetBinding(CircleImage.SourceProperty, "ImageSource", BindingMode.Default);


            ViewModel.ProfilePicture = img_User;
            btn_camera = new Image
            {
                Source            = "camera.png",
                WidthRequest      = Width / 8,
                HeightRequest     = Height / 8,
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Center,
                BackgroundColor   = Xamarin.Forms.Color.Red,
            };

            var Cameratap = new TapGestureRecognizer(OnCameraTapped);

            btn_camera.IsEnabled = true;
            btn_camera.GestureRecognizers.Clear();
            btn_camera.GestureRecognizers.Add(Cameratap);

            btn_gallery = new Image
            {
                Source            = "gallery.png",
                WidthRequest      = Width / 8,
                HeightRequest     = Height / 8,
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Center,
                BackgroundColor   = Xamarin.Forms.Color.Green,
            };
            var Gallerytap = new TapGestureRecognizer(OnGalleryTapped);

            btn_gallery.IsEnabled = true;
            btn_gallery.GestureRecognizers.Clear();
            btn_gallery.GestureRecognizers.Add(Gallerytap);

            stack_pop = new StackLayout
            {
                HeightRequest     = Width / 2,
                WidthRequest      = Width / 2,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                BackgroundColor   = Xamarin.Forms.Color.White,
                TranslationY      = Width / 2,
                Opacity           = 1,
                Children          =
                {
                    new StackLayout
                    {
                        VerticalOptions   = LayoutOptions.Center,
                        HorizontalOptions = LayoutOptions.Center,
                        Orientation       = StackOrientation.Horizontal,
                        TranslationY      = Width / 6,
                        Children          =
                        {
                            btn_camera, btn_gallery
                        }
                    }
                }
            };
            stack_popup = new StackLayout
            {
                WidthRequest    = Width,
                HeightRequest   = Height,
                BackgroundColor = Xamarin.Forms.Color.Transparent,
                Children        =
                {
                    stack_pop
                }
            };
            image_bg = new Image
            {
                WidthRequest      = Width,
                HeightRequest     = Height,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Source            = "bg.png",
                IsVisible         = false
            };
            var PopUpGestureRecognizer = new  TapGestureRecognizer
            {
                //ViewModel.SelectPictureCommand.Execute(null);
                Command = new Command(() =>
                {
                    //ViewModel.SelectPictureCommand.Execute(null);
                    var eAndN = new Tuple <Easing, string>[]
                    {
                        new Tuple <Easing, string> (Easing.Linear, "Linear")
                    };
                    double w     = Width;
                    double h     = Height;
                    var newPos   = new Rectangle(0, h, w, h);
                    var eAndName = eAndN[iClicks];
                    var easing   = eAndName.Item1;
                    stack_popup.LayoutTo(newPos, 80, easing);
                    iClicks           %= eAndN.Length;
                    image_bg.IsVisible = false;
                }),
                NumberOfTapsRequired = 1
            };

            stack_popup.GestureRecognizers.Add(PopUpGestureRecognizer);


            var ProfilePictureGestureRecognizer = new  TapGestureRecognizer
            {
                //ViewModel.SelectPictureCommand.Execute(null);
                Command = new Command(() =>
                {
                    var eAndN = new Tuple <Easing, string>[]
                    {
                        new Tuple <Easing, string> (Easing.Linear, "Linear")
                    };
                    double w     = Width;
                    double h     = Height;
                    var newPos   = new Rectangle(0, 0, w, h);
                    var eAndName = eAndN[iClicks];
                    var easing   = eAndName.Item1;
                    stack_popup.LayoutTo(newPos, 80, easing);
                    iClicks           %= eAndN.Length;
                    image_bg.IsVisible = true;
                }),
                NumberOfTapsRequired = 1
            };

            img_User.GestureRecognizers.Add(ProfilePictureGestureRecognizer);
            txt_Name = new EditText
            {
                WidthRequest      = Width,
                HorizontalOptions = LayoutOptions.Center,
                Placeholder       = "FullName",
                TextColor         = Colors.DarkGray.ToFormsColor(),
                BackgroundColor   = Xamarin.Forms.Color.Transparent,
                HeightRequest     = Width / 10,
            };
            txt_Name.SetBinding(Entry.TextProperty, "UserRegInfo.name");

            txt_Email = new EditText
            {
                WidthRequest      = Width,
                HorizontalOptions = LayoutOptions.Center,
                Keyboard          = Keyboard.Email,
                Placeholder       = "Email",
                TextColor         = Colors.DarkGray.ToFormsColor(),
                BackgroundColor   = Xamarin.Forms.Color.Transparent,
                HeightRequest     = Width / 10
            };
            txt_Email.SetBinding(Entry.TextProperty, "UserRegInfo.email");

            txt_Password = new EditText
            {
                WidthRequest      = Width,
                HorizontalOptions = LayoutOptions.Center,
                IsPassword        = true,
                Placeholder       = "Password",
                TextColor         = Colors.DarkGray.ToFormsColor(),
                BackgroundColor   = Xamarin.Forms.Color.Transparent,
                HeightRequest     = Width / 10
            };
            txt_Password.SetBinding(Entry.TextProperty, "UserRegInfo.password");

            picker_Country = new CustomPicker
            {
                WidthRequest      = Width,
                HorizontalOptions = LayoutOptions.Center,
                Title             = "Location",
                HeightRequest     = Width / 10,
                BackgroundColor   = Xamarin.Forms.Color.Transparent,
            };
            picker_Country.SelectedIndexChanged += ((sender, e) =>
            {
                ViewModel.SelectedIndex = picker_Country.SelectedIndex;
            });


            btn_Submit = new Button
            {
                WidthRequest      = Width / 2,
                HorizontalOptions = LayoutOptions.Center,
                HeightRequest     = Width / 8,
                Text            = "Submit",
                FontSize        = 17,
                TextColor       = Xamarin.Forms.Color.White,
                BackgroundColor = Colors.DarkGray.ToFormsColor(),
                //CommandParameter = 1,
                Command = ViewModel.RegisterUser,
            };

            stack_TopView = new StackLayout
            {
                HorizontalOptions = LayoutOptions.Fill,
                HeightRequest     = Width / 3,
                Padding           = new Thickness(0, 0, 0, Height / 45),
                //BackgroundColor=Color.Blue,
                Children =
                {
                    stack_CoverPage, img_User
                }
            };

            lbl_Expert = new Label
            {
                Text           = "Experts",
                FontSize       = 18,
                TextColor      = Colors.DarkGray.ToFormsColor(),
                FontAttributes = FontAttributes.Bold
            };

            stack_MiddleView = new StackLayout
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.StartAndExpand,
                Padding           = new Thickness(Width / 8, Height / 40, Width / 8, 0),
                //BackgroundColor=Color.Pink,
                Spacing  = Height / 45,
                Children =
                {
                    txt_Name, txt_Email, txt_Password, picker_Country, lbl_Expert
                }
            };

            img_iOS = new Image
            {
                WidthRequest      = Width / 7,
                HeightRequest     = Width / 7,
                HorizontalOptions = LayoutOptions.Start,
                Source            = "iOS.png",
                BackgroundColor   = Colors.DarkGray.ToFormsColor(),
                IsEnabled         = false
            };
            var iOStap = new TapGestureRecognizer(OniOSTapped);

            iOStap.NumberOfTapsRequired = 1;
            img_iOS.IsEnabled           = true;
            img_iOS.GestureRecognizers.Clear();
            img_iOS.GestureRecognizers.Add(iOStap);

            img_Certified = new Image
            {
                WidthRequest      = Width / 7,
                HeightRequest     = Width / 7,
                HorizontalOptions = LayoutOptions.Center,
                Source            = "Certified.png",
                BackgroundColor   = Colors.DarkGray.ToFormsColor(),
                IsEnabled         = false
            };

            var Certifiedtap = new TapGestureRecognizer(OnCertifiedTapped);

            img_Certified.IsEnabled = true;
            img_Certified.GestureRecognizers.Clear();
            img_Certified.GestureRecognizers.Add(Certifiedtap);

            img_Android = new Image
            {
                WidthRequest      = Width / 7,
                HeightRequest     = Width / 7,
                HorizontalOptions = LayoutOptions.End,
                Source            = "Android.png",
                BackgroundColor   = Colors.DarkGray.ToFormsColor(),
                IsEnabled         = false
            };

            var Androidtap = new TapGestureRecognizer(OnAndroidTapped);

            Androidtap.NumberOfTapsRequired = 1;
            img_Android.IsEnabled           = true;
            img_Android.GestureRecognizers.Clear();
            img_Android.GestureRecognizers.Add(Androidtap);

            img_Forms = new Image
            {
                WidthRequest      = Width / 7,
                HeightRequest     = Width / 7,
                HorizontalOptions = LayoutOptions.Start,
                Source            = "Forms.png",
                BackgroundColor   = Colors.DarkGray.ToFormsColor(),
                IsEnabled         = false
            };

            var Formstap = new TapGestureRecognizer(OnFormsTapped);

            img_Forms.IsEnabled = true;
            img_Forms.GestureRecognizers.Clear();
            img_Forms.GestureRecognizers.Add(Formstap);


            img_Insights = new Image
            {
                WidthRequest      = Width / 7,
                HeightRequest     = Width / 7,
                HorizontalOptions = LayoutOptions.Center,
                Source            = "Insight.png",
                BackgroundColor   = Colors.DarkGray.ToFormsColor(),
                IsEnabled         = false
            };

            var Insightstap = new TapGestureRecognizer(OnInsightTapped);

            img_Insights.IsEnabled = true;
            img_Insights.GestureRecognizers.Clear();
            img_Insights.GestureRecognizers.Add(Insightstap);


            img_Testcloud = new Image
            {
                WidthRequest      = Width / 7,
                HeightRequest     = Width / 7,
                HorizontalOptions = LayoutOptions.End,
                Source            = "TestCloud.png",
                BackgroundColor   = Colors.DarkGray.ToFormsColor(),
                IsEnabled         = false
            };
            var Testcloudtap = new TapGestureRecognizer(OnTestCloudTapped);

            img_Testcloud.IsEnabled = true;
            img_Testcloud.GestureRecognizers.Clear();
            img_Testcloud.GestureRecognizers.Add(Testcloudtap);


            stack_FirstExpert = new StackLayout
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.StartAndExpand,
                Orientation       = StackOrientation.Horizontal,
                //BackgroundColor=Color.Yellow,
                Spacing  = Height / 40,
                Children =
                {
                    img_iOS, img_Certified, img_Android
                }
            };
            stack_SecondExpert = new StackLayout
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.StartAndExpand,
                Orientation       = StackOrientation.Horizontal,
                //BackgroundColor=Color.Red,
                Spacing  = Height / 40,
                Children =
                {
                    img_Forms, img_Insights, img_Testcloud
                }
            };
            StackLayout stack_MainLayout = new StackLayout
            {
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions   = LayoutOptions.Fill,
                //BackgroundColor=Color.Aqua,
                Spacing  = Width / 25,
                Children =
                {
                    stack_MiddleView, stack_FirstExpert, stack_SecondExpert, btn_Submit
                }
            };

            scroll_Main = new ScrollView
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Start,
            };
            scroll_Main.Content = stack_MainLayout;

            mainLayout = new StackLayout
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.End,
                BackgroundColor   = Xamarin.Forms.Color.White,
                WidthRequest      = Width,
                HeightRequest     = Height,
                Children          =
                {
                    stack_TopView, scroll_Main
                }
            };

            rltv_main = new RelativeLayout
            {
                WidthRequest  = Width,
                HeightRequest = Height
            };

            rltv_main.Children.Add(mainLayout, Constraint.Constant(0), Constraint.Constant(0), Constraint.Constant(Width), Constraint.Constant(Height));
            rltv_main.Children.Add(image_bg, Constraint.Constant(0), Constraint.Constant(0), Constraint.Constant(Width), Constraint.Constant(Height));
            rltv_main.Children.Add(stack_popup, Constraint.Constant(0), Constraint.Constant(Height), Constraint.Constant(Width), Constraint.Constant(Height));
            this.Content = rltv_main;
        }
Example #59
0
        void InitSizes()
        {
            layoutScrollSize = new StackLayout {
                Orientation       = StackOrientation.Horizontal,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };

            scrollSizes = new MyScrollView {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Orientation     = ScrollOrientation.Horizontal,
            };
            scrollSizes.Content = layoutScrollSize;

            relativeLayoutSize = new RelativeLayout()
            {
                HeightRequest = 43
            };

            relativeLayoutSize.Children.Add(scrollSizes,
                                            Constraint.Constant(0),
                                            Constraint.Constant(0),
                                            Constraint.RelativeToParent((parent) => {
                return(parent.Width);
            }),
                                            Constraint.RelativeToParent((parent) => {
                return(parent.Height);
            })
                                            );

            relativeLayoutSize.Children.Add(
                new Image {
                HorizontalOptions = LayoutOptions.Start,
                Source            = Device.OnPlatform("Catalog/Sizesfon_left_", "Sizesfon_left_", "Sizesfon_left_"),
                HeightRequest     = Utils.GetSize(43)
            },
                Constraint.Constant(0),
                Constraint.Constant(0)
                );

            relativeLayoutSize.Children.Add(
                new Image {
                HorizontalOptions = LayoutOptions.EndAndExpand,
                Source            = Device.OnPlatform("Catalog/Sizesfon_right_", "Sizesfon_right_", "Sizesfon_right_"),
                HeightRequest     = Utils.GetSize(43)
            },
                Constraint.RelativeToParent((parent) => {
                return(parent.Width - 40);
            }),
                Constraint.Constant(0)
                );

            lblSize = new Label {
                HorizontalOptions     = LayoutOptions.CenterAndExpand,
                VerticalOptions       = LayoutOptions.FillAndExpand,
                VerticalTextAlignment = TextAlignment.Center,
                FontSize = 14,
                Text     = "Нет размеров",
            };

            layoutSize = new StackLayout {
                Padding       = new Thickness(0, 8, 0, 0),
                Spacing       = 0,
                HeightRequest = Utils.GetSize(45),
                Children      =
                {
                    new BoxView {
                        HeightRequest = 1.5
                    },
                    relativeLayoutSize,
                    //gridLayoutSize,
                    lblSize,
                    new BoxView {
                        HeightRequest = 1.5
                    },
                }
            };
        }
        private void Setup()
        {
            Title = ViewModel.InitialTitle;
            // image
            this.ContentViewImage.Content = this.ImageContentManage;


            // Toolbar items
            this.ToolbarItems.Add(ToolbarUser);


            // GridButtons
            // grid.Children.Add(item ,col, col+colSpan, row, row+rowspan)
            this.GridButtons.Children.Add(ImageButtonUploadPhotos, 0, 1, 0, 1);
            this.GridButtons.Children.Add(ImageButtonDeletePhotos, 1, 2, 0, 1);
            this.GridButtons.Children.Add(ButtonSubscribe, 0, 2, 1, 2);


            // Label wrapping is buggy, so we put the wrapped label in 1x1 grid
            var gridSummary = new Grid {
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },                                                                           // row 0
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },                                                                           // row 1
                }
            };

            gridSummary.Children.Add(this.LabelURL, 0, 0);
            gridSummary.Children.Add(this.LabelMessage, 0, 1);

            // flexlayout
            this.FlexLayoutMainContent.Children.Add(this.ContentViewImage);
            this.FlexLayoutMainContent.Children.Add(this.LabelInstruction);
            this.FlexLayoutMainContent.Children.Add(gridSummary);
            this.FlexLayoutMainContent.Children.Add(this.GridButtons);

            this.ScrollViewContent.Content = new StackLayout {
                Children =
                {
                    this.FlexLayoutMainContent,
                }
            };

            RelativeLayout relativelayout = new RelativeLayout();

            // stack
            relativelayout.Children.Add(ScrollViewContent, Constraint.Constant(0), Constraint.Constant(0),
                                        Constraint.RelativeToParent((parent) => {
                return(parent.Width);
            }), Constraint.RelativeToParent((parent) => {
                return(parent.Height);
            }));

            // loading
            relativelayout.Children.Add(CustomActivityIndicator, Constraint.Constant(0), Constraint.Constant(0),
                                        Constraint.RelativeToParent((parent) => {
                return(parent.Width);
            }), Constraint.RelativeToParent((parent) => {
                return(parent.Height);
            }));

            Content = relativelayout;
        }