Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Commit

Permalink
fix: NavigationBarItem action property (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
dantes-git authored Mar 4, 2022
1 parent 8d93a70 commit 8f3fb11
Show file tree
Hide file tree
Showing 24 changed files with 139 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,23 @@ data class SafeArea(
*
* @param text defines the description for the item
* @param image defines the local image for the item
* @param action defines an action to be called when the item is clicked on
* @param onPress defines an action list to be called when the item is clicked on
* @param accessibility defines the accessibility details for the item
*
*/

data class NavigationBarItem(
val text: String,
val image: Bind<String>?,
val action: Action,
val onPress: List<Action>,
val accessibility: Accessibility? = null
) {
constructor(
text: String,
image: String? = null,
action: Action,
onPress: List<Action>,
accessibility: Accessibility? = null,
) : this(text, constantNullable(image), action, accessibility)
) : this(text, constantNullable(image), onPress, accessibility)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ object AccessibilityScreenBuilder : ScreenBuilder {
NavigationBarItem(
text = "",
image = "informationImage",
action = Alert(
title = "Accessibility Screen",
message = "This method applies accessibility in a widget",
labelOk = "OK"
onPress = listOf(
Alert(
title = "Accessibility Screen",
message = "This method applies accessibility in a widget",
labelOk = "OK"
)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ object ActionScreenBuilder : ScreenBuilder {
NavigationBarItem(
text = "",
image = "informationImage",
action = Alert(
title = "Action",
message = "This class handles transition actions between screens in the application. ",
labelOk = "OK"
onPress = listOf(
Alert(
title = "Action",
message = "This class handles transition actions between screens in the application. ",
labelOk = "OK"
)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@ object ButtonScreenBuilder : ScreenBuilder {
NavigationBarItem(
text = "",
image = "informationImage",
action = Alert(
title = "Button",
message = "This is a widget that will define a button natively using the server " +
"driven information received through Beagle.",
labelOk = "OK"
onPress = listOf(
Alert(
title = "Button",
message = "This is a widget that will define a button natively using the server " +
"driven information received through Beagle.",
labelOk = "OK"
)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ object ComposeScreenBuilder : ScreenBuilder {
NavigationBarItem(
text = "",
image = "informationImage",
action = Alert(
title = "Compose Component",
message = "Creates components to call in different places.",
labelOk = "OK"
onPress = listOf(
Alert(
title = "Compose Component",
message = "Creates components to call in different places.",
labelOk = "OK"
)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ object ImageLocalScreenBuilder : ScreenBuilder {
NavigationBarItem(
text = "",
image = expressionOf("@{context.informationImage}"),
action = Alert(
title = "Image",
message = "This widget will define a image view natively using the server driven " +
"information received through Beagle.",
labelOk = "OK"
onPress = listOf(
Alert(
title = "Image",
message = "This widget will define a image view natively using the server driven " +
"information received through Beagle.",
labelOk = "OK"
)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ class ImageRemoteScreenBuilder(private val imagePath: String) : ScreenBuilder {
NavigationBarItem(
text = "",
image = "informationImage",
action = Alert(
title = "Image Remote",
message = "It is a widget that implements an image with a URL.",
labelOk = "OK"
onPress = listOf(
Alert(
title = "Image Remote",
message = "It is a widget that implements an image with a URL.",
labelOk = "OK"
)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ object LazyComponentScreenBuilder : ScreenBuilder {
NavigationBarItem(
text = "",
image = "informationImage",
action = Alert(
title = "Lazy Component",
message = "A widget that implements loading.",
labelOk = "OK"
onPress = listOf(
Alert(
title = "Lazy Component",
message = "A widget that implements loading.",
labelOk = "OK"
)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ object ListViewScreenBuilder : ScreenBuilder {
NavigationBarItem(
text = "",
image = "informationImage",
action = Alert(
title = "ListView",
message = "Is a Layout component that will define a list of views natively. " +
"These views could be any Server Driven Component.",
labelOk = "OK"
onPress = listOf(
Alert(
title = "ListView",
message = "Is a Layout component that will define a list of views natively. " +
"These views could be any Server Driven Component.",
labelOk = "OK"
)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ class MyScreenBuilder(private val title: String) : ScreenBuilder {
NavigationBarItem(
text = "",
image = "informationImage",
action = Alert(
title = "Screen",
message = "This component description and attribute details",
labelOk = "OK"
onPress = listOf(
Alert(
title = "Screen",
message = "This component description and attribute details",
labelOk = "OK"
)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ object NavigationBarViewScreenBuilder : ScreenBuilder {
text = "Ajuda",
accessibility = Accessibility(accessibilityLabel = "Content Description"),
image = "informationImage",
action = Alert(
title = "NavigationBar",
message = "This component that allows to place titles and button action.",
labelOk = "OK"
onPress = listOf(
Alert(
title = "NavigationBar",
message = "This component that allows to place titles and button action.",
labelOk = "OK"
)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ object PageViewScreenBuilder : ScreenBuilder {
NavigationBarItem(
text = "",
image = "informationImage",
action = Alert(
title = "PageView",
message = "This component is a specialized container " +
"to hold pages (views) that may be swiped.",
labelOk = "OK"
onPress = listOf(
Alert(
title = "PageView",
message = "This component is a specialized container " +
"to hold pages (views) that may be swiped.",
labelOk = "OK"
)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ object SampleViewScreenBuilder : ScreenBuilder {
NavigationBarItem(
text = "First",
image = "delete",
action = Navigate.PopToView(PATH_SAMPLE_VIEW_ENDPOINT)
onPress = listOf(Navigate.PopToView(PATH_SAMPLE_VIEW_ENDPOINT))
),
NavigationBarItem(
text = "Second",
image = "question",
action = Navigate.PopView()
onPress = listOf(Navigate.PopView())
)
)
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ object ScrollViewScreenBuilder : ScreenBuilder {
NavigationBarItem(
text = "",
image = "informationImage",
action = Alert(
title = "ScrollView",
message = "This component is a specialized container that will display its " +
"components in a Scroll like view.",
labelOk = "OK"
onPress = listOf(
Alert(
title = "ScrollView",
message = "This component is a specialized container that will display its " +
"components in a Scroll like view.",
labelOk = "OK"
)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ object SimpleFormScreenBuilder : ScreenBuilder {
NavigationBarItem(
text = "",
image = "informationImage",
action = Alert(
title = "SimpleForm",
message = "A SubmitForm action will define a submit handler in a form.",
labelOk = "OK"
onPress = listOf(
Alert(
title = "SimpleForm",
message = "A SubmitForm action will define a submit handler in a form.",
labelOk = "OK"
)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ object TabBarScreenBuilder : ScreenBuilder {
NavigationBarItem(
text = "",
image = "informationImage",
action = Alert(
title = "TabBar",
message = " Is a component that will make the navigation between views. It may happen by " +
"sliding through screens or by clicking at the tabs shown. ",
labelOk = "OK"
onPress = listOf(
Alert(
title = "TabBar",
message = " Is a component that will make the navigation between views. It may happen by " +
"sliding through screens or by clicking at the tabs shown. ",
labelOk = "OK"
)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ object TextInputBuilder : ScreenBuilder {
NavigationBarItem(
text = "",
image = "informationImage",
action = Alert(
title = "Text Input",
message = "This widget will define a Text Input view natively using the server driven " +
"information received through Beagle.",
labelOk = "OK"
onPress = listOf(
Alert(
title = "Text Input",
message = "This widget will define a Text Input view natively using the server driven " +
"information received through Beagle.",
labelOk = "OK"
)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ object TextScreenBuilder : ScreenBuilder {
NavigationBarItem(
text = "",
image = "informationImage",
action = Alert(
title = "Text",
message = "This widget will define a text view natively using the server driven " +
"information received through Beagle.",
labelOk = "OK"
onPress = listOf(
Alert(
title = "Text",
message = "This widget will define a text view natively using the server driven " +
"information received through Beagle.",
labelOk = "OK"
)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ object TouchableScreenBuilder : ScreenBuilder {
NavigationBarItem(
text = "",
image = "informationImage",
action = Alert(
title = "Touchable",
message = "Applies click action on widgets that have no action.",
labelOk = "OK"
onPress = listOf(
Alert(
title = "Touchable",
message = "Applies click action on widgets that have no action.",
labelOk = "OK"
)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ object WebViewScreenBuilder : ScreenBuilder {
NavigationBarItem(
text = "",
image = "informationImage",
action = Alert(
title = "Web View",
message = "The Web View component is responsible for defining a web view natively " +
"using server driven information",
labelOk = "OK"
onPress = listOf(
Alert(
title = "Web View",
message = "The Web View component is responsible for defining a web view natively " +
"using server driven information",
labelOk = "OK"
)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class SampleNavigationBarService {
navigationBarItems = listOf(
NavigationBarItem(
text = "Entrar",
action = Navigate.PushView(Route.Remote(SCREEN_ACTION_CLICK_ENDPOINT))
onPress = listOf(Navigate.PushView(Route.Remote(SCREEN_ACTION_CLICK_ENDPOINT)))
)
)
)
Expand All @@ -59,7 +59,7 @@ class SampleNavigationBarService {
NavigationBarItem(
text = "",
image = LOGO_BEAGLE,
action = Navigate.PushView(Route.Remote(SCREEN_ACTION_CLICK_ENDPOINT))
onPress = listOf(Navigate.PushView(Route.Remote(SCREEN_ACTION_CLICK_ENDPOINT)))
)
)
)
Expand Down
Loading

0 comments on commit 8f3fb11

Please sign in to comment.