File tree 1 file changed +35
-2
lines changed
1 file changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -206,15 +206,48 @@ let product: StoriesPromoCodeElement?
206
206
```
207
207
208
208
```kotlin
209
+
210
+ // Initialization by adding code into layout
211
+ < com .personalizatio.stories.views.StoriesView
212
+ android:layout_width ="match_parent "
213
+ android:layout_height ="wrap_content "
214
+ app:code ="STORY BLOCK CODE " />
215
+
216
+ val storiesView = findViewById< StoriesView > (R.id.stories_view)
217
+ sdk.initializeStoriesView(storiesView)
218
+
219
+ // Programmatic initialization
220
+ val storiesView = StoriesView(this, "STORY BLOCK CODE")
221
+ findViewById< ViewGroup > (R.id.stories).addView(storiesView)
222
+ sdk.initializeStoriesView(storiesView)
223
+
224
+ //Font setup
209
225
val stories = findViewById< StoriesView > (R.id.story_view)
210
226
stories.settings.apply {
211
227
label_font_size = 16
212
228
label_font_family = Typeface.SERIF
213
229
button_font_family = Typeface.MONOSPACE
214
230
products_button_font_family = Typeface.DEFAULT_BOLD
215
231
}
216
- ```
217
- ```
232
+
233
+ // Set item click listener:
234
+ val storiesView = findViewById< StoriesView > (R.id.stories_view)
235
+ storiesView.itemClickListener = object : OnLinkClickListener {
236
+ override fun onClick(url: String): Boolean {
237
+ // return true if need to opening using the SDK
238
+ return false
239
+ }
240
+
241
+ override fun onClick(product: Product): Boolean {
242
+ // return true if need to opening using the SDK
243
+ return false
244
+ }
245
+ }
246
+
247
+ // Show story by id:
248
+
249
+ sdk.showStory(STORY_ID)
250
+
218
251
219
252
// TextBlock
220
253
You can’t perform that action at this time.
0 commit comments