Esempio n. 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.RentFlow1);
            var signature = FindViewById <SignaturePadView>(Resource.Id.signatureView);

            signature.Caption.Text = "Authorization Signature";
            signature.Caption.SetTypeface(Typeface.Serif, TypefaceStyle.BoldItalic);
            signature.Caption.SetTextSize(global::Android.Util.ComplexUnitType.Sp, 16f);
            signature.SignaturePrompt.Text = ">>";
            signature.SignaturePrompt.SetTypeface(Typeface.SansSerif, TypefaceStyle.Normal);
            signature.SignaturePrompt.SetTextSize(global::Android.Util.ComplexUnitType.Sp, 32f);
            signature.BackgroundColor = Color.Rgb(0, 0, 0); // a light yellow.
            signature.StrokeColor     = Color.White;

            signature.BackgroundImageView.SetImageResource(Resource.Drawable.CarExterior);
            //signature.BackgroundImageView.SetAlpha(16);
            signature.BackgroundImageView.SetAdjustViewBounds(true);

            var layout = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);

            layout.AddRule(LayoutRules.CenterInParent);
            layout.SetMargins(20, 20, 20, 20);
            signature.BackgroundImageView.LayoutParameters = layout;
        }
Esempio n. 2
0
        public TabularItemButton(Context context) : base(context)
        {
            RelativeLayout.LayoutParams paramsForHolder = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.WrapContent);

            LayoutParameters = paramsForHolder;

            TextView NameText   = new TextView(context);
            TextView numberText = new TextView(context);

            NameText.SetTextAppearance(context, Resource.Style.TextAppearance_AppCompat_Medium);
            NameText.SetTextColor(Color.ParseColor("#000000"));
            NameText.SetPadding(10, 10, 10, 10);

            RelativeLayout.LayoutParams paramsForNameText = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            paramsForNameText.AddRule(LayoutRules.AlignParentTop);
            paramsForNameText.AddRule(LayoutRules.AlignParentStart);
            NameText.LayoutParameters = paramsForNameText; //causes layout update


            numberText.SetTextAppearance(context, Resource.Style.TextAppearance_AppCompat_Medium);
            numberText.SetTextColor(Color.ParseColor("#ffffff"));
            numberText.SetBackgroundColor(Color.ParseColor("#8f8e94"));
            numberText.SetBackgroundResource(Resource.Drawable.tabularcount);
            numberText.SetPadding(7, 0, 7, 0);
            numberText.Gravity = GravityFlags.Center;

            RelativeLayout.LayoutParams paramsFornumberText = new RelativeLayout.LayoutParams(70, RelativeLayout.LayoutParams.WrapContent);
            paramsFornumberText.AddRule(LayoutRules.AlignParentEnd);
            paramsFornumberText.AddRule(LayoutRules.CenterVertical);
            paramsFornumberText.SetMargins(0, 0, 30, 0);
            numberText.LayoutParameters = paramsFornumberText; //causes layout update

            AddView(NameText);
            AddView(numberText);
        }
Esempio n. 3
0
        internal void UpdatePicture(string imgData, List <Dictionary <string, object> > coordIndexList)
        {
            var picture = BinaryToBitmap(imgData);

            if (picture != null)
            {
                image.SetImageBitmap(picture);
            }
            if (coordIndexList == null && coordIndexList.Count == 0)
            {
                return;
            }
            for (int i = 0; i < coordIndexList.Count; i++)
            {
                var x       = Convert.ToInt32(coordIndexList[i]["X"]);
                var y       = Convert.ToInt32(coordIndexList[i]["Y"]);
                var control = new Button(zoomLayout.Context);
                var param   = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
                param.SetMargins(x, y, 0, 0);
                param.Width              = DpToPx(30, this.Context);
                param.Height             = DpToPx(30, this.Context);
                control.LayoutParameters = param;
                control.SetBackgroundColor(Color.Black);
                control.Text = coordIndexList[i]["Index"].ToString();
                control.SetTextColor(Color.White);
                zoomLayout.AddView(control);
            }
        }
Esempio n. 4
0
        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);

            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);
        }
Esempio n. 5
0
        public static void SetXY(View el, int left, int top)
        {
            var lp = new RelativeLayout.LayoutParams(el.Width, el.Height);

            lp.SetMargins(left, top, 0, 0);
            el.LayoutParameters = lp;
        }
        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;
		}
Esempio n. 7
0
        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);
        }
		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;
		}
        public static ViewGroup.MarginLayoutParams WithMargins(this ViewGroup.MarginLayoutParams self, int?left, int?top, int?right, int?bottom)
        {
            var actualTop    = top ?? self.TopMargin;
            var actualLeft   = left ?? self.LeftMargin;
            var actualRight  = right ?? self.RightMargin;
            var actualBottom = bottom ?? self.BottomMargin;

            switch (self)
            {
            case LinearLayout.LayoutParams linearParams:
                var newLinearLayoutParams = new LinearLayout.LayoutParams(self);
                newLinearLayoutParams.SetMargins(actualLeft, actualTop, actualRight, actualBottom);
                return(newLinearLayoutParams);

            case RelativeLayout.LayoutParams relativeParams:
                var newRelativeLayoutParams = new RelativeLayout.LayoutParams(self);
                newRelativeLayoutParams.SetMargins(actualLeft, actualTop, actualRight, actualBottom);
                return(newRelativeLayoutParams);

            case FrameLayout.LayoutParams frameParams:
                var newFrameLayoutParams = new FrameLayout.LayoutParams(self);
                newFrameLayoutParams.SetMargins(actualLeft, actualTop, actualRight, actualBottom);
                return(newFrameLayoutParams);

            case RecyclerView.LayoutParams recyclerParams:
                var newRecyclerParams = new FrameLayout.LayoutParams(self);
                newRecyclerParams.SetMargins(actualLeft, actualTop, actualRight, actualBottom);
                return(newRecyclerParams);
            }

            return(null);
        }
Esempio n. 10
0
		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;
        }
Esempio n. 11
0
        protected override View GetViewImpl(Context context, View convertView, ViewGroup parent)
        {
            if (scaled == null)
            {
                scaled = Scale(Value);
            }

            Click = delegate { SelectImage(); };

            var view = convertView as RelativeLayout ?? new RelativeLayout(context);

            var parms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                        ViewGroup.LayoutParams.WrapContent);

            parms.SetMargins(5, 2, 5, 2);
            parms.AddRule(LayoutRules.AlignParentLeft);

            // SEC bug fix, not yet submitted to Kenny.  Getting exception "specified view already has a parent"
            if (scaled.Parent != view)
            {
                view.AddView(scaled, parms);
            }

            return(view);
        }
Esempio n. 12
0
        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);

            parms.SetMargins(5, 3, 5, 0);
            parms.AddRule(LayoutRules.CenterVertical);

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

            var sparms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                         ViewGroup.LayoutParams.WrapContent);

            sparms.SetMargins(5, 3, 5, 0);
            sparms.AddRule(LayoutRules.CenterVertical);
            sparms.AddRule(LayoutRules.AlignParentRight);

            sw = new ToggleButton(context)
            {
                Tag = 1, Checked = Value
            };

            view.AddView(sw, sparms);
            return(view);
        }
        private int SetItemListContainerHeight(LinearLayout layout, Android.Support.V7.Widget.Toolbar layoutBelow)
        {
            var rlCheckoutButtonContainer = thisFragmentView.FindViewById <RelativeLayout>(Resource.Id.rlCheckoutButtonContainer);

            int actionBarHeight         = dpToPixel(40);
            int tabLayoutHeight         = mTabs.Height;
            int searchToolBarHeight     = toolbar.Height;
            int checkoutButtonHeight    = rlCheckoutButtonContainer.Height;
            int marginOffset            = dpToPixel(10);
            int fragmentContainerHeight = thisFragmentViewOriginalHeight;

            int calculatedHeight = fragmentContainerHeight - (actionBarHeight + tabLayoutHeight + searchToolBarHeight + checkoutButtonHeight + marginOffset);
            int _topMargin       = 0;
            int _bottomMargin    = 0;
            int _leftMargin      = dpToPixel(5);
            int _rightMargin     = dpToPixel(5);

            RelativeLayout.LayoutParams layoutParams =
                new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, calculatedHeight);
            layoutParams.SetMargins(_leftMargin, _topMargin, _rightMargin, _bottomMargin);
            layoutParams.AddRule(LayoutRules.Below, layoutBelow.Id);
            layout.LayoutParameters = layoutParams;
            layout.RequestLayout();

            return(calculatedHeight);
        }
Esempio n. 14
0
 public void HidePotvrdaButton()
 {
     izradaPotvrde.Visibility = Android.Views.ViewStates.Gone;
     RelativeLayout.LayoutParams imgViewParams = new RelativeLayout.LayoutParams(140, 140);
     imgViewParams.AddRule(LayoutRules.AlignParentBottom);
     imgViewParams.AddRule(LayoutRules.AlignParentRight);
     imgViewParams.SetMargins(10, 10, 20, 20);
     noviMaterijalBtn.LayoutParameters = imgViewParams;
 }
        static AnimeListPageFlyoutBuilder()
        {
            ParamTextView = new RelativeLayout.LayoutParams(-1, -2); //wrap content
            ParamTextView.AddRule(LayoutRules.AlignParentLeft);
            ParamTextView.AddRule(LayoutRules.CenterVertical);
            var margin = DimensionsHelper.DpToPx(8);

            ParamTextView.SetMargins(margin * 2, margin, margin * 2, margin);
        }
        private void AdjustViewsToDevice()
        {
            RelativeLayout.LayoutParams ll = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            ll.SetMargins(10, 10, 10, 10); //left, top, right, bottom

            ll.Width = MainActivity.widthInDp - 100;
            textView.LayoutParameters = ll;
            textView.RequestLayout();
        }
		private static void SetLayotParameters(ConversationMessage currentItem, ConversationMessageViewHolder vh) {
			RelativeLayout.LayoutParams parameters = new RelativeLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent);
			if (currentItem.UserWasSender) {
				parameters.AddRule(LayoutRules.AlignParentLeft);
				parameters.SetMargins(5, 5, 30, 5);
				vh.MessageLayout.Background = ContextCompat.GetDrawable(Application.Context, Resource.Drawable.conversation_user_message_background_border);
				vh.MessageHeader.SetTextColor(Color.Black);
				vh.MessageContent.SetTextColor(Color.Black);
			}
			else {
				parameters.AddRule(LayoutRules.AlignParentRight);
				parameters.SetMargins(30, 5, 5, 5);
				vh.MessageLayout.Background = ContextCompat.GetDrawable(Application.Context, Resource.Drawable.conversation_sender_message_background_border);
				vh.MessageHeader.SetTextColor(Color.White);
				vh.MessageContent.SetTextColor(Color.White);
			}
			vh.MessageLayout.LayoutParameters = parameters;
		}
        private void AdjustViewsToDevice(ImageView imageView)
        {
            RelativeLayout.LayoutParams ll = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            ll.SetMargins(10, 10, 10, 10); //left, top, right, bottom
            ll.Width  = 100;
            ll.Height = 100;

            imageView.LayoutParameters = ll;
            imageView.RequestLayout();
        }
 private void SetSearchActiveGridHeight(LinearLayout _layout, int _gridheight, int _buttonheight,
                                        Android.Support.V7.Widget.Toolbar layoutBelow)
 {
     RelativeLayout.LayoutParams layoutParams =
         new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, _gridheight - _buttonheight);
     layoutParams.SetMargins(dpToPixel(5), 0, dpToPixel(5), 0);
     layoutParams.AddRule(LayoutRules.Below, layoutBelow.Id);
     _layout.LayoutParameters = layoutParams;
     _layout.RequestLayout();
 }
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            if (IsInitialized)
            {
                return;
            }

            base.OnViewCreated(view, savedInstanceState);

            if (_media.Count > 1)
            {
                _photos.Visibility           = ViewStates.Visible;
                _previewContainer.Visibility = ViewStates.Gone;
                _photos.SetLayoutManager(new LinearLayoutManager(Activity, LinearLayoutManager.Horizontal, false));
                _photos.SetAdapter(GalleryAdapter);
                _photos.AddItemDecoration(new ListItemDecoration((int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 10, Resources.DisplayMetrics)));
            }
            else
            {
                _photos.Visibility           = ViewStates.Gone;
                _previewContainer.Visibility = ViewStates.Visible;
                _preview.CornerRadius        = BitmapUtils.DpToPixel(5, Resources);

                var margin = (int)BitmapUtils.DpToPixel(15, Resources);

                if (_media[0].PreparedBitmap == null)
                {
                    var layoutParams = new RelativeLayout.LayoutParams(Resources.DisplayMetrics.WidthPixels - margin * 2, Resources.DisplayMetrics.WidthPixels - margin * 2);
                    layoutParams.SetMargins(margin, 0, margin, margin);
                    _previewContainer.LayoutParameters = layoutParams;

                    _preview.SetImagePath(_media[0].Path, _media[0].Parameters);
                    _ratioBtn.Click  += RatioBtnOnClick;
                    _rotateBtn.Click += RotateBtnOnClick;
                }
                else
                {
                    var previewSize = ViewUtils.CalculateImagePreviewSize(_media[0].PreparedBitmap.Width,
                                                                          _media[0].PreparedBitmap.Height, Resources.DisplayMetrics.WidthPixels - margin * 2,
                                                                          int.MaxValue);
                    var layoutParams = new RelativeLayout.LayoutParams(previewSize.Width, previewSize.Height);
                    layoutParams.SetMargins(margin, 0, margin, margin);
                    _previewContainer.LayoutParameters = layoutParams;

                    _ratioBtn.Visibility = _rotateBtn.Visibility = ViewStates.Gone;
                    _preview.SetImageBitmap(_media[0].PreparedBitmap);
                }

                _preview.Touch += PreviewOnTouch;
            }

            SearchTextChanged();
            CheckOnSpam();
        }
Esempio n. 21
0
        private View prepareElementForCircle(View elem, int distX, int distY)
        {
             RelativeLayout.LayoutParams lp = createNewRelativeLayoutParams();

            elem.Measure(0, 0);
            int deltaX = elem.Width / 2;
            int deltaY = elem.Height / 2;
            lp.SetMargins(distX - deltaX, 0, 0, radius - distY - deltaY);
            elem.LayoutParameters =(lp);
            return elem;
        }
        public void SignaturePad()
        {
            signature.BackgroundColor = Color.Rgb(205, 55, 155);
            signature.StrokeColor     = Color.White;

            var layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.WrapContent);

            layout.AddRule(LayoutRules.CenterInParent);
            layout.SetMargins(20, 20, 20, 20);
            signature.BackgroundImageView.LayoutParameters = layout;
        }
        // Delay creation of static edit text to last moment when we are sure to be in Android UI thread.
        // -> some Android phones crashes when native edit text is created from another thread than OS UI thread.
        private void EnsureStaticEditText()
        {
            if (staticEditText == null)
            {
                // create and add the edit text
                staticEditText = new MyAndroidEditText(PlatformAndroid.Context);

                var editLayoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
                editLayoutParams.SetMargins(75, 200, 75, 0);
                GetGameContext().EditTextLayout.AddView(staticEditText, editLayoutParams);
            }
        }
Esempio n. 24
0
        //public override void OnPause()
        //{
        //    if (_isEnableSaveState)
        //    {
        //        SaveGalleryTemp();
        //        SavePreparePostTemp();
        //    }

        //    base.OnPause();
        //}

        //private void TitleOnFocusChange(object sender, View.FocusChangeEventArgs e)
        //{
        //    if (!e.HasFocus)
        //        SavePreparePostTemp();
        //}

        //private void LocalTagsChanged(object sender, NotifyCollectionChangedEventArgs e)
        //{
        //    Model.Tags = LocalTagsAdapter.LocalTags.ToArray();
        //    SavePreparePostTemp();
        //}

        //private void TitleChanged(object sender, Android.Text.TextChangedEventArgs e)
        //{
        //    Model.Title = Title.Text;
        //}

        //private void DescriptionChanged(object sender, Android.Text.TextChangedEventArgs e)
        //{
        //    Model.Description = Description.Text;
        //}

        protected virtual async void InitData()
        {
            if (_isSingleMode)
            {
                Photos.Visibility           = ViewStates.Gone;
                PreviewContainer.Visibility = ViewStates.Visible;
                Preview.CornerRadius        = Style.CornerRadius5;
                RatioBtn.Visibility         = ViewStates.Gone;
                RotateBtn.Visibility        = ViewStates.Gone;

                var previewSize  = BitmapUtils.CalculateImagePreviewSize(Media[0].Parameters, Style.ScreenWidth - Style.Margin15 * 2);
                var layoutParams = new RelativeLayout.LayoutParams(previewSize.Width, previewSize.Height);
                layoutParams.SetMargins(Style.Margin15, 0, Style.Margin15, Style.Margin15);
                PreviewContainer.LayoutParameters = layoutParams;
                Preview.Touch += PreviewOnTouch;

                if (Media[0].UploadState >= UploadState.Saved)
                {
                    Preview.SetImageBitmap(Media[0]);
                }
            }
            else
            {
                Photos.Visibility           = ViewStates.Visible;
                PreviewContainer.Visibility = ViewStates.Gone;
                Photos.SetLayoutManager(new LinearLayoutManager(Activity, LinearLayoutManager.Horizontal, false));
                Photos.AddItemDecoration(new ListItemDecoration(Style.Margin10));
                Photos.LayoutParameters.Height = Style.GalleryHorizontalHeight;

                Photos.SetAdapter(_galleryAdapter);
            }

            await ConvertAndSave();

            if (!IsInitialized)
            {
                return;
            }

            await CheckOnSpam();

            if (!IsInitialized)
            {
                return;
            }

            if (IsSpammer == true)
            {
                return;
            }

            StartUploadMedia(true);
        }
Esempio n. 25
0
        private void Initialize(Context context)
        {
            var standardMargin = (int)Resources.GetDimension(Resource.Dimension.standard_margin);
            var tileDimension  = (int)Resources.GetDimension(Resource.Dimension.player_tile_dimension);

            Background = context.GetDrawable(Resource.Layout.shape_player_tile);

            var layout = new RelativeLayout.LayoutParams(tileDimension, tileDimension);

            layout.SetMargins(standardMargin, standardMargin, standardMargin, standardMargin);
            LayoutParameters = layout;
        }
Esempio n. 26
0
        private void ShowDialog()
        {
            var relativeLayout = new RelativeLayout(Context.ApplicationContext);

            relativeLayout.SetMinimumHeight(450);
            relativeLayout.Background = CrossCurrentActivity.Current.Activity.GetDrawable(Resource.Drawable.client_app_layout_background);

            var dataFormParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);

            dataFormParams.Width       = ViewGroup.LayoutParams.MatchParent;
            dataFormParams.RightMargin = 48;
            dataFormParams.TopMargin   = 12;
            dataFormParams.Height      = ViewGroup.LayoutParams.WrapContent;

            dataForm                = new SfDataForm(Context.ApplicationContext);
            phoneInfo               = new PhoneInfo();
            dataForm.DataObject     = phoneInfo;
            dataForm.ColumnCount    = 4;
            dataForm.LayoutManager  = new DataFormLayoutManagerExt(dataForm, ShowCountryListDialog);
            dataForm.LabelPosition  = LabelPosition.Top;
            dataForm.Id             = View.GenerateViewId();
            dataForm.ValidationMode = ValidationMode.LostFocus;
            dataForm.CommitMode     = CommitMode.LostFocus;
            relativeLayout.AddView(dataForm, dataFormParams);

            var loginTxtParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);

            loginTxtParams.AddRule(LayoutRules.Below, dataForm.Id);
            loginTxtParams.SetMargins(12, 12, 12, 8);
            loginTxtParams.AddRule(LayoutRules.CenterHorizontal);
            loginTxtParams.AddRule(LayoutRules.AlignBottom);
            loginTxtParams.Height = ViewGroup.LayoutParams.WrapContent;
            loginTxtParams.Width  = ViewGroup.LayoutParams.WrapContent;

            var loginTxtView = new TextView(Context.ApplicationContext);

            loginTxtView.Id   = View.GenerateViewId();
            loginTxtView.Text = Resources.GetString(Resource.String.log_in);
            loginTxtView.SetTextColor(Color.White);
            loginTxtView.Id        = View.GenerateViewId();
            loginTxtView.TextSize  = 20;
            loginTxtView.Typeface  = Typeface.DefaultBold;
            loginTxtView.Clickable = true;
            relativeLayout.AddView(loginTxtView, loginTxtParams);

            loginTxtView.Click += LoginTxtView_Click;

            var builder = new AlertDialog.Builder(CrossCurrentActivity.Current.Activity, Resource.Style.LogInTheme)
                          .SetView(relativeLayout)
                          .Show();

            builder.Window.SetLayout(1000, 450);
        }
Esempio n. 27
0
        // Delay creation of static edit text to last moment when we are sure to be in Android UI thread.
        // -> some Android phones crashes when native edit text is created from another thread than OS UI thread.
        private void EnsureStaticEditText()
        {
            if (staticEditText == null)
            {
                // create and add the edit text
                staticEditText = new MyAndroidEditText(PlatformAndroid.Context);

                var editLayoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
                editLayoutParams.SetMargins(75, 200, 75, 0);
                GetGameContext().EditTextLayout.AddView(staticEditText, editLayoutParams);
            }
        }
Esempio n. 28
0
 private static void SetLayotParameters(ConversationMessage currentItem, ConversationMessageViewHolder vh)
 {
     RelativeLayout.LayoutParams parameters = new RelativeLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent);
     if (currentItem.UserWasSender)
     {
         parameters.AddRule(LayoutRules.AlignParentLeft);
         parameters.SetMargins(10, 5, 50, 15);
         vh.MessageLayout.Background = ContextCompat.GetDrawable(Application.Context, Resource.Drawable.conversation_user_message_background_border);
         var color = new Color(141, 110, 99);
         vh.MessageHeader.SetTextColor(color);
         vh.MessageContent.SetTextColor(color);
     }
     else
     {
         parameters.AddRule(LayoutRules.AlignParentRight);
         parameters.SetMargins(50, 5, 10, 15);
         vh.MessageLayout.Background = ContextCompat.GetDrawable(Application.Context, Resource.Drawable.conversation_sender_message_background_border);
         var color = new Color(239, 235, 233);
         vh.MessageHeader.SetTextColor(color);
         vh.MessageContent.SetTextColor(color);
     }
     vh.MessageLayout.LayoutParameters = parameters;
 }
Esempio n. 29
0
 private void MoveMyLocationButtonIntoBottom()
 {
     if (_mapView.FindViewById(1) != null)
     {
         View locationButton = ((View)_mapView.FindViewById(1).Parent).FindViewById(2);
         RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams)locationButton.LayoutParameters;
         layoutParams.AddRule(LayoutRules.AlignParentTop, 0);
         layoutParams.AddRule(LayoutRules.AlignParentBottom, 1);
         DisplayMetrics realMetrics = new DisplayMetrics();
         Activity.WindowManager.DefaultDisplay.GetRealMetrics(realMetrics);
         var bottomPadding = realMetrics.HeightPixels / 4;
         layoutParams.SetMargins(0, 0, 30, bottomPadding);
     }
 }
Esempio n. 30
0
        public override View GetView(Context context, View convertView, ViewGroup parent)
        {
            _context = context;
            var cell = new RelativeLayout(context);

            if (entry == null)
            {
                var _entry = new EditText(context)
                {
                    Tag  = 1,
                    Hint = hint ?? "",
                    Text = Value ?? "",
                };

                if (isPassword)
                {
                    _entry.InputType = Android.Text.InputTypes.TextVariationPassword;
                }

                entry = _entry;

                entry.TextChanged += delegate
                {
                    FetchValue();
                };
            }
            var tvparams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                           ViewGroup.LayoutParams.WrapContent);

            tvparams.SetMargins(5, 3, 5, 0);
            tvparams.AddRule(LayoutRules.CenterVertical);
            tvparams.AddRule(LayoutRules.AlignParentLeft);

            var tv = new TextView(context)
            {
                Text = Caption, TextSize = 16f
            };

            var eparams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                          ViewGroup.LayoutParams.WrapContent);

            eparams.SetMargins(5, 3, 5, 0);
            eparams.AddRule(LayoutRules.CenterVertical);
            eparams.AddRule(LayoutRules.AlignParentRight);

            cell.AddView(tv, tvparams);
            cell.AddView(entry, eparams);
            return(cell);
        }
        internal void Initialize(int frameCount, int margin)
        {
            outerContainer.AddView(container);

            AddView(indicator);
            AddView(Counter);
            AddView(Button);

            int intervalMargin = 0;
            int intervalHeight = 0;
            int intervalWidth  = GetIntervalWidth();

            int width           = frameCount * intervalWidth + frameCount * intervalMargin;
            var containerParams = new RelativeLayout.LayoutParams(width, RelativeLayout.LayoutParams.MatchParent);

            containerParams.SetMargins(0, CounterHeight + margin, 0, margin);
            outerContainer.LayoutParameters = containerParams;

            for (int i = 0; i < frameCount; i++)
            {
                var bar = new TorqueInterval(Context, intervalWidth, intervalMargin, intervalHeight);
                container.AddView(bar);
                intervals.Add(bar);
            }

            var parameters = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, TotalHeight);

            parameters.AddRule(LayoutRules.AlignParentBottom);
            parameters.SetMargins(margin, 0, 0, 0);
            LayoutParameters = parameters;

            var counterParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, CounterHeight);

            counterParams.AddRule(LayoutRules.AlignParentTop);
            Counter.LayoutParameters = counterParams;

            var indictorParams = LayoutUtils.Relative(0, CounterHeight, GetIntervalWidth(), RelativeLayout.LayoutParams.MatchParent);

            indicator.LayoutParameters = indictorParams;

            int buttonSize = BarHeight - 2 * margin;

            var buttonParams = LayoutUtils.Relative(0, 0, buttonSize, buttonSize);

            buttonParams.AddRule(LayoutRules.AlignParentRight);
            buttonParams.AddRule(LayoutRules.AlignParentBottom);
            buttonParams.SetMargins(margin, margin, margin, margin);
            Button.LayoutParameters = buttonParams;
        }
Esempio n. 32
0
        void setPos(int x, int y)
        {
            var box = this.FindViewById <View>(Resource.Id.box1);

            // var lp = new RelativeLayout.LayoutParams(box.Width, box.Height);
            if (_box_w == 0 || _box_h == 0)
            {
                _box_w = box.Width;
                _box_h = box.Height;
            }
            var lp = new RelativeLayout.LayoutParams(_box_w, _box_h);

            lp.SetMargins(x, y, 0, 0);
            box.LayoutParameters = lp;
        }
Esempio n. 33
0
        private void SetupController()
        {
            int w            = (int)(mMetrics.WidthPixels * MEDIA_BAR_WIDTH);
            int h            = (int)(mMetrics.HeightPixels * MEDIA_BAR_HEIGHT);
            int marginLeft   = (int)(mMetrics.WidthPixels * MEDIA_BAR_LEFT_MARGIN);
            int marginTop    = (int)(mMetrics.HeightPixels * MEDIA_BAR_TOP_MARGIN);
            int marginRight  = (int)(mMetrics.WidthPixels * MEDIA_BAR_RIGHT_MARGIN);
            int marginBottom = (int)(mMetrics.HeightPixels * MEDIA_BAR_BOTTOM_MARGIN);
            var lp           = new RelativeLayout.LayoutParams(w, h);

            lp.SetMargins(marginLeft, marginTop, marginRight, marginBottom);
            mControllers.LayoutParameters = lp;
            mStartText.SetText(Resource.String.init_text);
            mEndText.SetText(Resource.String.init_text);
        }
Esempio n. 34
0
        protected override void OnUISystemChanged(UISystem system)
        {
            base.OnUISystemChanged(system);

            // create the Android OS edit text only when element is inserted into hierarchy.
            if (staticEditText == null)
            {
                // create and add the edit text
                staticEditText = new MyAndroidEditText(PlatformAndroid.Context);

                var editLayoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
                editLayoutParams.SetMargins(75, 200, 75, 0);
                game.Context.EditTextLayout.AddView(staticEditText, editLayoutParams);
            }
        }
Esempio n. 35
0
		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, 2, 5, 2);
            parms.AddRule(LayoutRules.AlignParentLeft);
			
			view.AddView(scaled,parms);

            return view;
		}
Esempio n. 36
0
        public void SetMemberShipsLayout()
        {
            foreach (var membership in memberships)
            {
                RelativeLayout LLMemberShip = new RelativeLayout(this);
                RelativeLayout.LayoutParams lpForLLMemberShip = new RelativeLayout.LayoutParams(-1, -2);
                lpForLLMemberShip.SetMargins(0, 5, 0, 0);
                LLMemberShip.SetBackgroundResource(Resource.Color.colorBackgroundCard);

                LinearLayout LLRole = new LinearLayout(this);
                LLRole.SetPadding(10, 0, 0, 0);
                LLRole.Orientation = Orientation.Horizontal;

                TextView TVUsername = new TextView(this);
                TVUsername.SetTextColor(Android.Graphics.Color.Black);
                TVUsername.Text = membership.user.name + " - ";
                LLRole.AddView(TVUsername);

                TextView TVRoles = new TextView(this);
                TVRoles.SetTextColor(Resources.GetColor(Resource.Color.colorPrimary));
                foreach (var role in membership.roles)
                {
                    TVRoles.Text += role.name;
                }

                LLRole.AddView(TVRoles);

                LLMemberShip.AddView(LLRole);

                ImageView BDelete = new ImageView(this);
                RelativeLayout.LayoutParams lpForBDelete = new RelativeLayout.LayoutParams(-2, -2);
                lpForBDelete.AddRule(LayoutRules.AlignParentRight);
                lpForBDelete.RightMargin = 5;
                BDelete.SetImageResource(Resource.Drawable.ic_delete_black_18dp);
                BDelete.Click += delegate
                {
                    RedMineManager.Delete("/memberships/" + membership.id + ".json");
                    memberships.Remove(membership);
                    Recreate();
                };
                LLMemberShip.AddView(BDelete, lpForBDelete);
                LLRoot.AddView(LLMemberShip, lpForLLMemberShip);
            }
        }
        public static ImageView CreateImageView(int drawableId, int marginLeft, int marginTop,
                    int? id = null, int controlHeight = ViewGroup.LayoutParams.WrapContent)
        {
            ImageView imageView = new ImageView(_context);
                imageView.SetImageResource(drawableId);

                if (id != null)
                {
                    imageView.Id = id.Value;
                }

                RelativeLayout.LayoutParams layoutParams =
                    new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, controlHeight);

                //margin values are in pixels
                layoutParams.SetMargins(marginLeft, marginTop, 0, 0);
                imageView.LayoutParameters = layoutParams;

                return imageView;
        }
        public static TextView CreateGameOverTextView()
        {
            TextView gameOverTextView = new TextView(_context);

                gameOverTextView.Text = "Game over";
                gameOverTextView.TextSize = 48;
                gameOverTextView.SetTextColor(Color.White);

                RelativeLayout.LayoutParams layoutParams =
                    new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                    ViewGroup.LayoutParams.WrapContent);

                layoutParams.SetMargins(ConvertDpToPixels(200),
                    ConvertDpToPixels(150), 0, 0);

                gameOverTextView.LayoutParameters = layoutParams;
                gameOverTextView.BringToFront();

                return gameOverTextView;
        }
Esempio n. 39
0
        public override View GetView(Context context, View convertView, ViewGroup parent)
        {
            if (scaled == null)
                scaled = Scale(Value);

            Click = delegate { SelectImage(); };

            var view = convertView as RelativeLayout ?? new RelativeLayout(context);

            var parms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                        ViewGroup.LayoutParams.WrapContent);
            parms.SetMargins(5, 2, 5, 2);
            parms.AddRule(LayoutRules.AlignParentLeft);

            // SEC bug fix, not yet submitted to Kenny.  Getting exception "specified view already has a parent"
            if (scaled.Parent != view)
                view.AddView(scaled, parms);

            return view;
        }
Esempio n. 40
0
		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);
            parms.SetMargins(5, 3, 5, 0);
            parms.AddRule((int) LayoutRules.CenterVertical);

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

            var sparms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                         ViewGroup.LayoutParams.WrapContent);
            sparms.SetMargins(5, 3, 5, 0);
            sparms.AddRule((int) LayoutRules.CenterVertical);
            sparms.AddRule((int) LayoutRules.AlignParentRight);

            sw = new ToggleButton(context) {Tag = 1, Checked = Value};

            view.AddView(sw, sparms);
            return view;
        }
Esempio n. 41
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            //RequestedOrientation = global::Android.Content.PM.ScreenOrientation.Landscape;

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

            SignaturePadView signature = FindViewById<SignaturePadView> (Resource.Id.signatureView);

            if (true) { // Customization activated
                View root = FindViewById<View> (Resource.Id.rootView);
                root.SetBackgroundColor (Color.White);

                // Activate this to internally use a bitmap to store the strokes
                // (good for frequent-redraw situations, bad for memory footprint)
                // signature.UseBitmapBuffer = true;

                signature.CaptionTextView.Text = "Authorization Signature";
                signature.CaptionTextView.SetTypeface (Typeface.Serif, TypefaceStyle.BoldItalic);
                signature.CaptionTextView.SetTextSize (global::Android.Util.ComplexUnitType.Sp, 16f);
                signature.SignaturePromptTextView.Text = ">>";
                signature.SignaturePromptTextView.SetTypeface (Typeface.SansSerif, TypefaceStyle.Normal);
                signature.SignaturePromptTextView.SetTextSize (global::Android.Util.ComplexUnitType.Sp, 32f);
                signature.BackgroundColor = Color.Rgb (255, 255, 200); // a light yellow.
                signature.StrokeColor = Color.Black;

                signature.BackgroundImageView.SetImageResource (Resource.Drawable.logo_galaxy_black_64);
                signature.BackgroundImageView.SetAlpha (16);
                signature.BackgroundImageView.SetAdjustViewBounds (true);
                var layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.FillParent, RelativeLayout.LayoutParams.FillParent);
                layout.AddRule (LayoutRules.CenterInParent);
                layout.SetMargins (20, 20, 20, 20);
                signature.BackgroundImageView.LayoutParameters = layout;

                // You can change paddings for positioning...
                var caption = signature.CaptionTextView;
                caption.SetPadding (caption.PaddingLeft, 1, caption.PaddingRight, 25);
            }

            // Get our button from the layout resource,
            // and attach an event to it
            Button btnSave = FindViewById<Button> (Resource.Id.btnSave);
            btnSave.Click += delegate {
                if (signature.IsBlank)
                {//Display the base line for the user to sign on.
                    AlertDialog.Builder alert = new AlertDialog.Builder (this);
                    alert.SetMessage ("No signature to save.");
                    alert.SetNeutralButton ("Okay", delegate { });
                    alert.Create ().Show ();
                }
                points = signature.Points;
            };
            btnSave.Dispose ();

            Button btnLoad = FindViewById<Button> (Resource.Id.btnLoad);
            btnLoad.Click += delegate {
                if (points != null)
                    signature.LoadPoints (points);
            };
            btnLoad.Dispose ();
        }
Esempio n. 42
0
        //highly customized widgets for raffle detail
        public void ShowRaffleDetailShareAndRefresh()
        {
            if (shareandrefreshcontainer == null) {
                //customize a bar with refresh and  share
                shareandrefreshcontainer = new RelativeLayout (this);
                RelativeLayout.LayoutParams shareandrefreshparam = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, TapUtil.dptodx (35));
             				shareandrefreshparam.SetMargins (0, 0,TapUtil.dptodx (10), 0);
                shareandrefreshparam.AddRule (LayoutRules.CenterVertical);
                shareandrefreshparam.AddRule (LayoutRules.AlignParentRight);
                shareandrefreshcontainer.LayoutParameters = shareandrefreshparam;

                //create share img
                shareimg = new ImageView (this);
                shareimg.Id = TapUtil.generateViewId ();
                RelativeLayout.LayoutParams shareimgparam = new RelativeLayout.LayoutParams (TapUtil.dptodx (35), TapUtil.dptodx (35));
                shareimg.LayoutParameters = shareimgparam;
                shareimg.SetImageResource (Resource.Drawable.ic_share128X128);
                if (!shareimg.HasOnClickListeners) {
                    shareimg.Click += (object sender, EventArgs e) => {
                        //send request
                        if(OnShareClick!=null){
                            OnShareClick();
                        }
                    };
                }

                //create refresh img-right side
                refreshimg = new ImageView (this);
                RelativeLayout.LayoutParams refreshimgparam = new RelativeLayout.LayoutParams (TapUtil.dptodx (35), TapUtil.dptodx (35));
                refreshimgparam.AddRule (LayoutRules.RightOf, shareimg.Id);
                refreshimgparam.LeftMargin = TapUtil.dptodx (20);
                refreshimg.LayoutParameters = refreshimgparam;
                refreshimg.SetImageResource (Resource.Drawable.ic_refresh128X128);
                if (!refreshimg.HasOnClickListeners) {
                    refreshimg.Click += (object sender, EventArgs e) => {
                        //send request
                        if(OnRefreshclick!=null){
                            OnRefreshclick();
                        }
                    };
                }

                shareandrefreshcontainer.AddView (shareimg);
                shareandrefreshcontainer.AddView (refreshimg);
                (headerfragment.View as RelativeLayout).AddView (shareandrefreshcontainer);
            }
            else if(shareandrefreshcontainer!=null&&!shareandrefreshcontainer.IsShown&&shareandrefreshcontainer.Parent==null)
            {
                (headerfragment.View as RelativeLayout).AddView (shareandrefreshcontainer);
            }
        }
Esempio n. 43
0
		public override View GetView(Context context, View convertView, ViewGroup parent)
		{
			var cell = new RelativeLayout(context);

			if (entry == null)
			{
				//SizeF size = ComputeEntryPosition(tv, cell);
				var _entry = new EditText(context)
								 {
									 Tag = 1,
									 Hint = hint ?? "",
									 Text = Value ?? "",
								 };

				if(isPassword)
				{
					_entry.InputType = Android.Resource.Attribute.Password;
				}

				entry = _entry;

				entry.TextChanged += delegate
				{
					FetchValue();
				};

				//entry.ShouldReturn += delegate
				//{
				//    EntryElement focus = null;
				//    foreach (var e in (Parent as Section).Elements)
				//    {
				//        if (e == this)
				//            focus = this;
				//        else if (focus != null && e is EntryElement)
				//            focus = e as EntryElement;
				//    }

				//    if (focus != this)
				//        focus.entry.BecomeFirstResponder();
				//    else
				//        focus.entry.ResignFirstResponder();

				//    return true;
				//};
				//entry.Started += delegate
				//{
				//    EntryElement self = null;
				//    var returnType = UIReturnKeyType.Default;

				//    foreach (var e in (Parent as Section).Elements)
				//    {
				//        if (e == this)
				//            self = this;
				//        else if (self != null && e is EntryElement)
				//            returnType = UIReturnKeyType.Next;
				//    }
				//    entry.ReturnKeyType = returnType;
				//};
			}
			var tvparams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
														  ViewGroup.LayoutParams.WrapContent);
			tvparams.SetMargins(5,3,5,0);
            tvparams.AddRule((int)LayoutRules.CenterVertical);
            tvparams.AddRule((int)LayoutRules.AlignParentLeft);

			var tv = new TextView(_context) {Text = Caption, TextSize = 16f};

			var eparams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
														  ViewGroup.LayoutParams.WrapContent);
			eparams.SetMargins(5, 3, 5, 0);
            eparams.AddRule((int)LayoutRules.CenterVertical);
            eparams.AddRule((int)LayoutRules.AlignParentRight);

			cell.AddView(tv,tvparams);
			cell.AddView(entry,eparams);
			return cell;
		}
        private void Init()
        {
            base.RemoveAllViews();

            hintTextView = new EditText(Context);
            textTextView = new NoCursorMovingEditText(Context, BackKeyPressed);

            linearLayout = new LinearLayout(Context);
            linearLayout.LayoutParameters = new ViewGroup.LayoutParams(LinearLayout.LayoutParams.MatchParent, (int)GetContainerHeight());

            textLayout = new RelativeLayout(Context);
            textLayout.LayoutParameters = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MatchParent, 1);
            textLayout.SetGravity(GravityFlags.Center);

            linearLayout.AddView(textLayout);

            textTextView.SetTextAppearance(Context, Resource.Style.judo_payments_CardText);
            hintTextView.SetTextAppearance(Context, Resource.Style.judo_payments_HintText);

            LayoutParams lp = new LayoutParams(LinearLayout.LayoutParams.MatchParent,
                LinearLayout.LayoutParams.WrapContent);
            lp.AddRule(LayoutRules.CenterVertical);

            hintTextView.LayoutParameters = lp;
            textTextView.LayoutParameters = lp;
            hintTextView.Enabled = false;
            hintTextView.Focusable = false;

            textTextView.InputType = InputTypes.ClassNumber | InputTypes.TextFlagNoSuggestions;
            hintTextView.InputType = InputTypes.ClassNumber | InputTypes.TextFlagNoSuggestions;

            hintTextView.SetBackgroundColor(Resources.GetColor(Android.Resource.Color.Transparent));
            textTextView.SetBackgroundColor(Resources.GetColor(Android.Resource.Color.Transparent));
            int horizontalPadding =
                Resources.GetDimensionPixelOffset(Resource.Dimension.backgroundhinttextview_horizontal_padding);
            hintTextView.SetPadding(horizontalPadding, 0 , horizontalPadding, 0);
            textTextView.SetPadding(horizontalPadding, 0, horizontalPadding, 0);

            textErrorView = new EditText(Context);
            RelativeLayout.LayoutParams errorLP = new RelativeLayout.LayoutParams(LayoutParams.MatchParent,
                LayoutParams.WrapContent);
            errorLP.AddRule(LayoutRules.CenterVertical);

            int margin = UiUtils.ToPixels(Context, 2);
            errorLP.SetMargins(margin, 0, margin, 0);

            textErrorView.LayoutParameters = errorLP;
            textErrorView.Enabled = false;
            textErrorView.Focusable = false;
            textErrorView.Visibility = ViewStates.Gone;
            textErrorView.SetBackgroundColor(Color.Red);
            int errorVerticalPadding =
                Context.Resources.GetDimensionPixelOffset(
                    Resource.Dimension.backgroundhinttextview_error_vertical_padding);
            textErrorView.SetPadding(horizontalPadding, errorVerticalPadding, horizontalPadding, errorVerticalPadding);
            textErrorView.Text = errorText;
            textErrorView.SetSingleLine(true);
            textErrorView.Gravity = GravityFlags.Center;
            textErrorView.SetTextAppearance(Context, Resource.Style.judo_payments_ErrorText);

            //set courier font
            Typeface type = Typefaces.LoadTypefaceFromRaw(Context, Resource.Raw.courier);
            //hintTextView.Typeface = type;
            hintTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal);
            //textTextView.Typeface = type;
            textTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal);
            textErrorView.Typeface = type;


            textLayout.AddView(hintTextView);
            textLayout.AddView(textTextView);

            AddView(linearLayout);

            IEnumerable<char> previousCharSequence;
            EventHandler<TextChangedEventArgs> beforeTextChanged = (sender, args) =>
                                                                    {
                                                                        previousCharSequence = args.Text;
                                                                    };

            EventHandler<TextChangedEventArgs> textChanged = (sender, args) =>
                                                            {
                                                                beforeTextSize = args.BeforeCount;
                                                            };

            EventHandler<AfterTextChangedEventArgs> afterTextChanged = null;

            
            Action<string> updateTextView = newText =>
            {
                textTextView.TextChanged -= textChanged;
                textTextView.BeforeTextChanged -= beforeTextChanged;
                textTextView.AfterTextChanged -= afterTextChanged;

                textTextView.Text = newText;

                textTextView.TextChanged += textChanged;
                textTextView.BeforeTextChanged += beforeTextChanged;
                textTextView.AfterTextChanged += afterTextChanged;
            };

            afterTextChanged = (sender, args) =>
            {
                var length = args.Editable.ToString().Length;
                var deleting = beforeTextSize == 1;

                if (deleting)
                {
                    nextMustBeDeleted = false;
                }
                else
                {
                    if (nextMustBeDeleted && length > 0)
                    {
                        updateTextView(args.Editable.SubSequence(0, length - 1));
                        UpdateHintTextForCurrentTextEntry();
                        return;
                    }
                }

                // If we are deleting (we've just removed a space char, so delete another char please:
                // Or if we've pressed space don't allow it!
                if ((deleting && skipCharsAtPositions.Contains(length)) ||
                    (length > 0 && IsCharInFilter(args.Editable.CharAt(length - 1)) &&
                     !skipCharsAtPositions.Contains(length - 1)))
                {
                    updateTextView(length == 0 ? "" : args.Editable.SubSequence(0, length - 1));
                    textTextView.SetSelection(length == 0 ? 0 : length - 1);
                    UpdateHintTextForCurrentTextEntry();
                    return;
                }

                // Adds a non numeric char at positions needed
                for (int i = 0; i < skipCharsAtPositions.Count; ++i)
                {
                    // We rescan all letters recursively to catch when a users pastes into the edittext
                    int charPosition = skipCharsAtPositions[i];
                    if (length > charPosition)
                    {
                        if (hintText[charPosition] != args.Editable.ToString()[charPosition])
                        {
                            updateTextView(args.Editable.SubSequence(0, charPosition) + "" + hintText[charPosition] +
                                           args.Editable.SubSequence(charPosition, args.Editable.Length()));
                            UpdateHintTextForCurrentTextEntry();
                            return;
                        }
                    }
                    else
                    {
                        if (length == charPosition)
                        {
                            updateTextView(textTextView.Text + "" + hintText[charPosition]);
                        }
                    }
                }

                UpdateHintTextForCurrentTextEntry();

                // We've got all the chars we need, fire off our listener
                if (length >= LengthToStartValidation())
                {
                    try
                    {
                        ValidateInput(args.Editable.ToString());
                        if (OnEntryComplete != null)
                        {
                            OnEntryComplete(args.Editable.ToString());
                        } 
                        return;
                    }
                    catch (Exception exception)
                    {
                        Log.Error(JudoSDKManager.DEBUG_TAG, exception.Message, exception);
                    }

                    ShowInvalid();
                }
                else
                {
                    if (OnProgress != null)
                    {
                        OnProgress(length);
                    }
                }
            };

            textTextView.BeforeTextChanged += beforeTextChanged;

            textTextView.TextChanged += textChanged;

            textTextView.AfterTextChanged += afterTextChanged;
        }
Esempio n. 45
0
        void RefreshTable()
        {
            table.RemoveAllViews ();

            TableRow.LayoutParams lpRow = new TableRow.LayoutParams ();
            lpRow.Height = TableLayout.LayoutParams.WrapContent;
            lpRow.Width = TableLayout.LayoutParams.WrapContent;
            lpRow.Gravity = GravityFlags.Center;

            //header
            TableRow trHeader = new TableRow (Activity);
            TextView tvHDrug = (TextView)layoutInflater.Inflate(Resource.Layout.DrugInfoDrugItem, null);
            //tvHDrug.SetTextAppearance (Activity, Resource.Style.text_header_large);
            tvHDrug.Text = "Препараты";
            tvHDrug.LayoutParameters = lpRow;
            ((TableRow.LayoutParams)tvHDrug.LayoutParameters).SetMargins (0, 0, ToDIP(1) , 0);
            tvHDrug.SetBackgroundColor (Android.Graphics.Color.White);
            trHeader.AddView (tvHDrug);

            int i = 0;

            TableRow.LayoutParams lpValue = new TableRow.LayoutParams ();
            lpValue.Height = TableLayout.LayoutParams.WrapContent;
            lpValue.Width = TableLayout.LayoutParams.WrapContent;
            lpValue.Gravity = GravityFlags.Center;
            lpValue.SetMargins (ToDIP(1), ToDIP(1), ToDIP(1), ToDIP(1));

            foreach (var drug in drugs) {

                i++;

                TableRow trRow = new TableRow (Activity);
                TextView tvDrug = (TextView)layoutInflater.Inflate(Resource.Layout.DrugInfoDrugItem, null);
                tvDrug.Gravity = GravityFlags.CenterVertical;
                tvDrug.SetTextAppearance (Activity, Resource.Style.text_row_large);
                tvDrug.Text = string.Format(@"{0}: {1}", i, drug.fullName);
                tvDrug.LayoutParameters = lpRow;
                tvDrug.SetBackgroundColor (Android.Graphics.Color.White);
                trRow.AddView (tvDrug);

                foreach (var info in infos) {

                    if (trHeader.Parent == null) {
                        TextView tvHInfo = (TextView)layoutInflater.Inflate(Resource.Layout.DrugInfoValueHeader, null);
                        tvHInfo.Text = info.name;
                        tvHInfo.SetBackgroundColor (Android.Graphics.Color.White);
                        trHeader.AddView (tvHInfo);
                    }

                    RelativeLayout rlValue = new RelativeLayout(Activity);
                    rlValue.SetGravity (GravityFlags.Center);
                    rlValue.SetMinimumHeight (ToDIP(64));
                    rlValue.SetMinimumWidth (ToDIP(64));
                    rlValue.LayoutParameters = lpValue;

                    rlValue.SetTag (Resource.String.IDinfo, info.id);
                    rlValue.SetTag (Resource.String.IDdrug, drug.id);
            //					rlValue.SetTag (Resource.String.IDattendance, attendace.id);

                    string value = AttendanceResultManager.GetResultValue (newAttendanceResults, info.id, drug.id);

                    if (info.valueType == @"number") {
                        RelativeLayout.LayoutParams nlpValue = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.MatchParent);
                        nlpValue.AddRule (LayoutRules.CenterInParent);
                        nlpValue.SetMargins (ToDIP(1), ToDIP(1), ToDIP(1), ToDIP(1));

                        EditText evValue = new EditText (Activity) { LayoutParameters = nlpValue };
                        evValue.SetMinimumWidth (ToDIP(64));
                        evValue.SetMaxWidth (ToDIP(64));
                        evValue.InputType = Android.Text.InputTypes.ClassNumber;
                        evValue.Text = value.Equals (@"N") ? string.Empty : value;
                        rlValue.AddView (evValue);
                        evValue.AfterTextChanged += NumberValue_AfterTextChanged;
                    }

                    if (info.valueType == @"decimal") {
                        RelativeLayout.LayoutParams dlpValue = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.MatchParent);
                        dlpValue.AddRule (LayoutRules.CenterInParent);
                        dlpValue.SetMargins (ToDIP(1), ToDIP(1), ToDIP(1), ToDIP(1));

                        EditText evValue = new EditText (Activity) { LayoutParameters = dlpValue };
                        evValue.SetMinimumWidth (ToDIP(64));
                        evValue.SetMaxWidth (ToDIP(64));
                        evValue.InputType = Android.Text.InputTypes.NumberFlagDecimal;
                        evValue.Text = value.Equals (@"N") ? string.Empty : value;
                        rlValue.AddView (evValue);
                        evValue.AfterTextChanged += DecimalValue_AfterTextChanged;
                    }

                    if (info.valueType == @"boolean") {
                        rlValue.Click += Rl_Click;

                        TextView tvValue = new TextView (Activity);
                        tvValue.Gravity = GravityFlags.Center;
                        if (string.IsNullOrEmpty (value) || value.Equals (@"N")) {
                            tvValue.SetTextAppearance (Activity, Resource.Style.text_danger);
                            rlValue.SetBackgroundColor (Android.Graphics.Color.LightPink);
                        } else {
                            tvValue.SetTextAppearance (Activity, Resource.Style.text_success);
                            rlValue.SetBackgroundColor (Android.Graphics.Color.LightGreen);
                        }
                        tvValue.Text = AttendanceResult.StringBoolToRussian (value);
                        rlValue.AddView (tvValue);
                    }

                    trRow.AddView (rlValue);
                }

                if (trHeader.Parent == null) {
                    table.AddView (trHeader);
                    table.AddView (GetDelim(Android.Graphics.Color.Black));
                }
                table.AddView (trRow);
                table.AddView (GetDelim(Android.Graphics.Color.Brown));
            }
        }
Esempio n. 46
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            string deviceid = TapUtil.GetDeviceID ();

            ScrollView rootscroller = new ScrollView (nn_activity);
            rootscroller.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            rootscroller.SetBackgroundResource (Resource.Color.soarnix_bg_gray);
            RelativeLayout relativelayout = new RelativeLayout (nn_activity);
            RelativeLayout.LayoutParams relativelayoutparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.MatchParent);
            relativelayout.LayoutParameters=relativelayoutparam;
            relativelayout.SetPadding(TapUtil.dptodx (5), TapUtil.dptodx (5), TapUtil.dptodx (5), TapUtil.dptodx (5));
            relativelayout.SetBackgroundResource (Resource.Color.soarnix_bg_gray);

            //raffle request Card

            LayoutInflater inflator = LayoutInflater.From (nn_activity);

            LinearLayout noeventcard = (LinearLayout)inflator.Inflate (Resource.Layout.raffleroot_noeventcard, null);
            RelativeLayout.LayoutParams noeventcardreparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            noeventcard.LayoutParameters=noeventcardreparam;
            noeventcard.Id = TapUtil.generateViewId ();

            TextView hinttextview=(TextView)noeventcard.FindViewById(Resource.Id.rafflenoevent_hint_textview);
            hinttextview.Text=AboutScreenData.AboutnoraffleLabel;

            EditText charityinput=(EditText)noeventcard.FindViewById(Resource.Id.rafflenoevent_charityinput_edittext);
            charityinput.Hint=RaffleListScreenData.organizationNameTextFieldPlaceholder;

            EditText numberinput=(EditText)noeventcard.FindViewById(Resource.Id.rafflenoevent_phonenumber_edittext);
            numberinput.Hint=RaffleListScreenData.phoneNumberTextFieldPlaceholder;

            Button chritysubmitbutton=(Button)noeventcard.FindViewById(Resource.Id.rafflenoevent_charitysubmit_button);
            chritysubmitbutton.Text=RaffleListScreenData.sentBtnTitle;
            chritysubmitbutton.Click+= (object sender, EventArgs e) => {

                //set flags
                FormatCheckFlagObject[] flags=new FormatCheckFlagObject[2];
                for(int i=0;i<flags.Length;i++){
                    string message="";
                    if(i==0){
                        message=AboutScreenData.organizationNameTextFieldPlaceholder;
                    }
                    if(i==1){
                        message=AboutScreenData.phoneNumberTextFieldPlaceholder;
                    }
                    flags[i]=new FormatCheckFlagObject(message);
                }

                //
                if(FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.OnlyLetter)){
                    flags[0].flag=true;
                }
                if(FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)){
                    flags[1].flag=true;
                }
                bool totalfalg=true;
                foreach(var flagobj in flags){
                    if(!flagobj.flag){
                        totalfalg=false;
                    }
                }
                if(totalfalg){
                    SocialShareAndroid.Email (string.Format(RaffleListScreenData.RequestRaffleEmailBody,GlobalVariable.username,GlobalVariable.currentlocation,charityinput.Text,numberinput.Text),RaffleListScreenData.RequestRaffleEmailSubject,new string[]{RaffleListScreenData.RequestRaffleEmailTarget});
                }
                else{
                    string message="Please check:\n";
                    for(int i=0;i<flags.Length;i++){
                        if(flags[i].flag==false){
                            if(i!=flags.Length-1){
                                message+=flags[i].message+",";
                            }else{
                                message+=flags[i].message;
                            }
                        }
                    }
                    nn_activity.ShowCustomAlterDialogFragment(AboutScreenData.AlertScreenFormatErrorTitle,message,GlobalScreenData.DefaultPositive,null,"invalidedialog.raffleroot.noeventinput");
                }
            //				if(FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)&&FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Regular)&&FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.Regular)){
            //					SocialShareAndroid.Email (string.Format(RaffleListScreenData.RequestRaffleEmailBody,GlobalVariable.username,GlobalVariable.currentlocation,charityinput.Text,numberinput.Text),RaffleListScreenData.RequestRaffleEmailSubject,new string[]{RaffleListScreenData.RequestRaffleEmailTarget});
            //				}
            //				else if(!FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Regular)||!FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.Regular)){
            //					nn_activity.ShowCustomAlterDialogFragment("Both input can not be empty",GlobalScreenData.DefaultPositive,null,"invalidedialog.raffleroot.noeventinput");
            //				}
            //				else if (!FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)){
            //					nn_activity.ShowCustomAlterDialogFragment("Please check format of your phone number",GlobalScreenData.DefaultPositive,null,"invalidedialog.raffleroot.noeventcardnumber");
            //				}

            };
            relativelayout.AddView (noeventcard);
            //tutorial card
            RelativeLayout tutorialcard = new RelativeLayout(nn_activity);
            RelativeLayout.LayoutParams tutorialcardparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            tutorialcardparam.AddRule (LayoutRules.Below,noeventcard.Id);
            tutorialcardparam.TopMargin = TapUtil.dptodx(10);
            tutorialcard.LayoutParameters=tutorialcardparam;
            tutorialcard.Id = TapUtil.generateViewId ();
            tutorialcard.SetBackgroundResource (Resource.Drawable.bg_relativelayout_grayround);
            tutorialcard.SetPadding(TapUtil.dptodx (20), TapUtil.dptodx (20), TapUtil.dptodx (20), TapUtil.dptodx (20));

            //tutorial label
            TextView tutoriallabel =new TextView(nn_activity);
            var tutorialparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            tutoriallabel.LayoutParameters = tutorialparam;
            tutoriallabel.Gravity = GravityFlags.CenterHorizontal;
            tutoriallabel.Text=AboutScreenData.TutorialLabel;
            tutoriallabel.TextSize=TapUtil.dptodx(6);
            tutoriallabel.SetTypeface (Typeface.Default, TypefaceStyle.Bold);
            tutoriallabel.Id = TapUtil.generateViewId ();

            LinearLayout tutorialcontainer = new LinearLayout (nn_activity);
            var tutorialcontainerparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            tutorialcontainerparam.AddRule (LayoutRules.Below, tutoriallabel.Id);
            tutorialcontainerparam.SetMargins (0, TapUtil.dptodx (5), 0, 0);
            tutorialcontainer.LayoutParameters = tutorialcontainerparam;
            tutorialcontainer.Orientation = global::Android.Widget.Orientation.Vertical;

            var tutorialitemparam=new LinearLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            tutorialitemparam.SetMargins (0,TapUtil.dptodx(15),0,0);
            tutorialitemparam.Gravity = GravityFlags.Center;

            TextView tutorial0label=new TextView(nn_activity);
            tutorial0label.Text=AboutScreenData.Tutorial0Label;
            tutorial0label.LayoutParameters = tutorialitemparam;
            tutorial0label.Gravity = GravityFlags.CenterHorizontal;
            tutorial0label.SetTextColor (Resources.GetColor(Resource.Color.iosblue));
            tutorial0label.Tag = 0;
            tutorial0label.Click-=OnShowTutorialTextClick;
            tutorial0label.Click+=OnShowTutorialTextClick;

            TextView tutorial1label=new TextView(nn_activity);
            tutorial1label.Text=AboutScreenData.Tutorial1Label;
            tutorial1label.LayoutParameters = tutorialitemparam;
            tutorial1label.Gravity = GravityFlags.CenterHorizontal;
            tutorial1label.SetTextColor (Resources.GetColor(Resource.Color.iosblue));
            tutorial1label.Tag = 1;
            tutorial1label.Click-=OnShowTutorialTextClick;
            tutorial1label.Click+=OnShowTutorialTextClick;

            TextView tutorial2label=new TextView(nn_activity);
            tutorial2label.Text=AboutScreenData.Tutorial2Label;
            tutorial2label.LayoutParameters = tutorialitemparam;
            tutorial2label.Gravity = GravityFlags.CenterHorizontal;
            tutorial2label.Tag = 2;
            tutorial2label.SetTextColor (Resources.GetColor(Resource.Color.iosblue));
            tutorial2label.Click-=OnShowTutorialTextClick;
            tutorial2label.Click+=OnShowTutorialTextClick;

            TextView tutorial3label=new TextView(nn_activity);
            tutorial3label.Text=AboutScreenData.Tutorial3Label;
            tutorial3label.LayoutParameters = tutorialitemparam;
            tutorial3label.Gravity = GravityFlags.CenterHorizontal;
            tutorial3label.Tag = 3;
            tutorial3label.SetTextColor (Resources.GetColor(Resource.Color.iosblue));
            tutorial3label.Click-=OnShowTutorialTextClick;
            tutorial3label.Click+=OnShowTutorialTextClick;

            TextView tutorial4label=new TextView(nn_activity);
            tutorial4label.Text=AboutScreenData.Tutorial4Label;
            tutorial4label.LayoutParameters = tutorialitemparam;
            tutorial4label.Gravity = GravityFlags.CenterHorizontal;
            tutorial4label.Tag = 4;
            tutorial4label.SetTextColor (Resources.GetColor(Resource.Color.iosblue));
            tutorial4label.Click-=OnShowTutorialTextClick;
            tutorial4label.Click+=OnShowTutorialTextClick;

            //version7 add tutorial
            TextView tutorial5label = new TextView(nn_activity);
            tutorial5label.Text = AboutScreenData.Tutorial5Label;
            tutorial5label.LayoutParameters = tutorialitemparam;
            tutorial5label.Gravity = GravityFlags.CenterHorizontal;
            tutorial5label.Tag = 5;
            tutorial5label.SetTextColor(Resources.GetColor(Resource.Color.iosblue));
            tutorial5label.Click -= OnShowTutorialTextClick;
            tutorial5label.Click += OnShowTutorialTextClick;

            tutorialcontainer.AddView (tutorial0label);
            tutorialcontainer.AddView (tutorial1label);
            tutorialcontainer.AddView (tutorial2label);
            tutorialcontainer.AddView (tutorial3label);
            tutorialcontainer.AddView (tutorial4label);
            tutorialcontainer.AddView(tutorial5label);

            tutorialcard.AddView (tutoriallabel);
            tutorialcard.AddView (tutorialcontainer);

            relativelayout.AddView (tutorialcard);

            //			LikeView likeview = new LikeView (nn_activity);
            //			var likeviewparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            //			likeviewparam.AddRule (LayoutRules.Below, tutorialcard.Id);
            //			likeview.LayoutParameters = likeviewparam;
            //			likeview.SetLikeViewStyle (LikeView.Style.Button);
            //			likeview.AlwaysDrawnWithCacheEnabled = true;
            //			likeview.SetFragment (this);
            //			likeview.SetObjectIdAndType( "https://www.facebook.com/tap5050/?ref=ts&fref=ts",LikeView.ObjectType.Page);
            //			relativelayout.AddView (likeview);
            TextView uniqueidtextview = new TextView (nn_activity);
            uniqueidtextview.SetTextColor (Color.LightGray);
            RelativeLayout.LayoutParams textparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent,RelativeLayout.LayoutParams.WrapContent);
            textparam.AddRule (LayoutRules.CenterHorizontal);
            textparam.AddRule (LayoutRules.AlignParentBottom);
            textparam.AddRule (LayoutRules.Below,tutorialcard.Id);
            textparam.TopMargin = TapUtil.dptodx(20);
            uniqueidtextview.LayoutParameters = textparam;
            uniqueidtextview.Text=deviceid;
            uniqueidtextview.Id = TapUtil.generateViewId ();
            relativelayout.AddView (uniqueidtextview);
            //			Button showtutorialbut = new Button (nn_activity);
            //			RelativeLayout.LayoutParams showtutorialbutparam = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent,RelativeLayout.LayoutParams.WrapContent);
            //			showtutorialbutparam.AddRule (LayoutRules.Below, uniqueidtextview.Id);
            //			showtutorialbutparam.AddRule (LayoutRules.CenterHorizontal);
            //			showtutorialbut.LayoutParameters=showtutorialbutparam;
            //			showtutorialbut.SetBackgroundResource (Resource.Drawable.bg_button_bluebutton);
            //			showtutorialbut.SetTextColor (Color.White);
            //			showtutorialbut.Typeface = Typeface.DefaultBold;
            //			showtutorialbut.Id= TapUtil.generateViewId ();
            //			showtutorialbut.Text="Show Tutorial Video";
            //
            //			showtutorialbut.Click -= OnShowTutorialButtonClick;
            //			showtutorialbut.Click += OnShowTutorialButtonClick;
            //
            //			relativelayout.AddView (showtutorialbut);
            rootscroller.AddView (relativelayout);
            return rootscroller;
        }
Esempio n. 47
0
		public override View GetView(Context context, View convertView, ViewGroup parent)
		{
            _context = context;
			var cell = new RelativeLayout(context);

			if (entry == null)
			{
				var _entry = new EditText(context)
								 {
									 Tag = 1,
									 Hint = hint ?? "",
									 Text = Value ?? "",
								 };

				if(isPassword)
				{
					_entry.InputType = Android.Text.InputTypes.TextVariationPassword;
				}

				entry = _entry;

				entry.TextChanged += delegate
				{
					FetchValue();
				};
			}
			var tvparams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
														  ViewGroup.LayoutParams.WrapContent);
			tvparams.SetMargins(5,3,5,0);
            tvparams.AddRule(LayoutRules.CenterVertical);
            tvparams.AddRule(LayoutRules.AlignParentLeft);

			var tv = new TextView(context) {Text = Caption, TextSize = 16f};

			var eparams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
														  ViewGroup.LayoutParams.WrapContent);
			eparams.SetMargins(5, 3, 5, 0);
            eparams.AddRule(LayoutRules.CenterVertical);
            eparams.AddRule(LayoutRules.AlignParentRight);

			cell.AddView(tv,tvparams);
			cell.AddView(entry,eparams);
			return cell;
		}
		private void SetupController ()
		{
			int w = (int)(mMetrics.WidthPixels * MEDIA_BAR_WIDTH);
			int h = (int)(mMetrics.HeightPixels * MEDIA_BAR_HEIGHT);
			int marginLeft = (int)(mMetrics.WidthPixels * MEDIA_BAR_LEFT_MARGIN);
			int marginTop = (int)(mMetrics.HeightPixels * MEDIA_BAR_TOP_MARGIN);
			int marginRight = (int)(mMetrics.WidthPixels * MEDIA_BAR_RIGHT_MARGIN);
			int marginBottom = (int)(mMetrics.HeightPixels * MEDIA_BAR_BOTTOM_MARGIN);
			var lp = new RelativeLayout.LayoutParams (w, h);
			lp.SetMargins (marginLeft, marginTop, marginRight, marginBottom);
			mControllers.LayoutParameters = lp;
			mStartText.SetText (Resource.String.init_text);
			mEndText.SetText (Resource.String.init_text);
		}
Esempio n. 49
0
        /* Snippet 2 Ende */
        /// <summary>
        /// Aufgenommenes Foto durch Project Oxford analysieren lassen und das Ergebnis visualisieren
        /// </summary>
        /// <param name="requestCode"></param>
        /// <param name="resultCode"></param>
        /// <param name="data"></param>
        protected override async void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);
            var progressBar = FindViewById<ProgressBar>(Resource.Id.progressBar1);
            try
            {
                // User canceled
                if (resultCode == Result.Canceled)
                    return;

                MediaFile file = await data.GetMediaFileExtraAsync(this);

                //Alte Face-Rectangles entfernen
                var rellayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1);
                for (int i = 2; i < rellayout.ChildCount; i++)
                {
                    rellayout.RemoveViewAt(i);
                }
                
                progressBar.Visibility = ViewStates.Visible;

                //Foto in ImageView anzeigen
                var bmp = BitmapFactory.DecodeFile(file.Path);
                ImageView _imgView = FindViewById<ImageView>(Resource.Id.imageView1);
                _imgView.SetImageBitmap(bmp);

                //Bild Analyse durch Project Oxford
                await _vm.Load(file.GetStream());

                //Brechnen der Face Rectangle Positionen
                float scale;
                if (_imgView.Width / bmp.Width >= _imgView.Height / bmp.Height)
                {
                    scale = (float)bmp.Height / _imgView.Height;
                }
                else
                {
                    scale = (float)bmp.Width / _imgView.Width;
                }

                var relX = (_imgView.Width - bmp.Width / scale) / 2;
                var relY = (_imgView.Height - bmp.Height / scale) / 2;
                foreach (Emotion.Contract.Emotion emo in _vm.Emotions)
                {
                    //Zeichnen der Face Rectangles
                    var butt = new Button(this);
                    GradientDrawable drawable = new GradientDrawable();
                    drawable.SetShape(ShapeType.Rectangle);
                    drawable.SetStroke(5, Color.Rgb(34, 135, 202));
                    drawable.SetColor(Color.Transparent);
                    butt.Background = drawable;
                    var layoutparams = new RelativeLayout.LayoutParams((int)Math.Ceiling(emo.FaceRectangle.Width / scale), (int)Math.Ceiling(emo.FaceRectangle.Height / scale));
                    layoutparams.SetMargins((int)Math.Ceiling(emo.FaceRectangle.Left / scale + relX), (int)Math.Ceiling(emo.FaceRectangle.Top / scale + relY), 0, 0);

                    butt.LayoutParameters = layoutparams;
                    butt.SetPadding(0, 0, 0, 0);
                    butt.Click += (e, s) =>
                    {
                        //Bei Klick auf Face Rectangle Emotionswerte anzeigen
                        (FindViewById<ProgressBar>(Resource.Id.angerProgressBar)).Progress = (int)Math.Ceiling(emo.Scores.Anger * 100);
                        (FindViewById<ProgressBar>(Resource.Id.contemptProgressBar)).Progress = (int)Math.Ceiling(emo.Scores.Contempt * 100);
                        (FindViewById<ProgressBar>(Resource.Id.disgustProgressBar)).Progress = (int)Math.Ceiling(emo.Scores.Disgust * 100);
                        (FindViewById<ProgressBar>(Resource.Id.fearProgressBar)).Progress = (int)Math.Ceiling(emo.Scores.Fear * 100);
                        (FindViewById<ProgressBar>(Resource.Id.happinessProgressBar)).Progress = (int)Math.Ceiling(emo.Scores.Happiness * 100);
                        (FindViewById<ProgressBar>(Resource.Id.neutralProgressBar)).Progress = (int)Math.Ceiling(emo.Scores.Neutral * 100);
                        (FindViewById<ProgressBar>(Resource.Id.sadnessProgressBar)).Progress = (int)Math.Ceiling(emo.Scores.Sadness * 100);
                        (FindViewById<ProgressBar>(Resource.Id.surpriseProgressBar)).Progress = (int)Math.Ceiling(emo.Scores.Surprise * 100);
                    };
                    rellayout.AddView(butt);
                }
            }
            finally{ progressBar.Visibility = ViewStates.Invisible; }
        }
Esempio n. 50
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            rootview = new RelativeLayout (nn_activity);
            rootview.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
            rootview.SetBackgroundColor (Resources.GetColor(Resource.Color.soarnix_bg_gray));
            rootview.Id = TapUtil.generateViewId ();

            //list to show event history

            historyeventlist = new ListView (nn_activity);
            historyeventlist.LayoutParameters= new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
            historyeventlist.Id = TapUtil.generateViewId ();

            adapter = new EventHistoryListAdapter (nn_activity,historylist);
            historyeventlist.Adapter = adapter;

            //add a relative layout to rootview to show no result event
            nohistorylayout=new RelativeLayout(nn_activity);
            nohistorylayout.LayoutParameters= new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
            nohistorylayout.SetBackgroundResource(Resource.Color.soarnix_bg_gray);
            nohistorylayout.Visibility = ViewStates.Gone;

            nohistorytext = new TextView (nn_activity);
            nohistorytext.Text = HistoryScreenData.NoRecordMessage;
            nohistorytext.Gravity = GravityFlags.Center;
            RelativeLayout.LayoutParams nohistorytextparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            nohistorytextparam.AddRule (LayoutRules.CenterInParent);
            nohistorytextparam.SetMargins (TapUtil.dptodx (10), 0, TapUtil.dptodx (10), 0);
            nohistorytext.LayoutParameters = nohistorytextparam;

            nohistorylayout.AddView (nohistorytext);
            rootview.AddView (historyeventlist);
            rootview.AddView (nohistorylayout);
            return rootview;
        }
Esempio n. 51
0
 void setPos(int x, int y)
 {
     var box = this.FindViewById<View>(Resource.Id.box1);
     // var lp = new RelativeLayout.LayoutParams(box.Width, box.Height);
     if (_box_w == 0 || _box_h == 0)
     {
         _box_w = box.Width;
         _box_h = box.Height;
     }
     var lp = new RelativeLayout.LayoutParams(_box_w, _box_h);
     lp.SetMargins(x, y, 0, 0);
     box.LayoutParameters = lp;
 }
        private void RenderMail(Array TRs)
        {
            Loading("");
            Refresh = "Mail";

            RunOnUiThread (() =>
            {
                SetContentView(Resource.Layout.Mail);
                LinearLayout Main = FindViewById<LinearLayout>(Resource.Id.MyMainLayout);
                RelativeLayout RemoveMe = FindViewById<RelativeLayout>(Resource.Id.RemoveMe);
                Main.RemoveView(RemoveMe);

                Button BLogout = FindViewById<Button>(Resource.Id.Back);
                BLogout.Click += delegate
                { ThreadPool.QueueUserWorkItem(o => Logout()); };

                Button BCompose = FindViewById<Button>(Resource.Id.Compose);
                BCompose.Click += delegate
                { ThreadPool.QueueUserWorkItem(o => Compose()); };

                int CNT = 0;
                RelativeLayout.LayoutParams MyPars;
                foreach (HtmlNode TR in TRs)
                {
                    CNT++;
                    if (CNT <= 2 || CNT == TRs.Length)
                        continue;

                    string HTML = TR.InnerHtml;
                    HtmlDocument doc = new HtmlDocument();
                    doc.LoadHtml(HTML);
                    HtmlNode node = doc.DocumentNode;

                    HtmlNode a = node.Descendants("a").Last();
                    string ID =	a.Attributes.First().Value;
                    ID = ID.Split('=')[1];
                    string From = a.InnerText;

                    HtmlNode Temp;
                    Array Fonts = node.Descendants("font").ToArray();
                    Temp = (HtmlNode) Fonts.GetValue(2);
                    string Time = Temp.InnerText;
                    Temp = (HtmlNode) Fonts.GetValue(3);
                    string Where = Temp.InnerText;
                    Temp = (HtmlNode) Fonts.GetValue(4);
                    string MSG = Regex.Split(Temp.InnerText, "\\\n")[0];

                    RelativeLayout NewLayout = new RelativeLayout(this);
                    if (CNT % 2 == 0)
                        NewLayout.SetBackgroundColor(Color.ParseColor("#F0E68C"));
                    else
                        NewLayout.SetBackgroundColor(Color.ParseColor("#D1CD76"));

                    MyPars = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                    MyPars.AddRule(LayoutRules.AlignParentLeft);
                    MyPars.AddRule(LayoutRules.AlignParentTop);
                    TextView Mittente = new TextView(this)
                    { Text = From };
                    Mittente.Id = 6901;
                    Mittente.LayoutParameters = MyPars;
                    Mittente.SetTextColor(Color.Black);
                    NewLayout.AddView(Mittente);

                    MyPars = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                    MyPars.AddRule(LayoutRules.AlignParentRight);
                    MyPars.AddRule(LayoutRules.AlignParentTop);
                    TextView Locazione = new TextView(this)
                    { Text = Where };
                    Locazione.Id = 6902;
                    Locazione.LayoutParameters = MyPars;
                    Locazione.SetTypeface(Locazione.Typeface, TypefaceStyle.Italic);
                    Locazione.SetTextColor(Color.Black);
                    NewLayout.AddView(Locazione);

                    MyPars = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                    MyPars.AddRule(LayoutRules.CenterHorizontal);
                    MyPars.AddRule(LayoutRules.Below, 6901);
                    TextView Testo = new TextView(this)
                    { Text = MSG };
                    Testo.Id = 6903;
                    Testo.LayoutParameters = MyPars;
                    Testo.SetTypeface(Testo.Typeface, TypefaceStyle.Bold);
                    Testo.SetTextColor(Color.Black);
                    NewLayout.AddView(Testo);

                    MyPars = new RelativeLayout.LayoutParams(150, 45);
                    MyPars.AddRule(LayoutRules.AlignParentLeft);
                    MyPars.AddRule(LayoutRules.Below, 6903);
                    Button Leggi = new Button(this)
                    { Text = "Leggi" };
                    Leggi.Id = 6904;
                    Leggi.LayoutParameters = MyPars;
                    Leggi.SetBackgroundResource(Resource.Drawable.LotButton);
                    Leggi.SetTextColor(Color.White);
                    Leggi.SetTextSize(Android.Util.ComplexUnitType.Dip, 15);
                    Leggi.Click += delegate
                    { ThreadPool.QueueUserWorkItem(o => ReadMail(ID)); };
                    NewLayout.AddView(Leggi);

                    MyPars = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                    MyPars.AddRule(LayoutRules.CenterHorizontal);
                    MyPars.AddRule(LayoutRules.Below, 6903);
                    MyPars.SetMargins(0, 5, 0, 0);
                    TextView Orario = new TextView(this)
                    { Text = Time };
                    Orario.Id = 6905;
                    Orario.LayoutParameters = MyPars;
                    Orario.SetTextColor(Color.Black);
                    NewLayout.AddView(Orario);

                    MyPars = new RelativeLayout.LayoutParams(150, 45);
                    MyPars.AddRule(LayoutRules.AlignParentRight);
                    MyPars.AddRule(LayoutRules.Below, 6903);
                    Button Cancella = new Button(this)
                    { Text = "Elimina" };
                    Cancella.Id = 6906;
                    Cancella.LayoutParameters = MyPars;
                    Cancella.SetBackgroundResource(Resource.Drawable.LotButton);
                    Cancella.SetTextColor(Color.White);
                    Cancella.SetTextSize(Android.Util.ComplexUnitType.Dip, 15);
                    Cancella.Click += delegate
                    { ThreadPool.QueueUserWorkItem(o => DeleteMail(ID)); };
                    NewLayout.AddView(Cancella);

                    Main.AddView(NewLayout);
                }
            });
        }
Esempio n. 53
0
		void Initialize ()
		{
			BackgroundColor = Color.Black;
			strokeColor = Color.White;
			StrokeWidth = 2f;

			canvasView = new SignatureCanvasView (this.context);
			canvasView.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.FillParent, RelativeLayout.LayoutParams.FillParent);

			//Set the attributes for painting the lines on the screen.
			paint = new Paint ();
			paint.Color = strokeColor;
			paint.StrokeWidth = StrokeWidth;
			paint.SetStyle (Paint.Style.Stroke);
			paint.StrokeJoin = Paint.Join.Round;
			paint.StrokeCap = Paint.Cap.Round;
			paint.AntiAlias = true;

			#region Add Subviews
			RelativeLayout.LayoutParams layout;

			BackgroundImageView = new ImageView (this.context);
			BackgroundImageView.Id = generateId ();
			AddView (BackgroundImageView);

			//Add an image that covers the entire signature view, used to display already drawn
			//elements instead of having to redraw them every time the user touches the screen.
			imageView = new ClearingImageView (context);
			imageView.SetBackgroundColor (Color.Transparent);
			imageView.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.FillParent, RelativeLayout.LayoutParams.FillParent);
			AddView (imageView);

			lblSign = new TextView (context);
			lblSign.Id = generateId ();
			lblSign.SetIncludeFontPadding (true);
			lblSign.Text = "Sign Here";
			layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
			layout.AlignWithParent = true;
			layout.BottomMargin = 6;
			layout.AddRule (LayoutRules.AlignBottom);
			layout.AddRule (LayoutRules.CenterHorizontal);
			lblSign.LayoutParameters = layout;
			lblSign.SetPadding (0, 0, 0, 6);
			AddView (lblSign);

			//Display the base line for the user to sign on.
			signatureLine = new View (context);
			signatureLine.Id = generateId ();
			signatureLine.SetBackgroundColor (Color.Gray);
			layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, 1);
			layout.SetMargins (10, 0, 10, 5);
			layout.AddRule (LayoutRules.Above, lblSign.Id);
            signatureLine.LayoutParameters = layout;
			AddView (signatureLine);

			//Display the X on the left hand side of the line where the user signs.
			xLabel = new TextView (context);
			xLabel.Id = generateId ();
			xLabel.Text = "X";
			xLabel.SetTypeface (null, TypefaceStyle.Bold);
			layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
			layout.LeftMargin = 11;
			layout.AddRule (LayoutRules.Above, signatureLine.Id);
			xLabel.LayoutParameters = layout;
			AddView (xLabel);

			AddView (canvasView);

			lblClear = new TextView (context);
			lblClear.Id = generateId ();
			lblClear.Text = "Clear";
			layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
			layout.SetMargins (0, 10, 22, 0);
			layout.AlignWithParent = true;
			layout.AddRule (LayoutRules.AlignRight);
			layout.AddRule (LayoutRules.AlignTop);
			lblClear.LayoutParameters = layout;
			lblClear.Visibility = ViewStates.Invisible;
			lblClear.Click += (object sender, EventArgs e) => {
				Clear ();
			};
			AddView (lblClear);
			#endregion

			paths = new List<Path> ();
			points = new List<System.Drawing.PointF[]> ();
			currentPoints = new List<System.Drawing.PointF> ();

			dirtyRect = new RectF ();
		}
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			mapView = base.OnCreateView (inflater, container, savedInstanceState);

			// Save ScreenController for later use
			ctrl = ((GameController)this.Activity);

			RelativeLayout view = new RelativeLayout(ctrl);
			view.AddView(mapView, new RelativeLayout.LayoutParams(-1, -1));

//			var view = inflater.Inflate(Resource.Layout.ScreenMap, container, false);
//
//			mapView = new MapView(ctrl);
//			mapView.OnCreate(savedInstanceState);
//
			// Set all relevant data for map

			_zoom = (float)Main.Prefs.GetDouble("MapZoom", 16);

			_map = this.Map;
			_map.MapType = GoogleMap.MapTypeNormal;
			_map.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(Main.GPS.Location.Latitude, Main.GPS.Location.Longitude), _zoom));
			_map.MyLocationEnabled = true;
			_map.BuildingsEnabled = true;
			_map.UiSettings.ZoomControlsEnabled = false;
			_map.UiSettings.MyLocationButtonEnabled = false;
			_map.UiSettings.CompassEnabled = false;
			_map.UiSettings.TiltGesturesEnabled = false;
			_map.UiSettings.RotateGesturesEnabled = false;
			_map.MapClick += OnMapClick;

			// Create tile layers
			_osmTileLayer = new OsmTileProvider("http://a.tile.openstreetmap.org/{0}/{1}/{2}.png");
			_ocmTileLayer = new OsmTileProvider("http://c.tile.opencyclemap.org/cycle/{0}/{1}/{2}.png");

			// Set selected map type
			SetMapType(Main.Prefs.GetInt("map_source", 0));

			// Create the zones the first time
			CreateZones();

			// Create layout for map buttons
			layoutButtons = new RelativeLayout(ctrl);

			// Button for center menu
			var lp = new RelativeLayout.LayoutParams(64, 64);
			lp.SetMargins(16, 16, 16, 8);
			lp.AddRule(LayoutRules.AlignParentLeft);
			lp.AddRule(LayoutRules.AlignParentTop);

			btnMapCenter = new ImageButton(ctrl);
			btnMapCenter.Id = 1;
			btnMapCenter.SetImageResource(Resource.Drawable.ic_button_center);
			btnMapCenter.SetBackgroundResource(Resource.Drawable.MapButton);
			btnMapCenter.Click += OnMapCenterButtonClick;

			layoutButtons.AddView(btnMapCenter, lp);

			// Button for the orientation: north up or always in direction
			lp = new RelativeLayout.LayoutParams(64, 64);
			lp.SetMargins(16, 8, 16, 16);
			lp.AddRule(LayoutRules.Below, btnMapCenter.Id);
			lp.AddRule(LayoutRules.AlignParentLeft);

			btnMapOrientation = new ImageButton(ctrl);
			if (Main.Prefs.GetBool ("MapOrientationNorth", true))
				btnMapOrientation.SetImageResource (Resource.Drawable.ic_button_orientation_north);
			else
				btnMapOrientation.SetImageResource (Resource.Drawable.ic_button_orientation);
			btnMapOrientation.SetBackgroundResource(Resource.Drawable.MapButton);
			btnMapOrientation.Click += OnMapOrientationButtonClick;

			layoutButtons.AddView(btnMapOrientation, lp);

			// Button for selecting the map type
			lp = new RelativeLayout.LayoutParams(64, 64);
			lp.SetMargins(16, 16, 16, 8);
			lp.AddRule(LayoutRules.AlignParentTop);
			lp.AddRule(LayoutRules.AlignParentRight);

			btnMapType = new ImageButton(ctrl);
			btnMapType.SetImageResource(Resource.Drawable.ic_button_layer);
			btnMapType.SetBackgroundResource(Resource.Drawable.MapButton);
			btnMapType.Click += OnMapTypeButtonClick;

			layoutButtons.AddView(btnMapType, lp);

			view.AddView(layoutButtons);

			return view;
		}
Esempio n. 55
0
 public static void SetXY(View el, int left, int top)
 {
     var lp = new RelativeLayout.LayoutParams(el.Width, el.Height);
     lp.SetMargins(left, top, 0, 0);
     el.LayoutParameters = lp;
 }