Back to Home

ESO Lua File v101044

ingame/housetours/gamepad/housetours_gamepad.lua

[◄ back to folders ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
ZO_GAMEPAD_HOUSE_TOURS_LISTING_PANEL_TEXTURE_SQUARE_DIMENSION = 1024
ZO_GAMEPAD_HOUSE_TOURS_LISTING_PANEL_TEXTURE_COORD_RIGHT = ZO_GAMEPAD_QUADRANT_2_3_CONTENT_BACKGROUND_WIDTH / ZO_GAMEPAD_HOUSE_TOURS_LISTING_PANEL_TEXTURE_SQUARE_DIMENSION
local HOUSE_TOURS_MODES =
{
    OVERVIEW = 1,
    RECOMMENDED = 2,
    BROWSE = 3,
    FAVORITES = 4,
    MANAGE_LISTINGS = 5,
    SELECT_HOME = 6,
}
local PRESERVE_SELECTIONS = true
local SUPPRESS_CALLBACKS = true
local TAGS_DROPDOWN_WIDTH_OFFSET = 130
-----------------------------
--Tags Filter Header Focus
-----------------------------
ZO_HouseTours_Tags_Filter_Header_Focus_Gamepad = ZO_InitializingCallbackObject:Subclass()
function ZO_HouseTours_Tags_Filter_Header_Focus_Gamepad:Initialize(control)
    self.control = control
    self.dropdown:SetDropdownWidthOffset(TAGS_DROPDOWN_WIDTH_OFFSET)
    self.active = false
    self.enabled = true
end
function ZO_HouseTours_Tags_Filter_Header_Focus_Gamepad:Activate()
    self.active = true
    self:Update()
    self:FireCallbacks("FocusActivated")
end
function ZO_HouseTours_Tags_Filter_Header_Focus_Gamepad:Enable()
    self.enabled = true
    self:Update()
end
function ZO_HouseTours_Tags_Filter_Header_Focus_Gamepad:Deactivate()
    self.active = false
    self:Update()
    self:FireCallbacks("FocusDeactivated")
end
function ZO_HouseTours_Tags_Filter_Header_Focus_Gamepad:Disable()
    self.enabled = false
    self:Update()
end
function ZO_HouseTours_Tags_Filter_Header_Focus_Gamepad:Update()
    local normalColor = self.enabled and ZO_GAMEPAD_UNSELECTED_COLOR or ZO_GAMEPAD_DISABLED_UNSELECTED_COLOR
    local highlightColor = self.enabled and ZO_GAMEPAD_SELECTED_COLOR or ZO_GAMEPAD_DISABLED_SELECTED_COLOR
    self.dropdown:SetNormalColor(normalColor:UnpackRGB())
    self.dropdown:SetHighlightedColor(highlightColor:UnpackRGB())
end
function ZO_HouseTours_Tags_Filter_Header_Focus_Gamepad:IsActive()
    return self.active
end
-----------------------------
--House Tours Gamepad
-----------------------------
ZO_HouseTours_Gamepad = ZO_Object.MultiSubclass(ZO_Gamepad_ParametricList_Screen, ZO_SocialOptionsDialogGamepad)
function ZO_HouseTours_Gamepad:Initialize(control)
    HOUSE_TOURS_SCENE_GAMEPAD = ZO_Scene:New("houseToursGamepad", SCENE_MANAGER)
    HOUSE_TOURS_GAMEPAD_FRAGMENT = ZO_FadeSceneFragment:New(control)
    HOUSE_TOURS_SCENE_GAMEPAD:AddFragment(HOUSE_TOURS_GAMEPAD_FRAGMENT)
    local ACTIVATE_ON_SHOW = true
    ZO_Gamepad_ParametricList_Screen.Initialize(self, control, ZO_GAMEPAD_HEADER_TABBAR_DONT_CREATE, ACTIVATE_ON_SHOW, HOUSE_TOURS_SCENE_GAMEPAD)
    ZO_SocialOptionsDialogGamepad.Initialize(self)
end
function ZO_HouseTours_Gamepad:InitializeActivityFinderCategory()
    self.houseToursCategoryData = 
    {
        gamepadData =
        {
            priority = ZO_ACTIVITY_FINDER_SORT_PRIORITY.HOUSE_TOURS,
            name = GetString(SI_ACTIVITY_FINDER_CATEGORY_HOUSE_TOURS),
            menuIcon = "EsoUI/Art/LFG/Gamepad/LFG_menuIcon_houseTours.dds",
            disabledMenuIcon = "EsoUI/Art/LFG/Gamepad/LFG_menuIcon_houseTours_disabled.dds",
            sceneName = "houseToursGamepad",
            tooltipDescription = GetString(SI_HOUSE_TOURS_DESCRIPTION),
            isHouseTours = true,
        },
    }
    local gamepadData = self.houseToursCategoryData.gamepadData
    ZO_ACTIVITY_FINDER_ROOT_GAMEPAD:AddCategory(gamepadData, gamepadData.priority)
end
function ZO_HouseTours_Gamepad:InitializeTagsSelector()
    self.tagsFilterDropdownControl = self.header:GetNamedChild("TagsSelector")
    self.tagsFilterDropdown = ZO_ComboBox_ObjectFromContainer(self.tagsFilterDropdownControl:GetNamedChild("Dropdown"))
    self.tagsFilterHeaderFocus = ZO_HouseTours_Tags_Filter_Header_Focus_Gamepad:New(self.tagsFilterDropdownControl:GetNamedChild("Dropdown"))
    self.tagsFilterHeaderFocus:RegisterCallback("FocusActivated", function()
        local NARRATE_HEADER = true
        SCREEN_NARRATION_MANAGER:QueueCustomEntry("houseToursTagsFilter", NARRATE_HEADER)
    end)
    local function TagSelectionChanged()
        local newTags = {}
        local selectedTagsData = self.tagsFilterDropdownEntries:GetSelectedItems()
        for _, item in ipairs(selectedTagsData) do
            table.insert(newTags, item.tagValue)
        end
        local modeData = self:GetDataForMode(self.mode)
        local filters = HOUSE_TOURS_SEARCH_MANAGER:GetSearchFilters(modeData.listingType)
        filters:SetTags(newTags)
    end
    local function OnTagsDropdownShown()
        local modeData = self:GetDataForMode(self.mode)
        local filters = HOUSE_TOURS_SEARCH_MANAGER:GetSearchFilters(modeData.listingType)
        self.oldTags = {}
        ZO_DeepTableCopy(filters.tags, self.oldTags)
        table.sort(self.oldTags)
    end
    local function OnDropdownDeactivated()
        if self:IsShowing() then
            SCREEN_NARRATION_MANAGER:QueueCustomEntry("houseToursTagsFilter")
            --Execute a search when the dropdown is closed if filters have changed
            local modeData = self:GetDataForMode(self.mode)
            local filters = HOUSE_TOURS_SEARCH_MANAGER:GetSearchFilters(modeData.listingType)
            table.sort(filters.tags)
            if modeData and modeData.listingType and not ZO_AreNumericallyIndexedTablesEqual(filters.tags, self.oldTags) then
                HOUSE_TOURS_SEARCH_MANAGER:ExecuteSearch(modeData.listingType)
            end
        end
    end
    self.tagsFilterDropdown:SetMaxSelections(MAX_HOUSE_TOURS_LISTING_TAGS)
    self.tagsFilterDropdown:SetNoSelectionText(GetString(SI_HOUSE_TOURS_FILTERS_TAGS_DROPDOWN_NO_SELECTION_TEXT))
    self.tagsFilterDropdown:SetMultiSelectionTextFormatter(SI_HOUSE_TOURS_TAGS_DROPDOWN_TEXT_FORMATTER)
    self.tagsFilterDropdown:SetName(GetString(SI_HOUSE_TOURS_LISTING_TAGS_HEADER))
    self.tagsFilterDropdownEntries = ZO_MultiSelection_ComboBox_Data_Gamepad:New()
    for i = HOUSE_TOURS_LISTING_TAG_ITERATION_BEGIN, HOUSE_TOURS_LISTING_TAG_ITERATION_END do
        local tagEntry = ZO_ComboBox_Base:CreateItemEntry(GetString("SI_HOUSETOURLISTINGTAG", i), TagSelectionChanged)
        tagEntry.tagValue = i
        self.tagsFilterDropdownEntries:AddItem(tagEntry)
    end
    self.tagsFilterDropdown:LoadData(self.tagsFilterDropdownEntries)
    self:SetupHeaderFocus(self.tagsFilterHeaderFocus)
    --Set up a custom narration for the header focus
    local narrationInfo =
    {
        canNarrate = function()
            return self:IsHeaderActive()
        end,
        selectedNarrationFunction = function()
            local narrations = {}
            ZO_AppendNarration(narrations, self.tagsFilterDropdown:GetNarrationText())
            local list = self:GetCurrentList()
            --If the list is empty, include that in the header focus narration as well
            if list:IsEmpty() then
                ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(list:GetNoItemText()))
            end
            return narrations
        end,
        headerNarrationFunction = function()
            return self:GetHeaderNarration()
        end,
    }
    SCREEN_NARRATION_MANAGER:RegisterCustomObject("houseToursTagsFilter", narrationInfo)
end
function ZO_HouseTours_Gamepad:InitializeListingPanel()
    local listingPanel = self.control:GetNamedChild("ListingPanel")
    listingPanel.backgroundControl = listingPanel:GetNamedChild("Background")
    local searchContainer = listingPanel:GetNamedChild("SearchInfo")
    local manageListingsContainer = listingPanel:GetNamedChild("ListingManagementInfo")
    --Initialize each of the content containers
    self:InitializePanelContents(searchContainer)
    self:InitializePanelContents(manageListingsContainer)
    self.listingPanelControl = listingPanel
    self.listingPanelFragment = ZO_FadeSceneFragment:New(self.listingPanelControl)
end
function ZO_HouseTours_Gamepad:InitializePanelContents(control)
    control.nicknameLabel = control:GetNamedChild("Nickname")
    control.nameLabel = control:GetNamedChild("Name")
    control.furnitureCountLabel = control:GetNamedChild("FurnitureCount")
    control.ownerLabel = control:GetNamedChild("OwnerValue")
    control.tagsLabel = control:GetNamedChild("TagsValue")
    control.statusLabel = control:GetNamedChild("StatusValue")
    control.recommendationsLabel = control:GetNamedChild("RecommendationsValue")
    control.recommendationsHeader = control:GetNamedChild("RecommendationsHeader")
end
function ZO_HouseTours_Gamepad:InitializeModeData()
    self.modeData =
    {
        [HOUSE_TOURS_MODES.OVERVIEW] =
        {
            list = self.categoryList,
            headerData =
            {
                titleText = GetString(SI_ACTIVITY_FINDER_CATEGORY_HOUSE_TOURS),
            },
            keybindStripDescriptor = self.overviewKeybindStripDescriptor,
            refreshFunction = function() self:RefreshCategoryList() end,
        },
        [HOUSE_TOURS_MODES.RECOMMENDED] =
        {
            list = self.searchResultsList,
            headerData =
            {
                titleText = GetString(SI_HOUSE_TOURS_RECOMMENDED),
            },
            keybindStripDescriptor = self.searchKeybindStripDescriptor,
            refreshFunction = function() self:RefreshSearchResultsList() end,
            selectionChangedFunction = function(list, selectedData, oldSelectedData)
                self:SetupOptions(selectedData)
            end,
            listingPanelContents = self.listingPanelControl:GetNamedChild("SearchInfo"),
            hasListingPanel = true,
            listingType = HOUSE_TOURS_LISTING_TYPE_RECOMMENDED,
            hasTagsFilter = true,
        },
        [HOUSE_TOURS_MODES.BROWSE] =
        {
            list = self.searchResultsList,
            headerData =
            {
                titleText = GetString(SI_HOUSE_TOURS_BROWSE_HOMES),
            },
            keybindStripDescriptor = self.searchKeybindStripDescriptor,
            refreshFunction = function() self:RefreshSearchResultsList() end,
            selectionChangedFunction = function(list, selectedData, oldSelectedData)
                self:SetupOptions(selectedData)
            end,
            listingPanelContents = self.listingPanelControl:GetNamedChild("SearchInfo"),
            hasListingPanel = true,
            listingType = HOUSE_TOURS_LISTING_TYPE_BROWSE,
            hasTagsFilter = true,
        },
        [HOUSE_TOURS_MODES.FAVORITES] =
        {
            list = self.searchResultsList,
            headerData =
            {
                titleText = GetString(SI_HOUSE_TOURS_FAVORITE_HOMES),
            },
            keybindStripDescriptor = self.searchKeybindStripDescriptor,
            refreshFunction = function() self:RefreshSearchResultsList() end,
            selectionChangedFunction = function(list, selectedData, oldSelectedData)
                self:SetupOptions(selectedData)
            end,
            listingPanelContents = self.listingPanelControl:GetNamedChild("SearchInfo"),
            hasListingPanel = true,
            listingType = HOUSE_TOURS_LISTING_TYPE_FAVORITE,
            hasTagsFilter = true,
        },
        [HOUSE_TOURS_MODES.MANAGE_LISTINGS] =
        {
            list = self.listingsManagementList,
            headerData =
            {
                titleText = GetString(SI_HOUSE_TOURS_MANAGE_LISTINGS),
            },
            keybindStripDescriptor = self.manageListingsKeybindStripDescriptor,
            refreshFunction = function() self:RefreshListingsManagementList() end,
            listingPanelContents = self.listingPanelControl:GetNamedChild("ListingManagementInfo"),
            hasListingPanel = function()
                --Only show the listing panel when the player owns houses
                return self.hasHouses
            end,
            tooltipFunction = function()
                local selectedData = HOUSE_TOURS_PLAYER_LISTINGS_MANAGER:GetListingDataByCollectibleId(self.selectedPlayerListingCollectibleId)
                if selectedData and not selectedData:HasValidPermissions() then
                    GAMEPAD_TOOLTIPS:LayoutTitleAndDescriptionTooltip(GAMEPAD_RIGHT_TOOLTIP, GetString(SI_HOUSE_TOURS_MANAGE_LISTING_GAMEPAD_LOCKED_TOOLTIP_HEADER), selectedData:GetLockReasonText())
                end
            end,
        },
        [HOUSE_TOURS_MODES.SELECT_HOME] =
        {
            list = self.homeList,
            headerData =
            {
                titleText = GetString(SI_HOUSE_TOURS_MANAGE_LISTING_HOUSE_SELECT_HOME),
            },
            keybindStripDescriptor = self.selectHomeKeybindStripDescriptor,
            refreshFunction = function() self:RefreshHomeList() end,
            listingPanelContents = self.listingPanelControl:GetNamedChild("ListingManagementInfo"),
            hasListingPanel = true,
        },
    }
end
function ZO_HouseTours_Gamepad:SetupManageListingsList(list)
    local function EntryWithArrowSetup(control, data, selected, reselectingDuringRebuild, enabled, active)
        ZO_SharedGamepadEntry_OnSetup(control, data, selected, reselectingDuringRebuild, enabled, active)
        local color = data:GetNameColor(selected)
        if type(color) == "function" then
            color = color(data)
        end
        control:GetNamedChild("Arrow"):SetColor(color:UnpackRGBA())
    end
    local function OnDropdownDeactivated()
        --Re-narrate the selected entry when the dropdown is closed
        SCREEN_NARRATION_MANAGER:QueueParametricListEntry(self.listingsManagementList)
    end
    --Logic shared between both dropdown entries
    local function SharedDropdownEntrySetup(dropdown, selected)
        dropdown:SetNormalColor(ZO_GAMEPAD_COMPONENT_COLORS.UNSELECTED_INACTIVE:UnpackRGB())
        dropdown:SetHighlightedColor(ZO_GAMEPAD_COMPONENT_COLORS.SELECTED_ACTIVE:UnpackRGB())
        dropdown:SetSelectedItemTextColor(selected)
    end
    local function OnVisitorAccessPresetSelected(dropdown, entryText, entry)
        local selectedData = HOUSE_TOURS_PLAYER_LISTINGS_MANAGER:GetListingDataByCollectibleId(self.selectedPlayerListingCollectibleId)
        if selectedData then
            local changePermissionData =
            {
                houseId = selectedData:GetHouseId(),
                housePermissionDefaultAccessSetting = entry.defaultAccess,
                failureCallback = function()
                    self:RefreshListingsManagementList(PRESERVE_SELECTIONS)
                    self:RefreshKeybinds()
                    self:RefreshTooltips()
                end,
                successCallback = function()
                    self:RefreshKeybinds()
                    self:RefreshTooltips()
                end,
            }
            ZO_Dialogs_ShowPlatformDialog("CONFIRM_CHANGE_DEFAULT_HOUSING_PERMISSION", changePermissionData)
        end
    end
    local function DefaultVisitorAccessDropdownEntrySetup(control, data, selected, selectedDuringRebuild, enabled, activated)
        ZO_SharedGamepadEntry_OnSetup(control, data, selected, selectedDuringRebuild, enabled, activated)
        local dropdown = control.dropdown
        SharedDropdownEntrySetup(dropdown, selected)
        dropdown:SetSortsItems(false)
        dropdown:ClearItems()
        local allDefaultAccessSettings = HOUSE_SETTINGS_MANAGER:GetAllDefaultAccessSettings()
        for i = HOUSE_PERMISSION_DEFAULT_ACCESS_SETTING_ITERATION_BEGIN, HOUSE_PERMISSION_DEFAULT_ACCESS_SETTING_ITERATION_END do
            local entry = dropdown:CreateItemEntry(allDefaultAccessSettings[i], OnVisitorAccessPresetSelected)
            entry.defaultAccess = i
            if not IsHouseDefaultAccessSettingValidForHouseToursListing(i) then
                entry.name = ZO_ERROR_COLOR:Colorize(entry.name)
            end
            dropdown:AddItem(entry, ZO_COMBOBOX_SUPPRESS_UPDATE)
        end
        local selectedListingData = HOUSE_TOURS_PLAYER_LISTINGS_MANAGER:GetListingDataByCollectibleId(self.selectedPlayerListingCollectibleId)
        local function ShouldAutoSelectEntry(entry)
            local defaultAccess = HOUSE_SETTINGS_MANAGER:GetDefaultHousingPermission(selectedListingData:GetHouseId())
            return entry.defaultAccess == defaultAccess
        end
        --Attempt to select the currently chosen permission for the house. If we fail to select the matching entry, just default to the first one
        if not dropdown:SetSelectedItemByEval(ShouldAutoSelectEntry, SUPPRESS_CALLBACKS) then
            dropdown:SelectFirstItem(SUPPRESS_CALLBACKS)
        end
    end
    self.tagsDropdownEntries = ZO_MultiSelection_ComboBox_Data_Gamepad:New()
    for i = HOUSE_TOURS_LISTING_TAG_ITERATION_BEGIN, HOUSE_TOURS_LISTING_TAG_ITERATION_END do
        local tagEntry = ZO_ComboBox_Base:CreateItemEntry(GetString("SI_HOUSETOURLISTINGTAG", i))
        tagEntry.tagValue = i
        self.tagsDropdownEntries:AddItem(tagEntry)
    end
    local function TagsDropdownEntrySetup(control, data, selected, selectedDuringRebuild, enabled, activated)
        ZO_SharedGamepadEntry_OnSetup(control, data, selected, selectedDuringRebuild, enabled, activated)
        local dropdown = control.dropdown
        SharedDropdownEntrySetup(dropdown, selected)
        dropdown:SetMaxSelections(MAX_HOUSE_TOURS_LISTING_TAGS)
        dropdown:SetNoSelectionText(GetString(SI_HOUSE_TOURS_TAGS_DROPDOWN_NO_SELECTION_TEXT))
        dropdown:SetMultiSelectionTextFormatter(SI_HOUSE_TOURS_TAGS_DROPDOWN_TEXT_FORMATTER)
        dropdown:LoadData(self.tagsDropdownEntries)
    end
    list:AddDataTemplateWithHeader("ZO_GamepadMenuEntryTemplate", ZO_SharedGamepadEntry_OnSetup, ZO_GamepadMenuEntryTemplateParametricListFunction, nil, "ZO_GamepadMenuEntryHeaderTemplate")
    list:AddDataTemplateWithHeader("ZO_GamepadMenuEntryTemplateWithArrow", EntryWithArrowSetup, ZO_GamepadMenuEntryTemplateParametricListFunction, nil, "ZO_GamepadMenuEntryHeaderTemplate", nil, "ArrowEntry")
    list:AddDataTemplateWithHeader("ZO_Gamepad_Dropdown_Item_Indented", DefaultVisitorAccessDropdownEntrySetup, ZO_GamepadMenuEntryTemplateParametricListFunction, nil, "ZO_GamepadMenuEntryHeaderTemplate", nil, "DefaultAccessEntry")
    list:AddDataTemplateWithHeader("ZO_Gamepad_MultiSelection_Dropdown_Item_Indented", TagsDropdownEntrySetup, ZO_GamepadMenuEntryTemplateParametricListFunction, nil, "ZO_GamepadMenuEntryHeaderTemplate", nil, "TagsEntry")
    --The only time this list can be empty is when the player has no houses
    local housingQuestId = GetHousingStarterQuestId()
    local formattedHousingQuestText = zo_strformat(SI_HOUSE_TOURS_MANAGE_LISTING_NO_HOUSES_STARTER_QUEST, ZO_SELECTED_TEXT:Colorize(GetQuestName(housingQuestId)))
    list:SetNoItemText(ZO_GenerateParagraphSeparatedList({ GetString(SI_HOUSE_TOURS_MANAGE_LISTING_NO_HOUSES), formattedHousingQuestText }))
end
function ZO_HouseTours_Gamepad:InitializeLists()
    local function SetupHomeList(list)
    end
    local function SetupSearchResultsList(list)
        list:AddDataTemplate("ZO_GamepadItemEntryTemplate", ZO_SharedGamepadEntry_OnSetup, ZO_GamepadMenuEntryTemplateParametricListFunction, ZO_HouseToursListingSearchData.Equals)
    end
    self.categoryList = self:GetMainList()
    self.searchResultsList = self:AddList("SearchResults", SetupSearchResultsList)
    self.listingsManagementList = self:AddList("ManageListings", function(list) self:SetupManageListingsList(list) end)
    self.homeList = self:AddList("Homes", SetupHomeList)
end
function ZO_HouseTours_Gamepad:RegisterDialogs()
    ZO_Dialogs_RegisterCustomDialog("HOUSE_TOURS_SUBMIT_LISTING_GAMEPAD",
    {
        gamepadInfo =
        {
            dialogType = GAMEPAD_DIALOGS.BASIC,
        },
        title =
        {
            text = SI_HOUSE_TOURS_SUBMIT_HOME,
        },
        mainText =
        {
            text = SI_HOUSE_TOURS_GAMEPAD_SUBMIT_DIALOG_TEXT,
        },
        buttons =
        {
            {
                keybind = "DIALOG_PRIMARY",
                text = SI_DIALOG_CONFIRM,
                callback = function(dialog)
                    local data = dialog.data
                    if data and data.selectedListingData and data.tags then
                        local houseId = data.selectedListingData:GetHouseId()
                        RequestCreateHouseToursListing(houseId, unpack(data.tags))
                    end
                end,
            },
            {
                keybind = "DIALOG_NEGATIVE",
                text = SI_DIALOG_CANCEL,
            },
        },
    })
    local function OnReleaseDialog(dialog)
        --Make sure we deactivate any open dropdowns when the dialog closes
        local targetControl = dialog.entryList:GetTargetControl()
        if targetControl and targetControl.dropdown then
            targetControl.dropdown:Deactivate()
        end
    end
    local function RefreshFiltersTooltip(dialog, list, data)
        local tooltipText
        if data and data.tooltipText then
            tooltipText = data.tooltipText(dialog)
        end
        if tooltipText then
            GAMEPAD_TOOLTIPS:LayoutTextBlockTooltip(GAMEPAD_LEFT_DIALOG_TOOLTIP, tooltipText)
            ZO_GenericGamepadDialog_ShowTooltip(dialog)
        else
            ZO_GenericGamepadDialog_HideTooltip(dialog)
        end
    end
    ZO_Dialogs_RegisterCustomDialog("HOUSE_TOURS_ALL_FILTERS_GAMEPAD",
    {
        blockDialogReleaseOnPress = true,
        gamepadInfo =
        {
            dialogType = GAMEPAD_DIALOGS.PARAMETRIC,
            allowRightStickPassThrough = true,
        },
        title =
        {
            text = SI_HOUSE_TOURS_ALL_FILTERS,
        },
        setup = function(dialog, data)
            dialog.filterData = data.filterData
            dialog.pendingFilterData = ZO_HouseTours_Search_Filters:New(dialog.filterData:GetListingType())
            dialog.pendingFilterData:CopyFrom(dialog.filterData)
            dialog:setupFunc()
        end,
        parametricList =
        {
            -- User Id
            {
                template = "ZO_Gamepad_GenericDialog_Parametric_TextFieldItem",
                templateData =
                {
                    focusLostCallback = function(control)
                        local dialog = ZO_GenericGamepadDialog_GetControl(GAMEPAD_DIALOGS.PARAMETRIC)
                        dialog.pendingFilterData:SetDisplayName(control:GetText())
                    end,
                    setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                        local dialog = data.dialog
                        control.highlight:SetHidden(not selected)
                        control.editBoxControl:SetDefaultText(ZO_GetPlatformAccountLabel())
                        control.editBoxControl:SetText(dialog.pendingFilterData:GetDisplayName())
                        control.editBoxControl:SetMaxInputChars(DECORATED_DISPLAY_NAME_MAX_LENGTH)
                        control.editBoxControl.focusLostCallback = data.focusLostCallback
                        data.control = control
                    end,
                    callback = function(dialog)
                        local targetData = dialog.entryList:GetTargetData()
                        if targetData then
                            local editControl = targetData.control.editBoxControl
                            editControl:TakeFocus()
                        end
                    end,
                    narrationText = ZO_GetDefaultParametricListEditBoxNarrationText
                }
            },
            -- Tags
            {
                template = "ZO_GamepadMultiSelectionDropdownItem",
                templateData =
                {
                    setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                        local dialog = data.dialog
                        local dropdown = control.dropdown
                        dropdown:SetSortsItems(true)
                        dropdown:SetMaxSelections(MAX_HOUSE_TOURS_LISTING_TAGS)
                        dropdown:SetNoSelectionText(GetString(SI_HOUSE_TOURS_FILTERS_TAGS_DROPDOWN_NO_SELECTION_TEXT))
                        dropdown:SetMultiSelectionTextFormatter(SI_HOUSE_TOURS_TAGS_DROPDOWN_TEXT_FORMATTER)
                        dropdown:SetNormalColor(ZO_GAMEPAD_COMPONENT_COLORS.UNSELECTED_INACTIVE:UnpackRGB())
                        dropdown:SetHighlightedColor(ZO_GAMEPAD_COMPONENT_COLORS.SELECTED_ACTIVE:UnpackRGB())
                        dropdown:SetSelectedItemTextColor(selected)
                        dropdown.dropdownData = ZO_MultiSelection_ComboBox_Data_Gamepad:New()
                        local function TagSelectionChanged()
                            local newTags = {}
                            local selectedTagsData = dropdown.dropdownData:GetSelectedItems()
                            for _, item in ipairs(selectedTagsData) do
                                table.insert(newTags, item.tagValue)
                            end
                            dialog.pendingFilterData:SetTags(newTags)
                        end
                        local tags = dialog.pendingFilterData:GetTags()
                        for i = HOUSE_TOURS_LISTING_TAG_ITERATION_BEGIN, HOUSE_TOURS_LISTING_TAG_ITERATION_END do
                            local tagEntry = ZO_ComboBox_Base:CreateItemEntry(GetString("SI_HOUSETOURLISTINGTAG", i), TagSelectionChanged)
                            tagEntry.tagValue = i
                            dropdown.dropdownData:AddItem(tagEntry)
                            if ZO_IsElementInNumericallyIndexedTable(tags, tagEntry.tagValue) then
                                dropdown.dropdownData:SetItemSelected(tagEntry, true)
                            end
                        end
                        dropdown:LoadData(dropdown.dropdownData)
                        SCREEN_NARRATION_MANAGER:RegisterDialogDropdown(dialog, dropdown)
                    end,
                    callback = function(dialog)
                        local targetControl = dialog.entryList:GetTargetControl()
                        if targetControl then
                            targetControl.dropdown:Activate()
                        end
                    end,
                    narrationText = ZO_GetDefaultParametricListDropdownNarrationText,
                },
            },
            -- House Name
            {
                template = "ZO_GamepadMultiSelectionDropdownItem",
                templateData =
                {
                    setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                        local dialog = data.dialog
                        local dropdown = control.dropdown
                        dropdown:SetSortsItems(true)
                        dropdown:SetMaxSelections(MAX_HOUSE_TOURS_HOUSE_FILTERS)
                        dropdown:SetNoSelectionText(GetString(SI_HOUSE_TOURS_FILTERS_HOUSE_DROPDOWN_NO_SELECTION_TEXT))
                        dropdown:SetMultiSelectionTextFormatter(SI_HOUSE_TOURS_FILTERS_HOUSE_DROPDOWN_TEXT_FORMATTER)
                        dropdown:SetNormalColor(ZO_GAMEPAD_COMPONENT_COLORS.UNSELECTED_INACTIVE:UnpackRGB())
                        dropdown:SetHighlightedColor(ZO_GAMEPAD_COMPONENT_COLORS.SELECTED_ACTIVE:UnpackRGB())
                        dropdown:SetSelectedItemTextColor(selected)
                        dropdown.dropdownData = ZO_MultiSelection_ComboBox_Data_Gamepad:New()
                        local function HouseSelectionChanged()
                            local newHouseIds = {}
                            local selectedHouseData = dropdown.dropdownData:GetSelectedItems()
                            for _, item in ipairs(selectedHouseData) do
                                table.insert(newHouseIds, item.houseId)
                            end
                            dialog.pendingFilterData:SetHouseIds(newHouseIds)
                            --Changes to the house name selection can impact the house category dropdown, so refresh that too when the house selection changes
                            if dialog.houseCategoryDropdown then
                                --Update the colors of the house category dropdown depending on whether or not it is now disabled
                                local canSet = dialog.pendingFilterData:CanSetHouseCategoryTypes()
                                local normalColor = canSet and ZO_GAMEPAD_UNSELECTED_COLOR or ZO_GAMEPAD_DISABLED_UNSELECTED_COLOR
                                local highlightColor = canSet and ZO_GAMEPAD_SELECTED_COLOR or ZO_GAMEPAD_DISABLED_SELECTED_COLOR
                                dialog.houseCategoryDropdown:SetNormalColor(normalColor:UnpackRGB())
                                dialog.houseCategoryDropdown:SetHighlightedColor(highlightColor:UnpackRGB())
                                --It can be assumed that the house category dropdown is not selected, since in order to change the house selection, the house name dropdown needs to be selected
                                local NOT_SELECTED = false
                                dialog.houseCategoryDropdown:SetSelectedItemTextColor(NOT_SELECTED)
                                --If the house category dropdown is now supposed to be disabled, clear all of its selections
                                if not canSet then
                                    dialog.houseCategoryDropdown:ClearAllSelections()
                                    dialog.houseCategoryDropdown:RefreshSelections()
                                end
                            end
                        end
                        local allHouses = ZO_COLLECTIBLE_DATA_MANAGER:GetAllCollectibleDataObjects({ ZO_CollectibleCategoryData.IsHousingCategory })
                        local houseIds = dialog.pendingFilterData:GetHouseIds()
                        for _, collectibleData in ipairs(allHouses) do
                            local houseEntry = ZO_ComboBox_Base:CreateItemEntry(collectibleData:GetFormattedName(), HouseSelectionChanged)
                            houseEntry.houseId = collectibleData:GetReferenceId()
                            dropdown.dropdownData:AddItem(houseEntry)
                            if ZO_IsElementInNumericallyIndexedTable(houseIds, houseEntry.houseId) then
                                dropdown.dropdownData:SetItemSelected(houseEntry, true)
                            end
                        end
                        dropdown:LoadData(dropdown.dropdownData)
                        SCREEN_NARRATION_MANAGER:RegisterDialogDropdown(dialog, dropdown)
                    end,
                    callback = function(dialog)
                        local targetControl = dialog.entryList:GetTargetControl()
                        if targetControl then
                            targetControl.dropdown:Activate()
                        end
                    end,
                    narrationText = ZO_GetDefaultParametricListDropdownNarrationText,
                },
            },
            -- House Category
            {
                template = "ZO_GamepadMultiSelectionDropdownItem",
                templateData =
                {
                    setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                        local dialog = data.dialog
                        local dropdown = control.dropdown
                        dialog.houseCategoryDropdown = dropdown
                        dropdown:SetSortsItems(true)
                        dropdown:SetMaxSelections(MAX_HOUSE_TOURS_CATEGORY_TYPE_FILTERS)
                        dropdown:SetNoSelectionText(GetString(SI_HOUSE_TOURS_FILTERS_HOUSE_CATEGORY_DROPDOWN_NO_SELECTION_TEXT))
                        dropdown:SetMultiSelectionTextFormatter(SI_HOUSE_TOURS_FILTERS_HOUSE_CATEGORY_DROPDOWN_TEXT_FORMATTER)
                        local canSet = dialog.pendingFilterData:CanSetHouseCategoryTypes()
                        local normalColor = canSet and ZO_GAMEPAD_UNSELECTED_COLOR or ZO_GAMEPAD_DISABLED_UNSELECTED_COLOR
                        local highlightColor = canSet and ZO_GAMEPAD_SELECTED_COLOR or ZO_GAMEPAD_DISABLED_SELECTED_COLOR
                        dropdown:SetNormalColor(normalColor:UnpackRGB())
                        dropdown:SetHighlightedColor(highlightColor:UnpackRGB())
                        dropdown:SetSelectedItemTextColor(selected)
                        dropdown.dropdownData = ZO_MultiSelection_ComboBox_Data_Gamepad:New()
                        local function CategorySelectionChanged()
                            local newCategories = {}
                            local selectedHouseCategoryData = dropdown.dropdownData:GetSelectedItems()
                            for _, item in ipairs(selectedHouseCategoryData) do
                                table.insert(newCategories, item.categoryValue)
                            end
                            dialog.pendingFilterData:SetHouseCategoryTypes(newCategories)
                        end
                        local categories = dialog.pendingFilterData:GetHouseCategoryTypes()
                        for i = HOUSE_CATEGORY_TYPE_ITERATION_BEGIN, HOUSE_CATEGORY_TYPE_ITERATION_END do
                            local categoryEntry = ZO_ComboBox_Base:CreateItemEntry(GetString("SI_HOUSECATEGORYTYPE", i), CategorySelectionChanged)
                            categoryEntry.categoryValue = i
                            dropdown.dropdownData:AddItem(categoryEntry)
                            if ZO_IsElementInNumericallyIndexedTable(categories, categoryEntry.categoryValue) then
                                dropdown.dropdownData:SetItemSelected(categoryEntry, true)
                            end
                        end
                        dropdown:LoadData(dropdown.dropdownData)
                        SCREEN_NARRATION_MANAGER:RegisterDialogDropdown(dialog, dropdown)
                    end,
                    callback = function(dialog)
                        local targetControl = dialog.entryList:GetTargetControl()
                        if targetControl then
                            targetControl.dropdown:Activate()
                        end
                    end,
                    enabled = function(dialog)
                        return dialog.pendingFilterData:CanSetHouseCategoryTypes()
                    end,
                    tooltipText = function(dialog)
                        local pendingFilterData = dialog.pendingFilterData
                        if not pendingFilterData:CanSetHouseCategoryTypes() then
                            return GetString(SI_HOUSE_TOURS_FILTERS_HOUSE_CATEGORY_DISABLED)
                        end
                    end,
                    narrationText = ZO_GetDefaultParametricListDropdownNarrationText,
                    narrationTooltip = GAMEPAD_LEFT_DIALOG_TOOLTIP,
                },
            },
        },
        parametricListOnSelectionChangedCallback = function(dialog, list, newSelectedData, oldSelectedData)
            RefreshFiltersTooltip(dialog, list, newSelectedData)
        end,
        buttons =
        {
            {
                keybind = "DIALOG_PRIMARY",
                text = SI_GAMEPAD_SELECT_OPTION,
                callback = function(dialog)
                    local targetData = dialog.entryList:GetTargetData()
                    if targetData and targetData.callback then
                        targetData.callback(dialog)
                    end
                end,
                enabled = function(dialog)
                    local enabled = true
                    local targetData = dialog.entryList:GetTargetData()
                    if targetData then
                        if type(targetData.enabled) == "function" then
                            enabled = targetData.enabled(dialog)
                        else
                            enabled = targetData.enabled
                        end
                    end
                    return enabled
                end,
            },
            {
                keybind = "DIALOG_NEGATIVE",
                text = SI_DIALOG_CANCEL,
                callback = function(dialog)
                    ZO_Dialogs_ReleaseDialogOnButtonPress("HOUSE_TOURS_ALL_FILTERS_GAMEPAD")
                end,
            },
            {
                keybind = "DIALOG_SECONDARY",
                text = SI_DIALOG_CONFIRM,
                callback = function(dialog)
                    dialog.filterData:CopyFrom(dialog.pendingFilterData)
                    if dialog.data.confirmCallback then
                        dialog.data:confirmCallback()
                    end
                    ZO_Dialogs_ReleaseDialogOnButtonPress("HOUSE_TOURS_ALL_FILTERS_GAMEPAD")
                end,
            },
            {
                keybind = "DIALOG_RESET",
                text = SI_HOUSE_TOURS_RESET_FILTERS_KEYBIND,
                callback = function(dialog)
                    dialog.pendingFilterData:ResetFilters()
                    ZO_GenericParametricListGamepadDialogTemplate_RefreshVisibleEntries(dialog)
                    ZO_GenericGamepadDialog_RefreshKeybinds(dialog)
                    local targetData = dialog.entryList:GetTargetData()
                    if targetData then
                        RefreshFiltersTooltip(dialog, dialog.entryList, targetData)
                    end
                    --Re-narrate the selection when the filters are reset
                    SCREEN_NARRATION_MANAGER:QueueDialog(dialog)
                end,
            },
        },
        onHidingCallback = OnReleaseDialog,
        noChoiceCallback = OnReleaseDialog,
    })
end
function ZO_HouseTours_Gamepad:RegisterForEvents()
    HOUSE_TOURS_SEARCH_MANAGER:RegisterCallback("OnSearchStateChanged", function(newState, listingType)
        if self:IsShowing() then
            local modeData = self:GetDataForMode(self.mode)
            if modeData and modeData.listingType == listingType then
                self:RefreshList()
                local currentList = self:GetCurrentList()
                self:RefreshListingPanel(currentList, currentList:GetSelectedData())
                local NARRATE_HEADER = true
                if self:IsHeaderActive() then
                    SCREEN_NARRATION_MANAGER:QueueCustomEntry("houseToursTagsFilter", NARRATE_HEADER)
                else
                    SCREEN_NARRATION_MANAGER:QueueParametricListEntry(self:GetCurrentList(), NARRATE_HEADER)
                end
            end
        end
    end)
    HOUSE_TOURS_SEARCH_MANAGER:RegisterCallback("OnFavoritesChanged", function()
        if self:IsShowing() and
            (self.mode == HOUSE_TOURS_MODES.BROWSE or
             self.mode == HOUSE_TOURS_MODES.FAVORITES or
             self.mode == HOUSE_TOURS_MODES.RECOMMENDED) then
            local modeData = self:GetDataForMode(self.mode)
            if modeData and modeData.listingType then
                -- Refresh the current list.
                HOUSE_TOURS_SEARCH_MANAGER:ExecuteSearch(modeData.listingType)
            end
        end
    end)
    HOUSE_TOURS_PLAYER_LISTINGS_MANAGER:RegisterCallback("ListingOperationCooldownStateChanged", ZO_GetCallbackForwardingFunction(self, self.SetIsListingOperationOnCooldown))
    HOUSE_TOURS_PLAYER_LISTINGS_MANAGER:RegisterCallback("ListingOperationCompleted", function(operationType, houseId, result)
        if self:IsShowing() and self.mode == HOUSE_TOURS_MODES.MANAGE_LISTINGS then
            local listingData = HOUSE_TOURS_PLAYER_LISTINGS_MANAGER:GetListingDataByCollectibleId(self.selectedPlayerListingCollectibleId)
            if listingData and listingData:GetHouseId() == houseId then
                self:RefreshList()
                self:RefreshListingPanel(self:GetCurrentList(), listingData)
            end
        end
    end)
    ZO_COLLECTIBLE_DATA_MANAGER:RegisterCallback("OnCollectibleUpdated", function() self:RefreshNickname() end)
    local function OnQuestsUpdated()
        if self:IsShowing() then
            self:RefreshKeybinds()
        end
    end
    EVENT_MANAGER:RegisterForEvent("HouseTours_Gamepad", EVENT_QUEST_ADDED, OnQuestsUpdated)
    EVENT_MANAGER:RegisterForEvent("HouseTours_Gamepad", EVENT_QUEST_REMOVED, OnQuestsUpdated)
    local function OnPendingPermissionsChangesUpdated()
        if self:IsShowing() then
            self:RefreshKeybinds()
        end
    end
    EVENT_MANAGER:RegisterForEvent("HouseTours_Gamepad", EVENT_HOUSING_PERMISSIONS_SAVE_PENDING, OnPendingPermissionsChangesUpdated)
    EVENT_MANAGER:RegisterForEvent("HouseTours_Gamepad", EVENT_HOUSING_PERMISSIONS_SAVE_COMPLETE, OnPendingPermissionsChangesUpdated)
end
--Overridden from base
function ZO_HouseTours_Gamepad:InitializeKeybindStripDescriptors()
    self.overviewKeybindStripDescriptor =
    {
        alignment = KEYBIND_STRIP_ALIGN_LEFT,
        -- Select
        {
            keybind = "UI_SHORTCUT_PRIMARY",
            name = GetString(SI_GAMEPAD_SELECT_OPTION),
            callback = function()
                local categoryData = self.categoryList:GetTargetData()
                if categoryData then
                    self:SetMode(categoryData.mode)
                end
            end,
            sound = SOUNDS.GAMEPAD_MENU_FORWARD,
        },
        -- Back
        KEYBIND_STRIP:GetDefaultGamepadBackButtonDescriptor(),
    }
    local function OnConfirmFilters()
        if self:IsShowing() then
            self:RefreshTagsFilterDropdown()
            local modeData = self:GetDataForMode(self.mode)
            --Execute a new search when the filters change
            if modeData and modeData.listingType then
                HOUSE_TOURS_SEARCH_MANAGER:ExecuteSearch(modeData.listingType)
            end
        end
    end
    self.searchKeybindStripDescriptor =
    {
        alignment = KEYBIND_STRIP_ALIGN_LEFT,
        -- Select / Visit Home
        {
            keybind = "UI_SHORTCUT_PRIMARY",
            name = function()
                if self:IsHeaderActive() then
                    return GetString(SI_GAMEPAD_SELECT_OPTION)
                else
                    return GetString(SI_HOUSE_TOURS_VISIT_HOME)
                end
            end,
            callback = function()
                if self:IsHeaderActive() then
                    self.tagsFilterDropdown:Activate()
                else
                    local targetData = self.searchResultsList:GetTargetData()
                    if targetData then
                        local FROM_HOUSE_TOURS = true
                        HOUSING_SOCIAL_MANAGER:VisitHouse(targetData:GetHouseId(), targetData:GetOwnerDisplayName(), FROM_HOUSE_TOURS)
                    end
                end
            end,
            enabled = function()
                --Dont allow use of the header dropdown if a search is in progress
                if self:IsHeaderActive() then
                    local modeData = self:GetDataForMode(self.mode)
                    local currentSearchState = HOUSE_TOURS_SEARCH_MANAGER:GetSearchState(modeData.listingType)
                    return currentSearchState == ZO_HOUSE_TOURS_SEARCH_STATES.COMPLETE
                end
            end,
            sound = SOUNDS.GAMEPAD_MENU_FORWARD,
        },
        -- All Filters
        {
            keybind = "UI_SHORTCUT_SECONDARY",
            name = GetString(SI_HOUSE_TOURS_ALL_FILTERS),
            callback = function()
                local modeData = self:GetDataForMode(self.mode)
                ZO_Dialogs_ShowPlatformDialog("HOUSE_TOURS_ALL_FILTERS_GAMEPAD", { filterData = HOUSE_TOURS_SEARCH_MANAGER:GetSearchFilters(modeData.listingType), confirmCallback = OnConfirmFilters })
            end,
        },
        -- Add/Remove Favorite Home
        {
            keybind = "UI_SHORTCUT_TERTIARY",
            name = function()
                local targetData = self.searchResultsList:GetTargetData()
                if targetData then
                    if targetData:IsFavorite() then
                        return zo_strformat(SI_HOUSE_TOURS_REMOVE_FAVORITE_LISTING, GetNumFavoriteHouses(), MAX_HOUSE_TOURS_LISTING_FAVORITES)
                    else
                        return zo_strformat(SI_HOUSE_TOURS_ADD_FAVORITE_LISTING, GetNumFavoriteHouses(), MAX_HOUSE_TOURS_LISTING_FAVORITES)
                    end
                end
            end,
            callback = function()
                local targetData = self.searchResultsList:GetTargetData()
                if targetData then
                    if targetData:IsFavorite() then
                        targetData:RequestRemoveFavorite()
                    else
                        targetData:RequestAddFavorite()
                    end
                end
            end,
            visible = function()
                if self:IsHeaderActive() or self.searchResultsList:IsEmpty() then
                    return false
                end
                local targetData = self.searchResultsList:GetTargetData()
                if not targetData then
                    return false
                end
                if not targetData:CanFavorite() then
                    return false
                end
                local modeData = self:GetDataForMode(self.mode)
                local currentSearchState = HOUSE_TOURS_SEARCH_MANAGER:GetSearchState(modeData.listingType)
                return currentSearchState == ZO_HOUSE_TOURS_SEARCH_STATES.COMPLETE
            end,
        },
        -- Options
        {
            keybind = "UI_SHORTCUT_QUATERNARY",
            name = GetString(SI_GAMEPAD_OPTIONS_MENU),
            visible = function()
                if self:IsHeaderActive() or self.searchResultsList:IsEmpty() then
                    return false
                end
                local targetData = self.searchResultsList:GetTargetData()
                return targetData ~= nil
            end,
            callback = function()
                self:ShowOptionsDialog()
            end,
        },
        -- Back
        KEYBIND_STRIP:GenerateGamepadBackButtonDescriptor(function()
            self:SetMode(HOUSE_TOURS_MODES.OVERVIEW)
        end, nil, SOUNDS.GAMEPAD_MENU_BACK)
    }
    self.manageListingsKeybindStripDescriptor =
    {
        alignment = KEYBIND_STRIP_ALIGN_LEFT,
        -- Select
        {
            keybind = "UI_SHORTCUT_PRIMARY",
            name = function()
                if not self.hasHouses then
                    return GetString(SI_COLLECTIBLE_ACTION_ACCEPT_QUEST)
                end
                local targetData = self.listingsManagementList:GetTargetData()
                if targetData and targetData.selectName then
                    return targetData.selectName
                end
                return GetString(SI_GAMEPAD_SELECT_OPTION)
            end,
            callback = function()
                if self.hasHouses then
                    local targetData = self.listingsManagementList:GetTargetData()
                    if targetData.selectCallback ~= nil then
                        local targetControl = self.listingsManagementList:GetTargetControl()
                        targetData.selectCallback(targetData, targetControl, self.selectedPlayerListingCollectibleId)
                    end
                else
                    RequestBestowHousingStarterQuest()
                end
            end,
            enabled = function()
                if self.isListingOperationOnCooldown then
                    return false, GetString("SI_HOUSETOURLISTINGRESULT", HOUSE_TOURS_LISTING_RESULT_COOLDOWN_NOT_READY)
                end
                if self.hasHouses and AreHousingPermissionsChangesPending() then
                    return false, GetString(SI_HOUSE_TOURS_MANAGE_LISTINGS_GAMEPAD_PERMISSIONS_CHANGE_PENDING)
                end
                return true
            end,
            visible = function()
                if self.hasHouses then
                    return true
                else
                    local questId = GetHousingStarterQuestId()
                    return not HasQuest(questId)
                end
            end,
            sound = SOUNDS.GAMEPAD_MENU_FORWARD,
        },
        -- Submit/Edit
        {
            alignment = KEYBIND_STRIP_ALIGN_CENTER,
            keybind = "UI_SHORTCUT_SECONDARY",
            name = function()
                local selectedData = HOUSE_TOURS_PLAYER_LISTINGS_MANAGER:GetListingDataByCollectibleId(self.selectedPlayerListingCollectibleId)
                if selectedData then
                    local isListed = selectedData:IsListed()
                    return isListed and GetString(SI_HOUSE_TOURS_EDIT_LISTING) or GetString(SI_HOUSE_TOURS_SUBMIT_HOME)
                end
                return GetString(SI_HOUSE_TOURS_SUBMIT_HOME)
            end,
            callback = function()
                local selectedData = HOUSE_TOURS_PLAYER_LISTINGS_MANAGER:GetListingDataByCollectibleId(self.selectedPlayerListingCollectibleId)
                if selectedData then
                    local tags = {}
                    local selectedTagsData = self.tagsDropdownEntries:GetSelectedItems()
                    for _, item in ipairs(selectedTagsData) do
                        table.insert(tags, item.tagValue)
                    end
                    if selectedData:IsListed() then
                        RequestUpdateHouseToursListing(selectedData:GetHouseId(), unpack(tags))
                    else
                        ZO_Dialogs_ShowGamepadDialog("HOUSE_TOURS_SUBMIT_LISTING_GAMEPAD", { selectedListingData = selectedData, tags = tags })
                    end
                end
            end,
            visible = function()
                return self.hasHouses
            end,
            enabled = function()
                if self.isListingOperationOnCooldown then
                    return false, GetString("SI_HOUSETOURLISTINGRESULT", HOUSE_TOURS_LISTING_RESULT_COOLDOWN_NOT_READY)
                end
                if AreHousingPermissionsChangesPending() then
                    return false, GetString(SI_HOUSE_TOURS_MANAGE_LISTINGS_GAMEPAD_PERMISSIONS_CHANGE_PENDING)
                end
                local selectedData = HOUSE_TOURS_PLAYER_LISTINGS_MANAGER:GetListingDataByCollectibleId(self.selectedPlayerListingCollectibleId)
                if selectedData then
                    if selectedData:IsListed() then
                        --Grab a copy of the currently saved tags
                        local currentTags = {}
                        ZO_ShallowNumericallyIndexedTableCopy(selectedData:GetTags(), currentTags)
                        --Grab the currently selected tags in the UI
                        local newTags = {}
                        local selectedTagsData = self.tagsDropdownEntries:GetSelectedItems()
                        for _, item in ipairs(selectedTagsData) do
                            table.insert(newTags, item.tagValue)
                        end
                        --Sort both the current and new tags to make sure they are in the same order when we compare them
                        table.sort(newTags)
                        table.sort(currentTags)
                        return not ZO_AreNumericallyIndexedTablesEqual(currentTags, newTags)
                    else
                        return selectedData:HasValidPermissions(), selectedData:GetLockReasonText()
                    end
                end
                return false
            end,
        },
        -- Remove Listing
        {
            alignment = KEYBIND_STRIP_ALIGN_CENTER,
            keybind = "UI_SHORTCUT_TERTIARY",
            name = GetString(SI_HOUSE_TOURS_REMOVE_LISTING),
            callback = function()
                local selectedData = HOUSE_TOURS_PLAYER_LISTINGS_MANAGER:GetListingDataByCollectibleId(self.selectedPlayerListingCollectibleId)
                if selectedData then
                    RequestDeleteHouseToursListing(selectedData:GetHouseId())
                end
            end,
            enabled = function()
                if self.isListingOperationOnCooldown then
                    return false, GetString("SI_HOUSETOURLISTINGRESULT", HOUSE_TOURS_LISTING_RESULT_COOLDOWN_NOT_READY)
                end
                if AreHousingPermissionsChangesPending() then
                    return false, GetString(SI_HOUSE_TOURS_MANAGE_LISTINGS_GAMEPAD_PERMISSIONS_CHANGE_PENDING)
                end
                
                return true
            end,
            visible = function()
                local selectedData = HOUSE_TOURS_PLAYER_LISTINGS_MANAGER:GetListingDataByCollectibleId(self.selectedPlayerListingCollectibleId)
                if selectedData then
                    return selectedData:IsListed()
                end
                return false
            end,
        },
        -- Travel to home
        {
            alignment = KEYBIND_STRIP_ALIGN_CENTER,
            keybind = "UI_SHORTCUT_QUATERNARY",
            name = GetString(SI_HOUSE_TOURS_MANAGE_LISTING_TRAVEL_TO_HOUSE),
            callback = function()
                local selectedData = HOUSE_TOURS_PLAYER_LISTINGS_MANAGER:GetListingDataByCollectibleId(self.selectedPlayerListingCollectibleId)
                if selectedData then
                    HOUSING_SOCIAL_MANAGER:VisitHouse(selectedData:GetHouseId())
                end
            end,
            visible = function()
                return self.hasHouses
            end,
        },
        -- Back
        KEYBIND_STRIP:GenerateGamepadBackButtonDescriptor(function()
            self:SetMode(HOUSE_TOURS_MODES.OVERVIEW)
        end, nil, SOUNDS.GAMEPAD_MENU_BACK)
    }
    self.selectHomeKeybindStripDescriptor =
    {
        alignment = KEYBIND_STRIP_ALIGN_LEFT,
        -- Select
        {
            keybind = "UI_SHORTCUT_PRIMARY",
            name = GetString(SI_GAMEPAD_SELECT_OPTION),
            callback = function()
                local entryData = self.homeList:GetSelectedData()
                if entryData then
                    self.selectedPlayerListingCollectibleId = entryData:GetCollectibleId()
                    self:SetMode(HOUSE_TOURS_MODES.MANAGE_LISTINGS)
                end
            end,
            enabled = function()
                if self.isListingOperationOnCooldown then
                    return false, GetString("SI_HOUSETOURLISTINGRESULT", HOUSE_TOURS_LISTING_RESULT_COOLDOWN_NOT_READY)
                end
                return true
            end,
            sound = SOUNDS.GAMEPAD_MENU_FORWARD,
        },
        -- Back
        KEYBIND_STRIP:GenerateGamepadBackButtonDescriptor(function()
            self:SetMode(HOUSE_TOURS_MODES.MANAGE_LISTINGS)
        end, nil, SOUNDS.GAMEPAD_MENU_BACK)
    }
end
--Overridden from base
function ZO_HouseTours_Gamepad:OnDeferredInitialize()
    --Order matters
    --The lists must be initialized before initializing mode data, and mode data must be initialized before refreshing the header
    self:RefreshHeader()
end
--Overridden from base
function ZO_HouseTours_Gamepad:PerformUpdate()
   self.dirty = false
end
--Overridden from base
function ZO_HouseTours_Gamepad:RefreshKeybinds()
    local modeData = self:GetDataForMode(self.mode)
    if modeData and modeData.keybindStripDescriptor then
        KEYBIND_STRIP:UpdateKeybindButtonGroup(modeData.keybindStripDescriptor)
    end
end
--Overridden from base
function ZO_HouseTours_Gamepad:OnShow()
    ZO_Gamepad_ParametricList_Screen.OnShow(self)
    TriggerTutorial(TUTORIAL_TRIGGER_HOUSE_TOURS_OPENED)
end
--Overridden from base
function ZO_HouseTours_Gamepad:OnShowing()
    ZO_Gamepad_ParametricList_Screen.OnShowing(self)
    self:SetMode(HOUSE_TOURS_MODES.OVERVIEW)
    --Calculate if the player has any houses
    local sortedListingData = HOUSE_TOURS_PLAYER_LISTINGS_MANAGER:GetSortedListingData()
    self.hasHouses = #sortedListingData > 0
    if self.manageSpecificHouseId then
        -- Queued house id for the Manage Listings UI.
        self.selectedPlayerListingCollectibleId = GetCollectibleIdForHouse(self.manageSpecificHouseId)
        self.manageSpecificHouseId = nil
        self:SetMode(HOUSE_TOURS_MODES.MANAGE_LISTINGS)
    elseif self.pendingBrowseHouseId then
        -- Queued house id for the Browse UI.
        self:BrowseSpecificHouse(self.pendingBrowseHouseId)
        self.pendingBrowseHouseId = nil
    elseif self.hasHouses then
        if IsOwnerOfCurrentHouse() then
            -- Automatically select the current house if the player is in one of their own homes.
            self.selectedPlayerListingCollectibleId = GetCollectibleIdForHouse(GetCurrentZoneHouseId())
        elseif not self.selectedPlayerListingCollectibleId then
            --If we have houses but haven't set the selected player listing for the management screen, do that now
            --Default to the house the player is in, fall back to first thing in the list
            self.selectedPlayerListingCollectibleId = sortedListingData[1]:GetCollectibleId()
        end
    end
end
--Overridden from base
function ZO_HouseTours_Gamepad:OnHiding()
    ZO_Gamepad_ParametricList_Screen.OnHiding(self)
    local currentList = self:GetCurrentList()
    local targetControl = currentList:GetTargetControl()
    --Make sure dropdowns are deactivated when the screen hides
    if targetControl and targetControl.dropdown then
        targetControl.dropdown:Deactivate()
    end
    self.tagsFilterDropdown:Deactivate()
    self:SetMode(nil)
end
--Overridden from base
function ZO_HouseTours_Gamepad:OnTargetChanged(list, selectedData, oldSelectedData, hasReachedTarget, targetIndex, reselectingDuringRebuild)
    if self.mode ~= HOUSE_TOURS_MODES.MANAGE_LISTINGS then
        if not reselectingDuringRebuild then
            self:UpdateLastSelectedIndexForCurrentMode(targetIndex)
        end
        self:RefreshListingPanel(list, selectedData)
    end
end
--Overridden from base
function ZO_HouseTours_Gamepad:OnSelectionChanged(list, selectedData, oldSelectedData)
    ZO_Gamepad_ParametricList_Screen.OnSelectionChanged(self, list, selectedData, oldSelectedData)
    local modeData = self:GetDataForMode(self.mode)
    if modeData and list == modeData.list and modeData.selectionChangedFunction then
        modeData.selectionChangedFunction(list, selectedData, oldSelectedData)
    end
end
--Overridden from base
function ZO_HouseTours_Gamepad:CanEnterHeader()
    return not self.tagsFilterDropdownControl:IsHidden()
end
--Overridden from base
function ZO_HouseTours_Gamepad:OnEnterHeader()
end
--Overridden from base
function ZO_HouseTours_Gamepad:OnLeaveHeader()
end
--Overridden from base
function ZO_HouseTours_Gamepad:BuildOptionsList()
    local groupId = self:AddOptionTemplateGroup(ZO_SocialOptionsDialogGamepad.GetDefaultHeader)
    self:AddOptionTemplate(groupId, ZO_SocialOptionsDialogGamepad.BuildGamerCardOption, IsConsoleUI)
    local function CanReport()
        return self.socialData.canReport
    end
    self:AddOptionTemplate(groupId, ZO_HouseTours_Gamepad.BuildReportOption, CanReport)
end
--Overridden from base
function ZO_HouseTours_Gamepad:SetupOptions(entryData)
    if entryData then
        local socialData =
        {
            displayName = entryData:GetOwnerDisplayName(),
            canReport = entryData:CanReport(),
        }
        ZO_SocialOptionsDialogGamepad.SetupOptions(self, socialData)
    end
end
function ZO_HouseTours_Gamepad:GetCategoryData()
    return self.houseToursCategoryData
end
function ZO_HouseTours_Gamepad:BrowseSpecificHouse(houseId)
    if self:IsShowing() then
        local modeData = self:GetDataForMode(HOUSE_TOURS_MODES.BROWSE)
        local filters = HOUSE_TOURS_SEARCH_MANAGER:GetSearchFilters(modeData.listingType)
        --Switch the filters to use the specific house id
        filters:ResetFilters()
        filters:SetHouseIds({houseId})
        --Make sure "Browse Homes" is selected in the category list
        self.categoryList:SetSelectedIndex(2)
        --If we are already in browse, just refresh the filters and manually execute the search, otherwise switch to browse
        if self.mode == HOUSE_TOURS_MODES.BROWSE then
            self:RefreshTagsFilterDropdown()
            HOUSE_TOURS_SEARCH_MANAGER:ExecuteSearch(modeData.listingType)
        else
            self:SetMode(HOUSE_TOURS_MODES.BROWSE)
        end
    else
        self.pendingBrowseHouseId = houseId
    end
end
function ZO_HouseTours_Gamepad:ManageSpecificHouse(houseId)
    if self:IsShowing() then
        -- Order matters:
        local collectibleId = GetCollectibleIdForHouse(houseId)
        self.selectedPlayerListingCollectibleId = collectibleId
        self:SetMode(HOUSE_TOURS_MODES.MANAGE_LISTINGS)
        self:RefreshListingsManagementList(PRESERVE_SELECTIONS)
    else
        -- Order matters:
        self.manageSpecificHouseId = houseId
        ZO_ACTIVITY_FINDER_ROOT_GAMEPAD:ShowCategory(self:GetCategoryData())
    end
end
function ZO_HouseTours_Gamepad:BuildReportOption()
    local callback = function()
        local targetData = self.searchResultsList:GetTargetData()
        if targetData and targetData:CanReport() then
            ZO_HELP_GENERIC_TICKET_SUBMISSION_MANAGER:OpenReportHouseTourListingTicketScene(targetData)
        end
    end
    return self:BuildOptionEntry(nil, SI_HOUSE_TOURS_REPORT_LISTING, callback)
end
function ZO_HouseTours_Gamepad:BuildLinkToChatOption()
    local callback = function()
        if IsChatSystemAvailableForCurrentPlatform() then
            local targetData = self.searchResultsList:GetTargetData()
            if targetData then
                local houseId = targetData:GetHouseId()
                local ownerDisplayName = targetData:GetFormattedOwnerDisplayName()
                local link = GetHousingLink(houseId, ownerDisplayName, LINK_STYLE_DEFAULT)
                ZO_LinkHandler_InsertLinkAndSubmit(link)
            end
        end
    end
    return self:BuildOptionEntry(nil, SI_ITEM_ACTION_LINK_TO_CHAT, callback)
end
function ZO_HouseTours_Gamepad:RefreshHeader()
    local modeData = self:GetDataForMode(self.mode)
    if modeData then
        self.headerData = modeData.headerData
        ZO_GamepadGenericHeader_Refresh(self.header, self.headerData)
    else
        self.headerData = nil
    end
end
function ZO_HouseTours_Gamepad:RefreshCategoryList()
    local list = self.categoryList
    list:Clear()
    local recommendedEntryData = ZO_GamepadEntryData:New(GetString(SI_HOUSE_TOURS_RECOMMENDED), "EsoUI/Art/HouseTours/Gamepad/houseTours_recommended.dds")
    recommendedEntryData.mode = HOUSE_TOURS_MODES.RECOMMENDED
    list:AddEntry("ZO_GamepadMenuEntryTemplate", recommendedEntryData)
    local browseEntryData = ZO_GamepadEntryData:New(GetString(SI_HOUSE_TOURS_BROWSE_HOMES), "EsoUI/Art/HouseTours/Gamepad/houseTours_browse.dds")
    browseEntryData.mode = HOUSE_TOURS_MODES.BROWSE
    list:AddEntry("ZO_GamepadMenuEntryTemplate", browseEntryData)
    local favoritesEntryData = ZO_GamepadEntryData:New(GetString(SI_HOUSE_TOURS_FAVORITE_HOMES), "EsoUI/Art/HouseTours/Gamepad/houseTours_favorites.dds")
    favoritesEntryData.mode = HOUSE_TOURS_MODES.FAVORITES
    list:AddEntry("ZO_GamepadMenuEntryTemplate", favoritesEntryData)
    local manageListingsEntryData = ZO_GamepadEntryData:New(GetString(SI_HOUSE_TOURS_MANAGE_LISTINGS), "EsoUI/Art/HouseTours/Gamepad/houseTours_manageListings.dds")
    manageListingsEntryData.mode = HOUSE_TOURS_MODES.MANAGE_LISTINGS
    list:AddEntry("ZO_GamepadMenuEntryTemplate", manageListingsEntryData)
    list:Commit()
end
do
    local function GetSearchEntryNarrationText(entryData, entryControl)
        local narrations = {}
        --Get the narration for the nickname and house name
        ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(entryData:GetFormattedNickname()))
        ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(entryData:GetFormattedHouseName()))
        --Get the narration for the furniture count
        ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(GetString(SI_HOUSE_TOURS_LISTING_FURNITURE_COUNT_HEADER_NARRATION)))
        local furnitureCount = entryData:GetFurnitureCount()
        --If the furniture count is unknown, narrate that instead of a number
        if furnitureCount ~= nil then
            ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(furnitureCount))
        else
            ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(GetString(SI_HOUSE_TOURS_LISTING_FURNITURE_COUNT_UNKNOWN_NARRATION)))
        end
        --Get the narration for the tags
        ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(GetString(SI_HOUSE_TOURS_LISTING_TAGS_HEADER)))
        ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(entryData:GetFormattedTagsText()))
        --Get the narration for the owner
        ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(GetString(SI_HOUSE_TOURS_LISTING_OWNER_HEADER)))
        --If the owner is a friend or in one of our guilds, include that in the narration
        if entryData:IsOwnedByFriend() then
            ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(GetString(SI_HOUSE_TOURS_LISTING_OWNER_IS_FRIEND_NARRATION)))
        elseif entryData:IsOwnedByGuildMember() then
            ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(GetString(SI_HOUSE_TOURS_LISTING_OWNER_IS_GUILD_MEMBER_NARRATION)))
        end
        ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(entryData:GetFormattedOwnerDisplayName()))
        return narrations
    end
    local function CreateSearchEntry(houseListingData)
        local houseNickname = houseListingData:GetFormattedNickname()
        local houseName = houseListingData:GetFormattedHouseName()
        local icon = houseListingData:GetCollectibleIcon()
        local entryData = ZO_GamepadEntryData:New(houseNickname, icon)
        entryData:AddSubLabel(houseName)
        entryData:SetModifyTextType(MODIFY_TEXT_TYPE_NONE)
        entryData:SetDataSource(houseListingData)
        entryData.narrationText = GetSearchEntryNarrationText
        entryData.isHouseToursFavorite = houseListingData:IsFavorite()
        return entryData
    end
    function ZO_HouseTours_Gamepad:RefreshSearchResultsList(dontLeaveHeader)
        local list = self.searchResultsList
        list:Clear()
        local modeData = self:GetDataForMode(self.mode)
        local searchResults = HOUSE_TOURS_SEARCH_MANAGER:GetSortedSearchResults(modeData.listingType)
        for _, houseListingData in ipairs(searchResults) do
            local entryData = CreateSearchEntry(houseListingData)
            list:AddEntry("ZO_GamepadItemEntryTemplate", entryData)
        end
        list:Commit()
        if modeData.hasTagsFilter then
            --If the list is empty, enter the header instead
            if list:IsEmpty() then
                self:RequestEnterHeader()
            elseif self:IsHeaderActive() and not dontLeaveHeader then
                self:RequestLeaveHeader()
                self.tagsFilterDropdown:Deactivate()
            end
        end
        self:RefreshSearchState()
    end
    function ZO_HouseTours_Gamepad:RefreshSearchState()
        local modeData = self:GetDataForMode(self.mode)
        local currentSearchState = HOUSE_TOURS_SEARCH_MANAGER:GetSearchState(modeData.listingType)
        if currentSearchState == ZO_HOUSE_TOURS_SEARCH_STATES.WAITING or currentSearchState == ZO_HOUSE_TOURS_SEARCH_STATES.QUEUED then
            self.searchResultsList:SetNoItemText(GetString(SI_GROUP_FINDER_SEARCH_RESULTS_REFRESHING_RESULTS))
            self.tagsFilterHeaderFocus:Disable()
        elseif currentSearchState == ZO_HOUSE_TOURS_SEARCH_STATES.COMPLETE then
            self.searchResultsList:SetNoItemText(GetString(SI_HOUSE_TOURS_SEARCH_RESULTS_EMPTY_TEXT))
            self.tagsFilterHeaderFocus:Enable()
        end
        self:RefreshKeybinds()
    end
end
do
    local function GetPlayerListingEntryNarrationText(listingData)
        local narrations = {}
        --Get the narration for the nickname and house name
        ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(listingData:GetFormattedHouseName()))
        ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(listingData:GetFormattedNickname()))
        --Get the narration for the furniture count
        ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(GetString(SI_HOUSE_TOURS_LISTING_FURNITURE_COUNT_HEADER_NARRATION)))
        local furnitureCount = listingData:GetFurnitureCount()
        --If the furniture count is unknown, narrate that instead of a number
        if furnitureCount ~= nil then
            ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(furnitureCount))
        else
            ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(GetString(SI_HOUSE_TOURS_LISTING_FURNITURE_COUNT_UNKNOWN_NARRATION)))
        end
        -- Get the narration for the listed status
        local statusText = listingData:IsListed() and GetString(SI_HOUSE_TOURS_MANAGE_LISTING_STATUS_LISTED) or GetString(SI_HOUSE_TOURS_MANAGE_LISTING_STATUS_NOT_LISTED)
        ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(GetString(SI_HOUSE_TOURS_MANAGE_LISTING_STATUS_HEADER)))
        ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(statusText))
        -- Get the narration for the number of recommendations
        local numRecommendations = listingData:GetNumRecommendations()
        if numRecommendations > 0 then
            ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(GetString(SI_HOUSE_TOURS_MANAGE_LISTING_RECOMMENDATIONS_HEADER)))
            ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(numRecommendations))
        end
        return narrations
    end
    function ZO_HouseTours_Gamepad:InitializeListingManagementFunctions()
        self.narrateEntryFunction = function(narrationFunction, entryData, entryControl)
            local narrations = {}
            -- Generate the entry narration using the specified narration function.
            ZO_AppendNarration(narrations, narrationFunction(entryData, entryControl))
            -- Generate the listing panel narration
            return narrations
        end
        self.narrateDefaultEntryFunction = function(entryData, entryControl)
            return self.narrateEntryFunction(ZO_GetSharedGamepadEntryDefaultNarrationText, entryData, entryControl)
        end
        self.narrateDropdownEntryFunction = function(entryData, entryControl)
            return self.narrateEntryFunction(ZO_GetDefaultParametricListDropdownNarrationText, entryData, entryControl)
        end
        self.onDropdownEntrySelected = function(entryData, entryControl)
            entryControl.dropdown:Activate()
        end
        self.onNicknameEntrySelected = function(targetData, targetControl, selectedCollectibleId)
            local selectedListingData = HOUSE_TOURS_PLAYER_LISTINGS_MANAGER:GetListingDataByCollectibleId(selectedCollectibleId)
            if selectedListingData then
                local nickname = selectedListingData:GetNickname()
                local defaultNickname = selectedListingData:GetDefaultNickname()
                -- Only pre-fill the edit text if it's different from the default nickname
                local initialEditText = ""
                if nickname ~= defaultNickname then
                    initialEditText = nickname
                end
                ZO_Dialogs_ShowGamepadDialog("GAMEPAD_COLLECTIONS_INVENTORY_RENAME_COLLECTIBLE", { collectibleId = selectedCollectibleId, name = initialEditText, defaultName = defaultNickname })
            end
        end
        self.onSelectHomeSelected = function(entryData, entryControl)
            self:SetMode(HOUSE_TOURS_MODES.SELECT_HOME)
        end
    end
    function ZO_HouseTours_Gamepad:GetSelectedPlayerListingData()
        return HOUSE_TOURS_PLAYER_LISTINGS_MANAGER:GetListingDataByCollectibleId(self.selectedPlayerListingCollectibleId)
    end
    function ZO_HouseTours_Gamepad:RefreshListingsManagementList(preserveEntrySelections)
        local preservedTagSelections = nil
        if preserveEntrySelections then
            preservedTagSelections = {}
            local selectedTagsData = self.tagsDropdownEntries:GetSelectedItems()
            for _, item in ipairs(selectedTagsData) do
                table.insert(preservedTagSelections, item.tagValue)
            end
        end
        local list = self.listingsManagementList
        list:Clear()
        local selectedData = self:GetSelectedPlayerListingData()
        if selectedData then
            -- Setup the select home entry
            local selectHomeEntryData = ZO_GamepadEntryData:New(selectedData:GetFormattedHouseName(), selectedData:GetCollectibleIcon())
            selectHomeEntryData.header = GetString(SI_HOUSE_TOURS_MANAGE_LISTING_HOUSE_SELECT_HOME)
            selectHomeEntryData.selectCallback = self.onSelectHomeSelected
            selectHomeEntryData.isListedResidence = selectedData:IsListed()
            selectHomeEntryData.isPrimaryResidence = selectedData:IsPrimaryResidence()
            selectHomeEntryData.isFavorite = selectedData:IsCollectibleFavorite()
            selectHomeEntryData.narrationText = self.narrateDefaultEntryFunction
            list:AddEntryWithHeader("ZO_GamepadMenuEntryTemplateWithArrow", selectHomeEntryData)
            -- Setup the default visitor access dropdown
            local defaultVisitorAccessEntryData = ZO_GamepadEntryData:New("")
            defaultVisitorAccessEntryData.header = GetString(SI_HOUSING_FURNITURE_SETTINGS_GENERAL_DEFAULT_ACCESS_TEXT)
            defaultVisitorAccessEntryData.selectCallback = self.onDropdownEntrySelected
            defaultVisitorAccessEntryData.narrationText = self.narrateDropdownEntryFunction
            list:AddEntryWithHeader("ZO_Gamepad_Dropdown_Item_Indented", defaultVisitorAccessEntryData)
            -- Setup the tags dropdown
            -- Clear out the tag selections and auto select the currently saved tags for this house
            self.tagsDropdownEntries:ClearAllSelections()
            local tags = preservedTagSelections or selectedData:GetTags()
            for _, item in ipairs(self.tagsDropdownEntries:GetAllItems()) do
                if ZO_IsElementInNumericallyIndexedTable(tags, item.tagValue) then
                    self.tagsDropdownEntries:SetItemSelected(item, true)
                end
            end
            local tagsEntryData = ZO_GamepadEntryData:New("")
            tagsEntryData.header = GetString(SI_HOUSE_TOURS_LISTING_TAGS_HEADER)
            tagsEntryData.selectCallback = self.onDropdownEntrySelected
            tagsEntryData.narrationText = self.narrateDropdownEntryFunction
            list:AddEntryWithHeader("ZO_Gamepad_MultiSelection_Dropdown_Item_Indented", tagsEntryData)
            -- Setup the house nickname entry
            local nicknameEntryData = ZO_GamepadEntryData:New(selectedData:GetFormattedNickname())
            nicknameEntryData.header = GetString(SI_HOUSE_TOURS_MANAGE_LISTING_CURRENT_NICKNAME_HEADER)
            nicknameEntryData.selectCallback = self.onNicknameEntrySelected
            nicknameEntryData.selectName = GetString(SI_COLLECTIBLE_ACTION_RENAME)
            nicknameEntryData.narrationText = self.narrateDefaultEntryFunction
            list:AddEntryWithHeader("ZO_GamepadMenuEntryTemplate", nicknameEntryData)
        end
        list:Commit()
    end
    local function GetHomeListEntryNarrationText(entryData, entryControl)
        local narrations = {}
        -- Generate the standard parametric list entry narration
        ZO_AppendNarration(narrations, ZO_GetSharedGamepadEntryDefaultNarrationText(entryData, entryControl))
        --Generate the listing panel narration
        ZO_AppendNarration(narrations, GetPlayerListingEntryNarrationText(entryData))
        return narrations
    end
    function ZO_HouseTours_Gamepad:RefreshHomeList()
        local list = self.homeList
        list:Clear()
        local sortedListingData = HOUSE_TOURS_PLAYER_LISTINGS_MANAGER:GetSortedListingData()
        for _, listingData in ipairs(sortedListingData) do
            local entryData = ZO_GamepadEntryData:New(listingData:GetFormattedHouseName(), listingData:GetCollectibleIcon())
            entryData:SetDataSource(listingData)
            entryData.isListedResidence = listingData:IsListed()
            entryData.isPrimaryResidence = listingData:IsPrimaryResidence()
            entryData.isFavorite = listingData:IsCollectibleFavorite()
            entryData.narrationText = GetHomeListEntryNarrationText
            list:AddEntry("ZO_GamepadItemEntryTemplate", entryData)
        end
        list:Commit()
    end
end
function ZO_HouseTours_Gamepad:ReselectLastSelectedIndexForCurrentMode()
    local modeData = self:GetDataForMode(self.mode)
    if not (modeData and modeData.list == self.searchResultsList) then
        -- Only reselect the last selected index for search results.
        return
    end
    local lastSelectedIndex = modeData.lastSelectedIndex
    if not lastSelectedIndex then
        -- There is no last selected index yet.
        return
    end
    local numEntries = modeData.list:GetNumEntries()
    if numEntries < 1 then
        -- There is nothing to reselect.
        return
    end
    -- Attempt to reselect the last selected index.
    local ALLOW_EVEN_IF_DISABLED = true
    lastSelectedIndex = zo_clamp(lastSelectedIndex, 1, numEntries)
    modeData.list:SetSelectedIndexWithoutAnimation(lastSelectedIndex, ALLOW_EVEN_IF_DISABLED)
end
function ZO_HouseTours_Gamepad:UpdateLastSelectedIndexForCurrentMode(selectedIndex)
    local modeData = self:GetDataForMode(self.mode)
    if not (modeData and modeData.list == self.searchResultsList) then
        -- Only track the last selected data for search results.
        return
    end
    -- Store the last selected index, if any.
    modeData.lastSelectedIndex = selectedIndex
end
function ZO_HouseTours_Gamepad:RefreshList()
    local modeData = self:GetDataForMode(self.mode)
    if modeData then
        modeData.refreshFunction()
    end
    self:RefreshHeader()
end
function ZO_HouseTours_Gamepad:ResetTooltips()
    GAMEPAD_TOOLTIPS:ClearTooltip(GAMEPAD_RIGHT_TOOLTIP)
end
function ZO_HouseTours_Gamepad:RefreshTooltips()
    self:ResetTooltips()
    local modeData = self:GetDataForMode(self.mode)
    if modeData and modeData.tooltipFunction then
        modeData.tooltipFunction()
    end
end
function ZO_HouseTours_Gamepad:RefreshTagsFilterDropdown()
    local modeData = self:GetDataForMode(self.mode)
    if modeData then
        self.tagsFilterDropdownControl:SetHidden(not modeData.hasTagsFilter)
        if modeData.hasTagsFilter then
            self.tagsFilterDropdownEntries:ClearAllSelections()
            local filters = HOUSE_TOURS_SEARCH_MANAGER:GetSearchFilters(modeData.listingType)
            if filters then
                local tags = filters:GetTags()
                for _, item in ipairs(self.tagsFilterDropdownEntries:GetAllItems()) do
                    if ZO_IsElementInNumericallyIndexedTable(tags, item.tagValue) then
                        self.tagsFilterDropdownEntries:SetItemSelected(item, true)
                    end
                end
                self.tagsFilterDropdown:LoadData(self.tagsFilterDropdownEntries)
            end
        end
    else
        self.tagsFilterDropdownControl:SetHidden(true)
    end
end
do
    local FURNITURE_COUNT_TEXTURE = "EsoUI/Art/HouseTours/houseTours_furnitureCount.dds"
    local IS_FRIEND_TEXTURE = "EsoUI/Art/HouseTours/houseTours_listingIcon_friends.dds"
    local IS_GUILD_MEMBER_TEXTURE = "EsoUI/Art/HouseTours/houseTours_listingIcon_guild.dds"
    local IS_LOCAL_PLAYER_TEXTURE = "EsoUI/Art/HouseTours/houseTours_listingIcon_localPlayer.dds"
    local IS_LISTED_TEXTURE = "EsoUI/Art/HouseTours/houseTours_listed.dds"
    function ZO_HouseTours_Gamepad:RefreshListingPanel(list, selectedData)
        local showPanel = false
        local modeData = self:GetDataForMode(self.mode)
        --If the mode has a listing panel that is visible, update it now
        if modeData and selectedData and list == modeData.list then
            local hasListingPanel = modeData.hasListingPanel
            if type(hasListingPanel) == "function" then
                hasListingPanel = hasListingPanel()
            end
            local panelContents = modeData.listingPanelContents
            if hasListingPanel and panelContents then
                local listingPanel = self.listingPanelControl
                listingPanel.backgroundControl:SetTexture(selectedData:GetBackgroundImage())
                panelContents.nicknameLabel:SetText(selectedData:GetFormattedNickname())
                panelContents.nameLabel:SetText(selectedData:GetFormattedHouseName())
                local furnitureCountText
                local furnitureCount = selectedData:GetFurnitureCount()
                if furnitureCount ~= nil then
                    furnitureCountText = zo_iconTextFormat(FURNITURE_COUNT_TEXTURE, 64, 64, furnitureCount)
                else
                    furnitureCountText = zo_iconTextFormat(FURNITURE_COUNT_TEXTURE, 64, 64, GetString(SI_HOUSE_TOURS_LISTING_FURNITURE_COUNT_UNKNOWN))
                end
                panelContents.furnitureCountLabel:SetText(furnitureCountText)
                if panelContents.tagsLabel then
                    panelContents.tagsLabel:SetText(selectedData:GetFormattedTagsText())
                end
                if panelContents.ownerLabel then
                    local formattedDisplayName = selectedData:GetFormattedOwnerDisplayName()
                    if selectedData:IsOwnedByFriend() then
                        formattedDisplayName = zo_iconTextFormatNoSpace(IS_FRIEND_TEXTURE, 64, 64, formattedDisplayName)
                    elseif selectedData:IsOwnedByGuildMember() then
                        formattedDisplayName = zo_iconTextFormatNoSpace(IS_GUILD_MEMBER_TEXTURE, 64, 64, formattedDisplayName)
                    elseif selectedData:IsOwnedByLocalPlayer() then
                        local INHERIT_COLOR = true
                        formattedDisplayName = ZO_SECOND_CONTRAST_TEXT:Colorize(zo_iconTextFormatNoSpace(IS_LOCAL_PLAYER_TEXTURE, 64, 64, formattedDisplayName, INHERIT_COLOR))
                    end
                    panelContents.ownerLabel:SetText(formattedDisplayName)
                end
                if panelContents.statusLabel then
                    local statusText
                    if selectedData:IsListed() then
                        statusText = zo_iconTextFormatNoSpace(IS_LISTED_TEXTURE, 32, 32, GetString(SI_HOUSE_TOURS_MANAGE_LISTING_STATUS_LISTED))
                    else
                        statusText = GetString(SI_HOUSE_TOURS_MANAGE_LISTING_STATUS_NOT_LISTED)
                    end
                    panelContents.statusLabel:SetText(statusText)
                end
                if panelContents.recommendationsLabel and panelContents.recommendationsHeader then
                    local numRecommendations = selectedData:GetNumRecommendations()
                    if numRecommendations > 0 then
                        panelContents.recommendationsHeader:SetHidden(false)
                        panelContents.recommendationsLabel:SetHidden(false)
                        panelContents.recommendationsLabel:SetText(ZO_CommaDelimitNumber(numRecommendations))
                    else
                        panelContents.recommendationsHeader:SetHidden(true)
                        panelContents.recommendationsLabel:SetHidden(true)
                    end
                end
                showPanel = true
            end
        end
        --Add or remove the fragments for the listing panel depending on if we should be showing it
        if showPanel then
            SCENE_MANAGER:AddFragment(GAMEPAD_NAV_QUADRANT_2_3_BACKGROUND_FRAGMENT)
            SCENE_MANAGER:AddFragment(self.listingPanelFragment)
        else
            SCENE_MANAGER:RemoveFragment(GAMEPAD_NAV_QUADRANT_2_3_BACKGROUND_FRAGMENT)
            SCENE_MANAGER:RemoveFragment(self.listingPanelFragment)
        end
    end
end
function ZO_HouseTours_Gamepad:RefreshNickname()
    if not (self.hasHouses and self.mode == HOUSE_TOURS_MODES.MANAGE_LISTINGS and self:IsShowing()) then
        return
    end
    local modeData = self:GetDataForMode(self.mode)
    if not modeData then
        return
    end
    local hasListingPanel = modeData.hasListingPanel
    if not hasListingPanel or (type(hasListingPanel) == "function" and not hasListingPanel()) then
        return
    end
    local panelContents = modeData.listingPanelContents
    if not panelContents then
        return
    end
    local selectedListingData = HOUSE_TOURS_PLAYER_LISTINGS_MANAGER:GetListingDataByCollectibleId(self.selectedPlayerListingCollectibleId)
    if not selectedListingData then
        return
    end
    -- Refresh the nickname in the listing panel.
    local formattedNickname = selectedListingData:GetFormattedNickname()
    panelContents.nicknameLabel:SetText(formattedNickname)
    -- Refresh the nickname entry data in the parametric list.
    self:RefreshListingsManagementList(PRESERVE_SELECTIONS)
end
function ZO_HouseTours_Gamepad:SetIsListingOperationOnCooldown(isListingOperationOnCooldown)
    self.isListingOperationOnCooldown = isListingOperationOnCooldown
end
function ZO_HouseTours_Gamepad:GetDataForMode(mode)
    return self.modeData[mode]
end
function ZO_HouseTours_Gamepad:SetMode(newMode)
    local oldMode = self.mode
    if newMode ~= oldMode then
        self.mode = newMode
        --Remove the keybinds and hide the panel contents for the previous mode first
        if oldMode then
            local oldModeData = self:GetDataForMode(oldMode)
            if oldModeData.listingPanelContents then
                oldModeData.listingPanelContents:SetHidden(true)
            end
            KEYBIND_STRIP:RemoveKeybindButtonGroup(oldModeData.keybindStripDescriptor)
        end
        self:RefreshTagsFilterDropdown()
        if newMode then
            --Add the keybinds and panel contents for the new mode and switch to the corresponding list
            local newModeData = self:GetDataForMode(newMode)
            if newModeData.listingPanelContents then
                newModeData.listingPanelContents:SetHidden(false)
            end
            KEYBIND_STRIP:AddKeybindButtonGroup(newModeData.keybindStripDescriptor)
            self:SetCurrentList(newModeData.list)
            --If the new mode doesn't have a tags filter, make sure to leave the header
            if not newModeData.hasTagsFilter and self:IsHeaderActive() then
                self:RequestLeaveHeader()
            end
            if newModeData.listingType then
                HOUSE_TOURS_SEARCH_MANAGER:ExecuteSearch(newModeData.listingType)
            end
        end
        --Since the mode changed, refresh the list and listing panel
        self:RefreshList()
        local currentList = self:GetCurrentList()
        local listingData
        --The manage listings mode pull its listing data from the selected player listing collectible id, not the current selection in the list
        if self.mode == HOUSE_TOURS_MODES.MANAGE_LISTINGS then
            listingData = HOUSE_TOURS_PLAYER_LISTINGS_MANAGER:GetListingDataByCollectibleId(self.selectedPlayerListingCollectibleId)
        else
            listingData = currentList:GetSelectedData()
        end
        self:RefreshListingPanel(currentList, listingData)
        self:RefreshTooltips()
    end
end
function ZO_HouseTours_Gamepad.OnControlInitialized(control)
    HOUSE_TOURS_GAMEPAD = ZO_HouseTours_Gamepad:New(control)
end