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 createView() { CustomPlacementLayout backgroundFrame = new CustomPlacementLayout(); backgroundFrame.setSizeParams(new SizeParams(MATCH_PARENT, MATCH_PARENT)); ColoredLayout background = new ColoredLayout(); background.color = new Color(45, 45, 48); background.setSizeParams(new SizeParams(MATCH_PARENT, MATCH_PARENT)); backgroundFrame.addChild(background); ColoredLayout horizontalDivider = new ColoredLayout(); horizontalDivider.setSizeParams(new SizeParams(MATCH_PARENT, 2)); horizontalDivider.color = new Color(63, 63, 70); ColoredLayout blankSpace = new ColoredLayout(); blankSpace.setSizeParams(new SizeParams(MATCH_PARENT, 6)); blankSpace.color = new Color(0, 0, 0, 0); LinearLayout vertical = new LinearLayout(); vertical.setSizeParams(new SizeParams(MATCH_PARENT, MATCH_PARENT)); vertical.addChild(blankSpace); vertical.addChild(createHeader()); vertical.addChild(blankSpace); vertical.addChild(horizontalDivider); vertical.addChild(createBody()); backgroundFrame.addChild(vertical); return(backgroundFrame); }
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 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); }