protected override View GetCellCore (Cell item, View convertView, ViewGroup parent, Context context)
		{
			var cell = (LinearLayout)base.GetCellCore (item, convertView, parent, context);
			cell.SetPadding(20, 10, 0, 10);
			cell.DividerPadding = 50;

			var div = new ShapeDrawable();
			div.SetIntrinsicHeight(1);
			//div.Paint.Set(new Paint { Color = Color.FromHex("00FFFFFF").ToAndroid() });

			if (parent is ListView) {
				((ListView)parent).Divider = div;
				((ListView)parent).DividerHeight = 1;
			}


			var label = (TextView)((LinearLayout)cell.GetChildAt(1)).GetChildAt(0);
			label.SetTextColor(Color.FromHex("000000").ToAndroid());
			label.TextSize = Font.SystemFontOfSize(NamedSize.Large).ToScaledPixel();

			var secondaryLabel = (TextView)((LinearLayout)cell.GetChildAt(1)).GetChildAt(1);
			secondaryLabel.SetTextColor(Color.FromHex("738182").ToAndroid());
			secondaryLabel.TextSize = Font.SystemFontOfSize(NamedSize.Medium).ToScaledPixel();


			return cell;
		}
		protected override void OnElementChanged (ElementChangedEventArgs<Xamarin.Forms.View> e)
		{
			base.OnElementChanged (e);

			//Get LayoutInflater and inflate from axml
			//Important note, this project utilizes a layout-land folder in the Resources folder
			//Android will use this folder with layout files for Landscape Orientations
			//This is why we don't have to worry about the layout of the play button, it doesn't exist in landscape layout file!!! 
			var activity = Context as Activity; 
			var viewHolder = activity.LayoutInflater.Inflate (Resource.Layout.Main, this, false);
			view = viewHolder;
			AddView (view);

			//Get and set Views
			videoView = FindViewById<VideoView> (Resource.Id.SampleVideoView);
			playButton = FindViewById<Android.Widget.Button> (Resource.Id.PlayVideoButton);

			//Give some color to the play button, but not important
			playButton.SetBackgroundColor (Android.Graphics.Color.Aqua);
			//uri for a free video
			var uri = Android.Net.Uri.Parse ("https://www.dropbox.com/s/hi45psyy0wq9560/PigsInAPolka1943.mp4?dl=1");
			//Set the videoView with our uri, this could also be a local video on device
			videoView.SetVideoURI (uri);
			//Assign click event on our play button to play the video
			playButton.Click += PlayVideo;
		}      
示例#3
0
		protected override void OnElementChanged (ElementChangedEventArgs<Page> e)
		{
			base.OnElementChanged (e);

			if (e.OldElement != null || Element == null)
				return;

			try {
				activity = this.Context as Activity;
				view = activity.LayoutInflater.Inflate(Resource.Layout.CameraLayout, this, false);
				cameraType = CameraFacing.Back;

				textureView = view.FindViewById<TextureView> (Resource.Id.textureView);
				textureView.SurfaceTextureListener = this;

				takePhotoButton = view.FindViewById<global::Android.Widget.Button> (Resource.Id.takePhotoButton);
				takePhotoButton.Click += TakePhotoButtonTapped;

				switchCameraButton = view.FindViewById<global::Android.Widget.Button> (Resource.Id.switchCameraButton);
				switchCameraButton.Click += SwitchCameraButtonTapped;

				toggleFlashButton = view.FindViewById<global::Android.Widget.Button> (Resource.Id.toggleFlashButton);
				toggleFlashButton.Click += ToggleFlashButtonTapped;

				AddView (view);
			} catch (Exception ex) {
				//Xamarin.Insights.Report (ex);
			}
		}
示例#4
0
        protected override View GetCellCore (Cell item, View convertView, ViewGroup parent, Context context)
        {
            var cell = (LinearLayout)base.GetCellCore (item, convertView, parent, context);
            cell.SetPadding(20, 10, 0, 10);
            cell.DividerPadding = 50;

            var div = new ShapeDrawable();
            div.SetIntrinsicHeight(1);

            div.Paint.Set(new Paint { Color = MobileCRM.Shared.Helpers.AppColors.SEPARATOR.ToAndroid() });


            if (parent is ListView) {
                ((ListView)parent).Divider = div;
                ((ListView)parent).DividerHeight = 1;
            }


            var label = (TextView)((LinearLayout)cell.GetChildAt(1)).GetChildAt(0);


            label.SetTextColor(MobileCRM.Shared.Helpers.AppColors.LABELWHITE.ToAndroid());

            
            label.TextSize = Font.SystemFontOfSize(NamedSize.Large).ToScaledPixel();

            var secondaryLabel = (TextView)((LinearLayout)cell.GetChildAt(1)).GetChildAt(1);

            secondaryLabel.SetTextColor(MobileCRM.Shared.Helpers.AppColors.LABELBLUE.ToAndroid());
           
            secondaryLabel.TextSize = Font.SystemFontOfSize(NamedSize.Medium).ToScaledPixel();


            return cell;
        }
        protected override View GetCellCore(Cell item, View convertView, ViewGroup parent, Context context)
        {
            var cell = (LinearLayout)base.GetCellCore(item, convertView, parent, context);
            cell.SetPadding(20, 30, 0, 30);
            cell.DividerPadding = 50;

            var div = new ShapeDrawable();
            div.SetIntrinsicHeight(1);
            div.Paint.Set(new Paint { Color = Color.FromHex("00FFFFFF").ToAndroid() });

            if (parent is ListView)
            {
                ((ListView)parent).Divider = div;
                ((ListView)parent).DividerHeight = 1;
            }

            var image = (ImageView)cell.GetChildAt(0);
            image.SetScaleType(ImageView.ScaleType.FitCenter);

            image.LayoutParameters.Width = 60;
            image.LayoutParameters.Height = 60;

            var linear = (LinearLayout)cell.GetChildAt(1);
            linear.SetGravity(Android.Views.GravityFlags.CenterVertical);

            var label = (TextView)linear.GetChildAt(0);
            label.SetTextColor(Color.White.ToAndroid());
            label.TextSize = Font.SystemFontOfSize(NamedSize.Large).ToScaledPixel() * 1.25f;
            label.Gravity = (Android.Views.GravityFlags.CenterVertical);
            label.SetTextColor(Color.FromHex("000000").ToAndroid());
            var secondaryLabel = (TextView)linear.GetChildAt(1);
            secondaryLabel.Visibility = Android.Views.ViewStates.Gone;

            return cell;
        }
		void SetupUserInterface ()
		{
			activity = this.Context as Activity;
			view = activity.LayoutInflater.Inflate (Resource.Layout.CameraLayout, this, false);
			cameraType = CameraFacing.Back;

			textureView = view.FindViewById<TextureView> (Resource.Id.textureView);
			textureView.SurfaceTextureListener = this;
		}
		/// <summary>
		/// Raises the element changed event to set the native control for this element.
		/// </summary>
		/// <param name="e">E.</param>
		protected override void OnElementChanged (ElementChangedEventArgs<View> e)
		{
			base.OnElementChanged (e);

			if (e.OldElement == null)
			{
				// Set a normal view as underlaying control
				_view = new global::Android.Views.View(Context);
				_view.BringToFront();
				_view.SetWillNotCacheDrawing(true);
				SetNativeControl(_view);
			}
		}
		public GridViewCellContainer (Context context, FastGridCell fastGridCell, global::Android.Views.View parent, Size initialCellSize) : base (context)
		{
			using (var h = new Handler (Looper.MainLooper)) {
				h.Post (() => {
					_parent = parent;
					_viewCell = fastGridCell;
					fastGridCell.PrepareCell (initialCellSize);
//					_viewCell.View.BackgroundColor = Xamarin.Forms.Color.Green;
					var renderer = fastGridCell.View.GetOrCreateRenderer ();
					_nativeView = renderer.ViewGroup;
//					SetBackgroundColor (Android.Graphics.Color.Yellow);
					AddView (_nativeView);
				});
			}

		}
示例#9
0
        public override global::Android.Views.View GetView(int position, global::Android.Views.View convertView, global::Android.Views.ViewGroup parent)
        {
            SpinnerHolder holder = null;
            var           view   = convertView;

            if (view != null)
            {
                holder = view.Tag as SpinnerHolder;
            }

            if (holder == null)
            {
                holder = new SpinnerHolder();
                //view = this._Context.LayoutInflater.Inflate (Resource.Layout.SpinnerItemLayout, null);
                view                 = this._Context.LayoutInflater.Inflate(Resource.Layout.SpinnerItemLayout, null);
                holder.Layout        = view.FindViewById <LinearLayout> (Resource.Id.SpinnerLayout);
                holder.Text          = view.FindViewById <TextView> (Resource.Id.SpinnerTextView);
                holder.Text.TextSize = this._FontSize;
                view.Tag             = holder;
            }

            var item = this._Items [position];

            if (position == 0)
            {
                holder.Text.Text = this._Title;
            }
            else
            {
//				if (SelectedText == item && this._NoSelectedColor == false) {
//					holder.Layout.SetBackgroundDrawable (new RectBorder (3,
//						global::Android.Graphics.Color.Black, this._SelectedBackColor));
//					holder.Text.SetTextColor (this._SelectedTextColor);
//				}
                holder.Text.Text = this._Items [position];
            }


            return(view);
        }
示例#10
0
        protected override bool DrawChild(Canvas canvas, global::Android.Views.View child, long drawingTime)
        {
            try
            {
                var radius      = Math.Min(Width, Height) / 2;
                var strokeWidth = 10;
                radius -= strokeWidth / 2;


                Path path = new Path();
                path.AddCircle(Width / 2, Height / 2, radius, Path.Direction.Ccw);
                canvas.Save();
                canvas.ClipPath(path);

                var result = base.DrawChild(canvas, child, drawingTime);

                canvas.Restore();

                path = new Path();
                path.AddCircle(Width / 2, Height / 2, radius, Path.Direction.Ccw);

                var paint = new Paint();
                paint.AntiAlias   = true;
                paint.StrokeWidth = 2;
                paint.SetStyle(Paint.Style.Stroke);

                paint.Color = global::Android.Graphics.Color.Rgb(175, 30, 45);
                canvas.DrawPath(path, paint);

                paint.Dispose();
                path.Dispose();
                return(result);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Draw Circlce : {0}", ex.Message);
            }

            return(base.DrawChild(canvas, child, drawingTime));
        }
示例#11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="canvas"></param>
        /// <param name="child"></param>
        /// <param name="drawingTime"></param>
        /// <returns></returns>
        protected override bool DrawChild(Canvas canvas, global::Android.Views.View child, long drawingTime)
        {
            try
            {
                var radius      = Math.Min(Width, Height) / 2;
                var strokeWidth = 10;
                radius -= strokeWidth / 2;


                Path path = new Path();
                path.AddCircle(Width / 2, Height / 2, radius, Path.Direction.Ccw);
                canvas.Save();
                canvas.ClipPath(path);

                var result = base.DrawChild(canvas, child, drawingTime);

                canvas.Restore();

                path = new Path();
                path.AddCircle(Width / 2, Height / 2, radius, Path.Direction.Ccw);

                var paint = new Paint();
                paint.AntiAlias   = true;
                paint.StrokeWidth = ((CircleImage)Element).BorderThickness;
                paint.SetStyle(Paint.Style.Stroke);
                paint.Color = ((CircleImage)Element).BorderColor.ToAndroid();

                canvas.DrawPath(path, paint);

                paint.Dispose();
                path.Dispose();
                return(result);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Unable to create circle image: " + ex);
            }

            return(base.DrawChild(canvas, child, drawingTime));
        }
        protected override bool DrawChild(ACanvas canvas, global::Android.Views.View child, long drawingTime)
        {
            if (Element == null)
            {
                return(false);
            }

            var control = (PancakeView)Element;

            SetClipChildren(true);

            //Create path to clip the child
            if (control.Sides != 4)
            {
                using (var path = PolygonUtils.GetPolygonCornerPath(Width, Height, control.Sides, control.CornerRadius.TopLeft, control.OffsetAngle))
                {
                    canvas.Save();
                    canvas.ClipPath(path);
                }
            }
            else
            {
                using (var path = new Path())
                {
                    path.AddRoundRect(new RectF(0, 0, Width, Height), GetRadii(control), Path.Direction.Ccw);

                    canvas.Save();
                    canvas.ClipPath(path);
                }
            }

            // Draw the child first so that the border shows up above it.
            var result = base.DrawChild(canvas, child, drawingTime);

            canvas.Restore();

            DrawBorder(canvas, control);

            return(result);
        }
            public override unsafe void GetOutline(global::Android.Views.View p0, global::Android.Graphics.Outline p1)
            {
                if (id_getOutline_Landroid_view_View_Landroid_graphics_Outline_ == IntPtr.Zero)
                {
                    id_getOutline_Landroid_view_View_Landroid_graphics_Outline_ = JNIEnv.GetMethodID(class_ref, "getOutline", "(Landroid/view/View;Landroid/graphics/Outline;)V");
                }
                try {
                    JValue *__args = stackalloc JValue [2];
                    __args [0] = new JValue(p0);
                    __args [1] = new JValue(p1);

                    if (GetType() == ThresholdType)
                    {
                        JNIEnv.CallVoidMethod(((global::Java.Lang.Object) this).Handle, id_getOutline_Landroid_view_View_Landroid_graphics_Outline_, __args);
                    }
                    else
                    {
                        JNIEnv.CallNonvirtualVoidMethod(((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, "getOutline", "(Landroid/view/View;Landroid/graphics/Outline;)V"), __args);
                    }
                } finally {
                }
            }
示例#14
0
        public virtual unsafe void InflateViewWithMessage(global::Android.Views.View p0, global::Com.Applozic.Mobicomkit.Api.Conversation.Message p1)
        {
            if (id_inflateViewWithMessage_Landroid_view_View_Lcom_applozic_mobicomkit_api_conversation_Message_ == IntPtr.Zero)
            {
                id_inflateViewWithMessage_Landroid_view_View_Lcom_applozic_mobicomkit_api_conversation_Message_ = JNIEnv.GetMethodID(class_ref, "inflateViewWithMessage", "(Landroid/view/View;Lcom/applozic/mobicomkit/api/conversation/Message;)V");
            }
            try {
                JValue *__args = stackalloc JValue [2];
                __args [0] = new JValue(p0);
                __args [1] = new JValue(p1);

                if (((object)this).GetType() == ThresholdType)
                {
                    JNIEnv.CallVoidMethod(((global::Java.Lang.Object) this).Handle, id_inflateViewWithMessage_Landroid_view_View_Lcom_applozic_mobicomkit_api_conversation_Message_, __args);
                }
                else
                {
                    JNIEnv.CallNonvirtualVoidMethod(((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, "inflateViewWithMessage", "(Landroid/view/View;Lcom/applozic/mobicomkit/api/conversation/Message;)V"), __args);
                }
            } finally {
            }
        }
示例#15
0
        public virtual unsafe void OnFocusChange(global::Android.Views.View p0, bool p1)
        {
            if (id_onFocusChange_Landroid_view_View_Z == IntPtr.Zero)
            {
                id_onFocusChange_Landroid_view_View_Z = JNIEnv.GetMethodID(class_ref, "onFocusChange", "(Landroid/view/View;Z)V");
            }
            try {
                JValue *__args = stackalloc JValue [2];
                __args [0] = new JValue(p0);
                __args [1] = new JValue(p1);

                if (GetType() == ThresholdType)
                {
                    JNIEnv.CallVoidMethod(((global::Java.Lang.Object) this).Handle, id_onFocusChange_Landroid_view_View_Z, __args);
                }
                else
                {
                    JNIEnv.CallNonvirtualVoidMethod(((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, "onFocusChange", "(Landroid/view/View;Z)V"), __args);
                }
            } finally {
            }
        }
示例#16
0
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.View> e)
        {
            base.OnElementChanged(e);


            if (e.OldElement == null)
            {
                var uiv = new global::Android.Views.View(this.Context);
                uiv.SetBackgroundResource(Shared.Core.Resource.Drawable.border);

                this.SetNativeControl(uiv);


                if (((Square)Element).DisplayActivityIndicator)
                {
                }


                //this.NativeView.Layer.BorderColor = Color.Gray.ToCGColor();
                //this.NativeView.Layer.BorderWidth = 1;
            }
        }
            public override global::Android.Views.View GetView(int position, global::Android.Views.View convertView, ViewGroup parent)
            {
                var view = base.GetView(position, convertView, parent);

                var element = GetCellForPosition(position);

                // section header will be a TextCell
                if (element.GetType() == typeof(TextCell))
                {
                    try
                    {
                        // Get the textView of the actual layout
                        var textView = ((((view as LinearLayout).GetChildAt(0) as LinearLayout).GetChildAt(1) as LinearLayout).GetChildAt(0) as TextView);

                        textView.TextSize = (float)_resizedTableView.FontSize;
                        //((IElementController)element).SetValueFromRenderer(Label.FontSizeProperty, _resizedTableView.FontSize);
                    }
                    catch (Exception) { }
                }

                return(view);
            }
示例#18
0
        public virtual unsafe void ShowIndicator(global::Android.Views.View p0, global::Android.Graphics.Rect p1)
        {
            if (id_showIndicator_Landroid_view_View_Landroid_graphics_Rect_ == IntPtr.Zero)
            {
                id_showIndicator_Landroid_view_View_Landroid_graphics_Rect_ = JNIEnv.GetMethodID(class_ref, "showIndicator", "(Landroid/view/View;Landroid/graphics/Rect;)V");
            }
            try {
                JValue *__args = stackalloc JValue [2];
                __args [0] = new JValue(p0);
                __args [1] = new JValue(p1);

                if (GetType() == ThresholdType)
                {
                    JNIEnv.CallVoidMethod(Handle, id_showIndicator_Landroid_view_View_Landroid_graphics_Rect_, __args);
                }
                else
                {
                    JNIEnv.CallNonvirtualVoidMethod(Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, "showIndicator", "(Landroid/view/View;Landroid/graphics/Rect;)V"), __args);
                }
            } finally {
            }
        }
示例#19
0
        /// <summary>
        /// Draw one child of this View Group.
        /// </summary>
        /// <param name="canvas">The canvas on which to draw the child</param>
        /// <param name="child">Who to draw</param>
        /// <param name="drawingTime">The time at which draw is occurring</param>
        /// <returns>To be added.</returns>
        /// <since version="Added in API level 1" />
        /// <remarks><para tool="javadoc-to-mdoc">Draw one child of this View Group. This method is responsible for getting
        /// the canvas in the right state. This includes clipping, translating so
        /// that the child's scrolled origin is at 0, 0, and applying any animation
        /// transformations.</para>
        /// <para tool="javadoc-to-mdoc">
        ///   <format type="text/html">
        ///     <a href="http://developer.android.com/reference/android/view/ViewGroup.html#drawChild(android.graphics.Canvas, android.view.View, long)" target="_blank">[Android Documentation]</a>
        ///   </format>
        /// </para></remarks>
        protected override bool DrawChild(Canvas canvas, global::Android.Views.View child, long drawingTime)
        {
            if (this.Element.Aspect == Aspect.AspectFit)
            {
                var radius      = Math.Min(Width, Height) / 2;
                var strokeWidth = 10;
                radius -= strokeWidth / 2;

                Path path = new Path();
                path.AddCircle(Width / 2, Height / 2, radius, Path.Direction.Ccw);
                canvas.Save();
                canvas.ClipPath(path);

                var result = base.DrawChild(canvas, child, drawingTime);

                path.Dispose();

                return(result);
            }

            return(base.DrawChild(canvas, child, drawingTime));
        }
示例#20
0
        public virtual unsafe void RenderAdView(global::Android.Views.View p0, global::Com.Mopub.Nativeads.StaticNativeAd p1)
        {
            if (id_renderAdView_Landroid_view_View_Lcom_mopub_nativeads_StaticNativeAd_ == IntPtr.Zero)
            {
                id_renderAdView_Landroid_view_View_Lcom_mopub_nativeads_StaticNativeAd_ = JNIEnv.GetMethodID(class_ref, "renderAdView", "(Landroid/view/View;Lcom/mopub/nativeads/StaticNativeAd;)V");
            }
            try {
                JValue *__args = stackalloc JValue [2];
                __args [0] = new JValue(p0);
                __args [1] = new JValue(p1);

                if (((object)this).GetType() == ThresholdType)
                {
                    JNIEnv.CallVoidMethod(((global::Java.Lang.Object) this).Handle, id_renderAdView_Landroid_view_View_Lcom_mopub_nativeads_StaticNativeAd_, __args);
                }
                else
                {
                    JNIEnv.CallNonvirtualVoidMethod(((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, "renderAdView", "(Landroid/view/View;Lcom/mopub/nativeads/StaticNativeAd;)V"), __args);
                }
            } finally {
            }
        }
示例#21
0
        protected override bool DrawChild(Canvas canvas, global::Android.Views.View child, long drawingTime)
        {
            try
            {
                var path = new Path();
                path.AddRoundRect(new RectF(0, 0, Width, Height), 15f, 15f, Path.Direction.Ccw);
                canvas.Save();
                canvas.ClipPath(path);

                var result = base.DrawChild(canvas, child, drawingTime);

                canvas.Restore();
                path.Dispose();
                return(result);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Unable to create rounded rectangle image: " + ex);
            }

            return(base.DrawChild(canvas, child, drawingTime));
        }
        public virtual unsafe void InitMargins(global::Android.Graphics.Rect p0, global::Android.Views.View p1)
        {
            if (id_initMargins_Landroid_graphics_Rect_Landroid_view_View_ == IntPtr.Zero)
            {
                id_initMargins_Landroid_graphics_Rect_Landroid_view_View_ = JNIEnv.GetMethodID(class_ref, "initMargins", "(Landroid/graphics/Rect;Landroid/view/View;)V");
            }
            try {
                JValue *__args = stackalloc JValue [2];
                __args [0] = new JValue(p0);
                __args [1] = new JValue(p1);

                if (((object)this).GetType() == ThresholdType)
                {
                    JNIEnv.CallVoidMethod(((global::Java.Lang.Object) this).Handle, id_initMargins_Landroid_graphics_Rect_Landroid_view_View_, __args);
                }
                else
                {
                    JNIEnv.CallNonvirtualVoidMethod(((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, "initMargins", "(Landroid/graphics/Rect;Landroid/view/View;)V"), __args);
                }
            } finally {
            }
        }
        public virtual unsafe void SetOnClickListener(global::Android.Views.View p0, global::Com.Mopub.Nativeads.IClickInterface p1)
        {
            if (id_setOnClickListener_Landroid_view_View_Lcom_mopub_nativeads_ClickInterface_ == IntPtr.Zero)
            {
                id_setOnClickListener_Landroid_view_View_Lcom_mopub_nativeads_ClickInterface_ = JNIEnv.GetMethodID(class_ref, "setOnClickListener", "(Landroid/view/View;Lcom/mopub/nativeads/ClickInterface;)V");
            }
            try {
                JValue *__args = stackalloc JValue [2];
                __args [0] = new JValue(p0);
                __args [1] = new JValue(p1);

                if (((object)this).GetType() == ThresholdType)
                {
                    JNIEnv.CallVoidMethod(((global::Java.Lang.Object) this).Handle, id_setOnClickListener_Landroid_view_View_Lcom_mopub_nativeads_ClickInterface_, __args);
                }
                else
                {
                    JNIEnv.CallNonvirtualVoidMethod(((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, "setOnClickListener", "(Landroid/view/View;Lcom/mopub/nativeads/ClickInterface;)V"), __args);
                }
            } finally {
            }
        }
示例#24
0
        protected override void OnElementChanged(ElementChangedEventArgs <Page> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement != null || Element == null)
            {
                return;
            }

            if (e.NewElement != null)
            {
                activity = this.Context as Activity;
                view     = activity.LayoutInflater.Inflate(Resource.Layout.main_layout, this, false);

                activity.SetContentView(view);
                material_card = (MaterialCardView)view.FindViewById(Resource.Id.material_card);
                localButton   = (Android.Widget.Button)view.FindViewById(Resource.Id.button);

                localButton?.SetOnClickListener(this);
                textview         = (TextView)view.FindViewById(Resource.Id.textview);
                linearLayoutCard = (LinearLayout)view.FindViewById(Resource.Id.linearLayoutCard);
            }
        }
        protected override bool DrawChild(Canvas canvas, global::Android.Views.View child, long drawingTime)
        {
            try
            {
                var radius      = Math.Min(Width, Height) / 2;
                var strokeWidth = 4;
                radius -= strokeWidth / 2;

                Path path = new Path();
                path.AddCircle(Width / 2, Height / 2, radius, Path.Direction.Ccw);
                canvas.Save();
                canvas.ClipPath(path);

                var result = base.DrawChild(canvas, child, drawingTime);

                canvas.Restore();

                path = new Path();
                path.AddCircle(Width / 2, Height / 2, radius, Path.Direction.Ccw);

                var paint = new Paint();
                paint.AntiAlias   = true;
                paint.StrokeWidth = strokeWidth / 2;
                paint.SetStyle(Paint.Style.Stroke);
                paint.Color = global::Android.Graphics.Color.Transparent;

                canvas.DrawPath(path, paint);

                paint.Dispose();
                path.Dispose();
                return(result);
            }
            catch (Exception ex)
            {
            }

            return(base.DrawChild(canvas, child, drawingTime));
        }
示例#26
0
        protected override View GetCellCore(Cell item, View convertView, ViewGroup parent, Context context)
        {
            var cell = (LinearLayout)base.GetCellCore(item, convertView, parent, context);

            cell.SetPadding(20, 10, 0, 10);
            cell.DividerPadding = 50;

            var div = new ShapeDrawable();

            div.SetIntrinsicHeight(1);
            div.Paint.Set(new Paint {
                Color = Color.FromHex("b7b7b7").ToAndroid()
            });

            if (parent is ListView)
            {
                ((ListView)parent).Divider       = div;
                ((ListView)parent).DividerHeight = 1;
            }

            var icon = (ImageView)cell.GetChildAt(0);

            var label = (TextView)((LinearLayout)cell.GetChildAt(1)).GetChildAt(0);

            label.SetTextColor(Color.FromHex("262626").ToAndroid());
            label.TextSize      = Font.SystemFontOfSize(NamedSize.Large).ToScaledPixel();
            label.TextAlignment = TextAlignment.Center;
            label.Text          = label.Text.ToUpper();

            var secondaryLabel = (TextView)((LinearLayout)cell.GetChildAt(1)).GetChildAt(1);

            secondaryLabel.SetTextColor(Color.FromHex("262626").ToAndroid());
            secondaryLabel.TextSize = Font.SystemFontOfSize(NamedSize.Large).ToScaledPixel();
            label.TextAlignment     = TextAlignment.Center;


            return(cell);
        }
示例#27
0
        protected override void OnNativeElementSet(
            TNativeElement oldElement,
            TNativeElement newElement)
        {
            if (null == newElement)
            {
                throw new ArgumentNullException(nameof(newElement));
            }

            base.OnNativeElementSet(oldElement, newElement);

            this._nativeView = newElement;

            if (null != oldElement)
            {
                oldElement.Touch -= Element_Touch;
            }

            if (null != newElement)
            {
                newElement.Touch += Element_Touch;
            }
        }
示例#28
0
 public bool OnKey(global::Android.Views.View view, int i, KeyEvent keyEvent)
 {
     if ((keyEvent.Action == KeyEventActions.Down) && (keyEvent.KeyCode == Keycode.Enter))
     {
         string inputText = ((IEditable)text.Text).ToString();
         if (inputText.Length > 0)
         {
             try
             {
                 Task.CreateTask(this._enclosing.GetDatabase(), inputText, this._enclosing.mImageToBeAttached
                                 , listId);
             }
             catch (CouchbaseLiteException e)
             {
                 Log.E(Application.Tag, "Cannot create new task", e);
             }
         }
         text.SetText(string.Empty);
         this._enclosing.DeleteCurrentPhoto();
         return(true);
     }
     return(false);
 }
示例#29
0
                public override unsafe float GetAlpha(global::Android.Views.View p0)
                {
                    if (id_getAlpha_Landroid_view_View_ == IntPtr.Zero)
                    {
                        id_getAlpha_Landroid_view_View_ = JNIEnv.GetMethodID(class_ref, "getAlpha", "(Landroid/view/View;)F");
                    }
                    try {
                        JValue *__args = stackalloc JValue [1];
                        __args [0] = new JValue(p0);

                        float __ret;
                        if (GetType() == ThresholdType)
                        {
                            __ret = JNIEnv.CallFloatMethod(((global::Java.Lang.Object) this).Handle, id_getAlpha_Landroid_view_View_, __args);
                        }
                        else
                        {
                            __ret = JNIEnv.CallNonvirtualFloatMethod(((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, "getAlpha", "(Landroid/view/View;)F"), __args);
                        }
                        return(__ret);
                    } finally {
                    }
                }
示例#30
0
        public unsafe InfoWindow(global::Android.Views.View p0, global::Com.Baidu.Mapapi.Model.LatLng p1, int p2, bool p3, int p4)
            : base(IntPtr.Zero, JniHandleOwnership.DoNotTransfer)
        {
            const string __id = "(Landroid/view/View;Lcom/baidu/mapapi/model/LatLng;IZI)V";

            if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero)
            {
                return;
            }

            try {
                JniArgumentValue *__args = stackalloc JniArgumentValue [5];
                __args [0] = new JniArgumentValue((p0 == null) ? IntPtr.Zero : ((global::Java.Lang.Object)p0).Handle);
                __args [1] = new JniArgumentValue((p1 == null) ? IntPtr.Zero : ((global::Java.Lang.Object)p1).Handle);
                __args [2] = new JniArgumentValue(p2);
                __args [3] = new JniArgumentValue(p3);
                __args [4] = new JniArgumentValue(p4);
                var __r = _members.InstanceMethods.StartCreateInstance(__id, ((object)this).GetType(), __args);
                SetHandle(__r.Handle, JniHandleOwnership.TransferLocalRef);
                _members.InstanceMethods.FinishCreateInstance(__id, this, __args);
            } finally {
            }
        }
示例#31
0
        public static bool?SetFocusable(this global::Android.Views.View Control, Element Element, bool?_defaultFocusable = null, ImportantForAccessibility?_defaultImportantForAccessibility = null)
        {
            if (Element == null)
            {
                return(_defaultFocusable);
            }

            if (!_defaultFocusable.HasValue)
            {
                _defaultFocusable = Control.Focusable;
            }
            if (!_defaultImportantForAccessibility.HasValue)
            {
                _defaultImportantForAccessibility = Control.ImportantForAccessibility;
            }

            bool?isInAccessibleTree = (bool?)Element.GetValue(AutomationProperties.IsInAccessibleTreeProperty);

            Control.Focusable = (bool)(isInAccessibleTree ?? _defaultFocusable);
            Control.ImportantForAccessibility = !isInAccessibleTree.HasValue ? (ImportantForAccessibility)_defaultImportantForAccessibility : (bool)isInAccessibleTree ? ImportantForAccessibility.Yes : ImportantForAccessibility.No;

            return(_defaultFocusable);
        }
示例#32
0
        protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null || Element == null)
                return;

            try
            {
                var activity = this.Context as Activity;
                activity.RequestedOrientation = ScreenOrientation.Landscape;
                view = activity.LayoutInflater.Inflate(Resource.Layout.CameraLayout, this, false);
                _textureView = view.FindViewById<TextureView>(Resource.Id.textureView);
                _textureView.SurfaceTextureListener = this;
                cameraType = CameraFacing.Back;
                AddView(view);
            }
            catch (Exception ex)
            {

                Console.WriteLine("Roland error...." + ex.Message);
            }
        }
示例#33
0
            protected override void Dispose(bool disposing)
            {
                if (disposing && !_disposed)
                {
                    _disposed = true;
                    RemoveAllViews();
                    if (_renderer != null)
                    {
                        _renderer.Dispose();
                        _renderer = null;
                        _modal.ClearValue(Android.Platform.RendererProperty);
                        _modal = null;
                    }

                    if (_backgroundView != null)
                    {
                        _backgroundView.Dispose();
                        _backgroundView = null;
                    }
                }

                base.Dispose(disposing);
            }
示例#34
0
        /// <summary>
        /// Raises the touch event.
        /// </summary>
        /// <param name="v">V.</param>
        /// <param name="e">E.</param>
        public bool OnTouch(global::Android.Views.View v, MotionEvent e)
        {
            _scaleGestureDetector.OnTouchEvent(e);
            if (!_scaled)
            {
                _gestureDetector.OnTouchEvent(e);

                if (e.Action == MotionEventActions.Up)
                {
                    //					System.Threading.Thread thread = new System.Threading.Thread(
                    //						new System.Threading.ThreadStart(NotifyMovement));
                    //					thread.Start();

                    //					_highQuality = true;
                    this.NotifyMovement();

                    OsmSharp.Logging.Log.TraceEvent("OsmSharp.Android.UI.MapGLView", System.Diagnostics.TraceEventType.Information, "OnTouch");
                    this.Change();
                }
            }
            _scaled = false;
            return(true);
        }
示例#35
0
        //Returns the view for a specific item on the list
        public override View GetView(int position, global::Android.Views.View convertView, global::Android.Views.ViewGroup parent)
        {
            var      row         = convertView;
            var      currentItem = this[position];
            CheckBox checkBox;

            if (row == null)
            {
                var inflater = activity.LayoutInflater;
                row = inflater.Inflate(layoutResourceId, parent, false);

                checkBox = row.FindViewById <CheckBox>(Resource.Id.checkToDoItem);

                checkBox.CheckedChange += async(sender, e) => {
                    var cbSender = sender as CheckBox;
                    if (cbSender != null && cbSender.Tag is ToDoItemWrapper && cbSender.Checked)
                    {
                        cbSender.Enabled = false;
                        if (activity is ToDoActivity)
                        {
                            await((ToDoActivity)activity).CheckItem((cbSender.Tag as ToDoItemWrapper).ToDoItem);
                        }
                    }
                };
            }
            else
            {
                checkBox = row.FindViewById <CheckBox>(Resource.Id.checkToDoItem);
            }

            checkBox.Text    = currentItem.Text;
            checkBox.Checked = false;
            checkBox.Enabled = true;
            checkBox.Tag     = new ToDoItemWrapper(currentItem);

            return(row);
        }
        public bool RequestFocus(global::Android.Views.View control, Func <bool> baseRequestFocus)
        {
            IViewParent ancestor             = control.Parent;
            var         previousFocusability = DescendantFocusability.BlockDescendants;


            LinearLayout cfl = null;

            // Work our way up through the tree until we find a ConditionalFocusLayout
            while (ancestor is ViewGroup)
            {
                cfl = ancestor as LinearLayout;

                var found = ancestor.GetType().Name == "ConditionalFocusLayout";

                if (cfl != null && found)
                {
                    previousFocusability = cfl.DescendantFocusability;
                    // Toggle DescendantFocusability to allow this control to get focus
                    cfl.DescendantFocusability = DescendantFocusability.AfterDescendants;
                    break;
                }

                ancestor = ancestor.Parent;
            }

            // Call the original RequestFocus implementation for the View
            bool result = baseRequestFocus();

            if (cfl != null)
            {
                // Toggle descendantfocusability back to whatever it was
                cfl.DescendantFocusability = previousFocusability;
            }

            return(result);
        }
示例#37
0
        bool global::Android.Views.View.IOnTouchListener.OnTouch(global::Android.Views.View v, MotionEvent e)
        {
            if (!_isEnabled)
            {
                return(true);
            }

            if (_inputTransparent)
            {
                return(false);
            }

            var handled = false;

            if (_pinchGestureHandler.IsPinchSupported)
            {
                if (!_scaleDetector.IsValueCreated)
                {
                    ScaleGestureDetectorCompat.SetQuickScaleEnabled(_scaleDetector.Value, true);
                }
                handled = _scaleDetector.Value.OnTouchEvent(e);
            }

            if (_gestureDetector.IsValueCreated && _gestureDetector.Value.Handle == IntPtr.Zero)
            {
                // This gesture detector has already been disposed, probably because it's on a cell which is going away
                return(handled);
            }

            // It's very important that the gesture detection happen first here
            // if we check handled first, we might short-circuit and never check for tap/pan
            handled = _gestureDetector.Value.OnTouchEvent(e) || handled;

            v.EnsureLongClickCancellation(e, handled, Element);

            return(handled);
        }
        protected override bool DrawChild(Canvas canvas, global::Android.Views.View child, long drawingTime)
        {
            GradientDrawable.Bounds = canvas.ClipBounds;

            switch (GradientContentView.Orientation)
            {
            case GradientOrientation.Vertical:
                GradientDrawable.SetOrientation(GradientDrawable.Orientation.TopBottom);
                break;

            case GradientOrientation.Horizontal:
                GradientDrawable.SetOrientation(GradientDrawable.Orientation.LeftRight);
                break;

            case GradientOrientation.BrTl:
                GradientDrawable.SetOrientation(GradientDrawable.Orientation.BrTl);
                break;

            case GradientOrientation.BlTr:
                GradientDrawable.SetOrientation(GradientDrawable.Orientation.BlTr);
                break;

            case GradientOrientation.TlBr:
                GradientDrawable.SetOrientation(GradientDrawable.Orientation.TlBr);
                break;

            case GradientOrientation.TrBl:
                GradientDrawable.SetOrientation(GradientDrawable.Orientation.TrBl);
                break;

            default:
                break;
            }

            GradientDrawable.Draw(canvas);
            return(base.DrawChild(canvas, child, drawingTime));
        }
        public virtual unsafe bool OnTouch(global::Android.Views.View p0, global::Android.Views.MotionEvent p1)
        {
            if (id_onTouch_Landroid_view_View_Landroid_view_MotionEvent_ == IntPtr.Zero)
            {
                id_onTouch_Landroid_view_View_Landroid_view_MotionEvent_ = JNIEnv.GetMethodID(class_ref, "onTouch", "(Landroid/view/View;Landroid/view/MotionEvent;)Z");
            }
            try {
                JValue *__args = stackalloc JValue [2];
                __args [0] = new JValue(p0);
                __args [1] = new JValue(p1);

                bool __ret;
                if (GetType() == ThresholdType)
                {
                    __ret = JNIEnv.CallBooleanMethod(((global::Java.Lang.Object) this).Handle, id_onTouch_Landroid_view_View_Landroid_view_MotionEvent_, __args);
                }
                else
                {
                    __ret = JNIEnv.CallNonvirtualBooleanMethod(((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, "onTouch", "(Landroid/view/View;Landroid/view/MotionEvent;)Z"), __args);
                }
                return(__ret);
            } finally {
            }
        }
        /// <summary>Users of this fragment must call this method to set up the navigation drawer interactions.
        ///     </summary>
        /// <remarks>Users of this fragment must call this method to set up the navigation drawer interactions.
        ///     </remarks>
        /// <param name="fragmentId">The android:id of this fragment in its activity's layout.
        ///     </param>
        /// <param name="drawerLayout">The DrawerLayout containing this fragment's UI.</param>
        public virtual void SetUp(int fragmentId, DrawerLayout drawerLayout)
        {
            mFragmentContainerView = Activity.FindViewById(fragmentId);
            mDrawerLayout = drawerLayout;
            mDrawerLayout.SetDrawerShadow(Resource.Drawable.drawer_shadow, GravityCompat.Start);
            ActionBar actionBar = GetActionBar();
            actionBar.SetDisplayHomeAsUpEnabled(true);
            actionBar.SetHomeButtonEnabled(true);
            // ActionBarDrawerToggle ties together the the proper interactions
            // between the navigation drawer and the action bar app icon.

            // calls onPrepareOptionsMenu()
            // calls onPrepareOptionsMenu()
            // Defer code dependent on restoration of previous instance state.
            mDrawerLayout.DrawerOpened += async (sender, e) => {
                mDrawerToggle.OnDrawerOpened(e.DrawerView);
                if (!IsAdded)
                {
                    return;
                }
                Activity.InvalidateOptionsMenu();
                mDrawerToggle.SyncState();
            };
            mDrawerLayout.DrawerClosed += async (sender, e) => {
                mDrawerToggle.OnDrawerClosed(e.DrawerView);
                if (!IsAdded)
                {
                    return;
                }
                Activity.InvalidateOptionsMenu();
                mDrawerToggle.SyncState();
            };

            mDrawerLayout.SetDrawerListener(mDrawerToggle);
        }
示例#41
0
			public ModalContainer(Context context, Page modal) : base(context)
			{
				_modal = modal;

				_backgroundView = new global::Android.Views.View(context);
				_backgroundView.SetWindowBackground();
				AddView(_backgroundView);

				Android.Platform.SetPageContext(modal, context);
				_renderer = Android.Platform.CreateRenderer(modal);
				Android.Platform.SetRenderer(modal, _renderer);

				AddView(_renderer.ViewGroup);
			}
示例#42
0
			protected override void Dispose(bool disposing)
			{
				if (disposing && !_disposed)
				{
					_disposed = true;
					RemoveAllViews();
					if (_renderer != null)
					{
						_renderer.Dispose();
						_renderer = null;
						_modal.ClearValue(Android.Platform.RendererProperty);
						_modal = null;
					}

					if (_backgroundView != null)
					{
						_backgroundView.Dispose();
						_backgroundView = null;
					}
				}

				base.Dispose(disposing);
			}
示例#43
0
		protected override View GetCellCore (Cell item, View convertView, ViewGroup parent, Context context)
		{
			var cell = (LinearLayout)base.GetCellCore (item, convertView, parent, context);

			return cell;
		}
        protected override global::Android.Views.View GetCellCore(Cell item, global::Android.Views.View convertView, ViewGroup parent, Context context)
        {
            this.cell = base.GetCellCore(item, convertView, parent, context);

            return cell;
        }