/// <summary>
        ///
        /// </summary>
        private void UpdateContent()
        {
            if (RefreshView.Content == null)
            {
                return;
            }

            if (_packed != null)
            {
                RemoveView(_packed.ViewGroup);
            }

            _packed = Platform.CreateRenderer(RefreshView.Content);

            try {
                RefreshView.Content.SetValue(RendererProperty, _packed);
            }
            catch (Exception ex) {
                System.Diagnostics.Debug.WriteLine("Unable to sent renderer property, maybe an issue: " + ex);
            }

            PrepareHint();
            PrepareSwipeObserver();

            _packed.ViewGroup.LayoutParameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);

            Android.Widget.LinearLayout baseLinearLayout = new Android.Widget.LinearLayout(this.Context);
            baseLinearLayout.Orientation = Orientation.Vertical;
            baseLinearLayout.AddView(_hintLayout);
            baseLinearLayout.AddView(_packed.ViewGroup);

            AddView(baseLinearLayout, LayoutParams.MatchParent);
        }
Exemplo n.º 2
0
 public void CheckOnStartedRecord()
 {
     if (video.startRecord)
     {
         video.StopRecord();
         VideoViewExtends videoView = Video.CreateVideoView(this, video.path);
         videoView.Id = ++countVideo;
         layout.AddView(videoView);
     }
     else
     {
         video.Dispose();
         video.ReleaseCamera();
     }
 }
Exemplo n.º 3
0
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Page> e)
        {
            base.OnElementChanged(e);

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


            var layout = new Android.Widget.LinearLayout(this.Context);

            layout.SetBackgroundColor(Android.Graphics.Color.Black);
            layout.LayoutParameters = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
            VideoView mVideoView = new VideoView(Context);

            mVideoView.SetVideoPath("android.resource://" + this.Context.PackageName + "/" + Resource.Drawable.IntroGladys);
            layout.SetVerticalGravity(GravityFlags.Center);
            layout.SetHorizontalGravity(GravityFlags.Center);
            mVideoView.LayoutParameters = new LayoutParams(LayoutParams.FillParent, LayoutParams.FillParent);
            layout.AddView(mVideoView);
            mVideoView.Start();
            _view = layout;
            AddView(_view);
        }
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.View> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null || e.NewElement == null)
            {
                return;
            }

            var stackLayout = (VideoLayout)this.Element;

            var mainActivity = Forms.Context as MainActivity;

            var publiserLayout = new Android.Widget.LinearLayout(mainActivity)
            {
                Orientation      = Orientation.Vertical,
                LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 200)
            };
            var subscriberLayout = new Android.Widget.LinearLayout(mainActivity)
            {
                Orientation      = Orientation.Vertical,
                LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 200)
            };
            var loadingProggressBar = new Android.Widget.ProgressBar(mainActivity);

            loadingProggressBar.Visibility = ViewStates.Gone;
            subscriberLayout.AddView(loadingProggressBar);

            stackLayout.Children.Add(publiserLayout);
            stackLayout.Children.Add(subscriberLayout);

            mainActivity.SetLayouts(publiserLayout, subscriberLayout, loadingProggressBar);
        }
Exemplo n.º 5
0
        protected override void OnElementChanged(ElementChangedEventArgs <ReceiverView> e)
        {
            base.OnElementChanged(e);

            if (Control == null)
            {
                var layoutparams = new Android.Widget.LinearLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
                _streamImage = new ImageView(Context);
                _streamImage.LayoutParameters = layoutparams;
                var mainView = new Android.Widget.LinearLayout(this.Context);
                mainView.AddView(_streamImage);

                SetNativeControl(mainView);
            }

            if (Control == null || Element == null)
            {
                return;
            }

            if (e.OldElement != null)
            {
                //Element being deleted
            }

            if (e.NewElement != null)
            {
                //Element being created
            }
        }
Exemplo n.º 6
0
            public override av.View GetView(int position, av.View convertView, av.ViewGroup parent)
            {
                var colCount = Handler.columns.Count;
                var row      = position;
                var view     = convertView as aw.LinearLayout;
                var item     = Handler.collection.ElementAt(row);

                if (view == null || view.ChildCount != Handler.columns.Count)
                {
                    view = new aw.LinearLayout(aa.Application.Context);

                    for (int i = 0; i < Handler.columns.Count; i++)
                    {
                        var     column  = Handler.columns.ElementAt(i);
                        var     cell    = column.DataCell;
                        av.View colView = null;
                        if (cell != null)
                        {
                            var cellHandler = cell.Handler as ICellHandler;
                            if (cellHandler != null)
                            {
                                colView = cellHandler.CreateView(null, item);
                            }
                        }
                        view.AddView(colView ?? new av.View(aa.Application.Context), new aw.LinearLayout.LayoutParams(av.ViewGroup.LayoutParams.MatchParent, av.ViewGroup.LayoutParams.MatchParent, 1f));
                    }
                }
                else
                {
                    for (int i = 0; i < Handler.columns.Count; i++)
                    {
                        var column = Handler.columns.ElementAt(i);
                        var cell   = column.DataCell;
                        if (cell != null)
                        {
                            var cellHandler = cell.Handler as ICellHandler;
                            if (cellHandler != null)
                            {
                                var colView = view.GetChildAt(i);
                                cellHandler.CreateView(colView, item);
                            }
                        }
                    }
                }
                return(view);
            }
Exemplo n.º 7
0
        private Android.Views.View CreateLayout(Context context)
        {
            Android.Widget.RelativeLayout layout = new Android.Widget.RelativeLayout(context);
            var layoutParam = new Android.Widget.RelativeLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);

            layout.SetPadding(30, 15, 30, 15);
            layout.LayoutParameters = layoutParam;


            //main layout
            Android.Widget.LinearLayout mainView = new Android.Widget.LinearLayout(context);
            var paramLayout = new Android.Widget.RelativeLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);

            mainView.Orientation = Orientation.Vertical;
            paramLayout.AddRule(NativeCell.IsIncoming ? LayoutRules.AlignParentLeft : LayoutRules.AlignParentRight);
            paramLayout.SetMargins(NativeCell.IsIncoming ? 0 : 50, 0, NativeCell.IsIncoming ? 50 : 0, 0);
            mainView.SetPadding(30, 30, 30, 30);
            mainView.LayoutParameters = paramLayout;

            //set drawable
            GradientDrawable shape = new GradientDrawable();

            shape.SetCornerRadius(NativeCell.CornerRadius * 2);
            shape.SetColor(NativeCell.IsIncoming ? NativeCell.IncomingColor.ToAndroid() : NativeCell.OutgoingColor.ToAndroid());
            mainView.Background = shape;


            // name text
            NameText = new TextView(context);
            NameText.SetTextColor(NativeCell.NameFontColor.ToAndroid());
            NameText.TextSize = NativeCell.NameFontSize;
            NameText.Text     = NativeCell.Name;
            NameText.Id       = Name_Text_Id;
            var paramNameText = new Android.Widget.LinearLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);

            NameText.LayoutParameters = paramNameText;

            //message text
            MessageText = new TextView(context);
            MessageText.SetTextColor(NativeCell.TextFontColor.ToAndroid());
            MessageText.Text     = NativeCell.MessageBody;
            MessageText.TextSize = NativeCell.TextFontSize;
            MessageText.Id       = Message_Text_Id;
            var paramMessageText = new Android.Widget.LinearLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);

            MessageText.LayoutParameters = paramMessageText;

            // status layout
            LinearLayout linearLayout = new LinearLayout(context);

            linearLayout.Orientation = Orientation.Horizontal;
            var paramlinearLayout = new Android.Widget.LinearLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);

            paramlinearLayout.Gravity = Android.Views.GravityFlags.Right;
            linearLayout.SetGravity(Android.Views.GravityFlags.Right);
            linearLayout.LayoutParameters = paramlinearLayout;

            // status text
            StatusText = new TextView(context);
            StatusText.SetTextColor(NativeCell.InfoFontColor.ToAndroid());
            StatusText.Text     = StatusHelper.GetStatusString(NativeCell.Status);
            StatusText.Id       = Status_Text_Id;
            StatusText.TextSize = NativeCell.InfoFontSize;
            StatusText.SetPadding(0, 0, 10, 0);
            StatusText.Gravity = Android.Views.GravityFlags.Left;
            var paramStatusText = new Android.Widget.LinearLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);

            paramStatusText.Gravity     = Android.Views.GravityFlags.Left;
            StatusText.LayoutParameters = paramStatusText;
            if (!NativeCell.IsIncoming)
            {
                linearLayout.AddView(StatusText);
            }

            // date text
            DateText = new TextView(context);
            DateText.SetTextColor(NativeCell.InfoFontColor.ToAndroid());
            DateText.Text = NativeCell.Date;
            DateText.SetLines(1);
            DateText.TextSize = NativeCell.InfoFontSize;
            DateText.SetMinWidth(LayoutParams.WrapContent);
            DateText.Id = Date_Text_Id;
            var paramDateText = new Android.Widget.LinearLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);

            DateText.LayoutParameters = paramDateText;
            linearLayout.AddView(DateText);


            if (!string.IsNullOrWhiteSpace(NameText.Text) && NativeCell.IsIncoming)
            {
                mainView.AddView(NameText);
            }

            mainView.AddView(MessageText);
            mainView.AddView(linearLayout);
            layout.AddView(mainView);

            return(layout);
        }
Exemplo n.º 8
0
        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_entrydetail);
            OverridePendingTransition(Resource.Animation.zoom_enter, Resource.Animation.zoom_exit);
            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar_addItem);

            SetSupportActionBar(toolbar);
            this.SupportActionBar.Title = AppResources.PageTitleItemDetail;
            this.SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            listEntryEdit = FindViewById <Android.Widget.LinearLayout>(Resource.Id.contentView);
            var e = Navigate.selectedEntry;

            vm = new EntryDetailVM(e);
            var view = listEntryEdit;

#if SCREENSHOT
            Navigate.screenshotScreen = this;
#endif

            var binding = DataContext <EntryDetailVM> .FromView(view);

            binding.VM = vm;
            listEntryEdit.AddView(View.Inflate(this, Resource.Layout.item_edit_entry_top, null));
            AmountCollectionVM avm = vm.AmountCollectionVM;
            ServingSizeAdapter a   = new ServingSizeAdapter(this, avm);

            // serving sizes
            listEntryEdit.AddView(View.Inflate(this, Resource.Layout.item_serving, null));
            var ServingExtraMenu = FindViewById(Resource.Id.addItemDialog);
            ServingExtraMenu.Click += (object sender, EventArgs e2) =>
            {
                ShowServingsExtraMenu();
            };

            var servingsizes = FindViewById <Android.Widget.LinearLayout>(Resource.Id.servingSizes);
            int cnt          = Math.Min(a.Count, MAXSERVINGSFIRST);
            for (int i = 0; i < cnt; i++)
            {
                servingsizes.AddView(a.GetView2(i, null, servingsizes));
            }

            View showmore = null;
            if (a.Count > MAXSERVINGSFIRST)
            {
                showmore = View.Inflate(this, Resource.Layout.item_servings_show_more, null);
                listEntryEdit.AddView(showmore);
                var button = FindViewById <TextView>(Resource.Id.button_showmoreoptions);
                button.Click += (sender, e2) =>
                {
                    servingsizes.RemoveAllViews();
                    for (int i = 0; i < a.Count; i++)
                    {
                        servingsizes.AddView(a.GetView2(i, null, servingsizes));
                    }
                    showmore.Visibility = ViewStates.Invisible;
                };
            }

            // add serving szie
            avm.Amounts.CollectionChanged += (sender, e3) =>
            {
                if (showmore != null)
                {
                    showmore.Visibility = ViewStates.Invisible;
                }
                servingsizes.RemoveAllViews();
                for (int i = 0; i < a.Count; i++)
                {
                    servingsizes.AddView(a.GetView2(i, null, servingsizes));
                }
            };

            PropertyAdapter p = new PropertyAdapter(this, vm);

            // properties
            listEntryEdit.AddView(View.Inflate(this, Resource.Layout.item_nutrition, null));
            var properties = FindViewById <Android.Widget.LinearLayout>(Resource.Id.properties);
            for (int i = 0; i < p.Count; i++)
            {
                properties.AddView(p.GetView2(i, null, properties));
            }

            Action action = () =>
            {
                servingsizes.RemoveAllViewsInLayout();
                for (int i = 0; i < a.Count; i++)
                {
                    servingsizes.AddView(a.GetView(i, null, servingsizes));
                }
            };

            a.RegisterDataSetObserver(new DSO(action));

            if (binding.Bindings.Count == 0)
            {
                binding.Add(Resource.Id.addInputDialog, x => x.Text);
                binding.Add(Resource.Id.opt_pergrams, x => x.Is100Gram);
                binding.Add(Resource.Id.opt_percup, x => x.IsNot100Gram);
                binding.Add(Resource.Id.opt_percup, x => x.SelectedServingText);
            }
            addInputDialog = listEntryEdit.FindViewById <EditText>(Resource.Id.addInputDialog);
            if (Navigate.selectedEntry.Item.IsNewItem)
            {
                addInputDialog.TextChanged += AddInputDialogTextChanged;
            }
            else
            {
                EditMode = true;
            }
            OriginalText = Navigate.selectedItem.Text;
#if DEBUG
            AndroidDebug.SetViewBorders(listEntryEdit);
#endif
        }