|
final Map< String, Adapter > | sections = new LinkedHashMap<>() |
|
final ArrayAdapter< String > | headers |
|
Definition at line 26 of file SeparatedListAdapter.java.
◆ SeparatedListAdapter()
com.freerdp.freerdpcore.utils.SeparatedListAdapter.SeparatedListAdapter |
( |
Context |
context | ) |
|
|
inline |
◆ addSection()
void com.freerdp.freerdpcore.utils.SeparatedListAdapter.addSection |
( |
String |
section, |
|
|
Adapter |
adapter |
|
) |
| |
|
inline |
Definition at line 38 of file SeparatedListAdapter.java.
39 {
40 this.headers.add(section);
41 this.sections.put(section, adapter);
42 }
◆ areAllItemsSelectable()
boolean com.freerdp.freerdpcore.utils.SeparatedListAdapter.areAllItemsSelectable |
( |
| ) |
|
|
inline |
◆ getCount()
int com.freerdp.freerdpcore.utils.SeparatedListAdapter.getCount |
( |
| ) |
|
|
inline |
Definition at line 83 of file SeparatedListAdapter.java.
84 {
85
86
87 int total = 0;
88 for (Adapter adapter : this.sections.values())
89 total += ((adapter.getCount() > 0) ? adapter.getCount() + 1 : 0);
90 return total;
91 }
◆ getItem()
Object com.freerdp.freerdpcore.utils.SeparatedListAdapter.getItem |
( |
int |
position | ) |
|
|
inline |
Definition at line 58 of file SeparatedListAdapter.java.
59 {
60 for (int i = 0; i < headers.getCount(); i++)
61 {
62 String section = headers.getItem(i);
63 Adapter adapter = sections.get(section);
64
65
66 if (adapter.getCount() > 0)
67 {
68 int size = adapter.getCount() + 1;
69
70
71 if (position == 0)
72 return section;
73 if (position < size)
74 return adapter.getItem(position - 1);
75
76
77 position -= size;
78 }
79 }
80 return null;
81 }
◆ getItemId()
long com.freerdp.freerdpcore.utils.SeparatedListAdapter.getItemId |
( |
int |
position | ) |
|
|
inline |
Definition at line 166 of file SeparatedListAdapter.java.
167 {
168 for (int i = 0; i < headers.getCount(); i++)
169 {
170 String section = headers.getItem(i);
171 Adapter adapter = sections.get(section);
172 if (adapter.getCount() > 0)
173 {
174 int size = adapter.getCount() + 1;
175
176
177 if (position < size)
178 return adapter.getItemId(position - 1);
179
180
181 position -= size;
182 }
183 }
184 return -1;
185 }
◆ getItemViewType()
int com.freerdp.freerdpcore.utils.SeparatedListAdapter.getItemViewType |
( |
int |
position | ) |
|
|
inline |
Definition at line 102 of file SeparatedListAdapter.java.
103 {
104 int type = 1;
105 for (int i = 0; i < headers.getCount(); i++)
106 {
107 String section = headers.getItem(i);
108 Adapter adapter = sections.get(section);
109
110
111 if (adapter.getCount() > 0)
112 {
113 int size = adapter.getCount() + 1;
114
115
116 if (position == 0)
117 return TYPE_SECTION_HEADER;
118 if (position < size)
119 return type + adapter.getItemViewType(position - 1);
120
121
122 position -= size;
123 type += adapter.getViewTypeCount();
124 }
125 }
126 return -1;
127 }
◆ getSectionForPosition()
String com.freerdp.freerdpcore.utils.SeparatedListAdapter.getSectionForPosition |
( |
int |
position | ) |
|
|
inline |
Definition at line 187 of file SeparatedListAdapter.java.
188 {
189 int curPos = 0;
190 for (int i = 0; i < headers.getCount(); i++)
191 {
192 String section = headers.getItem(i);
193 Adapter adapter = sections.get(section);
194 if (adapter.getCount() > 0)
195 {
196 int size = adapter.getCount() + 1;
197
198
199 if (position >= curPos && position < (curPos + size))
200 return section;
201
202
203 curPos += size;
204 }
205 }
206 return null;
207 }
◆ getView()
View com.freerdp.freerdpcore.utils.SeparatedListAdapter.getView |
( |
int |
position, |
|
|
View |
convertView, |
|
|
ViewGroup |
parent |
|
) |
| |
|
inline |
Definition at line 139 of file SeparatedListAdapter.java.
140 {
141 int sectionnum = 0;
142 for (int i = 0; i < headers.getCount(); i++)
143 {
144 String section = headers.getItem(i);
145 Adapter adapter = sections.get(section);
146
147
148 if (adapter.getCount() > 0)
149 {
150 int size = adapter.getCount() + 1;
151
152
153 if (position == 0)
154 return headers.getView(sectionnum, convertView, parent);
155 if (position < size)
156 return adapter.getView(position - 1, null, parent);
157
158
159 position -= size;
160 }
161 sectionnum++;
162 }
163 return null;
164 }
◆ getViewTypeCount()
int com.freerdp.freerdpcore.utils.SeparatedListAdapter.getViewTypeCount |
( |
| ) |
|
|
inline |
Definition at line 93 of file SeparatedListAdapter.java.
94 {
95
96 int total = 1;
97 for (Adapter adapter : this.sections.values())
98 total += adapter.getViewTypeCount();
99 return total;
100 }
◆ isEnabled()
boolean com.freerdp.freerdpcore.utils.SeparatedListAdapter.isEnabled |
( |
int |
position | ) |
|
|
inline |
◆ setSectionTitle()
void com.freerdp.freerdpcore.utils.SeparatedListAdapter.setSectionTitle |
( |
int |
section, |
|
|
String |
title |
|
) |
| |
|
inline |
Definition at line 44 of file SeparatedListAdapter.java.
45 {
46 String oldTitle = this.headers.getItem(section);
47
48
49 this.headers.remove(oldTitle);
50 this.headers.insert(title, section);
51
52
53 Adapter adapter = this.sections.get(oldTitle);
54 this.sections.remove(oldTitle);
55 this.sections.put(title, adapter);
56 }
◆ headers
final ArrayAdapter<String> com.freerdp.freerdpcore.utils.SeparatedListAdapter.headers |
◆ sections
final Map<String, Adapter> com.freerdp.freerdpcore.utils.SeparatedListAdapter.sections = new LinkedHashMap<>() |
◆ TYPE_SECTION_HEADER
final int com.freerdp.freerdpcore.utils.SeparatedListAdapter.TYPE_SECTION_HEADER = 0 |
|
static |
The documentation for this class was generated from the following file: