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 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); }