You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tutorials/sdk-android-wizard-app-customize/sdk-android-wizard-app-customize.md
+47-47Lines changed: 47 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,27 +68,31 @@ In this section, you will configure the object cell to display a product's name,
68
68
69
69
1. In Android Studio, on Windows, press **`Ctrl+shift+N`**, or on a Mac, press **`command+shift+O`**. Type **`ProductEntitiesScreen`** to open `ProductEntitiesScreen.kt`.
70
70
71
-
2. On Windows, press **`Ctrl+F`**, or on a Mac, press **`command+F`**, and type **`viewModel.getEntityTitle(entity)`** to navigate to the line `headline = viewModel.getEntityTitle(entity),`. Change this line to `headline = entity.getOptionalValue(Product.name).toString(),`. This will display the product name as the headline value of the object cell.
71
+
2. On Windows, press **`Ctrl+F`**, or on a Mac, press **`command+F`**, and type **`viewModel.getEntityTitle(entity)`** to navigate to the line `setHeadline(viewModel.getEntityTitle(entity))`. Change this line to `setHeadline(entity.getOptionalValue(Product.name).toString())`. This will display the product name as the headline value of the object cell.
72
72
73
73
If the class `Product` appears in red, it indicates that Android Studio could not locate the class. Select the class, and on Windows press **`Alt+Enter`**, or on a Mac, press **`option+return`** to use Android Studio's quick fix to add the missing imports.
74
74
75
-
Alternatively, you can enable the following setting: Windows: **Settings**; Mac: **Android Studio > Settings...**
75
+
Alternatively, you can open the settings screen: Windows: **Settings**; Mac: **Android Studio > Settings...**. Then go to **Editor > General > Auto Import**, enable **Add unambiguous imports on the fly** in the `Kotlin` section.
76
76
77
-

78
-
79
-
3. In the same code block, replace `subheadline` and `footnote`, and add `status` with the following code, which will display the category, description, and price.
77
+
3. In the same code block, replace `setSubheadline` and `setFootnote`, and add `setStatusInfoLabel` with the following code, which will display the category, description, and price.
4. On Windows, press **`Ctrl+F`**, or on a Mac, press **`command+F`**, and type **`FioriObjectCell`** to navigate to the `FioriObjectCell` invocation.
90
94
91
-
5. Add the following code right after `FioriObjectCell`, and add it right before `if (entities.loadState.refresh == LoadState.Loading)`, to add a divider between the product items.
95
+
5. Add the following code right after `FioriObjectCell` invocation, and add it right before `if (entities.loadState.refresh == LoadState.Loading)` at the same time, to add a divider between the product items.
92
96
93
97
```Kotlin
94
98
FioriDivider()
@@ -165,9 +169,7 @@ In this section, you will configure the object cell to display a product's name,
165
169
166
170
If the classes `LinearLayoutManager` and `DividerItemDecoration` appear in red, it indicates that Android Studio could not locate them. Select each class, and on Windows, press **`Alt+Enter`**, or on a Mac, press **`option+return`** to use Android Studio's quick fix to add the missing imports.
167
171
168
-
Alternatively, you can enable the following setting: Windows: **Settings**; Mac: **Android Studio > Settings...**
169
-
170
-

172
+
Alternatively, you can enable the following setting: Windows: **Settings**; Mac: **Android Studio > Settings...**. Then go to **Editor > General > Auto Import**, enable **Add unambiguous imports on the fly** in the `Kotlin` section.
171
173
172
174
6. On Windows, press **`Ctrl+N`**, or on a Mac, press **`command+O`**, and type **`Repository`** to open `Repository.kt`.
173
175
@@ -223,7 +225,7 @@ In this section, you will update the screen's title, configure the object cell t
223
225
224
226
7. On Windows, press **`Ctrl+F`**, or on a Mac, press **`command+F`**, and type **`FioriObjectCell`** to navigate to the `FioriObjectCell` invocation.
225
227
226
-
8. Add the following code right after `FioriObjectCell` and add it right before `if (entities.loadState.refresh == LoadState.Loading)`, which adds a divider between categories:
228
+
8. Add the following code right after `FioriObjectCell` invocation and add it right before `if (entities.loadState.refresh == LoadState.Loading)` at the same time, which adds a divider between categories:
227
229
228
230
```Kotlin
229
231
FioriDivider()
@@ -234,14 +236,20 @@ In this section, you will update the screen's title, configure the object cell t
234
236
10. Replace the value of `objectCellData` with the following to display the main category instead, hide the footnote, and show the number of products per category.
11. Run the app again. You'll see that the **title**, **subheadline**, and **status** are now displayed, while the **icon** and **footnote** are no longer visible.
@@ -366,7 +374,9 @@ In this section, you will modify the app to initially show the **Product Categor
366
374
367
375
3. On Windows, press **`Ctrl+N`**, or on a Mac, press **`command+O`**, and type **`ODataViewModel`**, to open `ODataViewModel.kt`.
368
376
369
-
4. Replace the `onFloatingAdd` function with the following code:
377
+
4. On Windows, press **`Ctrl+F12`**, or on a Mac, press **`command+F12`**, and type **`onFloatingAdd`**, to navigate to `onFloatingAdd` method.
378
+
379
+
5. Replace the `onFloatingAdd` function with the following code:
370
380
371
381
```Kotlin
372
382
//return create action when nav property value is list type or null, or entitySet is singleton and entity screen is not empty
@@ -389,15 +399,15 @@ In this section, you will modify the app to initially show the **Product Categor
389
399
}
390
400
```
391
401
392
-
5. On Windows, press **`Ctrl+Shift+N`**, or on a Mac, press **`command+Shift+O`**, and type **`ProductEntitiesScreen`**, to open `ProductEntitiesScreen.kt`.
402
+
6. On Windows, press **`Ctrl+Shift+N`**, or on a Mac, press **`command+Shift+O`**, and type **`ProductEntitiesScreen`**, to open `ProductEntitiesScreen.kt`.
393
403
394
-
6. Add a variable to retrive the selected category name from `ODataViewModel`:
404
+
7. Add a variable in the method body to retrive the selected category name from `ODataViewModel`:
395
405
396
406
```Kotlin
397
407
val category = (viewModel.parent as? ProductCategory)?.categoryName
398
408
```
399
409
400
-
7. On Windows, press **`Ctrl+F`**, or on a Mac, press **`command+F`**, and type **`return@items`** to locate the line `val entity = entities[index] ?: return@items`. Immediately after this line, add the following code to filter the products list to display only the products for the selected category:
410
+
8. On Windows, press **`Ctrl+F`**, or on a Mac, press **`command+F`**, and type **`return@items`** to locate the line `val entity = entities[index] ?: return@items`. Immediately after this line, add the following code to filter the products list to display only the products for the selected category:
401
411
402
412
```Kotlin
403
413
category?.also {
@@ -407,9 +417,9 @@ In this section, you will modify the app to initially show the **Product Categor
407
417
}
408
418
```
409
419
410
-
8. On Windows, press **`Ctrl+Shift+N`**, or on a Mac, press **`command+Shift+O`**, and type **`ODataNavHost`**, to open `ODataNavHost.kt`.
420
+
9. On Windows, press **`Ctrl+Shift+N`**, or on a Mac, press **`command+Shift+O`**, and type **`ODataNavHost`**, to open `ODataNavHost.kt`.
411
421
412
-
9. Replace the `if (!uiState.isEntityFocused)` block with the following:
422
+
10. Replace the `if (!uiState.isEntityFocused)` block with the following:
413
423
414
424
```Kotlin
415
425
if (!uiState.isEntityFocused) {
@@ -434,7 +444,7 @@ In this section, you will modify the app to initially show the **Product Categor
434
444
435
445
You can navigate to the **EntityList** screen by pressing the **Back** button on the **Product Categories** screen. The **EntityList** screen retains the **Settings** menu for convenience.
436
446
437
-
10. Replace the `EntityOperationType.DETAIL` code block with the following, which will enable the navigation from the Category list screen to the Product list screen.
447
+
11. Replace the `EntityOperationType.DETAIL` code block with the following, which will enable the navigation from the Category list screen to the Product list screen.
438
448
439
449
```Kotlin
440
450
EntityOperationType.DETAIL -> if (viewModel.entityType == ESPMContainerMetadata.EntityTypes.productCategory) {
@@ -454,7 +464,7 @@ In this section, you will modify the app to initially show the **Product Categor
454
464
}
455
465
```
456
466
457
-
11. Replace the `viewModel` of `composable(route = EntityNavigationCommands(entityType).entityListNav.route)` with the following `viewModel` so that the product screen can retrieve the selected category name:
467
+
12. Replace the `viewModel` of `composable(route = EntityNavigationCommands(entityType).entityListNav.route)` with the following `viewModel` so that the product screen can retrieve the selected category name:
458
468
459
469
```Kotlin
460
470
val viewModel: ODataViewModel = viewModel(
@@ -472,19 +482,19 @@ In this section, you will modify the app to initially show the **Product Categor
472
482
)
473
483
```
474
484
475
-
12. On Windows, press **`Ctrl+Shift+N`**, or on a Mac, press **`command+Shift+O`**, and type **`ProductCategoryEntitiesScreen`**, to open `ProductCategoryEntitiesScreen.kt`.
485
+
13. On Windows, press **`Ctrl+Shift+N`**, or on a Mac, press **`command+Shift+O`**, and type **`ProductCategoryEntitiesScreen`**, to open `ProductCategoryEntitiesScreen.kt`.
476
486
477
-
13. Set `floatingActionClick` in `OperationScreenSettings` of `OperationScreen` to **`null`** instead of `viewModel.onFloatingAdd()`.
487
+
14. Set `floatingActionClick` in `OperationScreenSettings` of `OperationScreen` to **`null`** instead of `viewModel.onFloatingAdd()`.
478
488
479
-
14. On Windows, press **`Ctrl+Shift+N`**, or on a Mac, press **`command+Shift+O`**, and type **`EntityScreenCommonUI`**, to open `EntityScreenCommonUI.kt`.
489
+
15. On Windows, press **`Ctrl+Shift+N`**, or on a Mac, press **`command+Shift+O`**, and type **`EntityScreenCommonUI`**, to open `EntityScreenCommonUI.kt`.
480
490
481
-
15. Find the `ActionItem` of `R.string.menu_home` and change its overflowMode to the following:
491
+
16. Find the `ActionItem` of `R.string.menu_home` and change its overflowMode to the following:
16. Run the app again. You'll see that the **Product Categories** screen is now the first screen displayed, the **Home** menu is no longer visible, and selecting a category shows the products list screen, which now displays only the products for that selected category.
497
+
17. Run the app again. You'll see that the **Product Categories** screen is now the first screen displayed, the **Home** menu is no longer visible, and selecting a category shows the products list screen, which now displays only the products for that selected category.
488
498
489
499

490
500
@@ -585,8 +595,6 @@ In this section you will add a search field to **Product Categories** screen, al
585
595
586
596
1. First, right-click the `res/drawable` folder to create a new **Drawable Resource File** **`ic_search_icon.xml`**, and use the following XML content.
587
597
588
-

@@ -765,8 +773,6 @@ In this section you will add a search field to **Product Categories** screen, al
765
773
766
774
1. First, right-click the `res/drawable` folder to create a new **Drawable Resource File** **`ic_search_icon.xml`**, and use the following XML content.
767
775
768
-

@@ -784,8 +790,6 @@ In this section you will add a search field to **Product Categories** screen, al
784
790
785
791
2. Right-click the `res/menu` folder to add a new **Menu Resource File** named **`product_categories_menu.xml`**, and use the following XML for its contents.
786
792
787
-

@@ -892,9 +896,7 @@ In this section, you will add a Top Products section to the **Products** screen,
892
896
893
897
First, we'll generate additional sales data in the sample OData service.
894
898
895
-
1. In **SAP Mobile Services cockpit**, navigate to **Mobile Applications** > **Native/MDK** > **com.sap.wizapp** and go to **Mobile Sample OData ESPM**.
896
-
897
-

899
+
1. In **SAP Mobile Services cockpit**, navigate to **Mobile Applications** > **Native/MDK** > **btp.sdk.wizapp** and go to **Sample OData ESPM**.
898
900
899
901
2. Change the **Entity Sets** dropdown to **`SalesOrderItems`** and then click the **generate sample sales orders** icon five times. This will create additional sales order items, which we can use to base our top products on, based on the quantity sold.
900
902
@@ -1050,9 +1052,7 @@ In this section, you will add a Top Products section to the **Products** screen,
1050
1052
1051
1053
First, we'll generate additional sales data in the sample OData service.
1052
1054
1053
-
1. In **SAP Mobile Services cockpit**, navigate to **Mobile Applications** > **Native/Hybrid** > **com.sap.wizapp** and go to **Mobile Sample OData ESPM**.
1054
-
1055
-

1055
+
1. In **SAP Mobile Services cockpit**, navigate to **Mobile Applications** > **Native/Hybrid** > **btp.sdk.wizapp** and go to **Sample OData ESPM**.
1056
1056
1057
1057
2. Change the **Entity Sets** dropdown to **`SalesOrderItems`** and then click the **generate sample sales orders** icon five times. This will create additional sales order items, which we can use to base our top products on, based on the quantity sold.
Copy file name to clipboardExpand all lines: tutorials/sdk-android-wizard-app-logging/sdk-android-wizard-app-logging.md
+4-8Lines changed: 4 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,8 +104,6 @@ time: 15
104
104
105
105
5. Navigate back to the entity list screen, then back into the **Settings** screen to see the effect of changing the log level.
106
106
107
-

108
-
109
107
6. Examine the **Logcat** (located at the bottom of the Android Studio screen, click it and you can see the logs). In the filter, add the name of the class that we are interested in seeing the log from: **`com.sap.wizapp.ui.odata.viewmodel.SettingsViewModel`**.
110
108
111
109
Notice that the messages were logged since the log level of the app was set to **Debug** or **Path**.
@@ -138,8 +136,6 @@ The SDK libraries also log output based on the app's log level.
138
136
139
137
5. Navigate back to the entity list screen, then back into the **Settings** screen to see the effect of changing the log level.
140
138
141
-

142
-
143
139
6. Examine the **Logcat** (located at the bottom of the Android Studio screen, click it and you can see the logs). In the filter, add the name of the class that we are interested in seeing the log from: **`com.sap.wizapp.mdui.EntitySetListActivity`**.
144
140
145
141
Notice that the messages were logged since the log level of the app was set to **Debug** or **Path**.
@@ -169,9 +165,9 @@ The SDK libraries also log output based on the app's log level.
169
165
170
166

171
167
172
-
2. In the **MobileServices cockpit**, navigate to **MobileApplications**>**Native/MDK**>**com.sap.wizapp**>**MobileClientLogUpload**.
168
+
2. In the **MobileServices cockpit**, navigate to **MobileApplications**>**Native/MDK**>**btp.sdk.wizapp**>**ClientLogUpload**.
3. Select the **ErrorLogs** tab and you will see the log you just uploaded in the **Error** level list. If the log doesn't appear immediately, wait for a few moments, then click **Go** to refresh the view.
177
173
@@ -199,9 +195,9 @@ The SDK libraries also log output based on the app's log level.
199
195
200
196

201
197
202
-
2. In the **Mobile Services cockpit**, navigate to **Mobile Applications** > **Native/MDK** > **com.sap.wizapp** > **Mobile Client Log Upload**.
198
+
2. In the **Mobile Services cockpit**, navigate to **Mobile Applications** > **Native/MDK** > **btp.sdk.wizapp** > **Client Log Upload**.
3. Select the **Error Logs** tab and you will see the log you just uploaded in the **Error** level list. If the log doesn't appear immediately, wait for a few moments, then click **Go** to refresh the view.
0 commit comments