Exemple #1
0
    public SpringInterfaceViewController()
    {
        springView = new GradientView(CGRect.Empty)
        {
            TranslatesAutoresizingMaskIntoConstraints = false,
            TopColor    = new UIColor(.39f, .8f, .96f, 1),
            BottomColor = new UIColor(.20f, .61f, .92f, 1)
        };
        dampingSliderView = new SliderView(CGRect.Empty)
        {
            TranslatesAutoresizingMaskIntoConstraints = false,
            Title                = "DAMPING (BOUNCINESS)",
            MinValue             = 0.1f,
            MaxValue             = 1,
            Value                = dampingRatio,
            SliderMoved          = (x) => dampingRatio = x,
            SliderFinishedMoving = () => ResetAnimation()
        };

        frequencySliderView = new SliderView(CGRect.Empty)
        {
            TranslatesAutoresizingMaskIntoConstraints = false,
            Title                = "RESPONSE (SPEED)",
            MinValue             = 0.1f,
            MaxValue             = 2f,
            Value                = frequencyResponse,
            SliderMoved          = (x) => frequencyResponse = x,
            SliderFinishedMoving = () => ResetAnimation()
        };
    }
Exemple #2
0
        public ActionResult Index(int page = 1)
        {
            SliderView model = new SliderView();

            model.Rows = _sliderRepo.GetList(orderBy: i => i.OrderByDescending(o => o.Order)).ToPagedList(page, myAppSetings.admin_pg_size);
            return(View(model));
        }
        private void prepareViews()
        {
            var screenWidth = UIScreen.MainScreen.Bounds.Width;

            PreferredContentSize = new CGSize
            {
                // ScreenWidth - 32 for 16pt margins on both sides
                Width = TraitCollection.HorizontalSizeClass == UIUserInterfaceSizeClass.Regular
                    ? 0
                    : screenWidth - 32,
                Height = TraitCollection.HorizontalSizeClass == UIUserInterfaceSizeClass.Regular
                    ? (ViewModel.AllowCustomColors ? customColorEnabledHeightPad : customColorDisabledHeight)
                    : (ViewModel.AllowCustomColors ? customColorEnabledHeight : customColorDisabledHeight)
            };

            if (!ViewModel.AllowCustomColors)
            {
                SliderView.RemoveFromSuperview();
                PickerView.RemoveFromSuperview();
                SliderBackgroundView.RemoveFromSuperview();
                return;
            }

            // Remove track
            SliderView.SetMinTrackImage(new UIImage(), UIControlState.Normal);
            SliderView.SetMaxTrackImage(new UIImage(), UIControlState.Normal);
        }
Exemple #4
0
        private void prepareViews()
        {
            var screenWidth = UIScreen.MainScreen.Bounds.Width;

            PreferredContentSize = new CGSize
            {
                // ScreenWidth - 32 for 16pt margins on both sides
                Width = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad
                    ? 0
                    : screenWidth > 320 ? screenWidth - 32 : 312,
                Height = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad
                    ? (ViewModel.AllowCustomColors ? customColorEnabledHeightPad : customColorDisabledHeight)
                    : (ViewModel.AllowCustomColors ? customColorEnabledHeight : customColorDisabledHeight)
            };

            if (!ViewModel.AllowCustomColors)
            {
                SliderView.RemoveFromSuperview();
                PickerView.RemoveFromSuperview();
                SliderBackgroundView.RemoveFromSuperview();
                return;
            }

            // Remove track
            SliderView.SetMinTrackImage(new UIImage(), UIControlState.Normal);
            SliderView.SetMaxTrackImage(new UIImage(), UIControlState.Normal);
        }
Exemple #5
0
        private void prepareViews(ColorSelectionCollectionViewSource source)
        {
            var screenWidth = UIScreen.MainScreen.Bounds.Width;

            PreferredContentSize = new CGSize
            {
                // ScreenWidth - 32 for 16pt margins on both sides
                Width  = screenWidth > 320 ? screenWidth - 32 : 312,
                Height = ViewModel.AllowCustomColors ? customColorEnabledHeight : customColorDisabledHeight
            };

            ColorCollectionView.Source = source;

            if (!ViewModel.AllowCustomColors)
            {
                SliderView.Hidden           = true;
                PickerView.Hidden           = true;
                SliderBackgroundView.Hidden = true;
                return;
            }

            // Initialize picker related layers
            var usableWidth = PreferredContentSize.Width - 28;

            PickerView.InitializeLayers(new CGRect(0, 0, usableWidth, 80));
            SliderBackgroundView.InitializeLayer(new CGRect(0, 0, usableWidth, 18));

            // Remove track
            SliderView.SetMinTrackImage(new UIImage(), UIControlState.Normal);
            SliderView.SetMaxTrackImage(new UIImage(), UIControlState.Normal);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            CloseButton.SetTemplateColor(ColorAssets.Text2);

            TitleLabel.Text = Resources.ProjectColor;
            SaveButton.SetTitle(Resources.Save, UIControlState.Normal);

            prepareViews();

            //Collection View
            ColorCollectionView.RegisterNibForCell(ColorSelectionViewCell.Nib, ColorSelectionViewCell.Identifier);
            source = new ColorSelectionCollectionViewSource(ViewModel.SelectableColors);
            ColorCollectionView.Source = source;
            ViewModel.SelectableColors
            .Subscribe(replaceColors)
            .DisposedBy(DisposeBag);

            source.ColorSelected
            .Subscribe(ViewModel.SelectColor.Inputs)
            .DisposedBy(DisposeBag);

            // Commands
            SaveButton.Rx()
            .BindAction(ViewModel.Save)
            .DisposedBy(DisposeBag);

            CloseButton.Rx().Tap()
            .Subscribe(() => ViewModel.CloseWithDefaultResult())
            .DisposedBy(DisposeBag);

            // Picker view
            PickerView.Rx().Hue()
            .Subscribe(ViewModel.SetHue.Inputs)
            .DisposedBy(DisposeBag);


            PickerView.Rx().Saturation()
            .Subscribe(ViewModel.SetSaturation.Inputs)
            .DisposedBy(DisposeBag);

            SliderView.Rx().Value()
            .Select(v => 1 - v)
            .Subscribe(ViewModel.SetValue.Inputs)
            .DisposedBy(DisposeBag);

            ViewModel.Hue
            .Subscribe(PickerView.Rx().HueObserver())
            .DisposedBy(DisposeBag);

            ViewModel.Saturation
            .Subscribe(PickerView.Rx().SaturationObserver())
            .DisposedBy(DisposeBag);

            ViewModel.Value
            .Subscribe(PickerView.Rx().ValueObserver())
            .DisposedBy(DisposeBag);
        }
Exemple #7
0
        // The project requires the Google Glass Component from
        // https://components.xamarin.com/view/googleglass
        // so make sure you add that in to compile succesfully.
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.activity_main);
            mProgress = (SliderView)FindViewById(Resource.Id.progress_slider);
            mIndeterm = (SliderView)FindViewById(Resource.Id.indeterm_slider);

            mIndeterm.StartIndeterminate();
            mProgress.StartProgress(10 * 1000);
        }
Exemple #8
0
        public SliderViewCommandBinding(SliderView sliderView, Button showButton, Func <IViewModel, Command <double> > commandFunc,
                                        Expression <Func <IViewModel, double> > propertyExpression, Action <double> updateViewAction) : base(commandFunc, null)
        {
            this.sliderView  = sliderView;
            this.commandFunc = commandFunc;
            this.showButton  = showButton;
            WireShowButtonClickEvent(showButton);

            if (propertyExpression != null && updateViewAction != null)
            {
                propBinding = new OneWayPropertyBinding <double, double> (propertyExpression, updateViewAction);
            }
        }
        protected override void OnElementChanged(ElementChangedEventArgs <View> e)
        {
            base.OnElementChanged(e);
            if (e.NewElement != null)
            {
                sliderView = e.NewElement as SliderView;
                sliderView.Children[currentViewIndex].HeightRequest   = sliderView.Height;
                sliderView.Children[currentViewIndex].WidthRequest    = sliderView.Width;
                sliderView.Children[currentViewIndex].BackgroundColor = sliderView.BackgroundColor;
            }

            rightGesture = new UISwipeGestureRecognizer(swipe =>
            {
                if (sliderView.Children.Count > currentViewIndex + 1)
                {
                    currentViewIndex++;

                    sliderView.CurrentView = sliderView.Children[currentViewIndex];
                    sliderView.CurrentView.HeightRequest   = sliderView.Height;
                    sliderView.CurrentView.WidthRequest    = sliderView.Width;
                    sliderView.CurrentView.BackgroundColor = sliderView.BackgroundColor;

                    TranslateToCurrentView("Left");
                }
            })
            {
                Direction = UISwipeGestureRecognizerDirection.Left
            };

            leftGesture = new UISwipeGestureRecognizer(swipe =>
            {
                if (currentViewIndex != 0)
                {
                    currentViewIndex--;

                    sliderView.CurrentView = sliderView.Children[currentViewIndex];
                    sliderView.CurrentView.HeightRequest   = sliderView.Height;
                    sliderView.CurrentView.WidthRequest    = sliderView.Width;
                    sliderView.CurrentView.BackgroundColor = sliderView.BackgroundColor;

                    TranslateToCurrentView("Right");
                }
            })
            {
                Direction = UISwipeGestureRecognizerDirection.Right
            };

            AddGestureRecognizer(rightGesture);
            AddGestureRecognizer(leftGesture);
        }
Exemple #10
0
        void ReleaseDesignerOutlets()
        {
            if (CloseButton != null)
            {
                CloseButton.Dispose();
                CloseButton = null;
            }

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

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

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

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

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

            if (TitleLabel != null)
            {
                TitleLabel.Dispose();
                TitleLabel = null;
            }
        }
        public SliderView All(string searchKey, DateTime?fromDate, bool?isTrash, DateTime?toDate, int?pageIndex, int?pageSize)
        {
            var entitys = GetAll();

            if (isTrash.HasValue)
            {
                entitys = entitys.Where(x => x.isTrash == isTrash);
            }
            if (!string.IsNullOrEmpty(searchKey))
            {
                entitys = entitys.Where(x => x.sliderName.ToLower().Contains(searchKey.ToLower().Trim()));
            }
            if (fromDate.HasValue)
            {
                entitys = entitys.Where(x => x.createTime.Date >= fromDate.Value.Date);
            }
            if (toDate.HasValue)
            {
                entitys = entitys.Where(x => x.createTime.Date <= toDate.Value.Date);
            }
            var totalRecord = entitys.Count();

            if (pageIndex != null && pageSize != null)
            {
                entitys = entitys.Skip(((int)pageIndex - 1) * (int)pageSize);
            }
            var totalPage = 0;

            if (pageSize != null)
            {
                totalPage = (int)Math.Ceiling(1.0 * totalRecord / pageSize.Value);
                entitys   = entitys.Take((int)pageSize);
            }
            var result = new SliderView {
                Total = totalPage, Sliders = entitys
            };

            return(result);
        }
        protected override void OnElementChanged(ElementChangedEventArgs <View> e)
        {
            base.OnElementChanged(e);
            //If the NewElement has been queued up
            if (e.NewElement != null)
            {
                //Set SliderView Instance
                _sliderView = e.NewElement as SliderView;
                //Make the currentView the same dimensions of the SliderView
                _sliderView.Children[currentViewIndex].HeightRequest = _sliderView.Height;
                _sliderView.Children[currentViewIndex].WidthRequest  = _sliderView.Width;
                //This is an optional thing, really depends on how you want to use this SliderView
                _sliderView.Children[currentViewIndex].BackgroundColor = _sliderView.BackgroundColor;
            }

            //Create the gesture that brings the view in from the right side
            rightGesture = new UISwipeGestureRecognizer(swipe =>
            {
                Console.WriteLine("Swipe Left");
                //Check to make sure we aren't on the current view
                if (_sliderView.Children.Count > currentViewIndex + 1)
                {
                    //Add one to the index
                    currentViewIndex++;

                    _sliderView.CurrentView = _sliderView.Children[currentViewIndex];
                    _sliderView.CurrentView.HeightRequest   = _sliderView.Height;
                    _sliderView.CurrentView.WidthRequest    = _sliderView.Width;
                    _sliderView.CurrentView.BackgroundColor = _sliderView.BackgroundColor;

                    //Translate the CurrentView onto the ViewScreen
                    TranslateToCurrentView("Left");
                }
            })
            {
                Direction = UISwipeGestureRecognizerDirection.Left
            };

            //Create the gesture that brings the view in from the left side
            leftGesture = new UISwipeGestureRecognizer(swipe =>
            {
                //Check to make sure we aren't at the first view
                if (currentViewIndex != 0)
                {
                    //Drop the index one
                    currentViewIndex--;

                    //Set the new CurrentView
                    _sliderView.CurrentView = _sliderView.Children[currentViewIndex];
                    //Set the size of the CurrentView to the size of the SliderView
                    _sliderView.CurrentView.HeightRequest = _sliderView.Height;
                    _sliderView.CurrentView.WidthRequest  = _sliderView.Width;
                    //This is an optional thing, really depends on how you want to use this SliderView
                    _sliderView.CurrentView.BackgroundColor = _sliderView.BackgroundColor;

                    //Translate the CurrentView onto the ViewScreen
                    TranslateToCurrentView("Right");
                }
            })
            {
                Direction = UISwipeGestureRecognizerDirection.Right
            };

            //Add the Gesture Recognizers to the SliderView
            AddGestureRecognizer(rightGesture);
            AddGestureRecognizer(leftGesture);
        }
Exemple #13
0
 /// <summary>
 /// Binds the specified <paramref name="sliderView"/> to the specified command and sets icon/tooltip from command to <paramref name="showButton"/>,
 /// additionally it binds scale to property expressed on <paramref name="propertyExpression"/>
 /// and perfoms an UI callback <paramref name="updateViewAction"/> when property binded is changed.
 /// </summary>
 /// <returns>The bind.</returns>
 /// <param name="sliderView">Slider view.</param>
 /// <param name="showButton">Show button.</param>
 /// <param name="commandFunc">Command func.</param>
 /// <param name="propertyExpression">Property expression.</param>
 /// <param name="updateViewAction">Update view action.</param>
 public static Binding Bind(this SliderView sliderView, Button showButton, Func <IViewModel, Command <double> > commandFunc,
                            Expression <Func <IViewModel, double> > propertyExpression = null, Action <double> updateViewAction = null)
 {
     return(new SliderViewCommandBinding(sliderView, showButton, commandFunc, propertyExpression, updateViewAction));
 }
        // Also known as "closure hell"
        public static IView View()
        {
            ListSelectView<OrbitDriver> currentlyEditing = null;
            Action<OrbitDriver> onCurrentlyEditingChange = null;

            var setToCurrentOrbit = new ButtonView("Set to current orbit", "Sets all the fields of the editor to reflect the orbit of the currently selected vessel",
                () => onCurrentlyEditingChange(currentlyEditing.CurrentlySelected));

            var referenceSelector = new ListSelectView<CelestialBody>("Reference body", () => FlightGlobals.fetch == null ? null : FlightGlobals.fetch.bodies, null, Extensions.CbToString);

            #region Simple
            var simpleAltitude = new TextBoxView<double>("Altitude", "Altitude of circular orbit", 110000, Model.SiSuffix.TryParse);
            var simpleApply = new ConditionalView(() => simpleAltitude.Valid && referenceSelector.CurrentlySelected != null,
                                  new ButtonView("Apply", "Sets the orbit", () =>
                    {
                        Model.OrbitEditor.Simple(currentlyEditing.CurrentlySelected, simpleAltitude.Object, referenceSelector.CurrentlySelected);

                        currentlyEditing.ReInvokeOnSelect();
                    }));
            var simple = new VerticalView(new IView[]
                {
                    simpleAltitude,
                    referenceSelector,
                    simpleApply,
                    setToCurrentOrbit
                });
            #endregion

            #region Complex
            var complexInclination = new TextBoxView<double>("Inclination", "How close to the equator the orbit plane is", 0, double.TryParse);
            var complexEccentricity = new TextBoxView<double>("Eccentricity", "How circular the orbit is (0=circular, 0.5=elliptical, 1=parabolic)", 0, double.TryParse);
            var complexSemiMajorAxis = new TextBoxView<double>("Semi-major axis", "Mean radius of the orbit (ish)", 10000000, Model.SiSuffix.TryParse);
            var complexLongitudeAscendingNode = new TextBoxView<double>("Lon. of asc. node", "Longitude of the place where you cross the equator northwards", 0, double.TryParse);
            var complexArgumentOfPeriapsis = new TextBoxView<double>("Argument of periapsis", "Rotation of the orbit around the normal", 0, double.TryParse);
            var complexMeanAnomalyAtEpoch = new TextBoxView<double>("Mean anomaly at epoch", "Position along the orbit at the epoch", 0, double.TryParse);
            var complexEpoch = new TextBoxView<double>("Epoch", "Epoch at which mEp is measured", 0, Model.SiSuffix.TryParse);
            var complexEpochNow = new ButtonView("Set epoch to now", "Sets the Epoch field to the current time", () => complexEpoch.Object = Planetarium.GetUniversalTime());
            var complexApply = new ConditionalView(() => complexInclination.Valid &&
                                   complexEccentricity.Valid &&
                                   complexSemiMajorAxis.Valid &&
                                   complexLongitudeAscendingNode.Valid &&
                                   complexArgumentOfPeriapsis.Valid &&
                                   complexMeanAnomalyAtEpoch.Valid &&
                                   complexEpoch.Valid &&
                                   referenceSelector.CurrentlySelected != null,
                                   new ButtonView("Apply", "Sets the orbit", () =>
                    {
                        Model.OrbitEditor.Complex(currentlyEditing.CurrentlySelected,
                            complexInclination.Object,
                            complexEccentricity.Object,
                            complexSemiMajorAxis.Object,
                            complexLongitudeAscendingNode.Object,
                            complexArgumentOfPeriapsis.Object,
                            complexMeanAnomalyAtEpoch.Object,
                            complexEpoch.Object,
                            referenceSelector.CurrentlySelected);

                        currentlyEditing.ReInvokeOnSelect();
                    }));
            var complex = new VerticalView(new IView[]
                {
                    complexInclination,
                    complexEccentricity,
                    complexSemiMajorAxis,
                    complexLongitudeAscendingNode,
                    complexArgumentOfPeriapsis,
                    complexMeanAnomalyAtEpoch,
                    complexEpoch,
                    complexEpochNow,
                    referenceSelector,
                    complexApply,
                    setToCurrentOrbit
                });
            #endregion

            #region Graphical
            SliderView graphicalInclination = null;
            SliderView graphicalEccentricity = null;
            SliderView graphicalPeriapsis = null;
            SliderView graphicalLongitudeAscendingNode = null;
            SliderView graphicalArgumentOfPeriapsis = null;
            SliderView graphicalMeanAnomaly = null;
            double graphicalEpoch = 0;

            Action<double> graphicalOnChange = ignored =>
            {
                Model.OrbitEditor.Graphical(currentlyEditing.CurrentlySelected,
                    graphicalInclination.Value,
                    graphicalEccentricity.Value,
                    graphicalPeriapsis.Value,
                    graphicalLongitudeAscendingNode.Value,
                    graphicalArgumentOfPeriapsis.Value,
                    graphicalMeanAnomaly.Value,
                    graphicalEpoch);

                currentlyEditing.ReInvokeOnSelect();
            };

            graphicalInclination = new SliderView("Inclination", "How close to the equator the orbit plane is", graphicalOnChange);
            graphicalEccentricity = new SliderView("Eccentricity", "How circular the orbit is", graphicalOnChange);
            graphicalPeriapsis = new SliderView("Periapsis", "Lowest point in the orbit", graphicalOnChange);
            graphicalLongitudeAscendingNode = new SliderView("Lon. of asc. node", "Longitude of the place where you cross the equator northwards", graphicalOnChange);
            graphicalArgumentOfPeriapsis = new SliderView("Argument of periapsis", "Rotation of the orbit around the normal", graphicalOnChange);
            graphicalMeanAnomaly = new SliderView("Mean anomaly", "Position along the orbit", graphicalOnChange);

            var graphical = new VerticalView(new IView[]
                {
                    graphicalInclination,
                    graphicalEccentricity,
                    graphicalPeriapsis,
                    graphicalLongitudeAscendingNode,
                    graphicalArgumentOfPeriapsis,
                    graphicalMeanAnomaly,
                    setToCurrentOrbit
                });
            #endregion

            #region Velocity
            var velocitySpeed = new TextBoxView<double>("Speed", "dV to apply", 0, Model.SiSuffix.TryParse);
            var velocityDirection = new ListSelectView<Model.OrbitEditor.VelocityChangeDirection>("Direction", () => Model.OrbitEditor.AllVelocityChanges);
            var velocityApply = new ConditionalView(() => velocitySpeed.Valid,
                                    new ButtonView("Apply", "Adds the selected velocity to the orbit", () =>
                    {
                        Model.OrbitEditor.Velocity(currentlyEditing.CurrentlySelected, velocityDirection.CurrentlySelected, velocitySpeed.Object);
                    }));
            var velocity = new VerticalView(new IView[]
                {
                    velocitySpeed,
                    velocityDirection,
                    velocityApply
                });
            #endregion

            #region Rendezvous
            var rendezvousLeadTime = new TextBoxView<double>("Lead time", "How many seconds off to rendezvous at (zero = on top of each other, bad)", 1, Model.SiSuffix.TryParse);
            var rendezvousVessel = new ListSelectView<Vessel>("Target vessel", () => FlightGlobals.fetch == null ? null : FlightGlobals.fetch.vessels, null, Extensions.VesselToString);
            var rendezvousApply = new ConditionalView(() => rendezvousLeadTime.Valid && rendezvousVessel.CurrentlySelected != null,
                                      new ButtonView("Apply", "Rendezvous", () =>
                    {
                        Model.OrbitEditor.Rendezvous(currentlyEditing.CurrentlySelected, rendezvousLeadTime.Object, rendezvousVessel.CurrentlySelected);
                    }));
            // rendezvous gets special ConditionalView to force only editing of planets
            var rendezvous = new ConditionalView(() => currentlyEditing.CurrentlySelected != null && currentlyEditing.CurrentlySelected.vessel != null,
                                 new VerticalView(new IView[]
                    {
                        rendezvousLeadTime,
                        rendezvousVessel,
                        rendezvousApply
                    }));
            #endregion

            #region CurrentlyEditing
            onCurrentlyEditingChange = newEditing =>
            {
                if (newEditing == null)
                {
                    return;
                }
                {
                    double altitude;
                    CelestialBody body;
                    Model.OrbitEditor.GetSimple(newEditing, out altitude, out body);
                    simpleAltitude.Object = altitude;
                    referenceSelector.CurrentlySelected = body;
                }
                {
                    double inclination;
                    double eccentricity;
                    double semiMajorAxis;
                    double longitudeAscendingNode;
                    double argumentOfPeriapsis;
                    double meanAnomalyAtEpoch;
                    double epoch;
                    CelestialBody body;
                    Model.OrbitEditor.GetComplex(newEditing,
                        out inclination,
                        out eccentricity,
                        out semiMajorAxis,
                        out longitudeAscendingNode,
                        out argumentOfPeriapsis,
                        out meanAnomalyAtEpoch,
                        out epoch,
                        out body);
                    complexInclination.Object = inclination;
                    complexEccentricity.Object = eccentricity;
                    complexSemiMajorAxis.Object = semiMajorAxis;
                    complexLongitudeAscendingNode.Object = longitudeAscendingNode;
                    complexArgumentOfPeriapsis.Object = argumentOfPeriapsis;
                    complexMeanAnomalyAtEpoch.Object = meanAnomalyAtEpoch;
                    complexEpoch.Object = epoch;
                    referenceSelector.CurrentlySelected = body;
                }
                {
                    double inclination;
                    double eccentricity;
                    double periapsis;
                    double longitudeAscendingNode;
                    double argumentOfPeriapsis;
                    double meanAnomaly;
                    Model.OrbitEditor.GetGraphical(newEditing,
                        out inclination,
                        out eccentricity,
                        out periapsis,
                        out longitudeAscendingNode,
                        out argumentOfPeriapsis,
                        out meanAnomaly,
                        out graphicalEpoch);
                    graphicalInclination.Value = inclination;
                    graphicalEccentricity.Value = eccentricity;
                    graphicalPeriapsis.Value = periapsis;
                    graphicalLongitudeAscendingNode.Value = longitudeAscendingNode;
                    graphicalArgumentOfPeriapsis.Value = argumentOfPeriapsis;
                    graphicalMeanAnomaly.Value = meanAnomaly;
                }
                {
                    Model.OrbitEditor.VelocityChangeDirection direction;
                    double speed;
                    Model.OrbitEditor.GetVelocity(newEditing, out direction, out speed);
                    velocityDirection.CurrentlySelected = direction;
                    velocitySpeed.Object = speed;
                }
            };

            currentlyEditing = new ListSelectView<OrbitDriver>("Currently editing", Model.OrbitEditor.OrderedOrbits, onCurrentlyEditingChange, Extensions.OrbitDriverToString);

            if (FlightGlobals.fetch != null && FlightGlobals.fetch.activeVessel != null && FlightGlobals.fetch.activeVessel.orbitDriver != null)
            {
                currentlyEditing.CurrentlySelected = FlightGlobals.fetch.activeVessel.orbitDriver;
            }
            #endregion

            var savePlanet = new ButtonView("Save planet", "Saves the current orbit of the planet to a file, so it stays edited even after a restart. Delete the file named the planet's name in " + IoExt.GetPath(null) + " to undo.",
                                 () => Model.PlanetEditor.SavePlanet(currentlyEditing.CurrentlySelected.celestialBody));
            var resetPlanet = new ButtonView("Reset to defaults", "Reset the selected planet to defaults",
                                  () => Model.PlanetEditor.ResetToDefault(currentlyEditing.CurrentlySelected.celestialBody));

            var planetButtons = new ConditionalView(() => currentlyEditing.CurrentlySelected?.celestialBody != null,
                                    new VerticalView(new IView[]
                    {
                        savePlanet,
                        resetPlanet
                    }));

            var tabs = new TabView(new List<KeyValuePair<string, IView>>()
                {
                    new KeyValuePair<string, IView>("Simple", simple),
                    new KeyValuePair<string, IView>("Complex", complex),
                    new KeyValuePair<string, IView>("Graphical", graphical),
                    new KeyValuePair<string, IView>("Velocity", velocity),
                    new KeyValuePair<string, IView>("Rendezvous", rendezvous),
                });

            return new VerticalView(new IView[]
                {
                    currentlyEditing,
                    planetButtons,
                    new ConditionalView(() => currentlyEditing.CurrentlySelected != null, tabs)
                });
        }
        void CreateUI()
        {
            stack = new StackLayout
            {
                Orientation     = StackOrientation.Vertical,
                WidthRequest    = App.ScreenSize.Width,
                HeightRequest   = App.ScreenSize.Height - 48,
                VerticalOptions = LayoutOptions.StartAndExpand
            };

            innerStack = new StackLayout
            {
                VerticalOptions     = LayoutOptions.Start,
                HorizontalOptions   = LayoutOptions.Start,
                Orientation         = StackOrientation.Horizontal,
                MinimumWidthRequest = App.ScreenSize.Width,
                WidthRequest        = App.ScreenSize.Width,
                HeightRequest       = App.ScreenSize.Height - 48,
            };

            var topbar = new TopBar(true, "", this, 1, "back_arrow", "", innerStack, true).CreateTopBar();

            stack.HeightRequest = App.ScreenSize.Height - topbar.HeightRequest;

            var titleBar = new Label
            {
                WidthRequest            = App.ScreenSize.Width,
                HeightRequest           = 48,
                MinimumHeightRequest    = 48,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                BackgroundColor         = FormsConstants.AppyBlue,
                TextColor = Color.White,
                Text      = Langs.Const_Menu_EmergencyAdvice
            };

            view1 = CreateView("icon_0", Langs.Const_Msg_SOS_Title_1, Langs.Const_Msg_SOS_Description_1, 1, .55);
            view2 = CreateView("icon_1", Langs.Const_Msg_SOS_Title_2, Langs.Const_Msg_SOS_Description_2, 1, .55);
            view3 = CreateView("icon_2", Langs.Const_Msg_SOS_Title_3, Langs.Const_Msg_SOS_Description_3, 1, .55);
            view4 = CreateView("icon_3", Langs.Const_Msg_SOS_Title_4, Langs.Const_Msg_SOS_Description_4, 1, .55);
            view5 = CreateView("icon_4", Langs.Const_Msg_SOS_Title_5, Langs.Const_Msg_SOS_Description_5, 1, .55);
            view6 = CreateView("icon_5", Langs.Const_Msg_SOS_Title_6, Langs.Const_Msg_SOS_Description_6, 1, .55);
            view7 = CreateView("icon_6", Langs.Const_Msg_SOS_Title_7, Langs.Const_Msg_SOS_Description_7, 1, .4);

            slider = new SliderView(view1, App.ScreenSize.Height * 0.62, App.ScreenSize.Width)
            {
                TransitionLength     = 200,
                MinimumSwipeDistance = 50
            };

            slider.Children.Add(view2);
            slider.Children.Add(view3);
            slider.Children.Add(view4);
            slider.Children.Add(view5);
            slider.Children.Add(view6);
            slider.Children.Add(view7);

            var btnSendSOS = ArrowBtn.ArrowButton(Langs.Const_Button_Send_Incident, App.ScreenSize.Width * .7,
                                                  new Action(() => ViewModel.SendSMS()));

            var dataStack = new StackLayout
            {
                WidthRequest      = App.ScreenSize.Width,
                HeightRequest     = App.ScreenSize.Height - 120,
                HorizontalOptions = LayoutOptions.Center,
                Children          =
                {
                    new Label   {
                        Text      = Langs.Const_Label_Guide_Steps, HorizontalTextAlignment = TextAlignment.Center, FontFamily = Helper.RegFont,
                        TextColor = Color.White, FontSize = 14
                    },
                    new BoxView {
                        WidthRequest = App.ScreenSize.Width, HeightRequest = 1, BackgroundColor = Color.White
                    },
                    slider,
                    new BoxView {
                        WidthRequest = App.ScreenSize.Width, HeightRequest = 1, BackgroundColor = Color.White
                    },
                    btnSendSOS
                }
            };

            stack.Children.Add(dataStack);

            innerStack.Children.Add(stack);

            var masterStack = new StackLayout
            {
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Start,
                Children          =
                {
                    new StackLayout
                    {
                        VerticalOptions   = LayoutOptions.Start,
                        HorizontalOptions = LayoutOptions.Start,
                        WidthRequest      = App.ScreenSize.Width,
                        Children          = { topbar }
                    },
                    new StackLayout
                    {
                        TranslationY = -6,
                        Children     = { titleBar    }
                    },
                    innerStack
                }
            };

            Content = masterStack;
        }
        protected SliderFeedCollectionViewCell(IntPtr handle) : base(handle)
        {
            _contentView = ContentView;

            _closeButton       = new UIButton();
            _closeButton.Frame = new CGRect(_contentView.Frame.Width - moreButtonWidth, 0, moreButtonWidth, likeButtonWidthConst);
            _closeButton.SetImage(UIImage.FromBundle("ic_close_black"), UIControlState.Normal);
            //_closeButton.BackgroundColor = UIColor.Yellow;
            _contentView.AddSubview(_closeButton);

            _moreButton       = new UIButton();
            _moreButton.Frame = new CGRect(_closeButton.Frame.Left - moreButtonWidth, 0, moreButtonWidth, likeButtonWidthConst);
            _moreButton.SetImage(UIImage.FromBundle("ic_more"), UIControlState.Normal);
            //_moreButton.BackgroundColor = UIColor.Black;
            _contentView.AddSubview(_moreButton);

            _avatarImage       = new UIImageView();
            _avatarImage.Frame = new CGRect(leftMargin, 20, 30, 30);
            _contentView.AddSubview(_avatarImage);

            authorX = _avatarImage.Frame.Right + 10;

            _author      = new UILabel(new CGRect(authorX, _avatarImage.Frame.Top - 2, _closeButton.Frame.Left - authorX, 18));
            _author.Font = Constants.Semibold14;
            //_author.BackgroundColor = UIColor.Yellow;
            _author.LineBreakMode = UILineBreakMode.TailTruncation;
            _author.TextColor     = Constants.R15G24B30;
            _contentView.AddSubview(_author);

            _timestamp      = new UILabel(new CGRect(authorX, _author.Frame.Bottom, _closeButton.Frame.Left - authorX, 16));
            _timestamp.Font = Constants.Regular12;
            //_timestamp.BackgroundColor = UIColor.Green;
            _timestamp.LineBreakMode = UILineBreakMode.TailTruncation;
            _timestamp.TextColor     = Constants.R151G155B158;
            _contentView.AddSubview(_timestamp);

            _contentScroll       = new UIScrollView();
            _contentScroll.Frame = new CGRect(0, _avatarImage.Frame.Bottom + 20, _contentView.Frame.Width,
                                              _contentView.Frame.Height - (_avatarImage.Frame.Bottom + 20));
            _contentScroll.ShowsVerticalScrollIndicator = false;
            _contentScroll.Bounces = false;
            //_contentScroll.BackgroundColor = UIColor.LightGray;
            _contentView.AddSubview(_contentScroll);

            _photoScroll = new UIScrollView();
            _photoScroll.ShowsHorizontalScrollIndicator = false;
            _photoScroll.Bounces       = false;
            _photoScroll.PagingEnabled = true;
            _photoScroll.Scrolled     += (sender, e) =>
            {
                var pageWidth = _photoScroll.Frame.Size.Width;
                _pageControl.CurrentPage = (int)Math.Floor((_photoScroll.ContentOffset.X - pageWidth / 2) / pageWidth) + 1;
            };
            _photoScroll.Layer.CornerRadius = 10;
            _contentScroll.AddSubview(_photoScroll);

            _pageControl        = new UIPageControl();
            _pageControl.Hidden = true;
            _pageControl.UserInteractionEnabled = false;
            _contentScroll.AddSubview(_pageControl);

            _likes                        = new UILabel();
            _likes.Font                   = Constants.Semibold14;
            _likes.LineBreakMode          = UILineBreakMode.TailTruncation;
            _likes.TextColor              = Constants.R15G24B30;
            _likes.UserInteractionEnabled = true;
            _contentScroll.AddSubview(_likes);
            //_likes.BackgroundColor = UIColor.Purple;

            _flags      = new UILabel();
            _flags.Font = Constants.Semibold14;
            //_flags.BackgroundColor = UIColor.Orange;
            _flags.LineBreakMode          = UILineBreakMode.TailTruncation;
            _flags.TextColor              = Constants.R15G24B30;
            _flags.UserInteractionEnabled = true;
            _contentScroll.AddSubview(_flags);

            _rewards      = new UILabel();
            _rewards.Font = Constants.Semibold14;
            //_rewards.BackgroundColor = UIColor.Orange;
            _rewards.LineBreakMode          = UILineBreakMode.TailTruncation;
            _rewards.TextColor              = Constants.R15G24B30;
            _rewards.UserInteractionEnabled = true;
            _contentScroll.AddSubview(_rewards);

            _like             = new UIImageView();
            _like.ContentMode = UIViewContentMode.Center;
            //_like.BackgroundColor = UIColor.Orange;
            _contentScroll.AddSubview(_like);

            _verticalSeparator = new UIView();
            _verticalSeparator.BackgroundColor = Constants.R244G244B246;
            _contentScroll.AddSubview(_verticalSeparator);

            _topSeparator = new UIView();
            _topSeparator.BackgroundColor = Constants.R244G244B246;
            _contentScroll.AddSubview(_topSeparator);

            _comments      = new UILabel();
            _comments.Font = Constants.Regular14;
            //_comments.BackgroundColor = UIColor.DarkGray;
            _comments.LineBreakMode          = UILineBreakMode.TailTruncation;
            _comments.TextColor              = Constants.R151G155B158;
            _comments.UserInteractionEnabled = true;
            _comments.TextAlignment          = UITextAlignment.Center;
            _contentScroll.AddSubview(_comments);

            _bottomSeparator = new UIView();
            _bottomSeparator.BackgroundColor = Constants.R244G244B246;
            _contentScroll.AddSubview(_bottomSeparator);

            _profileTapView = new UIView(new CGRect(0, 0, _contentView.Frame.Width / 2, likeButtonWidthConst));
            _profileTapView.UserInteractionEnabled = true;
            _contentView.AddSubview(_profileTapView);

            _likersTapView = new UIView();
            _likersTapView.UserInteractionEnabled = true;
            _contentScroll.AddSubview(_likersTapView);

            likersY            = underPhotoPanelHeight / 2 - likersImageSide / 2;
            likersCornerRadius = likersImageSide / 2;

            var liketap = new UITapGestureRecognizer(LikeTap);

            _like.AddGestureRecognizer(liketap);

            _sliderView          = new SliderView(_contentScroll.Frame.Width);
            _sliderView.LikeTap += () =>
            {
                LikeTap();
            };
            BaseViewController.SliderAction += (isOpening) =>
            {
                if (_sliderView.Superview != null && !isOpening)
                {
                    _sliderView.Close();
                }
            };

            var likelongtap = new UILongPressGestureRecognizer((UILongPressGestureRecognizer obj) =>
            {
                if (AppSettings.User.HasPostingPermission && !_currentPost.Vote)
                {
                    if (obj.State == UIGestureRecognizerState.Began)
                    {
                        if (!BasePostPresenter.IsEnableVote)
                        {
                            return;
                        }
                        BaseViewController.IsSliderOpen = true;
                        _sliderView.Show(_contentScroll);
                    }
                }
            });

            _like.AddGestureRecognizer(likelongtap);

            UITapGestureRecognizer tap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Preview, _currentPost);
            });

            _photoScroll.AddGestureRecognizer(tap);

            var profileTap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Profile, _currentPost);
            });
            var headerTap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Profile, _currentPost);
            });

            _profileTapView.AddGestureRecognizer(headerTap);
            _rewards.AddGestureRecognizer(profileTap);

            var commentTap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Comments, _currentPost);
            });

            _comments.AddGestureRecognizer(commentTap);

            var netVotesTap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Voters, _currentPost);
            });

            _likersTapView.AddGestureRecognizer(netVotesTap);

            var flagersTap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Flagers, _currentPost);
            });

            _flags.AddGestureRecognizer(flagersTap);

            _moreButton.TouchDown  += FlagButton_TouchDown;
            _closeButton.TouchDown += Close_TouchDown;
        }
Exemple #17
0
        protected CommentTableViewCell(IntPtr handle) : base(handle)
        {
            _avatar                    = new UIImageView();
            _avatar.ContentMode        = UIViewContentMode.ScaleAspectFill;
            _avatar.Layer.CornerRadius = 15;
            _avatar.ClipsToBounds      = true;
            ContentView.AddSubview(_avatar);
            _avatar.AutoSetDimensionsToSize(new CGSize(30, 30));
            _avatar.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 15);
            _avatar.AutoPinEdgeToSuperviewEdge(ALEdge.Top, 10);

            _loginLabel      = new UILabel();
            _loginLabel.Font = Constants.Semibold14;
            ContentView.AddSubview(_loginLabel);
            _loginLabel.AutoPinEdge(ALEdge.Left, ALEdge.Right, _avatar, 10);
            _loginLabel.AutoAlignAxis(ALAxis.Horizontal, _avatar);

            _timestamp           = new UILabel();
            _timestamp.Font      = Constants.Regular12;
            _timestamp.TextColor = Constants.R151G155B158;
            ContentView.AddSubview(_timestamp);
            _timestamp.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 14);
            _timestamp.AutoPinEdge(ALEdge.Left, ALEdge.Right, _loginLabel);
            _timestamp.SetContentHuggingPriority(251, UILayoutConstraintAxis.Horizontal);
            _timestamp.AutoAlignAxis(ALAxis.Horizontal, _avatar);

            _commentText                 = new UITextView();
            _commentText.Editable        = false;
            _commentText.ScrollEnabled   = false;
            _commentText.Font            = Constants.Regular14;
            _commentText.BackgroundColor = UIColor.Clear;
            ContentView.AddSubview(_commentText);
            _commentText.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, _avatar);
            _commentText.AutoPinEdge(ALEdge.Left, ALEdge.Left, _avatar, -4);

            _like                        = new UIImageView();
            _like.ContentMode            = UIViewContentMode.Center;
            _like.UserInteractionEnabled = true;
            ContentView.AddSubview(_like);
            _like.AutoSetDimensionsToSize(new CGSize(40, 50));
            _like.AutoAlignAxis(ALAxis.Horizontal, _commentText);
            _like.AutoPinEdge(ALEdge.Left, ALEdge.Right, _commentText);
            _like.AutoPinEdge(ALEdge.Right, ALEdge.Right, _timestamp, 11);

            _profileTapView = new UIView();
            _profileTapView.UserInteractionEnabled = true;
            ContentView.AddSubview(_profileTapView);
            _profileTapView.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            _profileTapView.AutoPinEdgeToSuperviewEdge(ALEdge.Top);
            _profileTapView.AutoPinEdge(ALEdge.Right, ALEdge.Right, _loginLabel);
            _profileTapView.AutoPinEdge(ALEdge.Bottom, ALEdge.Top, _commentText);

            _bottomView              = new UIStackView();
            _bottomView.Axis         = UILayoutConstraintAxis.Horizontal;
            _bottomView.Distribution = UIStackViewDistribution.Fill;
            _bottomView.Alignment    = UIStackViewAlignment.Leading;
            _bottomView.Spacing      = 19;
            ContentView.AddSubview(_bottomView);
            _bottomView.AutoSetDimension(ALDimension.Height, 50);
            _bottomView.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom);
            _bottomView.AutoPinEdge(ALEdge.Left, ALEdge.Left, _avatar);
            _bottomView.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, _commentText);
            _bottomView.AutoPinEdge(ALEdge.Right, ALEdge.Right, _timestamp);

            _replyLabel           = new UILabel();
            _replyLabel.Text      = "Reply";
            _replyLabel.Font      = Constants.Regular12;
            _replyLabel.TextColor = Constants.R151G155B158;
            _replyLabel.UserInteractionEnabled = true;
            _bottomView.AddArrangedSubview(_replyLabel);
            _replyLabel.SetContentHuggingPriority(251, UILayoutConstraintAxis.Horizontal);
            _replyLabel.SetContentCompressionResistancePriority(750, UILayoutConstraintAxis.Horizontal);

            _likesLabel           = new UILabel();
            _likesLabel.Font      = Constants.Regular12;
            _likesLabel.TextColor = Constants.R151G155B158;
            _likesLabel.UserInteractionEnabled = true;
            _bottomView.AddArrangedSubview(_likesLabel);
            _likesLabel.SetContentHuggingPriority(251, UILayoutConstraintAxis.Horizontal);

            _flagsLabel           = new UILabel();
            _flagsLabel.Font      = Constants.Regular12;
            _flagsLabel.TextColor = Constants.R151G155B158;
            _flagsLabel.UserInteractionEnabled = true;
            _bottomView.AddArrangedSubview(_flagsLabel);
            _flagsLabel.SetContentHuggingPriority(251, UILayoutConstraintAxis.Horizontal);

            _costLabel        = new UILabel();
            _costLabel.Font   = Constants.Regular12;
            _costLabel.Hidden = true;
#if DEBUG
            _costLabel.Hidden = false;
#endif
            _costLabel.TextColor = Constants.R151G155B158;
            _bottomView.AddArrangedSubview(_costLabel);
            _costLabel.SetContentHuggingPriority(251, UILayoutConstraintAxis.Horizontal);

            var hugView = new UIView();
            _bottomView.AddArrangedSubview(hugView);
            hugView.SetContentHuggingPriority(250, UILayoutConstraintAxis.Horizontal);

            var tap = new UITapGestureRecognizer(() =>
            {
                if (SwipeState == MGSwipeState.None)
                {
                    CellAction?.Invoke(ActionType.Profile, _currentPost);
                }
            });
            var costTap = new UITapGestureRecognizer(() =>
            {
                if (SwipeState == MGSwipeState.None)
                {
                    CellAction?.Invoke(ActionType.Profile, _currentPost);
                }
            });
            var replyTap = new UITapGestureRecognizer(() =>
            {
                if (SwipeState == MGSwipeState.None)
                {
                    CellAction?.Invoke(ActionType.Reply, _currentPost);
                }
            });
            var likersTap = new UITapGestureRecognizer(() =>
            {
                if (SwipeState == MGSwipeState.None)
                {
                    CellAction?.Invoke(ActionType.Voters, _currentPost);
                }
            });
            var flagersTap = new UITapGestureRecognizer(() =>
            {
                if (SwipeState == MGSwipeState.None)
                {
                    CellAction?.Invoke(ActionType.Flagers, _currentPost);
                }
            });
            _replyLabel.AddGestureRecognizer(replyTap);
            _profileTapView.AddGestureRecognizer(tap);
            _costLabel.AddGestureRecognizer(costTap);
            _likesLabel.AddGestureRecognizer(likersTap);
            _flagsLabel.AddGestureRecognizer(flagersTap);

            var liketap = new UITapGestureRecognizer(LikeTap);
            _like.AddGestureRecognizer(liketap);

            _sliderView          = new SliderView(UIScreen.MainScreen.Bounds.Width);
            _sliderView.LikeTap += () =>
            {
                LikeTap();
            };
            BaseViewController.SliderAction += (isSliderOpening) =>
            {
                if (_sliderView.Superview != null && !isSliderOpening)
                {
                    RightButtons = rigthButtons;
                    _sliderView.Close();
                }
            };

            var likelongtap = new UILongPressGestureRecognizer((UILongPressGestureRecognizer obj) =>
            {
                if (AppSettings.User.IsAuthenticated && !_currentPost.Vote)
                {
                    if (obj.State == UIGestureRecognizerState.Began)
                    {
                        if (!BasePostPresenter.IsEnableVote || BaseViewController.IsSliderOpen)
                        {
                            return;
                        }
                        rigthButtons = RightButtons;
                        RightButtons = new UIView[0];

                        _sliderView.Frame = new CGRect(4, ContentView.Frame.Height / 2 - 35, UIScreen.MainScreen.Bounds.Width - 8, 70);

                        BaseViewController.IsSliderOpen = true;
                        _sliderView.Show(this);
                    }
                }
            });
            _like.AddGestureRecognizer(likelongtap);

            RightSwipeSettings.Transition = MGSwipeTransition.Border;

            deleteButton = MGSwipeButton.ButtonWithTitle("", UIImage.FromBundle("ic_delete"), UIColor.FromRGB(250, 250, 250), 26, (tableCell) =>
            {
                CellAction?.Invoke(ActionType.Delete, _currentPost);
                return(true);
            });

            editButton = MGSwipeButton.ButtonWithTitle("", UIImage.FromBundle("ic_edit"), UIColor.FromRGB(250, 250, 250), 26, (arg0) =>
            {
                CellAction?.Invoke(ActionType.Edit, _currentPost);
                _currentPost.Editing        = true;
                ContentView.BackgroundColor = UIColor.FromRGB(255, 235, 143).ColorWithAlpha(0.5f);
                return(true);
            });

            flagButton = MGSwipeButton.ButtonWithTitle("", UIImage.FromBundle("ic_flag"), UIColor.FromRGB(250, 250, 250), 26, (arg0) =>
            {
                CellAction?.Invoke(ActionType.Flag, _currentPost);
                return(true);
            });
        }
Exemple #18
0
        public FeedCellBuilder(UIView contentView)
        {
            _contentView = contentView;

            _moreButton       = new UIButton();
            _moreButton.Frame = new CGRect(_contentView.Frame.Width - moreButtonWidth, 0, moreButtonWidth, likeButtonWidthConst);
            _moreButton.SetImage(UIImage.FromBundle("ic_more"), UIControlState.Normal);
            //_moreButton.BackgroundColor = UIColor.Black;
            _contentView.AddSubview(_moreButton);

            _avatarImage = new UIImageView(new CGRect(leftMargin, 20, 30, 30));
            _contentView.AddSubview(_avatarImage);

            var authorX = _avatarImage.Frame.Right + 10;

            _author      = new UILabel(new CGRect(authorX, _avatarImage.Frame.Top - 2, _moreButton.Frame.Left - authorX, 18));
            _author.Font = Constants.Semibold14;
            //_author.BackgroundColor = UIColor.Yellow;
            _author.LineBreakMode = UILineBreakMode.TailTruncation;
            _author.TextColor     = Constants.R15G24B30;
            _contentView.AddSubview(_author);

            _timestamp      = new UILabel(new CGRect(authorX, _author.Frame.Bottom, _moreButton.Frame.Left - authorX, 16));
            _timestamp.Font = Constants.Regular12;
            //_timestamp.BackgroundColor = UIColor.Green;
            _timestamp.LineBreakMode = UILineBreakMode.TailTruncation;
            _timestamp.TextColor     = Constants.R151G155B158;
            _contentView.AddSubview(_timestamp);

            _photoScroll = new UIScrollView();
            _photoScroll.ShowsHorizontalScrollIndicator = false;
            _photoScroll.Bounces       = false;
            _photoScroll.PagingEnabled = true;
            _photoScroll.Scrolled     += (sender, e) =>
            {
                var pageWidth = _photoScroll.Frame.Size.Width;
                _pageControl.CurrentPage = (int)Math.Floor((_photoScroll.ContentOffset.X - pageWidth / 2) / pageWidth) + 1;
            };
            contentView.AddSubview(_photoScroll);

            _pageControl        = new UIPageControl();
            _pageControl.Hidden = true;
            _pageControl.UserInteractionEnabled = false;
            contentView.AddSubview(_pageControl);

            _likes                        = new UILabel();
            _likes.Font                   = Constants.Semibold14;
            _likes.LineBreakMode          = UILineBreakMode.TailTruncation;
            _likes.TextColor              = Constants.R15G24B30;
            _likes.UserInteractionEnabled = true;
            _contentView.AddSubview(_likes);

            _flags      = new UILabel();
            _flags.Font = Constants.Semibold14;
            //_flags.BackgroundColor = UIColor.Orange;
            _flags.LineBreakMode          = UILineBreakMode.TailTruncation;
            _flags.TextColor              = Constants.R15G24B30;
            _flags.UserInteractionEnabled = true;
            _contentView.AddSubview(_flags);

            _rewards      = new UILabel();
            _rewards.Font = Constants.Semibold14;
            //_rewards.BackgroundColor = UIColor.Orange;
            _rewards.LineBreakMode          = UILineBreakMode.TailTruncation;
            _rewards.TextColor              = Constants.R15G24B30;
            _rewards.UserInteractionEnabled = true;
            _contentView.AddSubview(_rewards);

            _like             = new UIImageView();
            _like.ContentMode = UIViewContentMode.Center;
            _contentView.AddSubview(_like);

            _verticalSeparator = new UIView();
            _verticalSeparator.BackgroundColor = Constants.R244G244B246;
            _contentView.AddSubview(_verticalSeparator);

            _topSeparator = new UIView();
            _topSeparator.BackgroundColor = Constants.R244G244B246;
            _contentView.AddSubview(_topSeparator);

            var _noLinkAttribute = new UIStringAttributes
            {
                Font            = Constants.Regular14,
                ForegroundColor = Constants.R151G155B158,
            };

            var at = new NSMutableAttributedString();

            at.Append(new NSAttributedString("...", _noLinkAttribute));

            _attributedLabel = new TTTAttributedLabel();
            _attributedLabel.EnabledTextCheckingTypes = NSTextCheckingType.Link;
            var prop = new NSDictionary();

            _attributedLabel.LinkAttributes       = prop;
            _attributedLabel.ActiveLinkAttributes = prop;
            _attributedLabel.Font  = Constants.Regular14;
            _attributedLabel.Lines = 3;
            _attributedLabel.UserInteractionEnabled = true;
            _attributedLabel.Enabled = true;
            _attributedLabel.AttributedTruncationToken = at;
            //_attributedLabel.BackgroundColor = UIColor.Blue;
            _contentView.AddSubview(_attributedLabel);

            _comments      = new UILabel();
            _comments.Font = Constants.Regular14;
            //_comments.BackgroundColor = UIColor.DarkGray;
            _comments.LineBreakMode          = UILineBreakMode.TailTruncation;
            _comments.TextColor              = Constants.R151G155B158;
            _comments.UserInteractionEnabled = true;
            _comments.TextAlignment          = UITextAlignment.Center;
            _contentView.AddSubview(_comments);

            _bottomSeparator = new UIView();
            _bottomSeparator.BackgroundColor = Constants.R244G244B246;
            _contentView.AddSubview(_bottomSeparator);

            _profileTapView = new UIView(new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width / 2, likeButtonWidthConst));
            _profileTapView.UserInteractionEnabled = true;
            _contentView.AddSubview(_profileTapView);

            _likersTapView = new UIView();
            _likersTapView.UserInteractionEnabled = true;
            _contentView.AddSubview(_likersTapView);

            likersY            = underPhotoPanelHeight / 2 - likersImageSide / 2;
            likersCornerRadius = likersImageSide / 2;

            var liketap = new UITapGestureRecognizer(LikeTap);

            _like.AddGestureRecognizer(liketap);

            _sliderView          = new SliderView(UIScreen.MainScreen.Bounds.Width);
            _sliderView.LikeTap += () =>
            {
                LikeTap();
            };
            BaseViewController.SliderAction += (isSliderOpening) =>
            {
                if (_sliderView.Superview != null && !isSliderOpening)
                {
                    _sliderView.Close();
                }
            };

            var likelongtap = new UILongPressGestureRecognizer((UILongPressGestureRecognizer obj) =>
            {
                if (AppSettings.User.IsAuthenticated && !_currentPost.Vote)
                {
                    if (obj.State == UIGestureRecognizerState.Began)
                    {
                        if (!BasePostPresenter.IsEnableVote || BaseViewController.IsSliderOpen)
                        {
                            return;
                        }
                        BaseViewController.IsSliderOpen = true;
                        _sliderView.Show(_contentView);
                    }
                }
            });

            _like.AddGestureRecognizer(likelongtap);

            UITapGestureRecognizer tap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Preview, _currentPost);
            });

            _photoScroll.AddGestureRecognizer(tap);

            var profileTap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Profile, _currentPost);
            });
            var headerTap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Profile, _currentPost);
            });

            _profileTapView.AddGestureRecognizer(headerTap);
            _rewards.AddGestureRecognizer(profileTap);

            var commentTap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Comments, _currentPost);
            });

            _comments.AddGestureRecognizer(commentTap);

            var netVotesTap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Voters, _currentPost);
            });

            _likersTapView.AddGestureRecognizer(netVotesTap);

            var flagersTap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Flagers, _currentPost);
            });

            _flags.AddGestureRecognizer(flagersTap);

            _moreButton.TouchDown += FlagButton_TouchDown;
        }