Example #1
0
        void Initialize()
        {
            OnceInitializeAction = null;

            ContentView.SetBackgroundColor(_config.OverlayColor.ToAndroid());
            ContentView.Alpha = (float)_config.Opacity;

            var innerView = (Dialogs.Context as Activity).LayoutInflater.Inflate(Resource.Layout.LoadingDialogLayout, null);

            var progress = innerView.FindViewById <ProgressBar>(Resource.Id.progress);

            _messageLabel = innerView.FindViewById <TextView>(Resource.Id.loading_message);

            progress.IndeterminateDrawable.SetColorFilter(_config.IndicatorColor.ToAndroid(), PorterDuff.Mode.SrcIn);
            _messageLabel.SetTextSize(Android.Util.ComplexUnitType.Sp, (float)_config.FontSize);
            _messageLabel.SetTextColor(_config.FontColor.ToAndroid());

            using (var param = new FrameLayout.LayoutParams(
                       ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent)
            {
                Gravity = GravityFlags.Center,
            })
            {
                Dialogs.SetOffsetMargin(param, _config.OffsetX, _config.OffsetY);
                ContentView.AddView(innerView, 0, param);
            };
        }
Example #2
0
        void Initialize()
        {
            OnceInitializeAction = null;

            ContentView.SetBackgroundColor(_loadingView.OverlayColor.ToAndroid());
            ContentView.Alpha = 1f;
            ContentView.SetPadding(0, (int)Dialogs.Context.ToPixels(24), 0, 0); // Statusbar

            _loadingView.Parent = XF.Application.Current.MainPage;

            _renderer = Dialogs.CreateNativeView(_loadingView);

            if (_loadingView.CornerRadius > 0)
            {
                var nativeView = _renderer.View as ViewGroup;
                var border     = new GradientDrawable();
                border.SetCornerRadius(Dialogs.Context.ToPixels(_loadingView.CornerRadius));
                if (!_loadingView.BackgroundColor.IsDefault)
                {
                    border.SetColor(_loadingView.BackgroundColor.ToAndroid());
                }
                nativeView.ClipToOutline = true;
                nativeView.SetBackground(border);
            }

            var measure = Dialogs.Measure(_loadingView);

            _loadingView.Layout(new XF.Rectangle(0, 0, measure.Width, measure.Height));


            var width  = (int)Dialogs.Context.ToPixels(_loadingView.Bounds.Width);
            var height = (int)Dialogs.Context.ToPixels(_loadingView.Bounds.Height);

            using (var param = new FrameLayout.LayoutParams(
                       ViewGroup.LayoutParams.WrapContent,
                       ViewGroup.LayoutParams.WrapContent
                       )
            {
                Width = width,
                Height = height,
                Gravity = Dialogs.GetGravity(_loadingView)
            })
            {
                Dialogs.SetOffsetMargin(param, _loadingView);
                ContentView.AddView(_renderer.View, 0, param);
            }
        }
Example #3
0
        private void Setup()
        {
            this.Mode = DSoft.Datatypes.Enums.ToolbarMode.Navigation;

            //set container for the left buttons
            var leftContainer = new LinearLayout(Context);

            leftContainer.LayoutParameters = new ViewGroup.LayoutParams(LayoutParams.WrapContent, LayoutParams.FillParent);
            leftContainer.Orientation      = Orientation.Horizontal;
            mLeftArea = leftContainer;
            mLeftArea.SetBackgroundColor(Color.Transparent);
            ContentView.AddView(mLeftArea);

            mTitleLabel         = new TextView(Context, null, Android.Resource.Attribute.TextAppearanceMedium);
            mTitleLabel.Text    = "Title";
            mTitleLabel.Gravity = GravityFlags.Center;


            mTitleLabel.SetBackgroundColor(Color.Transparent);

            var tvParams = new LinearLayout.LayoutParams(LayoutParams.FillParent, LayoutParams.FillParent, 1.0f);

            var inset = Context.ToDevicePixels(4);

            tvParams.SetMargins(0, inset, 0, inset);
            mTitleLabel.LayoutParameters = tvParams;

            ContentView.AddView(mTitleLabel);

            var rightContainer = new LinearLayout(Context);

            rightContainer.LayoutParameters = new ViewGroup.LayoutParams(LayoutParams.WrapContent, LayoutParams.FillParent);
            rightContainer.Orientation      = Orientation.Horizontal;
            mRightArea = rightContainer;
            mRightArea.SetBackgroundColor(Color.Transparent);
            ContentView.AddView(mRightArea);
        }