예제 #1
0
        private void InitVideoPlayer()
        {
            if (Control != null)
            {
                return;
            }

            _videoView = new VideoView(Context);

            var relativeLayout = new AWR(Context);

            relativeLayout.AddView(_videoView);

            var layoutParams = new AWR.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);

            layoutParams.AddRule(LayoutRules.AlignParentTop);
            layoutParams.AddRule(LayoutRules.AlignParentBottom);
            layoutParams.AddRule(LayoutRules.AlignParentLeft);
            layoutParams.AddRule(LayoutRules.AlignParentRight);

            _videoView.LayoutParameters = layoutParams;
            _videoView.Prepared        += VideoView_Prepared;

            SetNativeControl(relativeLayout);
        }
예제 #2
0
        protected override void OnElementChanged(ElementChangedEventArgs <PDFView> e)
        {
            base.OnElementChanged(e);
            if (e.NewElement != null)
            {
                if (Control == null)
                {
                    RelativeLayout layout = new RelativeLayout(_context);

                    RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
                    param.AddRule(LayoutRules.CenterInParent);
                    _imageView = new ImageView(_context);
                    _imageView.LayoutParameters = param;
                    layout.AddView(_imageView, param);

                    param = new RelativeLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
                    param.AddRule(LayoutRules.CenterVertical);
                    param.AddRule(LayoutRules.AlignParentLeft);
                    prePageButton        = new Button(_context);
                    prePageButton.Text   = "<";
                    prePageButton.Click += (sender, arg) =>
                    {
                        showPage(--pageIndex);
                    };
                    prePageButton.LayoutParameters = param;
                    layout.AddView(prePageButton, param);

                    param = new RelativeLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
                    param.AddRule(LayoutRules.CenterVertical);
                    param.AddRule(LayoutRules.AlignParentRight);
                    nextPageButton        = new Button(_context);
                    nextPageButton.Text   = ">";
                    nextPageButton.Click += (sender, arg) =>
                    {
                        showPage(++pageIndex);
                    };
                    nextPageButton.LayoutParameters = param;
                    layout.AddView(nextPageButton, param);

                    SetNativeControl(layout);
                }
                try
                {
                    openRenderer(_context);
                    showPage(pageIndex);
                }
                catch (IOException ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.StackTrace);
                }
            }
        }
예제 #3
0
        protected override void OnElementChanged(ElementChangedEventArgs <VideoPlayer> args)
        {
            base.OnElementChanged(args);

            if (args.NewElement != null)
            {
                if (Control == null)
                {
                    // Save the VideoView for future reference
                    _videoView = new VideoView(Context);

                    // Put the VideoView in a RelativeLayout
                    RelativeLayoutDroid relativeLayout = new RelativeLayoutDroid(Context);
                    relativeLayout.AddView(_videoView);

                    // Center the VideoView in the RelativeLayout
                    RelativeLayoutDroid.LayoutParams layoutParams =
                        new RelativeLayoutDroid.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
                    layoutParams.AddRule(LayoutRules.CenterInParent);
                    _videoView.LayoutParameters = layoutParams;

                    // Handle a VideoView event
                    _videoView.Completion += OnVideoCompletion;

                    SetNativeControl(relativeLayout);
                }

                _mediaController = new MediaController(Context);
                _mediaController.SetMediaPlayer(_videoView);
                _videoView.SetMediaController(_mediaController);
                SetSource();
            }
        }
예제 #4
0
        protected override void OnElementChanged(ElementChangedEventArgs <VideoPlayerView> args)
        {
            base.OnElementChanged(args);

            if (args.NewElement != null && Control == null)
            {
                _videoView = new VideoView(Context);

                ARelativeLayout relativeLayout = new ARelativeLayout(Context);
                relativeLayout.AddView(_videoView);

                ARelativeLayout.LayoutParams layoutParams =
                    new ARelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
                layoutParams.AddRule(LayoutRules.CenterInParent);
                _videoView.LayoutParameters = layoutParams;

                _mediaController = new MediaController(Context);
                _mediaController.SetMediaPlayer(_videoView);
                _videoView.SetMediaController(_mediaController);

                SetNativeControl(relativeLayout);
                _videoView.Prepared += OnVideoViewPrepared;
            }
            if (args.NewElement == null)
            {
                _videoView.Prepared -= OnVideoViewPrepared;
            }
            SetTransportControls();
            SetSource(Element.Source);
        }
예제 #5
0
        protected override void OnElementChanged(ElementChangedEventArgs <PlayerView> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null)
            {
                // TODO: cleanup
            }

            if (e.NewElement != null)
            {
                _videoView = new VideoView(Context);
                var relativeLayout = new ARelativeLayout(Context);
                relativeLayout.AddView(_videoView);
                var layoutParams = new ARelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
                layoutParams.AddRule(LayoutRules.CenterInParent);
                _videoView.LayoutParameters = layoutParams;
                _mediaController            = new MediaController(Context);
                _mediaController.SetMediaPlayer(_videoView);
                _videoView.SetMediaController(_mediaController);

                SetSource();
                this.SetNativeControl(relativeLayout);
            }
        }
예제 #6
0
        protected override void OnElementChanged(ElementChangedEventArgs <VideoPlayer> e)
        {
            base.OnElementChanged(e);

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

            videoView = new VideoView(Context);
            RelativeLayout relativeLayout = new RelativeLayout(Context);

            relativeLayout.AddView(videoView);

            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
            layoutParams.AddRule(LayoutRules.CenterInParent);
            videoView.LayoutParameters = layoutParams;

            SetNativeControl(relativeLayout);

            videoView.Prepared += VideoView_Prepared;

            e.NewElement.PlayRequest  += NewElement_PlayRequest;
            e.NewElement.PauseRequest += NewElement_PauseRequest;

            timer.Elapsed += Timer_Elapsed;
        }
        private void CreateCustomKeyboard()
        {
            var activity = Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity;

            var rootView         = activity.FindViewById(global::Android.Resource.Id.Content);
            var activityRootView = (ViewGroup)((ViewGroup)rootView).GetChildAt(0);

            this.mKeyboardView = activityRootView.FindViewById <KeyboardView>(Droid.Resource.Id.customKeyboard);

            // If the previous line fails, it means the keyboard needs to be created and added
            if (this.mKeyboardView == null)
            {
                this.mKeyboardView =
                    (KeyboardView)activity.LayoutInflater.Inflate(Resource.Layout.customkeyboard, null);
                this.mKeyboardView.Id                   = Resource.Id.customKeyboard;
                this.mKeyboardView.Focusable            = true;
                this.mKeyboardView.FocusableInTouchMode = true;

                this.mKeyboardView.Release += (sender, e) => { };

                var layoutParams = new RelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent);
                layoutParams.AddRule(LayoutRules.AlignParentBottom);
                activityRootView.AddView(this.mKeyboardView, layoutParams);
            }
            EditText.SetTextIsSelectable(true);
            // EditText.SetCursorVisible(true);
            this.HideKeyboardView();

            this.mKeyboard = new Keyboard(this.context, Resource.Xml.special_keyboard);

            this.SetCurrentKeyboard();
        }
        void AddStatusBarUnderlay()
        {
            _statusBarUnderlay = new global::Android.Views.View(this);

            var layoutParameters = new ARelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, GetStatusBarHeight())
            {
                AlignWithParent = true
            };

            layoutParameters.AddRule(LayoutRules.AlignTop);
            _statusBarUnderlay.LayoutParameters = layoutParameters;
            _layout.AddView(_statusBarUnderlay);

            if (Forms.IsLollipopOrNewer)
            {
                Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
                Window.SetStatusBarColor(AColor.Transparent);

                int primaryColorDark = GetColorPrimaryDark();

                if (primaryColorDark != 0)
                {
                    int r = AColor.GetRedComponent(primaryColorDark);
                    int g = AColor.GetGreenComponent(primaryColorDark);
                    int b = AColor.GetBlueComponent(primaryColorDark);
                    int a = AColor.GetAlphaComponent(primaryColorDark);
                    SetStatusBarColor(AColor.Argb(a, r, g, b));
                }
            }
        }
        protected override void OnElementChanged(ElementChangedEventArgs <VideoPlayer> args)
        {
            base.OnElementChanged(args);

            if (args.NewElement != null)
            {
                if (Control == null)
                {
                    // Save the VideoView for future reference
                    videoView = new VideoView(Context);

                    // Put the VideoView in a RelativeLayout
                    ARelativeLayout relativeLayout = new ARelativeLayout(Context);
                    relativeLayout.AddView(videoView);

                    // Center the VideoView in the RelativeLayout
                    ARelativeLayout.LayoutParams layoutParams =
                        new ARelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
                    layoutParams.AddRule(LayoutRules.CenterInParent);
                    videoView.LayoutParameters = layoutParams;

                    // Handle a VideoView event
                    videoView.Prepared += OnVideoViewPrepared;

                    SetAreTransportControlsEnabled();

                    // Use the RelativeLayout as the native control
                    SetNativeControl(relativeLayout);
                }
            }
        }
예제 #10
0
        protected override void OnElementChanged(ElementChangedEventArgs <VideoPlayer> args)
        {
            base.OnElementChanged(args);

            if (args.NewElement != null)
            {
                if (Control == null)
                {
                    // Save the VideoView for future reference
                    videoView = new VideoView(Context);

                    // Put the VideoView in a RelativeLayout
                    ARelativeLayout relativeLayout = new ARelativeLayout(Context);
                    relativeLayout.AddView(videoView);

                    // Center the VideoView in the RelativeLayout
                    ARelativeLayout.LayoutParams layoutParams =
                        new ARelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
                    layoutParams.AddRule(LayoutRules.AlignParentTop);
                    layoutParams.AddRule(LayoutRules.AlignParentBottom);
                    layoutParams.AddRule(LayoutRules.AlignParentLeft);
                    layoutParams.AddRule(LayoutRules.AlignParentRight);
                    videoView.LayoutParameters = layoutParams;

                    // Handle a VideoView event
                    videoView.Prepared += OnVideoViewPrepared;

                    SetNativeControl(relativeLayout);
                }

                SetAreTransportControlsEnabled();
                SetSource();

                args.NewElement.UpdateStatus   += OnUpdateStatus;
                args.NewElement.PlayRequested  += OnPlayRequested;
                args.NewElement.PauseRequested += OnPauseRequested;
                args.NewElement.StopRequested  += OnStopRequested;
            }

            if (args.OldElement != null)
            {
                args.OldElement.UpdateStatus   -= OnUpdateStatus;
                args.OldElement.PlayRequested  -= OnPlayRequested;
                args.OldElement.PauseRequested -= OnPauseRequested;
                args.OldElement.StopRequested  -= OnStopRequested;
            }
        }
예제 #11
0
        protected override void OnElementChanged(ElementChangedEventArgs <VideoPlayer> args)
        {
            base.OnElementChanged(args);

            if (args.NewElement != null)
            {
                if (Control == null)
                {
                    // Save the VideoView for future reference
                    videoView = new VideoView(Context);

                    // Put the VideoView in a RelativeLayout
                    ARelativeLayout relativeLayout = new ARelativeLayout(Context);
                    relativeLayout.AddView(videoView);

                    // Center the VideoView in the RelativeLayout
                    ARelativeLayout.LayoutParams layoutParams =
                        new ARelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
                    layoutParams.AddRule(LayoutRules.CenterInParent);
                    videoView.LayoutParameters = layoutParams;

                    // Handle a VideoView event
                    videoView.Prepared += OnVideoViewPrepared;

                    SetNativeControl(relativeLayout);
                }

                SetAreTransportControlsEnabled();
                SetSource();

                args.NewElement.UpdateStatus               += OnUpdateStatus;
                args.NewElement.PlayRequested              += OnPlayRequested;
                args.NewElement.PauseRequested             += OnPauseRequested;
                args.NewElement.StopRequested              += OnStopRequested;
                args.NewElement.RewindTenRequested         += OnRewindTenRequested;
                args.NewElement.ForwardTenRequested        += OnForwardTenRequested;
                args.NewElement.LastFrameRequested         += OnLastFrameRequested;
                args.NewElement.NextFrameRequested         += OnNextFrameRequested;
                args.NewElement.ToggleSpeakerRequested     += OnToggleSpeakerRequested;
                args.NewElement.ReduceSpeedRateRequested   += OnReduceSpeedRateRequested;
                args.NewElement.IncreaseSpeedRateRequested += OnIncreaseSpeedRateRequested;
            }

            if (args.OldElement != null)
            {
                args.OldElement.UpdateStatus               -= OnUpdateStatus;
                args.OldElement.PlayRequested              -= OnPlayRequested;
                args.OldElement.PauseRequested             -= OnPauseRequested;
                args.OldElement.StopRequested              -= OnStopRequested;
                args.OldElement.RewindTenRequested         -= OnRewindTenRequested;
                args.OldElement.ForwardTenRequested        -= OnForwardTenRequested;
                args.OldElement.LastFrameRequested         -= OnLastFrameRequested;
                args.OldElement.NextFrameRequested         -= OnNextFrameRequested;
                args.OldElement.ToggleSpeakerRequested     -= OnToggleSpeakerRequested;
                args.OldElement.ReduceSpeedRateRequested   -= OnReduceSpeedRateRequested;
                args.OldElement.IncreaseSpeedRateRequested -= OnIncreaseSpeedRateRequested;
            }
        }
예제 #12
0
        protected override void OnElementChanged(ElementChangedEventArgs <TabbedPage> e)
        {
            base.OnElementChanged(e);
            var metrics = Resources.DisplayMetrics;
            var width   = metrics.WidthPixels;

            floatingActionButton = new FloatingActionButton(this.Context);
            var          layoutParams = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
            LayoutParams paramss      = new LayoutParams(
                LayoutParams.WrapContent,
                LayoutParams.WrapContent
                );
            MarginLayoutParams marginLayout = new MarginLayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);

            marginLayout.SetMargins((int)(width / 2.3), 0, 0, 40);
            floatingActionButton.BackgroundTintList = Context.GetColorStateList(Resource.Color.blueColor);
            floatingActionButton.Click += FloatingActionButton_Click;

            floatingActionButton.LayoutParameters = marginLayout;
            floatingActionButton.SetBackgroundColor(Android.Graphics.Color.Blue);
            floatingActionButton.SetImageResource(Resource.Drawable.plus_white);
            floatingActionButton.SetForegroundGravity(GravityFlags.Center);
            floatingActionButton.Elevation = 6;
            var layout = (GetChildAt(0) as Android.Widget.RelativeLayout);

            RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            p.AddRule(LayoutRules.AlignBottom);

            //layout.AddView(floatingActionButton);
            var bottomNavigationView = (GetChildAt(0) as Android.Widget.RelativeLayout).GetChildAt(1) as BottomNavigationView;

            //ViewGroupUtils.removeView(bottomNavigationView);
            //var b =  LayoutInflater.From(this.Context).Inflate(Resource.Layout.MaterialBottomAppBar, null);
            //layout.AddView(b,1);
            bottomNavigationView.SetClipChildren(false);
            var menuView = bottomNavigationView.GetChildAt(0) as BottomNavigationMenuView;
            BottomNavigationItemView item2 = (BottomNavigationItemView)menuView.GetChildAt(1);
            BottomNavigationItemView item3 = (BottomNavigationItemView)menuView.GetChildAt(2);

            item2.SetPadding(0, 0, 100, 0);
            item3.SetPadding(100, 0, 0, 0);

            //item2.SetPaddingRelative(0, 0, 300, 0);

            //for (int i = 0; i < menuView.ChildCount; i++)
            //{
            //    BottomNavigationItemView item = (BottomNavigationItemView)menuView.GetChildAt(i);
            //    item.SetPadding(0, 0, 50, 0);
            //    //noinspection RestrictedApi
            //    item.SetShifting(false);
            //    // set once again checked value, so view will be updated
            //    //noinspection RestrictedApi
            //    item.SetChecked(item.ItemData.IsChecked);
            //}
            bottomNavigationView.AddView(floatingActionButton);
        }
        protected override void OnElementChanged(ElementChangedEventArgs <VideoPlayer> args)
        {
            base.OnElementChanged(args);

            if (args.NewElement != null)
            {
                if (Control == null)
                {
                    // Save the VideoView for future reference
                    videoView = new VideoView(Context);
                    videoView.SetBackgroundColor(Color.Transparent);
                    videoView.Info       += VideoView_Info;
                    videoView.Completion += VideoView_Completion;
                    videoView.Error      += VideoView_Error;

                    // Put the VideoView in a RelativeLayout
                    ARelativeLayout relativeLayout = new ARelativeLayout(Context);
                    relativeLayout.AddView(videoView);

                    // Center the VideoView in the RelativeLayout
                    ARelativeLayout.LayoutParams layoutParams =
                        new ARelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
                    layoutParams.AddRule(LayoutRules.CenterInParent);
                    videoView.LayoutParameters = layoutParams;

                    // Handle a VideoView event
                    videoView.Prepared += OnVideoViewPrepared;

                    SetNativeControl(relativeLayout);
                }

                SetAreTransportControlsEnabled();
                SetSource();

                args.NewElement.UpdateStatus   += OnUpdateStatus;
                args.NewElement.PlayRequested  += OnPlayRequested;
                args.NewElement.PauseRequested += OnPauseRequested;
                args.NewElement.StopRequested  += OnStopRequested;
                args.NewElement.ShowTransportControlsRequested += OnShowTransportControls;
                args.NewElement.HideTransportControlsRequested += OnHideTransportControls;
            }

            if (args.OldElement != null)
            {
                args.OldElement.UpdateStatus   -= OnUpdateStatus;
                args.OldElement.PlayRequested  -= OnPlayRequested;
                args.OldElement.PauseRequested -= OnPauseRequested;
                args.OldElement.StopRequested  -= OnStopRequested;
                args.OldElement.ShowTransportControlsRequested -= OnShowTransportControls;
                args.OldElement.HideTransportControlsRequested -= OnHideTransportControls;
            }
        }
        protected override void OnElementChanged(ElementChangedEventArgs <VideoPlayer> args)
        {
            base.OnElementChanged(args);

            if (args.NewElement != null)
            {
                if (Control == null)
                {
                    // Save the VideoView for future reference
                    InitializePlayer();
                    //videoView = new VideoView(Context);

                    // Put the VideoView in a RelativeLayout
                    relativeLayout = new ARelativeLayout(Context);
                    //relativeLayout.AddView(videoView);
                    relativeLayout.AddView(PlayerView);
                    // Center the VideoView in the RelativeLayout
                    ARelativeLayout.LayoutParams layoutParams =
                        new ARelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
                    layoutParams.AddRule(LayoutRules.CenterInParent);
                    // videoView.LayoutParameters = layoutParams;
                    PlayerView.LayoutParameters = layoutParams;
                    PlayerView.SetShowBuffering(true);
                    PlayerView.ControllerAutoShow = false;
                    // Handle a VideoView event
                    // videoView.Prepared += OnVideoViewPrepared;
                    SetNativeControl(relativeLayout);
                    mFullScreen = PlayerView.FindViewById <Android.Widget.ImageView>(Resource.Id.exo_fullscreen_icon);
                    mainpage    = ((ViewGroup)PlayerView.Parent);
                    initFullscreenDialog();
                    mFullScreen.Click += MFullScreen_Click;
                }


                SetAreTransportControlsEnabled();
                SetSource();

                args.NewElement.UpdateStatus   += OnUpdateStatus;
                args.NewElement.PlayRequested  += OnPlayRequested;
                args.NewElement.PauseRequested += OnPauseRequested;
                args.NewElement.StopRequested  += OnStopRequested;
            }

            if (args.OldElement != null)
            {
                args.OldElement.UpdateStatus   -= OnUpdateStatus;
                args.OldElement.PlayRequested  -= OnPlayRequested;
                args.OldElement.PauseRequested -= OnPauseRequested;
                args.OldElement.StopRequested  -= OnStopRequested;
            }
        }
        public static RelativeLayout CreateRoot(this ExtendedTabbedPageRenderer renderer, int barId, int pageContainerId, out FrameLayout pageContainer)
        {
            var rootLayout = new RelativeLayout(renderer.Context)
            {
                LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent),
            };

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

            pageParams.AddRule(LayoutRules.Above, barId);
            pageContainer = new FrameLayout(renderer.Context)
            {
                LayoutParameters = pageParams,
                Id = pageContainerId
            };

            rootLayout.AddView(pageContainer, 0, pageParams);
            return(rootLayout);
        }
예제 #16
0
        protected override void OnElementChanged(ElementChangedEventArgs <VideoPlayer> args)
        {
            base.OnElementChanged(args);

            if (args.NewElement != null)
            {
                if (Control == null)
                {
                    videoView = new VideoView(Context);


                    ARelativeLayout relativeLayout = new ARelativeLayout(Context);
                    relativeLayout.AddView(videoView);


                    ARelativeLayout.LayoutParams layoutParams =
                        new ARelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
                    layoutParams.AddRule(LayoutRules.CenterInParent);
                    videoView.LayoutParameters = layoutParams;

                    videoView.Prepared += OnVideoViewPrepared;

                    SetNativeControl(relativeLayout);
                }

                SetAreTransportControlsEnabled();
                SetSource();

                args.NewElement.UpdateStatus   += OnUpdateStatus;
                args.NewElement.PlayRequested  += OnPlayRequested;
                args.NewElement.PauseRequested += OnPauseRequested;
                args.NewElement.StopRequested  += OnStopRequested;
            }

            if (args.OldElement != null)
            {
                args.OldElement.UpdateStatus   -= OnUpdateStatus;
                args.OldElement.PlayRequested  -= OnPlayRequested;
                args.OldElement.PauseRequested -= OnPauseRequested;
                args.OldElement.StopRequested  -= OnStopRequested;
            }
        }
예제 #17
0
        public static BottomNavigationViewEx SetupBottomBar(this BottomTabbedRenderer renderer, Android.Widget.RelativeLayout rootLayout, BottomNavigationViewEx bottomNav, int barId)
        {
            if (bottomNav != null)
            {
                rootLayout.RemoveView(bottomNav);
                bottomNav.SetOnNavigationItemSelectedListener(null);
            }

            var barParams = new Android.Widget.RelativeLayout.LayoutParams(
                ViewGroup.LayoutParams.MatchParent,
                BottomTabbedRenderer.BottomBarHeight.HasValue ? (int)rootLayout.Context.ToPixels(BottomTabbedRenderer.BottomBarHeight.Value) : ViewGroup.LayoutParams.WrapContent);

            //Add alignment rules to close to the lower edge of the parent contro
            barParams.AddRule(LayoutRules.AlignParentBottom);
            bottomNav = new BottomNavigationViewEx(rootLayout.Context)
            {
                LayoutParameters = barParams,
                Id = barId
            };
            if (BottomTabbedRenderer.BackgroundColor.HasValue)
            {
                bottomNav.SetBackgroundColor(BottomTabbedRenderer.BackgroundColor.Value);
            }
            if (BottomTabbedRenderer.ItemIconTintList != null)
            {
                bottomNav.ItemIconTintList = BottomTabbedRenderer.ItemIconTintList;
            }
            if (BottomTabbedRenderer.ItemTextColor != null)
            {
                bottomNav.ItemTextColor = BottomTabbedRenderer.ItemTextColor;
            }
            if (BottomTabbedRenderer.ItemBackgroundResource.HasValue)
            {
                bottomNav.ItemBackgroundResource = BottomTabbedRenderer.ItemBackgroundResource.Value;
            }
            //The listening callback method "setOnNavigationItemSelectedListener()", which defaults to the first entry being the first item selected, can be set by
            //"navigation.getMenu().getItem(index).setChecked(true);"
            bottomNav.SetOnNavigationItemSelectedListener(renderer);
            rootLayout.AddView(bottomNav, 1, barParams);

            return(bottomNav);
        }
예제 #18
0
        protected override void OnElementChanged(ElementChangedEventArgs <VideoPlayer> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                _videoPlayer = e.NewElement;
                _parent      = e.NewElement.Parent as View;

                if (Control == null)
                {
                    RelativeLayout layout = new RelativeLayout(Context);
                    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.MatchParent, 1);

                    _mediaController = new MediaController(Context);
                    _videoView       = new PrivateVideoView(Context, _videoPlayer);

                    layout.AddView(_videoView);
                    layoutParams.AddRule(LayoutRules.CenterInParent);

                    _videoView.LayoutParameters = layoutParams;

                    _videoView.SetMediaController(_mediaController);

                    SetNativeControl(layout);
                }

                if (e.NewElement.Source is VideoPlayer.FileSource fileSource)
                {
                    _videoView.SetVideoPath(fileSource.Path);
                }
                else if (e.NewElement.Source is VideoPlayer.UrlSource urlSource)
                {
                    _videoView.SetVideoURI(Uri.Parse(urlSource.Url));
                }
            }

            if (e.OldElement != null)
            {
            }
        }
        public static BottomNavigationViewEx SetupBottomBar(this BottomTabbedRenderer renderer, Android.Widget.RelativeLayout rootLayout, BottomNavigationViewEx bottomNav, int barId)
        {
            if (bottomNav != null)
            {
                rootLayout.RemoveView(bottomNav);
                bottomNav.SetOnNavigationItemSelectedListener(null);
            }

            var barParams = new Android.Widget.RelativeLayout.LayoutParams(
                ViewGroup.LayoutParams.MatchParent,
                BottomTabbedRenderer.BottomBarHeight.HasValue ? (int)rootLayout.Context.ToPixels(BottomTabbedRenderer.BottomBarHeight.Value) : ViewGroup.LayoutParams.WrapContent);

            barParams.AddRule(LayoutRules.AlignParentBottom);
            bottomNav = new BottomNavigationViewEx(rootLayout.Context)
            {
                LayoutParameters = barParams,
                Id = barId
            };
            if (BottomTabbedRenderer.BackgroundColor.HasValue)
            {
                bottomNav.SetBackgroundColor(BottomTabbedRenderer.BackgroundColor.Value);
            }
            if (BottomTabbedRenderer.ItemIconTintList != null)
            {
                bottomNav.ItemIconTintList = BottomTabbedRenderer.ItemIconTintList;
            }
            if (BottomTabbedRenderer.ItemTextColor != null)
            {
                bottomNav.ItemTextColor = BottomTabbedRenderer.ItemTextColor;
            }
            if (BottomTabbedRenderer.ItemBackgroundResource.HasValue)
            {
                bottomNav.ItemBackgroundResource = BottomTabbedRenderer.ItemBackgroundResource.Value;
            }

            bottomNav.SetOnNavigationItemSelectedListener(renderer);
            rootLayout.AddView(bottomNav, 1, barParams);

            return(bottomNav);
        }
예제 #20
0
        protected override void OnElementChanged(ElementChangedEventArgs <VideoPlayer> args)
        {
            base.OnElementChanged(args);

            if (args.NewElement != null)
            {
                if (Control == null)
                {
                    videoView = new VideoView(Context);

                    // set background to hide default initial black screen until video is prepared
                    UpdateVideoBackground();

                    // Wrap in relative layout to keep video aspect ratio
                    ARelativeLayout relativeLayout = new ARelativeLayout(Context);
                    relativeLayout.AddView(videoView);

                    ARelativeLayout.LayoutParams layoutParams =
                        new ARelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
                    layoutParams.AddRule(LayoutRules.CenterInParent);
                    videoView.LayoutParameters = layoutParams;

                    videoView.Prepared += OnVideoViewPrepared;
                    videoView.SetOnErrorListener(this);

                    SetNativeControl(relativeLayout);
                }

                UpdateSource();
                UpdatePlayback();

                args.NewElement.ResetToStartRequested += OnResetToStartRequested;
            }

            if (args.OldElement != null)
            {
                args.OldElement.ResetToStartRequested -= OnResetToStartRequested;
            }
        }
예제 #21
0
 protected override void OnElementChanged(ElementChangedEventArgs <ExoPlayerControls> e)
 {
     base.OnElementChanged(e);
     if (e.OldElement == null)
     {
         if (Control == null)
         {
             InitializePlayer();
             relativeLayout = new ARelativeLayout(Context);
             VideoPlayer.SetShowShuffleButton(true);
             VideoPlayer.ControllerAutoShow = false;
             ARelativeLayout.LayoutParams layoutParams =
                 new ARelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
             layoutParams.AddRule(LayoutRules.CenterInParent);
             VideoPlayer.LayoutParameters   = layoutParams;
             VideoPlayer.ControllerAutoShow = true;
             relativeLayout.AddView(VideoPlayer);
             SetNativeControl(relativeLayout);
             mainpage = ((ViewGroup)VideoPlayer.Parent);
         }
         SetSource();
     }
 }
        protected override void OnElementChanged(ElementChangedEventArgs <JwPlayerControlView> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement == null)
            {
                if (Control == null)
                {
                    InitializePlayer(e.NewElement.Souce);
                    frameLayout = new ARelativeLayout(context);
                    ARelativeLayout.LayoutParams layoutParams =
                        new ARelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
                    layoutParams.AddRule(LayoutRules.CenterInParent);

                    //mPlayerView.LayoutParameters = layoutParams;
                    mPlayerView.LayoutParameters = layoutParams;
                    frameLayout.AddView(mPlayerView);
                    SetNativeControl(frameLayout);
                    mainpage = ((ViewGroup)mPlayerView.Parent);
                }
                SetAreTransportControlsEnabled();
                SetSource();
            }
        }
예제 #23
0
        protected async override void OnElementChanged(ElementChangedEventArgs <YoutubePlayer> args)
        {
            base.OnElementChanged(args);
            YoutubeXamarin = args.NewElement;

            if (args.NewElement != null)
            {
                if (Control == null)
                {
                    var activity = Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity as MainActivity;

                    // Save the VideoView for future reference
                    youTubePlayerView = new YouTubePlayerView(Context);

                    // Put the VideoView in a RelativeLayout
                    ARelativeLayout relativeLayout = new ARelativeLayout(Context);
                    relativeLayout.AddView(youTubePlayerView);

                    // Center the VideoView in the RelativeLayout
                    ARelativeLayout.LayoutParams layoutParams = new ARelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent);
                    layoutParams.AddRule(LayoutRules.AlignParentTop);
                    youTubePlayerView.LayoutParameters = layoutParams;
                    youTubePlayerView.PlayerUiController.ShowYouTubeButton(false);
                    youTubePlayerView.PlayerUiController.ShowFullscreenButton(YoutubeXamarin.FullscrennEnable);
                    // Use the RelativeLayout as the native control
                    SetNativeControl(relativeLayout);
                    youTubePlayerView.AddYouTubePlayerListener(this);
                    youTubePlayerView.AddFullScreenListener(this);
                    while (tubePlayer == null)
                    {
                        await Task.Delay(100);
                    }
                    //tubePlayer.LoadVideo("fBg7xDeSxh0", 0);
                }
            }
        }
		protected override async void OnElementChanged (ElementChangedEventArgs<Page> e)
		{
			base.OnElementChanged (e);

			var metrics = Resources.DisplayMetrics;
			var activity = this.Context as Activity;

			relativeLayout = new RelLayout (activity);
			var relativeLayoutParams = new RelLayout.LayoutParams (
				RelLayout.LayoutParams.MatchParent, 
				RelLayout.LayoutParams.MatchParent
			);

			// Create topTextView - "Scan QR code to swap contact info"
			topTextView = new TextView (activity);
			topTextView.Text = "Scan QR code to swap contact info";
			topTextView.Gravity = GravityFlags.Center;
			topTextView.SetTextColor (AColor.Rgb (38, 173, 230));
			topTextView.TextSize = 14f;
			topTextView.Typeface = Typeface.CreateFromAsset (Forms.Context.Assets, "OpenSans-Bold.ttf");

			RelLayout.LayoutParams topTVLayoutParams = new RelLayout.LayoutParams(
				RelLayout.LayoutParams.MatchParent, 
				RelLayout.LayoutParams.MatchParent
			);

			relativeLayout.AddView (topTextView, topTVLayoutParams);
			/* * * * * * * * * * * * * * * * * * * * * * * * * * * */

			/* Create the Barcode Picker View */
			barcodePicker = new ScanditSDKBarcodePicker (activity, "EeQ6GjLtEeSWsF/zcFfsWC8RqIt/+skbdZJ/MWpLIR8");
			barcodePicker.OverlayView.AddListener (this);

			// disable all codes except QR for scanning
			barcodePicker.Set1DScanningEnabled (false);
			barcodePicker.Set2DScanningEnabled (false);
			barcodePicker.SetCode128Enabled (false);
			barcodePicker.SetCode39Enabled (false);
			barcodePicker.SetCode93Enabled (false);
			barcodePicker.SetDataMatrixEnabled (false);
			barcodePicker.SetEan13AndUpc12Enabled (false);
			barcodePicker.SetEan8Enabled (false);
			barcodePicker.SetItfEnabled (false);
			barcodePicker.SetMicroDataMatrixEnabled (false);
			barcodePicker.SetUpceEnabled (false);
			/* - * - * - * - * - * - * - */
			barcodePicker.SetQrEnabled (true);
			/* - * - * - * - * - * - * - */

			RelLayout.LayoutParams bpLayoutParams = new RelLayout.LayoutParams(
				RelLayout.LayoutParams.MatchParent, 
				RelLayout.LayoutParams.MatchParent
			);
			bpLayoutParams.AddRule(LayoutRules.CenterHorizontal);

			relativeLayout.AddView (barcodePicker, bpLayoutParams);
			/* * * * * * * * * * * * * * * * * * * * * * * * * * * */

			/* Create the overlay view -- this is to cover the bottom part of the barcode scanner view */
			overlay = new AView(activity);
			overlay.SetBackgroundColor (AColor.White);

			RelLayout.LayoutParams oLayoutParams = new RelLayout.LayoutParams(
				RelLayout.LayoutParams.MatchParent, 
				RelLayout.LayoutParams.MatchParent
			);
			oLayoutParams.AddRule(LayoutRules.AlignParentBottom);

			relativeLayout.AddView (overlay, oLayoutParams);
			/* * * * * * * * * * * * * * * * * * * * * * * * * * * */

			// Create bottomTextView - "Share your contact info"
			bottomTextView = new TextView (activity);
			bottomTextView.Text = "Share your contact info";
			bottomTextView.Gravity = GravityFlags.Center;
			bottomTextView.SetTextColor (AColor.Rgb (38, 173, 230));
			bottomTextView.TextSize = 14f;
			bottomTextView.Typeface = Typeface.CreateFromAsset (Forms.Context.Assets, "OpenSans-Bold.ttf");

			RelLayout.LayoutParams bottomTVLayoutParams = new RelLayout.LayoutParams(
				RelLayout.LayoutParams.MatchParent, 
				RelLayout.LayoutParams.MatchParent
			);

			relativeLayout.AddView (bottomTextView, bottomTVLayoutParams);
			/* * * * * * * * * * * * * * * * * * * * * * * * * * * */

			/* * * Generating QR code * * */
			IBarcodeWriter barcodeWriter = new BarcodeWriter 
			{ 
				Format = BarcodeFormat.QR_CODE,
				Options = new ZXing.Common.EncodingOptions
				{
					Width = 175,
					Height = 175
				}
			};

			// TODO: temp code - move to view model
			var service = TinyIoC.TinyIoCContainer.Current.Resolve<CouchbaseConnect2014.Services.ICouchbaseService> ();
			var contactId = service.GetUserId ();
			var repo = TinyIoC.TinyIoCContainer.Current.Resolve<CouchbaseConnect2014.Services.IRepository> ();
			var localUser = await repo.GetProfile ();
			// end of temp code

			var qrContent = string.Format ("{0},{1},{2}", contactId, localUser.First, localUser.Last);

			var result = barcodeWriter.Write (qrContent);
			qrImageView = new ImageView (activity);
			qrImageView.SetImageBitmap (result);

			RelLayout.LayoutParams qrLayoutParams = new RelLayout.LayoutParams (
				RelLayout.LayoutParams.MatchParent, 
				RelLayout.LayoutParams.MatchParent
			);
			qrLayoutParams.AddRule (LayoutRules.CenterHorizontal);

			relativeLayout.AddView (qrImageView, qrLayoutParams);
			/* * * * * * * * * * * * * * * * * * * * * * * * * * * */

			AddView (relativeLayout, relativeLayoutParams);

			barcodePicker.SetScanningHotSpot (0.5f, 0.2f);
			barcodePicker.OverlayView.SetViewfinderDimension (0.4f, 0.28f);
			barcodePicker.OverlayView.SetTorchEnabled (false);

			barcodePicker.StartScanning();
		}
        private void AudioVisualerInit()
        {
            if (Visualizer != null)
            {
                Visualizer.Release();
                relativeLayout.RemoveAllViews();
            }
            if (CircleBarVisualizer != null)
            {
                CircleBarVisualizer.Release();
                relativeLayout.RemoveAllViews();
            }
            switch (Element.AudioVisualizerType)
            {
            case CustomForms.AudioVisualizer.AudioVisualizerType.CircleLine:
                Visualizer = new Com.Gauravk.Audiovisualizer.Visualizer.CircleLineVisualizer(Context);
                break;

            case CustomForms.AudioVisualizer.AudioVisualizerType.Hifi:
                Visualizer = new Com.Gauravk.Audiovisualizer.Visualizer.HiFiVisualizer(Context);
                break;

            case CustomForms.AudioVisualizer.AudioVisualizerType.Wave:
                Visualizer = new Com.Gauravk.Audiovisualizer.Visualizer.WaveVisualizer(Context);
                break;

            case CustomForms.AudioVisualizer.AudioVisualizerType.Blob:
                Visualizer = new Com.Gauravk.Audiovisualizer.Visualizer.BlobVisualizer(Context);
                break;

            case CustomForms.AudioVisualizer.AudioVisualizerType.Blast:
                Visualizer = new Com.Gauravk.Audiovisualizer.Visualizer.BlastVisualizer(Context);
                break;

            case CustomForms.AudioVisualizer.AudioVisualizerType.Bar:
                Visualizer = new Com.Gauravk.Audiovisualizer.Visualizer.BarVisualizer(Context);
                break;

            case CustomForms.AudioVisualizer.AudioVisualizerType.Chibde:
                Visualizer          = null;
                CircleBarVisualizer = new Com.Chibde.Visualizer.CircleBarVisualizer(Context);
                break;

            default:
                Visualizer = new Com.Gauravk.Audiovisualizer.Visualizer.CircleLineVisualizer(Context);
                break;
            }
            ARelativeLayout.LayoutParams layoutParams =
                new ARelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
            layoutParams.AddRule(LayoutRules.CenterInParent);
            if (Visualizer != null)
            {
                Visualizer.SetAudioSessionId(0);
                Visualizer.SetAnimationSpeed(Com.Gauravk.Audiovisualizer.Model.AnimSpeed.Medium);
                Visualizer.SetDensity((float)Element.Density);
                Visualizer.SetColor(Element.Color.ToAndroid());
                Visualizer.LayoutParameters = layoutParams;
                relativeLayout.AddView(Visualizer);
            }
            else if (CircleBarVisualizer != null)
            {
                CircleBarVisualizer.SetColor(Element.Color.ToAndroid());
                CircleBarVisualizer.SetPlayer(0);
                CircleBarVisualizer.LayoutParameters = layoutParams;
                relativeLayout.AddView(CircleBarVisualizer);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            AToolbar bar;

            if (ToolbarResource != 0)
            {
                bar = LayoutInflater.Inflate(ToolbarResource, null).JavaCast <AToolbar>();
                if (bar == null)
                {
                    throw new InvalidOperationException("ToolbarResource must be set to a Android.Support.V7.Widget.Toolbar");
                }
            }
            else
            {
                bar = new AToolbar(this);
            }

            SetSupportActionBar(bar);

            Window.SetSoftInputMode(SoftInput.AdjustPan);

            _layout = new ARelativeLayout(BaseContext);
            SetContentView(_layout);

            Xamarin.Forms.Application.ClearCurrent();

            _previousState = _currentState;
            _currentState  = AndroidApplicationLifecycleState.OnCreate;

            OnStateChanged();

            _statusBarUnderlay = new global::Android.Views.View(this);
            var layoutParameters = new ARelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, GetStatusBarHeight())
            {
                AlignWithParent = true
            };

            layoutParameters.AddRule(LayoutRules.AlignTop);
            _statusBarUnderlay.LayoutParameters = layoutParameters;
            _layout.AddView(_statusBarUnderlay);

            if (Forms.IsLollipopOrNewer)
            {
                Window.DecorView.SystemUiVisibility = (StatusBarVisibility)(SystemUiFlags.LayoutFullscreen | SystemUiFlags.LayoutStable);
                Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
                Window.SetStatusBarColor(AColor.Transparent);

                int primaryColorDark = GetColorPrimaryDark();

                if (primaryColorDark != 0)
                {
                    int r = AColor.GetRedComponent(primaryColorDark);
                    int g = AColor.GetGreenComponent(primaryColorDark);
                    int b = AColor.GetBlueComponent(primaryColorDark);
                    int a = AColor.GetAlphaComponent(primaryColorDark);
                    SetStatusBarColor(AColor.Argb(a, r, g, b));
                }
            }
        }
예제 #27
0
        protected override async void OnElementChanged(ElementChangedEventArgs <Page> e)
        {
            base.OnElementChanged(e);

            var metrics  = Resources.DisplayMetrics;
            var activity = this.Context as Activity;

            relativeLayout = new RelLayout(activity);
            var relativeLayoutParams = new RelLayout.LayoutParams(
                RelLayout.LayoutParams.MatchParent,
                RelLayout.LayoutParams.MatchParent
                );

            // Create topTextView - "Scan QR code to swap contact info"
            topTextView         = new TextView(activity);
            topTextView.Text    = "Scan QR code to swap contact info";
            topTextView.Gravity = GravityFlags.Center;
            topTextView.SetTextColor(AColor.Rgb(38, 173, 230));
            topTextView.TextSize = 14f;
            topTextView.Typeface = Typeface.CreateFromAsset(Forms.Context.Assets, "OpenSans-Bold.ttf");

            RelLayout.LayoutParams topTVLayoutParams = new RelLayout.LayoutParams(
                RelLayout.LayoutParams.MatchParent,
                RelLayout.LayoutParams.MatchParent
                );

            relativeLayout.AddView(topTextView, topTVLayoutParams);
            /* * * * * * * * * * * * * * * * * * * * * * * * * * * */

            /* Create the Barcode Picker View */
            barcodePicker = new ScanditSDKBarcodePicker(activity, "EeQ6GjLtEeSWsF/zcFfsWC8RqIt/+skbdZJ/MWpLIR8");
            barcodePicker.OverlayView.AddListener(this);

            // disable all codes except QR for scanning
            barcodePicker.Set1DScanningEnabled(false);
            barcodePicker.Set2DScanningEnabled(false);
            barcodePicker.SetCode128Enabled(false);
            barcodePicker.SetCode39Enabled(false);
            barcodePicker.SetCode93Enabled(false);
            barcodePicker.SetDataMatrixEnabled(false);
            barcodePicker.SetEan13AndUpc12Enabled(false);
            barcodePicker.SetEan8Enabled(false);
            barcodePicker.SetItfEnabled(false);
            barcodePicker.SetMicroDataMatrixEnabled(false);
            barcodePicker.SetUpceEnabled(false);
            /* - * - * - * - * - * - * - */
            barcodePicker.SetQrEnabled(true);
            /* - * - * - * - * - * - * - */

            RelLayout.LayoutParams bpLayoutParams = new RelLayout.LayoutParams(
                RelLayout.LayoutParams.MatchParent,
                RelLayout.LayoutParams.MatchParent
                );
            bpLayoutParams.AddRule(LayoutRules.CenterHorizontal);

            relativeLayout.AddView(barcodePicker, bpLayoutParams);
            /* * * * * * * * * * * * * * * * * * * * * * * * * * * */

            /* Create the overlay view -- this is to cover the bottom part of the barcode scanner view */
            overlay = new AView(activity);
            overlay.SetBackgroundColor(AColor.White);

            RelLayout.LayoutParams oLayoutParams = new RelLayout.LayoutParams(
                RelLayout.LayoutParams.MatchParent,
                RelLayout.LayoutParams.MatchParent
                );
            oLayoutParams.AddRule(LayoutRules.AlignParentBottom);

            relativeLayout.AddView(overlay, oLayoutParams);
            /* * * * * * * * * * * * * * * * * * * * * * * * * * * */

            // Create bottomTextView - "Share your contact info"
            bottomTextView         = new TextView(activity);
            bottomTextView.Text    = "Share your contact info";
            bottomTextView.Gravity = GravityFlags.Center;
            bottomTextView.SetTextColor(AColor.Rgb(38, 173, 230));
            bottomTextView.TextSize = 14f;
            bottomTextView.Typeface = Typeface.CreateFromAsset(Forms.Context.Assets, "OpenSans-Bold.ttf");

            RelLayout.LayoutParams bottomTVLayoutParams = new RelLayout.LayoutParams(
                RelLayout.LayoutParams.MatchParent,
                RelLayout.LayoutParams.MatchParent
                );

            relativeLayout.AddView(bottomTextView, bottomTVLayoutParams);
            /* * * * * * * * * * * * * * * * * * * * * * * * * * * */

            /* * * Generating QR code * * */
            IBarcodeWriter barcodeWriter = new BarcodeWriter
            {
                Format  = BarcodeFormat.QR_CODE,
                Options = new ZXing.Common.EncodingOptions
                {
                    Width  = 175,
                    Height = 175
                }
            };

            // TODO: temp code - move to view model
            var service   = TinyIoC.TinyIoCContainer.Current.Resolve <CouchbaseConnect2014.Services.ICouchbaseService> ();
            var contactId = service.GetUserId();
            var repo      = TinyIoC.TinyIoCContainer.Current.Resolve <CouchbaseConnect2014.Services.IRepository> ();
            var localUser = await repo.GetProfile();

            // end of temp code

            var qrContent = string.Format("{0},{1},{2}", contactId, localUser.First, localUser.Last);

            var result = barcodeWriter.Write(qrContent);

            qrImageView = new ImageView(activity);
            qrImageView.SetImageBitmap(result);

            RelLayout.LayoutParams qrLayoutParams = new RelLayout.LayoutParams(
                RelLayout.LayoutParams.MatchParent,
                RelLayout.LayoutParams.MatchParent
                );
            qrLayoutParams.AddRule(LayoutRules.CenterHorizontal);

            relativeLayout.AddView(qrImageView, qrLayoutParams);
            /* * * * * * * * * * * * * * * * * * * * * * * * * * * */

            AddView(relativeLayout, relativeLayoutParams);

            barcodePicker.SetScanningHotSpot(0.5f, 0.2f);
            barcodePicker.OverlayView.SetViewfinderDimension(0.4f, 0.28f);
            barcodePicker.OverlayView.SetTorchEnabled(false);

            barcodePicker.StartScanning();
        }