Esempio n. 1
0
        void SwitchVertical()
        {
            CamUtils.SetVertical();

            if (btnSnap != null)
            {
                RelativeLayout.LayoutParams LParams = (RelativeLayout.LayoutParams)btnSnap.LayoutParameters;
                LParams.RemoveRule(LayoutRules.AlignParentRight);
                LParams.RemoveRule(LayoutRules.CenterVertical);

                LParams.AddRule(LayoutRules.AlignParentBottom);
                LParams.AddRule(LayoutRules.CenterHorizontal);
            }
        }
Esempio n. 2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var mapView = base.OnCreateView(inflater, container, savedInstanceState);

            try
            {
                // tags: GoogleMapCompass (id 4)
                // GoogleMapMyLocationButton
                var       compassView = mapView.FindViewWithTag("GoogleMapCompass");
                ViewGroup parent      = (ViewGroup)compassView.Parent;

                RelativeLayout.LayoutParams rlp = (RelativeLayout.LayoutParams)compassView.LayoutParameters;
                // position on top right
                rlp.AddRule(LayoutRules.AlignParentEnd);
                rlp.RemoveRule(LayoutRules.AlignParentStart);
                rlp.RightMargin = (int)LayoutHelper.ConvertDpToPixel(20);
                rlp.TopMargin   = (int)LayoutHelper.ConvertDpToPixel(155);

                compassView.RequestLayout();
                // listen to click on compass to stop compass mode
                compassView.SetOnClickListener(new CompassClickListener());

                //ViewGroup parent = (ViewGroup)mapView.FindViewWithTag("GoogleMapMyLocationButton").Parent;
                //for (int i = 0, n = parent.ChildCount; i < n; i++)
                //{
                //    View view = parent.GetChildAt(i);
                //    System.Diagnostics.Debug.WriteLine(i);
                //    System.Diagnostics.Debug.WriteLine(view.Tag);
                //    RelativeLayout.LayoutParams rlp = (RelativeLayout.LayoutParams)view.LayoutParameters;
                //    // position on top right
                //    rlp.AddRule(LayoutRules.AlignParentLeft, 0);
                //    rlp.AddRule(LayoutRules.AlignParentTop,0);
                //    rlp.AddRule(LayoutRules.AlignParentRight);
                //    rlp.AddRule(LayoutRules.AlignParentBottom);
                //    rlp.RightMargin = rlp.LeftMargin;
                //    rlp.TopMargin = 25;
                //    view.RequestLayout();
                //}
            }
            catch
            {
                // ignore
            }

            // enable a way to detect when the user is actually moving the map to unstick to the current user location for instance
            touchView = new TouchableWrapper(CrossCurrentActivity.Current.Activity);
            touchView.AddView(mapView);
            return(touchView);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates and gets the view.
        /// </summary>
        /// <param name="position"></param>
        /// <param name="convertView"></param>
        /// <param name="parent"></param>
        /// <returns></returns>
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View view = convertView;

            item = this[position];

            if (view == null)
            {
                view = context.LayoutInflater.Inflate(Resource.Layout.list_segmentlayout, parent, false);
            }

            var layoutView  = view.FindViewById <RelativeLayout>(Resource.Id.SegmentLayout);
            var companyType = view.FindViewById <TextView>(Resource.Id.CompanyTypeText);

            view.FindViewById <MvxImageView>(Resource.Id.CompanyImageView).ImageUrl          = item.ImageUrl;
            view.FindViewById <MvxImageView>(Resource.Id.CompanyTypeBackgroundView).ImageUrl = item.CompanyTypeBackgroundIcon;
            view.FindViewById <MvxImageView>(Resource.Id.CompanyTypeIconView).ImageUrl       = item.CompanyTypeIcon;
            view.FindViewById <TextView>(Resource.Id.RecommendationText).Text = item.RecommendedRide;
            view.FindViewById <TextView>(Resource.Id.CompanyNameText).Text    = item.CompanyTitle;
            companyType.Text = item.CompanyTypeText;
            view.FindViewById <TextView>(Resource.Id.DistanceTextView).Text   = item.CompanyDistanceFromCurrLocation;
            view.FindViewById <TextView>(Resource.Id.NoOfOffersTextView).Text = item.NoOfOffers;
            var recText = view.FindViewById <TextView>(Resource.Id.RecommendationText);
            var comText = view.FindViewById <TextView>(Resource.Id.CompanyNameText);

            if (item.CompanyType == Core.Enums.CompanyTypeEnum.Dealership)
            {
                view.FindViewById <TextView>(Resource.Id.NoOfOffersTextView).Visibility = ViewStates.Visible;
                view.FindViewById <TextView>(Resource.Id.NoOfOffersTextView).Text       = item.NoOfOffers;
                view.FindViewById <MvxImageView>(Resource.Id.OfferImage).ImageUrl       = item.OfferImageUrl;
                view.FindViewById <TextView>(Resource.Id.OfferText).Text = item.OfferText;
                view.FindViewById <RelativeLayout>(Resource.Id.OfferLayout).Visibility = ViewStates.Visible;
            }
            else
            {
                view.FindViewById <TextView>(Resource.Id.NoOfOffersTextView).Visibility = ViewStates.Gone;
                view.FindViewById <RelativeLayout>(Resource.Id.OfferLayout).Visibility  = ViewStates.Gone;
            }

            RelativeLayout.LayoutParams parameters = (RelativeLayout.LayoutParams)comText.LayoutParameters;

            if (item.CompanyType == Core.Enums.CompanyTypeEnum.Retailer || item.CompanyType == Core.Enums.CompanyTypeEnum.Dealership)
            {
                companyType.SetBackgroundResource(Resource.Drawable.green_textbackground);
            }
            else
            {
                companyType.SetBackgroundResource(Resource.Drawable.blue_textbackground);
            }

            mapview = view.FindViewById <MapView>(Resource.Id.MapFragmentList);
            if (view != null)
            {
                mapview.OnCreate(mBundle);
                mapview.OnResume();
                mapview.GetMapAsync(this);
            }

            if (string.IsNullOrWhiteSpace(item.RecommendedRide))
            {
                mapview.Visibility = ViewStates.Gone;
            }

            if (string.IsNullOrWhiteSpace(recText.Text))
            {
                parameters.AddRule(LayoutRules.AlignParentTop);
                comText.LayoutParameters = parameters;
            }
            else
            {
                parameters.RemoveRule(LayoutRules.AlignParentTop);
                comText.LayoutParameters = parameters;
            }

            return(view);
        }