|
3 | 3 | import android.content.Context; |
4 | 4 | import android.os.Build; |
5 | 5 | import android.util.AttributeSet; |
| 6 | +import android.util.Log; |
6 | 7 | import android.view.LayoutInflater; |
7 | 8 | import android.view.View; |
8 | 9 | import android.widget.HorizontalScrollView; |
@@ -181,40 +182,22 @@ private void populateStartHeader() { |
181 | 182 |
|
182 | 183 | // TODO: remove any extras view that may have been created |
183 | 184 | } |
184 | | - |
185 | | -// if (columnHeaderTexts == null) return; |
186 | | -// |
187 | | -// tlColumnHeader.removeAllViews(); |
188 | | -// |
189 | | -// for (String columnHeaderText : columnHeaderTexts) { |
190 | | -// StartHeaderTextView textView = dataTableAdapter.getStartHeaderView(); |
191 | | -// |
192 | | -// if (textView == null) |
193 | | -// throw new DataTableError("TopHeaderTextView cannot be null for DataTableAdapter!"); |
194 | | -// |
195 | | -// textView.setText(columnHeaderText); |
196 | | -// |
197 | | -// TableRow tableRow = new TableRow(context); |
198 | | -// tableRow.addView(textView); |
199 | | -// |
200 | | -// tlColumnHeader.addView(tableRow); |
201 | | -// } |
202 | | - |
203 | | -// tlBody.post(this::remeasureBodyWithStartHeader); |
204 | 185 | } |
205 | 186 |
|
206 | 187 | private void populateBody() { |
207 | | -// if (bodyTextsList == null) return; |
208 | | -// |
209 | | -// tlBody.removeAllViews(); |
210 | | -// |
211 | | -// for (List<String> bodyTexts : bodyTextsList) { |
212 | | -// TableRow tr = dataTableAdapter.getBodyView(bodyTexts); |
213 | | -// |
214 | | -// tr.setOnClickListener(this::handleOnBodyRowClicked); |
215 | | -// |
216 | | -// tlBody.addView(tr); |
217 | | -// } |
| 188 | + for (int i = 0; i < dataTableAdapter.getBodyCount(); i++) { |
| 189 | + Log.e("tlBody.getChildCount", tlBody.getChildCount() + " " + i); |
| 190 | + |
| 191 | + if (tlBody.getChildCount() > i) { |
| 192 | + BodyTableRow currentView = (BodyTableRow) tlBody.getChildAt(i); |
| 193 | + |
| 194 | + tlBody.removeViewAt(i); |
| 195 | + tlBody.addView(dataTableAdapter.getBodyView(i, currentView), i); |
| 196 | + } else |
| 197 | + tlBody.addView(dataTableAdapter.getBodyView(i, null)); |
| 198 | + } |
| 199 | + |
| 200 | + // TODO: remove any extras view that may have been created |
218 | 201 | } |
219 | 202 |
|
220 | 203 | private void handleOnBodyRowClicked(View rowView) { |
|
0 commit comments