Skip to content

Commit 01d9452

Browse files
Merge pull request #291541 from pavelprystinka/pavelprystinka/add_header_custom_buttons
Add header custom button sample
2 parents d5954c2 + 6ecba7a commit 01d9452

File tree

5 files changed

+54
-8
lines changed

5 files changed

+54
-8
lines changed

articles/communication-services/concepts/ui-library/includes/mobile-ui-use-cases.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ To ensure a consistent call experience, we recommend that you integrate Fluent U
191191
- **User testing**: Conduct user testing to ensure that the customizations meet user needs and don't confuse or overwhelm them.
192192
- **Feedback mechanism**: Adding buttons like **Report Issue** ensure that a robust back-end system is available to handle the feedback collected. Reuse the [mechanism that UI Library provides by default](../../../tutorials/collecting-user-feedback/collecting-user-feedback.md).
193193

194-
For more information, see [Customize the button bar](../../../how-tos/ui-library-sdk/button-injection.md).
194+
For more information, see [Customize buttons](../../../how-tos/ui-library-sdk/button-injection.md).
195195

196196
### Skip setup screen
197197

articles/communication-services/how-tos/ui-library-sdk/button-injection.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ ms.date: 08/01/2024
1212
ms.custom: template-how-to
1313
zone_pivot_groups: acs-plat-ios-android
1414

15-
#Customer intent: As a developer, I want to customize the button bar actions in the UI Library.
15+
#Customer intent: As a developer, I want to customize button actions in the UI Library.
1616
---
1717

18-
# Customize the button bar
18+
# Customize buttons
1919

2020
To implement custom actions or modify the current button layout, you can interact with the Native UI Library's API. This API involves defining custom button configurations, specifying actions, and managing the button bar's current actions. The API provides methods for adding custom actions, and removing existing buttons, all of which are accessible via straightforward function calls.
2121

articles/communication-services/how-tos/ui-library-sdk/includes/button-injection/android.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ms.service: azure-communication-services
1010

1111
## Remove buttons
1212

13-
`CallCompositeCallScreenControlBarOptions`, allow the flexibility to customize the button bar by removing specific buttons such as camera, microphone, and audio controls. This API allows you to tailor the user interface according to their specific application requirements and user experience design. Just set the `visible` or `enabled` to `false` for the `CallCompositeButtonViewData` to hide or disable button.
13+
`CallCompositeCallScreenControlBarOptions`, allow the flexibility to customize buttons by removing specific buttons such as camera, microphone, and audio controls. This API allows you to tailor the user interface according to their specific application requirements and user experience design. Just set the `visible` or `enabled` to `false` for the `CallCompositeButtonViewData` to hide or disable button.
1414

1515
:::image type="content" source="../../media/remove-button-experience.png" alt-text="Screenshot that shows the experience removing buttons in the UI Library.":::
1616

@@ -78,6 +78,22 @@ cameraButton.setVisible(true);
7878

7979
#### [Kotlin](#tab/kotlin)
8080
```kotlin
81+
82+
// Custom header button
83+
val headerCustomButton =
84+
CallCompositeCustomButtonViewData(
85+
"headerCustomButton",
86+
R.drawable.my_header_button_icon,
87+
"My header button",
88+
fun(it: CallCompositeCustomButtonClickEvent) {
89+
// process my button onClick
90+
}
91+
)
92+
93+
val headerOptions = CallCompositeCallScreenHeaderViewData()
94+
.setCustomButtons(listOf(headerCustomButton))
95+
96+
// Custom control bar button
8197
val controlBarOptions = CallCompositeCallScreenControlBarOptions()
8298

8399
controlBarOptions.setCustomButtons(
@@ -94,6 +110,7 @@ controlBarOptions.setCustomButtons(
94110
)
95111

96112
val callScreenOptions = CallCompositeCallScreenOptions()
113+
.setHeaderViewData(headerOptions)
97114
.setControlBarOptions(controlBarOptions)
98115

99116
val localOptions = CallCompositeLocalOptions()
@@ -107,6 +124,22 @@ callComposite.launch(context, locator, localOptions)
107124

108125
#### [Java](#tab/java)
109126
```java
127+
// Custom header button
128+
List<CallCompositeCustomButtonViewData> headerCustomButtons = new ArrayList<>();
129+
headerCustomButtons.add(
130+
new CallCompositeCustomButtonViewData(
131+
"headerCustomButton",
132+
R.drawable.my_header_button_icon,
133+
"My header button",
134+
eventArgs -> {
135+
// process my button onClick
136+
}
137+
)
138+
);
139+
CallCompositeCallScreenHeaderViewData headerOptions = new CallCompositeCallScreenHeaderViewData()
140+
.setCustomButtons(headerCustomButtons);
141+
142+
// Custom control bar button
110143
CallCompositeCallScreenControlBarOptions controlBarOptions = new CallCompositeCallScreenControlBarOptions();
111144

112145
List<CallCompositeCustomButtonViewData> customButtons = new ArrayList<>();
@@ -124,6 +157,7 @@ customButtons.add(
124157
controlBarOptions.setCustomButtons(customButtons);
125158

126159
CallCompositeCallScreenOptions callScreenOptions = new CallCompositeCallScreenOptions()
160+
.setHeaderViewData(headerOptions)
127161
.setControlBarOptions(controlBarOptions);
128162

129163
CallCompositeLocalOptions localOptions = new CallCompositeLocalOptions()

articles/communication-services/how-tos/ui-library-sdk/includes/button-injection/ios.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ms.service: azure-communication-services
1111

1212
## Remove or disable buttons
1313

14-
`CallScreenControlBarOptions`, allow the flexibility to customize the button bar by removing specific buttons such as camera, microphone, and audio controls. This API allows you to tailor the user interface according to their specific application requirements and user experience design. Just set the `visible` or `enabled` to `false` for the `ButtonViewData` to hide or disable button.
14+
`CallScreenControlBarOptions`, allow the flexibility to customize buttons by removing specific buttons such as camera, microphone, and audio controls. This API allows you to tailor the user interface according to their specific application requirements and user experience design. Just set the `visible` or `enabled` to `false` for the `ButtonViewData` to hide or disable button.
1515

1616
:::image type="content" source="../../media/remove-button-experience.png" alt-text="Screenshot that shows the experience removing buttons in the UI Library.":::
1717

@@ -42,16 +42,28 @@ cameraButton.visible = true
4242
:::image type="content" source="../../media/add-button-experience.png" alt-text="Screenshot that shows the experienc when you add a new button the UI Library.":::
4343

4444
```swift
45+
// Custom header button
46+
let headerCustomButton = CustomButtonViewData(image: UIImage(named: "...")!,
47+
title: "My header button") {_ in
48+
// Process my button onClick
49+
}
50+
let callScreenHeaderViewData = CallScreenHeaderViewData(
51+
customButtons: [headerCustomButton]
52+
)
53+
54+
// Custom control bar button
4555
let customButton = CustomButtonViewData(image: UIImage(named: "...")!,
46-
title: "My button") {_ in
56+
title: "My button") {_ in
4757
// Process my button onClick
4858
}
4959

5060
let callScreenControlBarOptions = CallScreenControlBarOptions(
5161
customButtons: [customButton]
5262
)
5363

54-
let callScreenOptions = CallScreenOptions(controlBarOptions: callScreenControlBarOptions)
64+
let callScreenOptions = CallScreenOptions(
65+
controlBarOptions: callScreenControlBarOptions, headerViewData: callScreenHeaderViewData)
66+
5567
let localOptions = LocalOptions(callScreenOptions: callScreenOptions)
5668

5769
let callComposite = CallComposite(credential: credential)

articles/communication-services/toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ items:
445445
href: how-tos/ui-library-sdk/closed-captions.md
446446
- name: Configure theming
447447
href: how-tos/ui-library-sdk/theming.md
448-
- name: Customize the button bar
448+
- name: Customize buttons
449449
href: how-tos/ui-library-sdk/button-injection.md
450450
- name: Customize the title and subtitle
451451
href: how-tos/ui-library-sdk/setup-title-subtitle.md

0 commit comments

Comments
 (0)