Skip to content

Commit 348b7e1

Browse files
committed
datatable working for body now
1 parent 3ce3754 commit 348b7e1

File tree

2 files changed

+16
-33
lines changed

2 files changed

+16
-33
lines changed

DataTable/src/main/java/com/isolpro/library/datatable/DataTable.java

Lines changed: 14 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.content.Context;
44
import android.os.Build;
55
import android.util.AttributeSet;
6+
import android.util.Log;
67
import android.view.LayoutInflater;
78
import android.view.View;
89
import android.widget.HorizontalScrollView;
@@ -181,40 +182,22 @@ private void populateStartHeader() {
181182

182183
// TODO: remove any extras view that may have been created
183184
}
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);
204185
}
205186

206187
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
218201
}
219202

220203
private void handleOnBodyRowClicked(View rowView) {

app/src/main/res/layout/layout_data_table_body.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<TableRow xmlns:android="http://schemas.android.com/apk/res/android">
2+
<com.isolpro.library.datatable.BodyTableRow xmlns:android="http://schemas.android.com/apk/res/android">
33

44
<TextView
55
android:id="@+id/name"
@@ -45,4 +45,4 @@
4545
android:padding="10dp"
4646
android:text="Subject" />
4747

48-
</TableRow>
48+
</com.isolpro.library.datatable.BodyTableRow>

0 commit comments

Comments
 (0)