@@ -14,6 +14,7 @@ import android.support.v7.widget.DividerItemDecoration
14
14
import android.text.TextUtils
15
15
import android.view.View
16
16
import android.widget.ImageView
17
+ import android.widget.LinearLayout
17
18
import android.widget.TextView
18
19
import com.microsoft.fluentui.listitem.ListItemDivider
19
20
import com.microsoft.fluentui.listitem.ListItemView
@@ -140,6 +141,39 @@ class ListItemViewActivity : DemoActivity() {
140
141
)
141
142
)
142
143
144
+ val twoLineCustomSecondarySubtitleSection = createSection(
145
+ createListSubHeader(getString(R .string.list_item_sub_header_two_line_custom_secondary_subtitle)),
146
+ arrayListOf (
147
+ createListItem(
148
+ getString(R .string.list_item_title),
149
+ getString(R .string.list_item_subtitle),
150
+ customView = createExampleCustomView(smallIcon),
151
+ customViewSize = ListItemView .CustomViewSize .SMALL ,
152
+ customSecondarySubtitleView = createExampleCustomSecondarySubtitleView(),
153
+ layoutDensity = ListItemView .LayoutDensity .COMPACT
154
+ ),
155
+ createListItem(
156
+ getString(R .string.list_item_title),
157
+ getString(R .string.list_item_subtitle),
158
+ customView = createExampleCustomView(smallIcon),
159
+ customViewSize = ListItemView .CustomViewSize .SMALL ,
160
+ customAccessoryView = createExampleCustomView(overflowIcon),
161
+ customSecondarySubtitleView = createExampleCustomSecondarySubtitleView(),
162
+ addCustomAccessoryViewClick = true ,
163
+ layoutDensity = ListItemView .LayoutDensity .COMPACT
164
+ ),
165
+ createListItem(
166
+ getString(R .string.list_item_title),
167
+ getString(R .string.list_item_subtitle),
168
+ customView = createExampleAvatarView(R .drawable.avatar_wanda_howard),
169
+ customViewSize = ListItemView .CustomViewSize .MEDIUM ,
170
+ customAccessoryView = createExampleTextView(),
171
+ customSecondarySubtitleView = createExampleCustomSecondarySubtitleView(),
172
+ layoutDensity = ListItemView .LayoutDensity .COMPACT
173
+ )
174
+ )
175
+ )
176
+
143
177
// Three-line list example
144
178
145
179
val threeLineSection = createSection(
@@ -276,7 +310,7 @@ class ListItemViewActivity : DemoActivity() {
276
310
)
277
311
)
278
312
279
- val twoLineListSections = twoLineSection + twoLineDenseSection
313
+ val twoLineListSections = twoLineSection + twoLineDenseSection + twoLineCustomSecondarySubtitleSection
280
314
val layoutVariantSections = noCustomViewSection + largeHeaderSection + truncationSection + wrappingSection
281
315
return (singleLineSection + twoLineListSections + threeLineSection + layoutVariantSections) as ArrayList <IBaseListItem >
282
316
}
@@ -319,6 +353,7 @@ class ListItemViewActivity : DemoActivity() {
319
353
customView : View ? = null,
320
354
customViewSize : ListItemView .CustomViewSize = DEFAULT_CUSTOM_VIEW_SIZE ,
321
355
customAccessoryView : View ? = null,
356
+ customSecondarySubtitleView : View ? = null,
322
357
addCustomAccessoryViewClick : Boolean = false,
323
358
layoutDensity : ListItemView .LayoutDensity = DEFAULT_LAYOUT_DENSITY ,
324
359
wrap : Boolean = false
@@ -331,6 +366,7 @@ class ListItemViewActivity : DemoActivity() {
331
366
item.customAccessoryView = customAccessoryView
332
367
item.customView = customView
333
368
item.customViewSize = customViewSize
369
+ item.customSecondarySubtitleView = customSecondarySubtitleView
334
370
335
371
if (wrap) {
336
372
item.titleMaxLines = 4
@@ -376,4 +412,18 @@ class ListItemViewActivity : DemoActivity() {
376
412
avatarView.name = getString(avatarNameStringId)
377
413
return avatarView
378
414
}
415
+
416
+ private fun createExampleCustomSecondarySubtitleView (): LinearLayout {
417
+ val dotTextView = TextView (this )
418
+ dotTextView.text = " . "
419
+
420
+ val secondarySubtitleTextView = TextView (this )
421
+ TextViewCompat .setTextAppearance(secondarySubtitleTextView, R .style.TextAppearance_DemoListItemSubtitle )
422
+ secondarySubtitleTextView.text = getString(R .string.list_item_secondary_subtitle)
423
+
424
+ val linearLayout = LinearLayout (this )
425
+ linearLayout.addView(dotTextView)
426
+ linearLayout.addView(secondarySubtitleTextView)
427
+ return linearLayout
428
+ }
379
429
}
0 commit comments