Back to Home

ESO Lua File v101041

ingame/housingeditor/gamepad/furnitureclasses_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
ZO_HOUSING_CATEGORY_PATHING_ICON_GAMEPAD = "EsoUI/Art/Housing/Gamepad/gp_housing_category_npc_pathing.dds"
ZO_HOUSING_PATH_STARTING_NODE_ICON_GAMEPAD = "EsoUI/Art/Housing/Gamepad/gp_npc_pathing_start.dds"
--
--[[ ZO_HousingFurnitureList_Gamepad ]]--
--
local RIGHT_INFO_STATE =
{
    NONE = 0,
    HOUSE_INFO = 1,
    FURNITURE_INFO = 2,
}
ZO_HousingFurnitureList_Gamepad = ZO_Object:Subclass()
function ZO_HousingFurnitureList_Gamepad:New(...)
    local furnitureList = ZO_Object.New(self)
    furnitureList:Initialize(...)
    return furnitureList
end
function ZO_HousingFurnitureList_Gamepad:Initialize(owner)
    self.owner = owner
    self.optionsDialogLayoutInfo = nil
    -- Order matters
    self.categoryList =
    {
        list = owner:RequestNewList(),
        keybinds = self.categoryKeybindStripDescriptor,
        buildListFunction = function() return self:BuildCategoryList() end,
        -- The title text will be updated to the name of current tab
    }
    local furnitureList = owner:RequestNewList()
    self.furnitureList =
    {
        list = furnitureList,
        keybinds = self.furnitureKeybindStripDescriptor,
        buildListFunction = function()
                                self:RefreshCurrentCategoryData()
                                self:UpdateFurnitureListSavedPosition()
                                return self:BuildFurnitureList()
                            end,
        -- The title text will be updated to the name of the furniture category/subcategory
    }
    self.savedCategoryListPositions = {}
    furnitureList:SetOnTargetDataChangedCallback(function(...) self:OnFurnitureTargetChanged(...) end)
    local function FurnitureEntryDataSetup(control, data, selected, reselectingDuringRebuild, enabled, active)
        ZO_SharedGamepadEntry_OnSetup(control, data, selected, reselectingDuringRebuild, enabled, active)
        local statusIndicator = control.statusIndicator
        if statusIndicator then
            local NO_TINT = nil
            if data.isFromCrownStore and not data.furnitureObject.marketProductId then
                statusIndicator:AddIcon(ZO_Currency_GetPlatformCurrencyIcon(CURT_CROWNS), NO_TINT, GetString(SI_SCREEN_NARRATION_CROWN_STORE_ITEM_ICON_NARRATION))
            end
            if data.isStartingPathNode then
                statusIndicator:AddIcon(ZO_HOUSING_PATH_STARTING_NODE_ICON_GAMEPAD, NO_TINT, GetString(SI_SCREEN_NARRATION_STARTING_NODE_ICON_NARRATION))
            end
            statusIndicator:Show()
        end
    end
    local PRICE_LABEL_PADDING_X = 5
    local function MarketProductEntryDataSetup(control, data, selected, ...)
        local canBePurchased = data.furnitureObject:CanBePurchased()
        data.iconDesaturation = canBePurchased and 0 or 1
        data.disabled = not canBePurchased
        FurnitureEntryDataSetup(control, data, selected, ...)
        local furnitureObject = data.furnitureObject
        local currencyType = GetCurrencyTypeFromMarketCurrencyType(furnitureObject.currencyType)
        ZO_CurrencyControl_SetSimpleCurrency(control.priceLabel, currencyType, furnitureObject.costAfterDiscount, ZO_GAMEPAD_CURRENCY_OPTIONS, CURRENCY_SHOW_ALL)
        data:SetPriceNarrationInfo(furnitureObject.costAfterDiscount, currencyType)
        
        local priceWidth = control.priceLabel:GetTextWidth()
        control.label:SetDimensions(ZO_GAMEPAD_DEFAULT_LIST_ENTRY_WIDTH_AFTER_INDENT - PRICE_LABEL_PADDING_X - priceWidth)
        if furnitureObject.onSale then
            local formattedAmount = zo_strformat(SI_NUMBER_FORMAT, furnitureObject.cost)
            local strikethroughAmountString = zo_strikethroughTextFormat(formattedAmount)
            control.previousPriceLabel:SetText(strikethroughAmountString)
        end
        control.previousPriceLabel:SetHidden(not furnitureObject.onSale)
        local subLabelBackgroundColor
        local subLabelTextColor
        local sublabelUpdateHandler
        if furnitureObject:IsLimitedTimeProduct() then
            subLabelBackgroundColor = ZO_BLACK
            subLabelTextColor = selected and ZO_MARKET_PRODUCT_ON_SALE_COLOR or ZO_MARKET_PRODUCT_ON_SALE_DIMMED_COLOR
            furnitureObject:SetTimeLeftOnLabel(control.subLabel1)
            sublabelUpdateHandler = function() furnitureObject:SetTimeLeftOnLabel(control.subLabel1) end
        elseif furnitureObject.onSale then
            subLabelBackgroundColor = selected and ZO_MARKET_PRODUCT_ON_SALE_COLOR or ZO_MARKET_PRODUCT_ON_SALE_DIMMED_COLOR
            subLabelTextColor = selected and ZO_MARKET_PRODUCT_BACKGROUND_BRIGHTNESS_COLOR or ZO_MARKET_DIMMED_COLOR
            control.subLabel1:SetText(zo_strformat(SI_MARKET_DISCOUNT_PRICE_PERCENT_FORMAT, furnitureObject.discountPercent))
            control.subLabel1:SetModifyTextType(MODIFY_TEXT_TYPE_UPPERCASE)
        elseif furnitureObject.isNew and canBePurchased then -- only show the new tag if the product isn't purchased
            subLabelBackgroundColor = selected and ZO_MARKET_PRODUCT_NEW_COLOR or ZO_MARKET_PRODUCT_NEW_DIMMED_COLOR
            subLabelTextColor = selected and ZO_MARKET_PRODUCT_BACKGROUND_BRIGHTNESS_COLOR or ZO_MARKET_DIMMED_COLOR
            control.subLabel1:SetText(GetString(SI_MARKET_TILE_CALLOUT_NEW))
            control.subLabel1:SetModifyTextType(MODIFY_TEXT_TYPE_UPPERCASE)
        end
        if subLabelBackgroundColor then
            furnitureObject.SetCalloutBackgroundColor(control.subLabel1LeftBackground, control.subLabel1RightBackground, control.subLabel1CenterBackground, subLabelBackgroundColor)
            control.subLabel1:SetColor(subLabelTextColor:UnpackRGB())
            control.numSubLabels = 1
        else
            control.numSubLabels = 0
        end
        control.subLabel1:SetHidden(not subLabelBackgroundColor)
        control.subLabel1:SetHandler("OnUpdate", sublabelUpdateHandler)
    end
    local DEFAULT_EQUALITY_FUNCTION = nil
    furnitureList:AddDataTemplate("ZO_GamepadHousingItemEntryTemplate", FurnitureEntryDataSetup, ZO_GamepadMenuEntryTemplateParametricListFunction, DEFAULT_EQUALITY_FUNCTION, "ItemEntry")
    furnitureList:AddDataTemplateWithHeader("ZO_GamepadHousingItemEntryTemplate", FurnitureEntryDataSetup,  ZO_GamepadMenuEntryTemplateParametricListFunction, DEFAULT_EQUALITY_FUNCTION, "ZO_GamepadMenuEntryHeaderTemplate", nil, "ItemEntry")
    furnitureList:AddDataTemplate("ZO_GamepadHousingMPEntryTemplate", MarketProductEntryDataSetup, ZO_GamepadMenuEntryTemplateParametricListFunction, DEFAULT_EQUALITY_FUNCTION, "MPEntry")
    furnitureList:AddDataTemplateWithHeader("ZO_GamepadHousingMPEntryTemplate", MarketProductEntryDataSetup, ZO_GamepadMenuEntryTemplateParametricListFunction, DEFAULT_EQUALITY_FUNCTION, "ZO_GamepadMenuEntryHeaderTemplate", nil, "MPEntry")
    self.CompareFurnitureEntriesFunction = function(a, b)
        return self:CompareFurnitureEntries(a, b)
    end
end
function ZO_HousingFurnitureList_Gamepad:InitializeKeybindStripDescriptors()
    local optionsDialogName = self.optionsDialogLayoutInfo and self.optionsDialogLayoutInfo.dialogName or nil
    local function ShowOptionsDialog()
        local boundFilterValue, locatonFiltersValue, limitFiltersValue = self.optionsDialogLayoutInfo:getFiltersFunction()
        local dialogData =
        {
            boundFilter = boundFilterValue,
            locationFilters = locatonFiltersValue,
            limitFilters = limitFiltersValue,
        }
        ZO_Dialogs_ShowGamepadDialog(optionsDialogName, dialogData)
    end
    --Category List Keybinds
    self.categoryKeybindStripDescriptor =
    {
        alignment = KEYBIND_STRIP_ALIGN_LEFT,
        -- Select Category
        {
            name = GetString(SI_GAMEPAD_SELECT_OPTION),
            keybind = "UI_SHORTCUT_PRIMARY",
            callback = function()
                self:ViewCategory()
            end,
            visible = function()
                if self.currentList then
                    local entryData = self.currentList.list:GetTargetData()
                    return entryData ~= nil
                end
                return false
            end,
            sound = SOUNDS.GAMEPAD_MENU_FORWARD,
        },
        -- Options
        {
            name = function()
                if optionsDialogName and not HOUSING_EDITOR_STATE:IsHousePreview() then
                    return GetString(SI_GAMEPAD_HOUSING_FURNITURE_BROWSER_OPTIONS_KEYBIND)
                else
                    return GetString(SI_GAMEPAD_FURNITURE_TEXT_FILTER_KEYBIND_TEXT)
                end
            end,
            keybind = "UI_SHORTCUT_TERTIARY",
            callback = function()
                if optionsDialogName and not HOUSING_EDITOR_STATE:IsHousePreview() then
                    ShowOptionsDialog()
                else
                    self.owner:SelectTextFilter()
                end
            end,
        },
        -- Link House Invite in Chat
        {
            name = GetString(SI_HOUSING_LINK_IN_CHAT),
            keybind = "UI_SHORTCUT_RIGHT_STICK",
            callback = ZO_HousingBook_LinkCurrentHouseInChat,
            alignment = KEYBIND_STRIP_ALIGN_RIGHT,
            order = 100,
            visible = function()
                return not HOUSING_EDITOR_STATE:IsHousePreview()
            end,
        },
        -- Link House Invite in Mail
        {
            name = GetString(SI_HOUSING_LINK_IN_MAIL),
            keybind = "UI_SHORTCUT_QUATERNARY",
            callback = function()
                local houseId = GetCurrentZoneHouseId()
                local ownerDisplayName = GetCurrentHouseOwner()
                local link = ZO_HousingBook_GetHouseLink(houseId, ownerDisplayName)
                if link then
                    MAIL_MANAGER_GAMEPAD.inbox:InsertBodyText(link)
                end
            end,
            alignment = KEYBIND_STRIP_ALIGN_RIGHT,
            order = 110,
            visible = function()
                return not HOUSING_EDITOR_STATE:IsHousePreview()
            end,
        },
    }
    local function BackFunction()
    end
    ZO_Gamepad_AddBackNavigationKeybindDescriptors(self.categoryKeybindStripDescriptor, GAME_NAVIGATION_TYPE_BUTTON, BackFunction)
    --Furniture List Keybinds
    local function ToggleFurnitureRightInfoState()
        if self.rightInfoState == RIGHT_INFO_STATE.HOUSE_INFO then
            self:SetFurnitureRightInfoState(RIGHT_INFO_STATE.FURNITURE_INFO)
        else
            self:SetFurnitureRightInfoState(RIGHT_INFO_STATE.HOUSE_INFO)
        end
        SCREEN_NARRATION_MANAGER:QueueParametricListEntry(self.furnitureList.list)
    end
    local function ToggleViewKeybindEnabled()
        return self.furnitureList.list:GetTargetData() ~= nil
    end
    self.furnitureKeybindStripDescriptor =
    {
        alignment = KEYBIND_STRIP_ALIGN_LEFT,
        -- Options
        {
            name = function()
                if optionsDialogName and not HOUSING_EDITOR_STATE:IsHousePreview() then
                    return GetString(SI_GAMEPAD_HOUSING_FURNITURE_BROWSER_OPTIONS_KEYBIND)
                else
                    return GetString(SI_GAMEPAD_FURNITURE_TEXT_FILTER_KEYBIND_TEXT)
                end
            end,
            keybind = "UI_SHORTCUT_TERTIARY",
            callback = function()
                if optionsDialogName and not HOUSING_EDITOR_STATE:IsHousePreview() then
                    ShowOptionsDialog()
                else
                    self.owner:SelectTextFilter()
                end
            end,
        },
        -- Toggle view
        {
            alignment = KEYBIND_STRIP_ALIGN_RIGHT,
            name = GetString(SI_GAMEPAD_HOUSING_FURNITURE_BROWSER_TOGGLE_INFO),
            keybind = "UI_SHORTCUT_LEFT_STICK",
            callback = ToggleFurnitureRightInfoState,
            visible = ToggleViewKeybindEnabled,
        },
    }
    local function OnFurnitureListBack()
    end
    ZO_Gamepad_AddBackNavigationKeybindDescriptors(self.furnitureKeybindStripDescriptor, GAME_NAVIGATION_TYPE_BUTTON, OnFurnitureListBack)
end
function ZO_HousingFurnitureList_Gamepad:InitializeOptionsDialog()
    local optionsDialogLayoutInfo = self.optionsDialogLayoutInfo
    if not optionsDialogLayoutInfo then
        -- This list does not require an Options dialog.
        return
    end
    local optionsDialogName = optionsDialogLayoutInfo.dialogName
    local boundFilterEnabled = optionsDialogLayoutInfo.boundFilterEnabled
    local locationFilterEnabled = optionsDialogLayoutInfo.locationFilterEnabled
    local limitFilterEnabled = optionsDialogLayoutInfo.limitFilterEnabled
    local boundFilterTypesData = nil
    if boundFilterEnabled then
        boundFilterTypesData = {}
        for filterValue = HOUSING_FURNITURE_BOUND_FILTER_ITERATION_BEGIN, HOUSING_FURNITURE_BOUND_FILTER_ITERATION_END do
            local function OnBoundFilterSelected()
                optionsDialogLayoutInfo.updateFiltersHandler(filterValue)
            end
            local entryName
            if filterValue == HOUSING_FURNITURE_BOUND_FILTER_ALL then
                entryName = GetString(SI_HOUSING_FURNITURE_BOUND_FILTER_ALL_TEXT)
            else
                entryName = GetString("SI_HOUSINGFURNITUREBOUNDFILTER", filterValue)
            end
            local newEntry = ZO_ComboBox_Base:CreateItemEntry(entryName, OnBoundFilterSelected)
            newEntry.filterValue = filterValue
            table.insert(boundFilterTypesData, newEntry)
        end
    end
    local locationFilterTypesData = nil
    if locationFilterEnabled then
        local locationFilterEntries = {}
        for filterValue in ZO_FlagHelpers.FlagIterator(HOUSING_FURNITURE_LOCATION_FILTER_ITERATION_BEGIN * 2, HOUSING_FURNITURE_LOCATION_FILTER_ITERATION_END) do
            local newEntry = ZO_ComboBox_Base:CreateItemEntry(GetString("SI_HOUSINGFURNITURELOCATIONFILTER", filterValue))
            newEntry.filterValue = filterValue
            newEntry.callback = function(control, name, item, isSelected)
                local boundFiltersValue, locationFiltersValue, limitFiltersValue = optionsDialogLayoutInfo:getFiltersFunction()
                if isSelected then
                    locationFiltersValue = ZO_FlagHelpers.SetMaskFlag(locationFiltersValue, filterValue)
                else
                    locationFiltersValue = ZO_FlagHelpers.ClearMaskFlag(locationFiltersValue, filterValue)
                end
                optionsDialogLayoutInfo.updateFiltersHandler(boundFiltersValue, locationFiltersValue, limitFiltersValue)
            end
            table.insert(locationFilterEntries, newEntry)
        end
        local function CompareLocationFilters(left, right)
            return left.name < right.name
        end
        table.sort(locationFilterEntries, CompareLocationFilters)
        locationFilterTypesData = ZO_MultiSelection_ComboBox_Data_Gamepad:New()
        for _, entry in ipairs(locationFilterEntries) do
            locationFilterTypesData:AddItem(entry)
        end
    end
    local limitFilterTypesData = nil
    if limitFilterEnabled then
        -- In order to match the House Information panel layout these limit filters are not sorted.
        limitFilterTypesData = ZO_MultiSelection_ComboBox_Data_Gamepad:New()
        for limitType = HOUSING_FURNISHING_LIMIT_TYPE_ITERATION_BEGIN, HOUSING_FURNISHING_LIMIT_TYPE_ITERATION_END do
            local newEntry = ZO_ComboBox_Base:CreateItemEntry(GetString("SI_HOUSINGFURNISHINGLIMITTYPE", limitType))
            local filterValue = ZO_HOUSING_FURNITURE_LIMIT_FILTERS[limitType + 1]
            newEntry.filterValue = filterValue
            newEntry.callback = function(control, name, item, isSelected)
                local boundFiltersValue, locationFiltersValue, limitFiltersValue = optionsDialogLayoutInfo:getFiltersFunction()
                if isSelected then
                    limitFiltersValue = ZO_FlagHelpers.SetMaskFlag(limitFiltersValue, filterValue)
                else
                    limitFiltersValue = ZO_FlagHelpers.ClearMaskFlag(limitFiltersValue, filterValue)
                end
                optionsDialogLayoutInfo.updateFiltersHandler(boundFiltersValue, locationFiltersValue, limitFiltersValue)
            end
            limitFilterTypesData:AddItem(newEntry)
        end
    end
    local boundFilterTypesDropdownEntry = nil
    if boundFilterEnabled then
        boundFilterTypesDropdownEntry =
        {
            template = "ZO_GamepadDropdownItem",
            templateData = 
            {
                setup = function(control, data, selected)
                    local dropdown = control.dropdown
                    boundFilterTypesData.dropdownInstance = dropdown
                    dropdown:SetNormalColor(ZO_GAMEPAD_COMPONENT_COLORS.UNSELECTED_INACTIVE:UnpackRGB())
                    dropdown:SetHighlightedColor(ZO_GAMEPAD_COMPONENT_COLORS.SELECTED_ACTIVE:UnpackRGB())
                    dropdown:SetSelectedItemTextColor(selected)
                    dropdown:SetSortsItems(false)
                    dropdown:ClearItems()
                    for _, entry in ipairs(boundFilterTypesData) do
                        dropdown:AddItem(entry)
                    end
                    dropdown:UpdateItems()
                    local boundFilterValue = optionsDialogLayoutInfo:getFiltersFunction()
                    boundFilterValue = boundFilterValue or HOUSING_FURNITURE_BOUND_FILTER_ALL
                    local isAllBoundSelected = false
                    if boundFilterValue == HOUSING_FURNITURE_BOUND_FILTER_ALL then
                        isAllBoundSelected = true
                    elseif boundFilterValue == (HOUSING_FURNITURE_BOUND_FILTER_BOUND + HOUSING_FURNITURE_BOUND_FILTER_UNBOUND) then
                        isAllBoundSelected = true
                    end
                    if isAllBoundSelected then
                        dropdown:SelectItemByIndex(1)
                    else
                        if ZO_FlagHelpers.MaskHasFlag(boundFilterValue, HOUSING_FURNITURE_BOUND_FILTER_BOUND) then
                            dropdown:SelectItemByIndex(2)
                        end
                        if ZO_FlagHelpers.MaskHasFlag(boundFilterValue, HOUSING_FURNITURE_BOUND_FILTER_UNBOUND) then
                            dropdown:SelectItemByIndex(3)
                        end
                    end
                    SCREEN_NARRATION_MANAGER:RegisterDialogDropdown(data.dialog, dropdown)
                end,
                callback = function(dialog)
                    local targetControl = dialog.entryList:GetTargetControl()
                    if targetControl then
                        targetControl.dropdown:Activate()
                    end
                end,
            },
        }
    end
    local limitFilterTypesDropdownEntry = nil
    if limitFilterEnabled then
        limitFilterTypesDropdownEntry =
        {
            template = "ZO_GamepadMultiSelectionDropdownItem",
            templateData = 
            {
                setup = function(control, data, selected)
                    local dropdown = control.dropdown
                    limitFilterTypesData.dropdownInstance = dropdown
                    local _, _, limitFilterValue = optionsDialogLayoutInfo:getFiltersFunction()
                    local entries = limitFilterTypesData:GetAllItems()
                    limitFilterTypesData:ClearAllSelections()
                    for _, entry in ipairs(entries) do
                        local isSelected = ZO_FlagHelpers.MaskHasFlag(limitFilterValue, entry.filterValue)
                        limitFilterTypesData:SetItemSelected(entry, isSelected)
                    end
                    dropdown:SetNormalColor(ZO_GAMEPAD_COMPONENT_COLORS.UNSELECTED_INACTIVE:UnpackRGB())
                    dropdown:SetHighlightedColor(ZO_GAMEPAD_COMPONENT_COLORS.SELECTED_ACTIVE:UnpackRGB())
                    dropdown:SetSelectedItemTextColor(selected)
                    dropdown:SetSortsItems(false)
                    dropdown:SetNoSelectionText(GetString(SI_GAMEPAD_HOUSING_FURNITURE_LIMIT_FILTER_ALL_TEXT))
                    dropdown:SetMultiSelectionTextFormatter(SI_HOUSING_FURNITURE_LIMIT_FILTER_DROPDOWN_TEXT)
                    dropdown:LoadData(limitFilterTypesData)
                    SCREEN_NARRATION_MANAGER:RegisterDialogDropdown(data.dialog, dropdown)
                end,
                callback = function(dialog)
                    local targetControl = dialog.entryList:GetTargetControl()
                    if targetControl then
                        targetControl.dropdown:Activate()
                    end
                end,
            },
        }
    end
    local locationFilterTypesDropdownEntry = nil
    if locationFilterEnabled then
        locationFilterTypesDropdownEntry =
        {
            template = "ZO_GamepadMultiSelectionDropdownItem",
            templateData = 
            {
                setup = function(control, data, selected)
                    local dropdown = control.dropdown
                    locationFilterTypesData.dropdownInstance = dropdown
                    local _, locationFilterValue = optionsDialogLayoutInfo:getFiltersFunction()
                    local entries = locationFilterTypesData:GetAllItems()
                    locationFilterTypesData:ClearAllSelections()
                    for _, entry in ipairs(entries) do
                        local isSelected = ZO_FlagHelpers.MaskHasFlag(locationFilterValue, entry.filterValue)
                        locationFilterTypesData:SetItemSelected(entry, isSelected)
                    end
                    dropdown:SetNormalColor(ZO_GAMEPAD_COMPONENT_COLORS.UNSELECTED_INACTIVE:UnpackRGB())
                    dropdown:SetHighlightedColor(ZO_GAMEPAD_COMPONENT_COLORS.SELECTED_ACTIVE:UnpackRGB())
                    dropdown:SetSelectedItemTextColor(selected)
                    dropdown:SetSortsItems(false)
                    dropdown:SetNoSelectionText(GetString(SI_GAMEPAD_HOUSING_FURNITURE_LOCATION_FILTER_ALL_TEXT))
                    dropdown:SetMultiSelectionTextFormatter(SI_HOUSING_FURNITURE_LOCATION_FILTER_DROPDOWN_TEXT)
                    dropdown:LoadData(locationFilterTypesData)
                    SCREEN_NARRATION_MANAGER:RegisterDialogDropdown(data.dialog, dropdown)
                end,
                callback = function(dialog)
                    local targetControl = dialog.entryList:GetTargetControl()
                    if targetControl then
                        targetControl.dropdown:Activate()
                    end
                end,
            },
        }
    end
    local dialogInfo =
    {
        gamepadInfo =
        {
            dialogType = GAMEPAD_DIALOGS.PARAMETRIC,
        },
        setup = function(dialog)
            ZO_GenericGamepadDialog_RefreshText(dialog, GetString(SI_GAMEPAD_HOUSING_FURNITURE_BROWSER_OPTIONS_KEYBIND))
            dialog:setupFunc()
        end,
        parametricList =
        {
            -- Text search
            {
                template = "ZO_GamepadFullWidthLeftLabelEntryTemplate",
                templateData =
                {
                    text = GetString(SI_GAMEPAD_FURNITURE_TEXT_FILTER_KEYBIND_TEXT),
                    setup = ZO_SharedGamepadEntry_OnSetup,
                    callback = function(dialog)
                        ZO_Dialogs_ReleaseDialogOnButtonPress(optionsDialogName)
                        self.owner:SelectTextFilter()
                    end,
                },
            },
        },
        blockDialogReleaseOnPress = true,
        buttons =
        {
            -- Select
            {
                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,
            },
            -- Back
            {
                keybind = "DIALOG_NEGATIVE",
                text = SI_DIALOG_CANCEL,
                callback = function()
                    ZO_Dialogs_ReleaseDialogOnButtonPress(optionsDialogName)
                end,
            },
            -- Reset Filters
            {
                keybind = "DIALOG_RESET",
                text = SI_HOUSING_FURNITURE_RESET_FILTERS_KEYBIND,
                enabled = function(dialog)
                    return SHARED_FURNITURE:CanResetFurnitureFilters()
                end,
                callback = function(dialog)
                    SHARED_FURNITURE:ResetFurnitureFilters()
                    dialog:setupFunc()
                end,
            },
        },
        onHidingCallback = function(dialog)
            local boundFilterValue = HOUSING_FURNITURE_BOUND_FILTER_ALL
            if boundFilterTypesData then
                boundFilterTypesData.dropdownInstance:Deactivate()
                local boundFilterData = boundFilterTypesData.dropdownInstance:GetSelectedItemData()
                if boundFilterData and boundFilterData.filterValue then
                    boundFilterValue = boundFilterData.filterValue
                end
            end
            local locationFilterValues = 0
            if locationFilterTypesData then
                locationFilterTypesData.dropdownInstance:Deactivate()
                for _, item in ipairs(locationFilterTypesData:GetSelectedItems()) do
                    locationFilterValues = locationFilterValues + item.filterValue
                end
            end
            local limitFilterValues = 0
            if limitFilterTypesData then
                limitFilterTypesData.dropdownInstance:Deactivate()
                for _, item in ipairs(limitFilterTypesData:GetSelectedItems()) do
                    limitFilterValues = limitFilterValues + item.filterValue
                end
            end
            optionsDialogLayoutInfo.updateFiltersHandler(boundFilterValue, locationFilterValues, limitFilterValues)
        end,
    }
    -- Filters
    if locationFilterEnabled then
        table.insert(dialogInfo.parametricList, locationFilterTypesDropdownEntry)
    end
    if limitFilterEnabled then
        table.insert(dialogInfo.parametricList, limitFilterTypesDropdownEntry)
    end
    if boundFilterEnabled then
        table.insert(dialogInfo.parametricList, boundFilterTypesDropdownEntry)
    end
    ZO_Dialogs_RegisterCustomDialog(optionsDialogName, dialogInfo)
end
function ZO_HousingFurnitureList_Gamepad:AddFurnitureListKeybind(keybindDescriptor)
    table.insert(self.furnitureKeybindStripDescriptor, keybindDescriptor)
end
function ZO_HousingFurnitureList_Gamepad:CategoryKeybindBackCallback()
    SCENE_MANAGER:HideCurrentScene()
end
function ZO_HousingFurnitureList_Gamepad:FurnitureKeybindBackCallback()
    self:SwitchActiveList(self.categoryList)
end
function ZO_HousingFurnitureList_Gamepad:OnShowing()
    self:UpdateLists()
    self:SwitchActiveList(self.categoryList)
end
function ZO_HousingFurnitureList_Gamepad:OnHiding()
    self:SetFurnitureRightInfoState(RIGHT_INFO_STATE.NONE)
end
function ZO_HousingFurnitureList_Gamepad:UpdateLists()
    if self.currentList then
        local success = self.currentList.buildListFunction()
        --if the list was empty with the new data then switch back to the top level category list
        if not success then
            self:SwitchActiveList(self.categoryList)
        end
    end
end
function ZO_HousingFurnitureList_Gamepad:ViewCategory()
    self:SwitchActiveList(self.furnitureList)
end
function ZO_HousingFurnitureList_Gamepad:RefreshCurrentCategoryData()
    local entryData = self.categoryList.list:GetTargetData()
    if entryData ~= nil then
        local categoryTreeData = self:GetCategoryTreeDataRoot()
        self.currentCategoryData = categoryTreeData:GetSubcategory(entryData.categoryId)
    else
        self.currentCategoryData = nil
    end
end
function ZO_HousingFurnitureList_Gamepad:UpdateFurnitureListSavedPosition()
    if not self.currentCategoryData then
        return
    end
    local currentCategoryId = self.currentCategoryData:GetCategoryId()
    local currentSelectedIndex = self.furnitureList.list:GetSelectedIndex()
    local currentSelectedData = self.furnitureList.list:GetSelectedData()
    if not currentSelectedData then
        if currentCategoryId ~= nil then
            self.savedCategoryListPositions[currentCategoryId] = nil
        end
        return
    end
    local categoryId, subcategoryId = currentSelectedData.furnitureObject:GetCategoryInfo()
    local savedListPositionData = self.savedCategoryListPositions[currentCategoryId]
    if not savedListPositionData then
        savedListPositionData = {}
        self.savedCategoryListPositions[currentCategoryId] = savedListPositionData
    end
    savedListPositionData.position = currentSelectedIndex
    savedListPositionData.categoryId = categoryId
    savedListPositionData.subcategoryId = subcategoryId
end
function ZO_HousingFurnitureList_Gamepad:ResetSavedPositions()
    ZO_ClearTable(self.savedCategoryListPositions)
end
function ZO_HousingFurnitureList_Gamepad:SwitchActiveList(list)
    if self.currentList == list then
        return
    end
    local previousList = self.currentList
    self.currentList = list
    if previousList then
        if previousList == self.furnitureList then
            self:UpdateFurnitureListSavedPosition()
            ITEM_PREVIEW_GAMEPAD:EndCurrentPreview()
        end
        KEYBIND_STRIP:RemoveKeybindButtonGroup(previousList.keybinds)
    end
    if list then
        self.owner:SetCurrentList(list.list)
        KEYBIND_STRIP:AddKeybindButtonGroup(list.keybinds)
        if list == self.categoryList then
            self:SetFurnitureRightInfoState(RIGHT_INFO_STATE.HOUSE_INFO)
        elseif list == self.furnitureList then
            self:SetFurnitureRightInfoState(RIGHT_INFO_STATE.FURNITURE_INFO)
        end
    else
        self.owner:SetCurrentList(nil)
    end
end
do
    local HIDE_VISUAL_LAYER_INFO = false
    local NO_COOLDOWN = nil
    local HIDE_BLOCK_REASON = false
    function ZO_HousingFurnitureList_Gamepad:RefreshFurnitureTooltip()
        if self.rightInfoState == RIGHT_INFO_STATE.FURNITURE_INFO then
            local targetData = self.furnitureList.list:GetTargetData()
            if targetData then
                local furnitureObject = targetData.furnitureObject
                if furnitureObject then
                    if furnitureObject.bagId and furnitureObject.slotIndex then
                        GAMEPAD_TOOLTIPS:LayoutBagItem(GAMEPAD_RIGHT_TOOLTIP, furnitureObject.bagId, furnitureObject.slotIndex)
                    elseif furnitureObject.marketProductId then
                        GAMEPAD_TOOLTIPS:LayoutMarketProductListing(GAMEPAD_RIGHT_TOOLTIP, furnitureObject.marketProductId, furnitureObject.presentationIndex)
                    elseif furnitureObject.collectibleId then
                        local collectibleData = ZO_COLLECTIBLE_DATA_MANAGER:GetCollectibleDataById(furnitureObject.collectibleId)
                        GAMEPAD_TOOLTIPS:LayoutCollectibleFromData(GAMEPAD_RIGHT_TOOLTIP, collectibleData, HIDE_VISUAL_LAYER_INFO, NO_COOLDOWN, HIDE_BLOCK_REASON)
                    elseif furnitureObject.retrievableFurnitureId then
                        local itemLink, collectibleLink = GetPlacedFurnitureLink(furnitureObject.retrievableFurnitureId)
                        if itemLink ~= "" then
                            GAMEPAD_TOOLTIPS:LayoutItem(GAMEPAD_RIGHT_TOOLTIP, itemLink)
                        elseif collectibleLink ~= "" then
                            GAMEPAD_TOOLTIPS:LayoutCollectibleFromLink(GAMEPAD_RIGHT_TOOLTIP, collectibleLink)
                        end
                    end
                end
            end
        else
            GAMEPAD_TOOLTIPS:ClearTooltip(GAMEPAD_RIGHT_TOOLTIP)
        end
    end
end
function ZO_HousingFurnitureList_Gamepad:SetFurnitureRightInfoState(rightInfoState)
    if self.rightInfoState ~= rightInfoState then
        self.rightInfoState = rightInfoState
        if rightInfoState == RIGHT_INFO_STATE.HOUSE_INFO then
            if not HOUSING_EDITOR_STATE:IsHousePreview() then
                SCENE_MANAGER:AddFragment(HOUSE_INFORMATION_FRAGMENT_GAMEPAD)
                SCENE_MANAGER:AddFragment(GAMEPAD_NAV_QUADRANT_4_BACKGROUND_FRAGMENT)
            end
        elseif rightInfoState == RIGHT_INFO_STATE.FURNITURE_INFO then
            SCENE_MANAGER:RemoveFragment(HOUSE_INFORMATION_FRAGMENT_GAMEPAD)
            SCENE_MANAGER:RemoveFragment(GAMEPAD_NAV_QUADRANT_4_BACKGROUND_FRAGMENT)
        end
        self:RefreshFurnitureTooltip()
    end
end
function ZO_HousingFurnitureList_Gamepad:HideCurrentList()
    if self.currentList == nil then
        return
    end
    self:SwitchActiveList(nil)
end
function ZO_HousingFurnitureList_Gamepad:UpdateCurrentKeybinds()
    if self.currentList then
        KEYBIND_STRIP:UpdateKeybindButtonGroup(self.currentList.keybinds)
    end
end
do
    local function CreateCategoryEntryData(categoryData)
        local categoryId = categoryData:GetCategoryId()
        local gamepadIcon = ZO_NO_TEXTURE_FILE
        if categoryId == ZO_FURNITURE_PATH_NODES_FAKE_CATEGORY then
            gamepadIcon = ZO_HOUSING_CATEGORY_PATHING_ICON_GAMEPAD
        elseif categoryId ~= ZO_FURNITURE_NEEDS_CATEGORIZATION_FAKE_CATEGORY then
            gamepadIcon = GetFurnitureCategoryGamepadIcon(categoryId)
        end
        -- Avoiding zo_strformat for performance, this will get run for every category every time the number of entries could have changed
        local formattedName = string.format("%s (%d)", categoryData:GetName(), categoryData:GetNumEntryItemsRecursive())
        local itemsData = ZO_GamepadEntryData:New(formattedName, gamepadIcon)
        itemsData.categoryId = categoryId
        itemsData.categoryData = categoryData
        return itemsData
    end
    function ZO_HousingFurnitureList_Gamepad:BuildCategoryList()
        local categoryList = self.categoryList.list
        categoryList:Clear()
        local categoryTreeData = self:GetCategoryTreeDataRoot()
        if categoryTreeData then
            local isOwner = IsOwnerOfCurrentHouse()
            local allTopLevelCategories = categoryTreeData:GetAllSubcategories()
            for i, categoryData in ipairs(allTopLevelCategories) do
                if isOwner or not categoryData:IsOwnerRestrictedCategory() then
                    local nextCategoryEntry = CreateCategoryEntryData(categoryData)
                    categoryList:AddEntry("ZO_GamepadMenuEntryTemplate", nextCategoryEntry)
                end
            end
        end
        categoryList:SetNoItemText(self:GetNoItemText())
        categoryList:Commit()
        return categoryList:IsEmpty()
    end    
end
function ZO_HousingFurnitureList_Gamepad:BuildFurnitureEntry(furnitureObject)
    local entry = ZO_GamepadEntryData:New(furnitureObject:GetFormattedName(), furnitureObject:GetIcon())
    entry.furnitureObject = furnitureObject
    entry:SetFontScaleOnSelection(false)
    entry.quality = furnitureObject:GetDisplayQuality()
    entry:SetNameColors(entry:GetColorsBasedOnQuality(entry.quality))
    local stackCount = furnitureObject:GetStackCount()
    entry:SetStackCount(stackCount)
    entry.isGemmable = furnitureObject:IsGemmable()
    entry.stolen = furnitureObject:IsStolen()
    entry.isFromCrownStore = furnitureObject:IsFromCrownStore()
    entry.isStartingPathNode = furnitureObject:GetDataType() == ZO_HOUSING_PATH_NODE_DATA_TYPE and furnitureObject:IsStartingPathNode()
    entry.narrationText = function(entryData, entryControl)
        local narrations = {}
        ZO_AppendNarration(narrations, ZO_GetSharedGamepadEntryDefaultNarrationText(entryData, entryControl))
        ZO_AppendNarration(narrations, entryData:GetPriceNarration())
        if ITEM_PREVIEW_GAMEPAD:IsPreviewEnabled() then
            ZO_AppendNarration(narrations, ITEM_PREVIEW_GAMEPAD:GetPreviewSpinnerNarrationText())
        end
        return narrations
    end
    entry.additionalInputNarrationFunction = function()
        if ITEM_PREVIEW_GAMEPAD:IsPreviewEnabled() and ITEM_PREVIEW_GAMEPAD:HasVariations() then
            return ZO_GetHorizontalDirectionalInputNarrationData(GetString(SI_SCREEN_NARRATION_ITEM_PREVIEW_STATE_PREVIOUS), GetString(SI_SCREEN_NARRATION_ITEM_PREVIEW_STATE_NEXT))
        end
        return {}
    end
    if furnitureObject:GetDataType() == ZO_RECALLABLE_HOUSING_DATA_TYPE then
        entry:SetShowUnselectedSublabels(true)
        entry:AddSubLabel(zo_strformat(SI_GAMEPAD_HOUSING_DISTANCE_AWAY_FORMAT, furnitureObject:GetDistanceFromPlayerM()))
    end
    return entry
end
function ZO_HousingFurnitureList_Gamepad:CompareFurnitureEntries(a, b)
    return a:GetRawName() < b:GetRawName()
end
function ZO_HousingFurnitureList_Gamepad:BuildFurnitureEntriesInCategory(category)
    local furnitureList = self.furnitureList.list
    local allEntries = category:GetAllEntries()
    if #allEntries > 0 then
        local sortedEntries = ZO_ShallowTableCopy(allEntries)
        table.sort(sortedEntries, self.CompareFurnitureEntriesFunction)
        for i, furnitureObject in ipairs(sortedEntries) do
            local entry = self:BuildFurnitureEntry(furnitureObject)
            local entryHasHeader = i == 1
            if entryHasHeader then
                entry:SetHeader(category:GetName())
            end
            if furnitureObject:GetDataType() == ZO_HOUSING_MARKET_PRODUCT_DATA_TYPE then
                if entryHasHeader then
                    furnitureList:AddEntry("ZO_GamepadHousingMPEntryTemplateWithHeader", entry)
                else
                    furnitureList:AddEntry("ZO_GamepadHousingMPEntryTemplate", entry)
                end
            else
                if entryHasHeader then
                    furnitureList:AddEntry("ZO_GamepadHousingItemEntryTemplateWithHeader", entry)
                else
                    furnitureList:AddEntry("ZO_GamepadHousingItemEntryTemplate", entry)
                end
            end
        end
    end
end
function ZO_HousingFurnitureList_Gamepad:BuildFurnitureList()
    local furnitureListInfo = self.furnitureList
    local furnitureList = furnitureListInfo.list
    furnitureList:Clear()
    if not self.currentCategoryData then
        return false
    end
    self:BuildFurnitureEntriesInCategory(self.currentCategoryData)
    for _, subCategory in ipairs(self.currentCategoryData:GetAllSubcategories()) do
        self:BuildFurnitureEntriesInCategory(subCategory)
    end
    if furnitureList:IsEmpty() then
        furnitureList:Commit()
        return false
    end
    local savedListPositionData = self.savedCategoryListPositions[self.currentCategoryData:GetCategoryId()]
    local currentPosition = savedListPositionData and savedListPositionData.position or 1
    furnitureList:SetSelectedIndexWithoutAnimation(currentPosition, true)
    furnitureList:Commit()
    local currentSelectedIndex = self.furnitureList.list:GetSelectedIndex()
    local currentSelectedData = self.furnitureList.list:GetSelectedData()
    if not currentSelectedData then
        return true
    end
    local currentSelectedCategoryId, currentSelectedSubcategoryId = currentSelectedData.furnitureObject:GetCategoryInfo()
    -- check to see if we are no longer in the same category as we were before
    if savedListPositionData and (savedListPositionData.categoryId ~= currentSelectedCategoryId or savedListPositionData.subcategoryId ~= currentSelectedSubcategoryId) then
        local previousIndexData = self.furnitureList.list:GetEntryData(currentSelectedIndex - 1)
        if previousIndexData then
            local previousSelectedCategoryId, previousSelectedSubcategoryId = previousIndexData.furnitureObject:GetCategoryInfo()
            -- check and see if we can move back into the category that we were before, otherwise we are good right where we are right now
            if savedListPositionData.categoryId == previousSelectedCategoryId and savedListPositionData.subcategoryId == previousSelectedSubcategoryId then
                furnitureList:SetSelectedIndexWithoutAnimation(currentSelectedIndex - 1)
            end
        end
    end
    
    return true
end
function ZO_HousingFurnitureList_Gamepad:GetCategoryTreeDataRoot()
    assert(false) -- override in derived classes
end
function ZO_HousingFurnitureList_Gamepad:InitializeOptionsDialogLayoutInfo()
    -- Override in derived classes that implement an options dialog.
end
function ZO_HousingFurnitureList_Gamepad:OnFurnitureTargetChanged(list, targetData, oldTargetData)
end
--Returns the text that is shown when the list has nothing in it
function ZO_HousingFurnitureList_Gamepad:GetNoItemText()
    assert(false) --Override
end
function ZO_HousingFurnitureList_Gamepad:PreviewMarketProductPlacement(marketProductData)
    if not marketProductData then
        return
    end
    if HousingEditorRequestMarketProductPlacementPreview(marketProductData.marketProductId) == HOUSING_REQUEST_RESULT_SUCCESS then
        HOUSING_EDITOR_SHARED:SetCurrentPreviewMarketProduct(marketProductData)
    end
end
------------------------------------
-- Housing Permissions List Gamepad
------------------------------------
ZO_HousingSettingsList_Gamepad = ZO_Object.MultiSubclass(ZO_GamepadInteractiveSortFilterList, ZO_SocialOptionsDialogGamepad)
function ZO_HousingSettingsList_Gamepad:New(...)
    return ZO_GamepadSocialListPanel.New(self, ...)
end
function ZO_HousingSettingsList_Gamepad:Initialize(userGroup, control, owner, dataType)
    self.userGroup = userGroup
    self.owner = owner
    self.rowDataType = dataType
    self.masterList = {}
    ZO_GamepadInteractiveSortFilterList.Initialize(self, control)
    ZO_SocialOptionsDialogGamepad.Initialize(self)
    ZO_ScrollList_AddDataType(self.list, dataType, "ZO_HousingPermissionsRow_Gamepad", ZO_GAMEPAD_INTERACTIVE_FILTER_LIST_ROW_HEIGHT, function(entryControl, data) self:SetupRow(entryControl, data) end)
    self:SetEmptyText(GetString(SI_GAMEPAD_HOUSING_PERMISSIONS_NO_ENTRIES))
    self:SetupSort(ZO_HOUSING_SETTINGS_LIST_ENTRY_SORT_KEYS, "displayName", ZO_SORT_ORDER_UP)
end
function ZO_HousingSettingsList_Gamepad:InitializeKeybinds()
    local keybindDescriptor = {}
    self.backButtonCallback = function()
                                self:Deactivate()
                                SYSTEMS:GetObject("furniture_settings"):SelectMainMenuList()
                            end
    self:AddSocialOptionsKeybind(keybindDescriptor)
    ZO_Gamepad_AddBackNavigationKeybindDescriptorsWithSound(keybindDescriptor, GAME_NAVIGATION_TYPE_BUTTON, self:GetBackKeybindCallback())
    self:SetKeybindStripDescriptor(keybindDescriptor)
    ZO_GamepadInteractiveSortFilterList.InitializeKeybinds(self)
end
function ZO_HousingSettingsList_Gamepad:InitializeSearchFilter()
    ZO_GamepadInteractiveSortFilterList.InitializeSearchFilter(self)
    if self.userGroup == HOUSE_PERMISSION_USER_GROUP_INDIVIDUAL then
        self.searchEdit:SetDefaultText(ZO_GetPlatformAccountLabel())
    else
        self.searchEdit:SetDefaultText(GetString(SI_GAMEPAD_HOUSING_PERMISSIONS_SEARCH_GUILD))
    end
    self.filterFunction = function(data)
                             return self:IsMatch(self:GetCurrentSearch(), data)
                          end
end
function ZO_HousingSettingsList_Gamepad:FilterScrollList()
    local scrollData = ZO_ScrollList_GetDataList(self.list)
    ZO_ClearNumericallyIndexedTable(scrollData)
    local searchTerm = self:GetCurrentSearch()
    
    for _, data in ipairs(self.masterList) do
        if searchTerm == "" or self:IsMatch(searchTerm, data) then
            table.insert(scrollData, ZO_ScrollList_CreateDataEntry(ZO_GAMEPAD_INTERACTIVE_FILTER_LIST_PRIMARY_DATA_TYPE, data))
        end
    end
end
function ZO_HousingSettingsList_Gamepad:BuildOptionsList()
    local groupingId = self:AddOptionTemplateGroup(ZO_SocialOptionsDialogGamepad.GetDefaultHeader)
    local function BuildKickOccupantOption()
        return self:BuildKickOccupantOption()
    end
    local function BuildRemoveUserGroupOption()
        return self:BuildRemoveUserGroupOption()
    end
    local function BuildChangeUserGroupPermissionsOption()
        return self:BuildChangeUserGroupPermissionsOption()
    end
    local function ShouldShowGamerCardOption()
        return IsConsoleUI() and (self.rowDataType == ZO_SETTINGS_VISITOR_DATA_TYPE or self.rowDataType == ZO_SETTINGS_BANLIST_DATA_TYPE)
    end
    self:AddOptionTemplate(groupingId, BuildChangeUserGroupPermissionsOption, ZO_HousingSettingsList_Gamepad.SelectedDataHasPreset)
    self:AddOptionTemplate(groupingId, BuildKickOccupantOption, ZO_HousingSettingsList_Gamepad.IsOccupantsListAndHomeowner)
    self:AddOptionTemplate(groupingId, BuildRemoveUserGroupOption, ZO_HousingSettingsList_Gamepad.IsNotOccupantsList)
    self:AddOptionTemplate(groupingId, ZO_SocialOptionsDialogGamepad.BuildGamerCardOption, ShouldShowGamerCardOption)
end
function ZO_HousingSettingsList_Gamepad:IsOccupantsListAndHomeowner()
    return self.rowDataType == ZO_SETTINGS_OCCUPANT_DATA_TYPE and HOUSING_EDITOR_STATE:IsLocalPlayerHouseOwner()
end
function ZO_HousingSettingsList_Gamepad:IsNotOccupantsList()
    return self.rowDataType ~= ZO_SETTINGS_OCCUPANT_DATA_TYPE
end
function ZO_HousingSettingsList_Gamepad:SelectedDataHasPreset()
    return self.socialData.permissionPresetName ~= nil
end
function ZO_HousingSettingsList_Gamepad:GetBackKeybindCallback()
    return self.backButtonCallback
end
function ZO_HousingSettingsList_Gamepad:SetupRow(control, data, selected)
    local displayNameControl = control:GetNamedChild("DisplayName")
    local permissionControl = control:GetNamedChild("Permission")
    displayNameControl:SetText(data.displayName)
    displayNameControl:SetColor(ZO_NORMAL_TEXT:UnpackRGB())
    if permissionControl then
        permissionControl:SetText(data.permissionPresetName)
    end
end
function ZO_HousingSettingsList_Gamepad:OnShown()
    ZO_GamepadInteractiveSortFilterList.OnShowing(self)
    self:RefreshData()
end
function ZO_HousingSettingsList_Gamepad:RefreshData()
    if not self.control:IsHidden() then
        ZO_GamepadSocialListPanel.RefreshData(self)
    end
end
function ZO_HousingSettingsList_Gamepad:RefreshTooltip()
    -- Do nothing, because housing permission list doesn't use a tooltip like other social lists
end
--ZO_GamepadInteractiveSortFilterList override
function ZO_HousingSettingsList_Gamepad:InitializeDropdownFilter()
    -- housing permission list doesn't use a dropdown
    self.filterControl = self.contentHeader:GetNamedChild("DropdownFilter")
    local filterDropdownControl = self.filterControl:GetNamedChild("Dropdown")
    self.filterDropdown = ZO_ComboBox_ObjectFromContainer(filterDropdownControl)
    self.filterControl:SetHidden(true)
end
--ZO_GamepadInteractiveSortFilterList override
function ZO_HousingSettingsList_Gamepad:GetNarrationText()
    local narrations = {}
    local entryData = self:GetSelectedData()
    if entryData then
        --Get the narration for the display name column
        if self.userGroup == HOUSE_PERMISSION_USER_GROUP_INDIVIDUAL then
            ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(ZO_GetPlatformAccountLabel()))
        else
            ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(GetString(SI_HOUSING_FURNITURE_SETTINGS_SOCIAL_LIST_GUILD)))
        end
        ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(entryData.displayName))
        --Get the narration for the permissions column if present
        if entryData.permissionPresetName then
            ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(GetString(SI_HOUSING_FURNITURE_SETTINGS_SOCIAL_LIST_PERMISSIONS)))
            ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(entryData.permissionPresetName))
        end
    end
    return narrations
end
function ZO_HousingSettingsList_Gamepad:OnSelectionChanged(oldData, newData)
    ZO_GamepadInteractiveSortFilterList.OnSelectionChanged(self, oldData, newData)
    self:SetupOptions(newData)
end
function ZO_HousingSettingsList_Gamepad:BuildKickOccupantOption()
    local callback = function()
        local data = self.socialData
        if data.dataEntry.typeId == ZO_SETTINGS_OCCUPANT_DATA_TYPE then
            ZO_Dialogs_ShowGamepadDialog("GAMEPAD_CONFIRM_KICK_OCCUPANT", { currentHouse = data.currentHouse, displayName = data.displayName, index = data.index }) 
        end
    end
    return self:BuildOptionEntry(nil, GetString(SI_HOUSING_OCCUPANTS_KICK_OCCUPANT), callback)
end
function ZO_HousingSettingsList_Gamepad:BuildRemoveUserGroupOption()
    local callback = function()
        local data = self.socialData
        local headerText
        local titleText
        if data.dataEntry.typeId == ZO_SETTINGS_VISITOR_DATA_TYPE then
            headerText = zo_strformat(SI_DIALOG_TEXT_REMOVE_INDIVIDUAL_PERMISSION, data.displayName)
            titleText = GetString(SI_DIALOG_TITLE_REMOVE_INDIVIDUAL_PERMISSION)
        elseif data.dataEntry.typeId == ZO_SETTINGS_GUILD_VISITOR_DATA_TYPE then
            headerText = zo_strformat(SI_DIALOG_TEXT_REMOVE_GUILD_PERMISSION, data.displayName)
            titleText = GetString(SI_DIALOG_TITLE_REMOVE_GUILD_PERMISSION)
        elseif data.dataEntry.typeId == ZO_SETTINGS_BANLIST_DATA_TYPE then
            headerText = zo_strformat(SI_DIALOG_TEXT_REMOVE_BANLIST_INDIVIDUAL_PERMISSION, data.displayName)
            titleText = GetString(SI_DIALOG_TITLE_REMOVE_BANLIST_INDIVIDUAL_PERMISSION)
        elseif data.dataEntry.typeId == ZO_SETTINGS_GUILD_BANLIST_DATA_TYPE then
            headerText = zo_strformat(SI_DIALOG_TEXT_REMOVE_BANLIST_GUILD_PERMISSION, data.displayName)
            titleText = GetString(SI_DIALOG_TITLE_REMOVE_BANLIST_GUILD_PERMISSION)
        end
        ZO_Dialogs_ShowGamepadDialog("GAMEPAD_CONFIRM_REMOVE_PERMISSIONS", { titleText = titleText, headerText = headerText, currentHouse = data.currentHouse, userGroup = data.userGroup, index = data.index }) 
    end
    return self:BuildOptionEntry(nil, GetString(SI_HOUSING_PERMISSIONS_OPTIONS_REMOVE), callback)
end
function ZO_HousingSettingsList_Gamepad:BuildChangeUserGroupPermissionsOption()
    local callback = function()
        local data = self.socialData
        ZO_Dialogs_ShowGamepadDialog("GAMEPAD_CHANGE_HOUSING_PERMISSIONS", data) 
    end
    return self:BuildOptionEntry(nil, GetString(SI_HOUSING_PERMISSIONS_OPTIONS_CHANGE_PERMISSIONS), callback)
end
function ZO_HousingSettingsList_Gamepad:ShowList()
    if not self.listFragmentGroup then
        self.listFragmentGroup = { self.listFragment, GAMEPAD_NAV_QUADRANT_2_3_BACKGROUND_FRAGMENT }
    end
    GAMEPAD_HOUSING_FURNITURE_BROWSER_SCENE:AddFragmentGroup(self.listFragmentGroup)
end
function ZO_HousingSettingsList_Gamepad:HideList()
    GAMEPAD_HOUSING_FURNITURE_BROWSER_SCENE:RemoveFragmentGroup(self.listFragmentGroup)
end
function ZO_HousingSettingsList_Gamepad:ActivateList()
    self:Activate()
end
function ZO_HousingSettingsList_Gamepad:GetNumPossibleEntries()
    return #self.masterList
end
function ZO_HousingSettingsList_Gamepad:GetUserGroup()
    return self.userGroup
end
function ZO_HousingSettingsList_Gamepad:FilterScrollList()
end
function ZO_HousingSettingsList_Gamepad:DoesEntryPassFilter(data)
    return self:IsMatch(self:GetCurrentSearch(), data)
end
function ZO_HousingSettingsList_Gamepad_CreateOccupantScrollData(displayName, currentHouse, index)
    return
    { 
        displayName = displayName, 
        currentHouse = currentHouse, 
        index = index,
        type = ZO_GAMEPAD_INTERACTIVE_FILTER_LIST_SEARCH_TYPE_NAMES,
    }
end
function ZO_HousingSettingsList_Gamepad_CreateScrollData(displayName, currentHouse, userGroup, index, permissionPresetName)
    return
    {
        displayName = displayName, 
        userGroup = userGroup,
        currentHouse = currentHouse, 
        index = index,
        permissionPresetName = permissionPresetName,
        type = ZO_GAMEPAD_INTERACTIVE_FILTER_LIST_SEARCH_TYPE_NAMES,
    }
end
--
--[[ ZO_HousingSettingsOccupantList_Gamepad ]]--
--
ZO_HousingSettingsOccupantList_Gamepad = ZO_HousingSettingsList_Gamepad:Subclass()
function ZO_HousingSettingsOccupantList_Gamepad:New(...)
    return ZO_HousingSettingsList_Gamepad.New(self, HOUSE_PERMISSION_USER_GROUP_INDIVIDUAL, ...)
end
function ZO_HousingSettingsOccupantList_Gamepad:BuildMasterList()
    self.currentHouse = GetCurrentZoneHouseId()
end
--
--[[ ZO_HousingSettingsVisitorList_Gamepad ]]--
--
ZO_HousingSettingsVisitorList_Gamepad = ZO_HousingSettingsList_Gamepad:Subclass()
function ZO_HousingSettingsVisitorList_Gamepad:New(...)
    return ZO_HousingSettingsList_Gamepad.New(self, HOUSE_PERMISSION_USER_GROUP_INDIVIDUAL, ...)
end
function ZO_HousingSettingsVisitorList_Gamepad:BuildMasterList()
    self.currentHouse = GetCurrentZoneHouseId()
    self.numPermissions = GetNumHousingPermissions(self.currentHouse, HOUSE_PERMISSION_USER_GROUP_INDIVIDUAL)
    ZO_HousingSettings_BuildMasterList_Visitor(self.currentHouse, self.userGroup, self.numPermissions, self.masterList, ZO_HousingSettingsList_Gamepad_CreateScrollData)
end
function ZO_HousingSettingsVisitorList_Gamepad:GetAddUserGroupDialogTitle()
    return GetString(SI_DIALOG_TITLE_ADD_INDIVIDUAL_PERMISSION)
end
--
--[[ ZO_HousingSettingsBanList_Gamepad ]]--
--
ZO_HousingSettingsBanList_Gamepad = ZO_HousingSettingsList_Gamepad:Subclass()
function ZO_HousingSettingsBanList_Gamepad:New(...)
    return ZO_HousingSettingsList_Gamepad.New(self, HOUSE_PERMISSION_USER_GROUP_INDIVIDUAL, ...)
end
function ZO_HousingSettingsBanList_Gamepad:BuildMasterList()
    self.currentHouse = GetCurrentZoneHouseId()
    self.numPermissions = GetNumHousingPermissions(self.currentHouse, HOUSE_PERMISSION_USER_GROUP_INDIVIDUAL)
    ZO_HousingSettings_BuildMasterList_Ban(self.currentHouse, self.userGroup, self.numPermissions, self.masterList, ZO_HousingSettingsList_Gamepad_CreateScrollData)
end
function ZO_HousingSettingsBanList_Gamepad:GetAddUserGroupDialogTitle()
    return GetString(SI_DIALOG_TITLE_BAN_INDIVIDUAL_PERMISSION)
end
--
--[[ ZO_HousingSettingsGuildVisitorList_Gamepad ]]--
--
ZO_HousingSettingsGuildVisitorList_Gamepad = ZO_HousingSettingsList_Gamepad:Subclass()
function ZO_HousingSettingsGuildVisitorList_Gamepad:New(...)
    return ZO_HousingSettingsList_Gamepad.New(self, HOUSE_PERMISSION_USER_GROUP_GUILD, ...)
end
function ZO_HousingSettingsGuildVisitorList_Gamepad:BuildMasterList()
    self.currentHouse = GetCurrentZoneHouseId()
    self.numPermissions = GetNumHousingPermissions(self.currentHouse, HOUSE_PERMISSION_USER_GROUP_GUILD)
    ZO_HousingSettings_BuildMasterList_Visitor(self.currentHouse, self.userGroup, self.numPermissions, self.masterList, ZO_HousingSettingsList_Gamepad_CreateScrollData)
end
function ZO_HousingSettingsGuildVisitorList_Gamepad:GetAddUserGroupDialogTitle()
    return GetString(SI_DIALOG_TITLE_ADD_GUILD_PERMISSION)
end
--
--[[ ZO_HousingSettingsGuildBanList_Gamepad ]]--
--
ZO_HousingSettingsGuildBanList_Gamepad = ZO_HousingSettingsList_Gamepad:Subclass()
function ZO_HousingSettingsGuildBanList_Gamepad:New(...)
    return ZO_HousingSettingsList_Gamepad.New(self, HOUSE_PERMISSION_USER_GROUP_GUILD, ...)
end
function ZO_HousingSettingsGuildBanList_Gamepad:BuildMasterList()
    self.currentHouse = GetCurrentZoneHouseId()
    self.numPermissions = GetNumHousingPermissions(self.currentHouse, HOUSE_PERMISSION_USER_GROUP_GUILD)
    ZO_HousingSettings_BuildMasterList_Ban(self.currentHouse, self.userGroup, self.numPermissions, self.masterList, ZO_HousingSettingsList_Gamepad_CreateScrollData)
end
function ZO_HousingSettingsGuildBanList_Gamepad:GetAddUserGroupDialogTitle()
    return GetString(SI_DIALOG_TITLE_BAN_GUILD_PERMISSION)
end
-- Global XML functions
    control.priceLabel = control:GetNamedChild("Price")
    control.previousPriceLabel = control:GetNamedChild("PreviousPrice")
    control.subLabel1 = control:GetNamedChild("SubLabel1")
    control.subLabel1Background = control.subLabel1:GetNamedChild("Background")
    control.subLabel1LeftBackground = control.subLabel1Background:GetNamedChild("Left")
    control.subLabel1RightBackground = control.subLabel1Background:GetNamedChild("Right")
    control.subLabel1CenterBackground = control.subLabel1Background:GetNamedChild("Center")
end