private BaseLayout createHeader()
        {
            LinearLayout horizontal = new LinearLayout();

            horizontal.setDirection(LinearLayout.Direction.HORIZONTAL);
            horizontal.setSizeParams(new SizeParams(MATCH_PARENT, WRAP_CONTENTS));

            TextBoxLayout logoText = new TextBoxLayout();

            logoText.text = "{DIFF}";
            logoText.setSizeParams(new SizeParams(WRAP_CONTENTS, WRAP_CONTENTS));
            logoText.textColor = uiWhite;
            logoText.textSize  = 10;

            ColoredLayout blankSpace = new ColoredLayout();

            blankSpace.setSizeParams(new SizeParams(5, MATCH_PARENT));
            blankSpace.color = new Color(0, 0, 0, 0);

            TextBoxLayout headerText = new TextBoxLayout();

            headerText.text      = "JSON Comparison Tool";
            headerText.textColor = new Color(150, 150, 150);
            headerText.setSizeParams(new SizeParams(WRAP_CONTENTS, WRAP_CONTENTS));
            headerText.setPositionParams(new PositionParams(CENTER, CENTER));

            horizontal.addChild(blankSpace);
            horizontal.addChild(logoText);
            horizontal.addChild(blankSpace);
            horizontal.addChild(headerText);

            return(horizontal);
        }
        private BaseLayout createJsonHeaderLayout(string text)
        {
            Color headerBlue = new Color(0, 122, 204);

            LinearLayout verticalLayout = new LinearLayout();

            verticalLayout.setSizeParams(new SizeParams(MATCH_PARENT, WRAP_CONTENTS));

            CustomPlacementLayout space = new CustomPlacementLayout();

            space.setSizeParams(new SizeParams(100, 20));
            space.color = headerBlue;

            TextBoxLayout headerText = new TextBoxLayout();

            headerText.text = text;
            headerText.setSizeParams(new SizeParams(WRAP_CONTENTS, WRAP_CONTENTS));
            headerText.setPositionParams(new PositionParams(5, CENTER));
            headerText.textColor = uiWhite;

            space.addChild(headerText);

            ColoredLayout horizontalDivider = new ColoredLayout();

            horizontalDivider.setSizeParams(new SizeParams(MATCH_PARENT, 3));
            horizontalDivider.color = headerBlue;

            verticalLayout.addChild(space);
            verticalLayout.addChild(horizontalDivider);

            return(verticalLayout);
        }
        private LinearLayout createKeysLayout()
        {
            LinearLayout keyVertical = new LinearLayout();

            keyVertical.setSizeParams(new SizeParams(MATCH_PARENT, MATCH_PARENT));
            keyVertical.setDirection(Direction.HORIZONTAL);
            keyVertical.invertDirection = true;

            LinearLayout linearLayout = new LinearLayout();

            linearLayout.setSizeParams(new SizeParams(FILL, FILL));

            keyList = new LinearLayout();
            keyList.setSizeParams(new SizeParams(MATCH_PARENT, WRAP_CONTENTS));

            linearLayout.addItem(keyList);

            ButtonLayout addButton = new ButtonLayout();

            addButton.setSizeParams(new SizeParams(30, 30));
            addButton.color = new Color(50, 50, 50);
            addButton.setPositionParams(new PositionParams(CENTER, CENTER));
            addButton.color = buttonBlue;

            TextBoxLayout text = new TextBoxLayout();

            text.setSizeParams(new SizeParams(WRAP_CONTENTS, WRAP_CONTENTS));
            text.text = "Add Key";
            text.setPositionParams(new PositionParams(CENTER, CENTER));
            text.textColor = uiWhite;

            addButton.setOnClickListener(() =>
            {
                addKey();
            });

            addKey();

            linearLayout.addItem(addButton);

            ColoredLayout verticalDivider = new ColoredLayout();

            verticalDivider.setSizeParams(new SizeParams(2, MATCH_PARENT));
            verticalDivider.color = new Color(63, 63, 70);

            keyVertical.addChild(verticalDivider);
            keyVertical.addChild(linearLayout);

            return(keyVertical);
        }
        private BaseLayout createBody()
        {
            LinearLayout horizontal = new LinearLayout();

            horizontal.setDirection(LinearLayout.Direction.HORIZONTAL);
            horizontal.setSizeParams(new SizeParams(MATCH_PARENT, FILL));

            CustomPlacementLayout keysHeader = new CustomPlacementLayout();

            keysHeader.setSizeParams(new SizeParams(MATCH_PARENT, 30));

            TextBoxLayout headerText = new TextBoxLayout();

            headerText.text = "Comparison Keys";
            headerText.setSizeParams(new SizeParams(WRAP_CONTENTS, WRAP_CONTENTS));
            headerText.setPositionParams(new PositionParams(5, 4));
            headerText.textColor = uiWhite;

            keysHeader.addChild(headerText);

            ColoredLayout greyBody = new ColoredLayout();

            greyBody.setSizeParams(new SizeParams(MATCH_PARENT, MATCH_PARENT));
            greyBody.color = new Color(90, 90, 90);

            ColoredLayout dargerGreyBody = new ColoredLayout();

            dargerGreyBody.setSizeParams(new SizeParams(MATCH_PARENT, MATCH_PARENT));
            dargerGreyBody.color = new Color(70, 70, 70);

            SizeParams thirdWidthSizeParams = new SizeParams();

            thirdWidthSizeParams.Width  = 250;
            thirdWidthSizeParams.Height = MATCH_PARENT;

            LinearLayout keysColumn = new LinearLayout();

            keysColumn.setSizeParams(thirdWidthSizeParams);
            keysColumn.addItem(keysHeader);
            keysColumn.addItem(createKeysLayout());
            horizontal.addItem(keysColumn);

            BaseLayout switchableSection = createContentLayout();

            switchableSection.setSizeParams(new SizeParams(MATCH_PARENT, MATCH_PARENT));

            horizontal.addItem(switchableSection);

            return(horizontal);
        }
        private BaseLayout createSwitchViewLayout()
        {
            CustomPlacementLayout space = new CustomPlacementLayout();

            space.setSizeParams(new SizeParams(MATCH_PARENT, 125));
            space.color = new Color(37, 37, 38);

            ButtonLayout button = new ButtonLayout();

            button.setSizeParams(new SizeParams(WRAP_CONTENTS, WRAP_CONTENTS));
            button.setPositionParams(new PositionParams(CENTER, CENTER));
            button.color = buttonBlue;

            TextBoxLayout text = new TextBoxLayout();

            text.setSizeParams(new SizeParams(WRAP_CONTENTS, WRAP_CONTENTS));
            text.text = "See Results";
            text.setPositionParams(new PositionParams(CENTER, CENTER));
            text.textColor = uiWhite;

            button.setContents(text);
            button.setOnClickListener(() =>
            {
                if (inputMode)
                {
                    contentHolder.removeChild(jsonInput);
                    contentHolder.addChild(jsonResultLayout);
                    text.text = "Change Input";
                }
                else
                {
                    contentHolder.removeChild(jsonResultLayout);
                    contentHolder.addChild(jsonInput);
                    text.text = "See Results";
                }

                inputMode = !inputMode;
            });

            space.AddItem(button);

            return(space);
        }
        private BaseLayout createKeyLayout()
        {
            int marginSize = 10;

            LinearLayout horizontalStack = new LinearLayout();

            horizontalStack.setDirection(LinearLayout.Direction.HORIZONTAL);
            horizontalStack.setSizeParams(new SizeParams(FILL, WRAP_CONTENTS));
            horizontalStack.invertDirection = true;

            ButtonLayout deleteButton = new ButtonLayout();

            deleteButton.setSizeParams(new SizeParams(25, MATCH_PARENT));
            deleteButton.color = buttonRed;

            TextBoxLayout delText = new TextBoxLayout();

            delText.setSizeParams(new SizeParams(WRAP_CONTENTS, WRAP_CONTENTS));
            delText.text     = "X";
            delText.textSize = 11;

            deleteButton.setContents(delText);

            ColoredLayout blankLeftMargin = new ColoredLayout();

            blankLeftMargin.color.a = 0;
            blankLeftMargin.setSizeParams(new SizeParams(marginSize, 0));

            keyEditText           = new EditTextLayout();
            keyEditText.edgeColor = LayoutLoader.buttonBlue;
            keyEditText.setSizeParams(new SizeParams(FILL, 22));
            keyEditText.singleLine = true;
            keyEditText.susbcribeToTextChanges(() =>
            {
                if (onKeyChanged != null)
                {
                    onKeyChanged();
                }
            });

            horizontalStack.addItem(blankLeftMargin);
            horizontalStack.addItem(deleteButton);

            horizontalStack.addItem(blankLeftMargin);
            horizontalStack.addItem(keyEditText);

            LinearLayout leftLay = new LinearLayout();

            leftLay.setSizeParams(new SizeParams(FILL, WRAP_CONTENTS));
            leftLay.setDirection(Direction.HORIZONTAL);
            leftLay.addItem(blankLeftMargin);
            leftLay.addItem(horizontalStack);

            ColoredLayout blankTopMargin = new ColoredLayout();

            blankTopMargin.color.a = 0;
            blankTopMargin.setSizeParams(new SizeParams(0, marginSize));

            LinearLayout topLay = new LinearLayout();

            topLay.setSizeParams(new SizeParams(FILL, WRAP_CONTENTS));
            topLay.setDirection(Direction.VERTICAL);
            topLay.invertDirection = true;

            topLay.addItem(blankTopMargin);
            topLay.addItem(leftLay);

            deleteButton.metaData = topLay;
            deleteButton.setOnClickListener(() =>
            {
                if (onKeyDeletePressed != null)
                {
                    onKeyDeletePressed();
                }
            });

            return(topLay);
        }
Пример #7
0
        public Styling()
        {
            normalGrid        = new GridLayout();
            normalGrid.width  = 950;
            normalGrid.height = 450;
            normalGrid.margin = new Thickness(0);

            textLayout            = new TextLayout();
            textLayout.fontFamily = new FontFamily("Cambria");

            imageLayout        = new ImageLayout();
            imageLayout.width  = 500;
            imageLayout.height = 250;
            imageLayout.margin = new Thickness(100, 50, 100, 50); //<----

            normalButton        = new ButtonLayout();
            normalButton.width  = 200;
            normalButton.height = 50;
            normalButton.margin = new Thickness(5); //<----

            menuButton        = new ButtonLayout();
            menuButton.width  = 250;
            menuButton.height = 50;
            menuButton.margin = new Thickness(0); //<----

            backButton        = new ButtonLayout();
            backButton.width  = 200;
            backButton.height = 50;
            backButton.margin = new Thickness(0); //<----

            textBoxLayout        = new TextBoxLayout();
            textBoxLayout.width  = 200;
            textBoxLayout.height = 25;
            textBoxLayout.margin = new Thickness(0); //<----

            normalLabel          = new LabelLayout();
            normalLabel.width    = 200;
            normalLabel.height   = 25;
            normalLabel.margin   = new Thickness(0); //<----
            normalLabel.fontSize = 12;

            titleLabel          = new LabelLayout();
            titleLabel.width    = 500;
            titleLabel.height   = 50;
            titleLabel.margin   = new Thickness(10);
            titleLabel.fontSize = 24;

            mainMenuStackPanel        = new StackLayout();
            mainMenuStackPanel.width  = 750;
            mainMenuStackPanel.height = 50;
            mainMenuStackPanel.margin = new Thickness(0, 37.5, 0, 37.5); //<----

            calculateStackPanel        = new StackLayout();
            calculateStackPanel.width  = 500;
            calculateStackPanel.height = 50;
            calculateStackPanel.margin = new Thickness(0, 0, 0, 0);

            inputFieldLayout        = new StackLayout();
            inputFieldLayout.width  = 50;
            inputFieldLayout.height = 200;
            inputFieldLayout.margin = new Thickness(0, 0, 0, 0);
        }