This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"screens": [ | |
{ | |
"id": "ROOT", | |
"screenProperties": {}, | |
"layout": { | |
"wide": {}, | |
"compact": { | |
"type": "SingleColumnLayout", | |
"main": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SectionComponentType(SectionComponentType.TITLE) | |
class TitleSectionComponent : SectionComponent<TitleSection>() { | |
override fun buildSectionUI(section: TitleSection) { | |
// Build title UI elements | |
if (!section.subtitle.isNullOrEmpty() { | |
Text( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface IAction {} | |
# A simple action that will navigate the user to the screen matching the screenId when invoked | |
type NavigateToScreen implements IAction { | |
screenId: String | |
} | |
# A sample TitleSection using an IAction type to handle the click of the subtitle | |
type TitleSection { | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface ILayout {} | |
type SectionDetail { | |
# References a SectionContainer in the GPResponse.sections array | |
sectionId: String | |
# Styling data | |
topPadding: Int | |
bottomPadding: Int | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ScreenContainer { | |
id: String | |
# Properties such as how to launch this screen (popup, sheet, etc.) | |
screenProperties: ScreenProperties | |
layout: LayoutsPerFormFactor | |
} | |
# Specifies the ILayout type depending on rotation, client screen density, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This annotation builds a Map<SectionComponentType, SectionComponent> that GP uses to render sections | |
@SectionComponentType(SectionComponentType.TITLE) | |
class TitleSectionComponent : SectionComponent<TitleSection>() { | |
// Developers override this method and build UI from TitleSection corresponding to TITLE | |
override fun buildSectionUI(section: TitleSection) { | |
// Text() Turns our title into a styled TextView | |
Text( | |
text = section.title, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example sections | |
type HeroSection { | |
# Image urls | |
images: [String]! | |
} | |
type TitleSection { | |
title: String!, | |
titleStyle: TextStyle! | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface GPResponse { | |
sections: [SectionContainer] | |
screens: [ScreenContainer] | |
# ... Other metadata, logging data or feature-specific logic | |
} |