Skip to content

Commit 2b6cc53

Browse files
committed
rename row->top and col->start
1 parent dd21189 commit 2b6cc53

8 files changed

Lines changed: 36 additions & 135 deletions

File tree

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

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ public class DataTable extends RelativeLayout {
2727

2828
private TableLayout tlTopHeader, tlStartHeader, tlBody;
2929

30-
private RelativeLayout layoutCorner, layoutColumnHeader, layoutRowHeader, layoutBody;
30+
private RelativeLayout layoutCorner, layoutTopHeader, layoutStartHeader, layoutBody;
3131

32-
private HorizontalScrollView hsvBody, hsvRowHeader;
33-
private ScrollView svBody, svColumnHeader;
32+
private HorizontalScrollView hsvBody, hsvTopHeader;
33+
private ScrollView svBody, svStartHeader;
3434

3535
public DataTable(Context context) {
3636
this(context, null);
@@ -51,18 +51,18 @@ public DataTable(Context context, AttributeSet attrs) {
5151

5252
private void instantiate() {
5353
layoutCorner = findViewById(R.id.layoutCorner);
54-
layoutColumnHeader = findViewById(R.id.layoutColumnHeader);
55-
layoutRowHeader = findViewById(R.id.layoutRowHeader);
54+
layoutTopHeader = findViewById(R.id.layoutTopHeader);
55+
layoutStartHeader = findViewById(R.id.layoutStartHeader);
5656
layoutBody = findViewById(R.id.layoutBody);
5757

58-
hsvRowHeader = layoutRowHeader.findViewById(R.id.horizontalScroll);
58+
hsvTopHeader = layoutTopHeader.findViewById(R.id.horizontalScroll);
5959
hsvBody = layoutBody.findViewById(R.id.horizontalScroll);
6060

61-
svBody = layoutColumnHeader.findViewById(R.id.scroll);
62-
svColumnHeader = layoutBody.findViewById(R.id.scroll);
61+
svBody = layoutStartHeader.findViewById(R.id.scroll);
62+
svStartHeader = layoutBody.findViewById(R.id.scroll);
6363

64-
tlTopHeader = layoutRowHeader.findViewById(R.id.table);
65-
tlStartHeader = layoutColumnHeader.findViewById(R.id.table);
64+
tlTopHeader = layoutTopHeader.findViewById(R.id.table);
65+
tlStartHeader = layoutStartHeader.findViewById(R.id.table);
6666
tlBody = layoutBody.findViewById(R.id.table);
6767

6868
adapterDataObserver = new AdapterDataObserver();
@@ -74,32 +74,32 @@ private void initialize() {
7474

7575
private void syncScrolling() {
7676
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
77-
syncBodyScrollWithRowHeaderScroll();
78-
syncBodyScrollWithColHeaderScroll();
77+
syncBodyScrollWithTopHeaderScroll();
78+
syncBodyScrollWithStartHeaderScroll();
7979
}
8080
}
8181

8282
@RequiresApi(api = Build.VERSION_CODES.M)
83-
private void syncBodyScrollWithRowHeaderScroll() {
83+
private void syncBodyScrollWithTopHeaderScroll() {
8484
hsvBody.setOnScrollChangeListener((v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
85-
hsvRowHeader.setScrollX(scrollX);
86-
hsvRowHeader.setScrollY(scrollY);
85+
hsvTopHeader.setScrollX(scrollX);
86+
hsvTopHeader.setScrollY(scrollY);
8787
});
8888

89-
hsvRowHeader.setOnScrollChangeListener((v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
89+
hsvTopHeader.setOnScrollChangeListener((v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
9090
hsvBody.setScrollX(scrollX);
9191
hsvBody.setScrollY(scrollY);
9292
});
9393
}
9494

9595
@RequiresApi(api = Build.VERSION_CODES.M)
96-
private void syncBodyScrollWithColHeaderScroll() {
96+
private void syncBodyScrollWithStartHeaderScroll() {
9797
svBody.setOnScrollChangeListener((v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
98-
svColumnHeader.setScrollX(scrollX);
99-
svColumnHeader.setScrollY(scrollY);
98+
svStartHeader.setScrollX(scrollX);
99+
svStartHeader.setScrollY(scrollY);
100100
});
101101

102-
svColumnHeader.setOnScrollChangeListener((v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
102+
svStartHeader.setOnScrollChangeListener((v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
103103
svBody.setScrollX(scrollX);
104104
svBody.setScrollY(scrollY);
105105
});
@@ -113,14 +113,14 @@ private void remeasureBodyWithTopHeader() {
113113

114114
for (int i = 0; i < trBody.getChildCount(); i++) {
115115
View cellBody = trBody.getChildAt(i);
116-
View cellRowHeader = trTopHeader.getChildAt(i);
116+
View cellTopHeader = trTopHeader.getChildAt(i);
117117

118-
if (cellBody == null || cellRowHeader == null) return;
118+
if (cellBody == null || cellTopHeader == null) return;
119119

120-
if (cellBody.getMeasuredWidth() > cellRowHeader.getMeasuredWidth())
121-
cellRowHeader.setMinimumWidth(cellBody.getMeasuredWidth());
120+
if (cellBody.getMeasuredWidth() > cellTopHeader.getMeasuredWidth())
121+
cellTopHeader.setMinimumWidth(cellBody.getMeasuredWidth());
122122
else
123-
cellBody.setMinimumWidth(cellRowHeader.getMeasuredWidth());
123+
cellBody.setMinimumWidth(cellTopHeader.getMeasuredWidth());
124124
}
125125
}
126126

@@ -243,11 +243,11 @@ public void setCornerViewBackgroundColor(int color) {
243243
layoutCorner.setBackgroundColor(color);
244244
}
245245

246-
public void setRowHeaderBackgroundColor(int color) {
246+
public void setTopHeaderBackgroundColor(int color) {
247247
tlTopHeader.setBackgroundColor(color);
248248
}
249249

250-
public void setColumnHeaderBackgroundColor(int color) {
250+
public void setStartHeaderBackgroundColor(int color) {
251251
tlStartHeader.setBackgroundColor(color);
252252
}
253253

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

Lines changed: 0 additions & 53 deletions
This file was deleted.

DataTable/src/main/res/layout/data_table.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
layout="@layout/data_table_corner" />
1616

1717
<include
18-
android:id="@+id/layoutColumnHeader"
18+
android:id="@+id/layoutStartHeader"
1919
layout="@layout/data_table_column_header" />
2020

2121
</LinearLayout>
@@ -27,7 +27,7 @@
2727
android:orientation="vertical">
2828

2929
<include
30-
android:id="@+id/layoutRowHeader"
30+
android:id="@+id/layoutTopHeader"
3131
layout="@layout/data_table_row_header" />
3232

3333
<include

DataTable/src/main/res/layout/data_table_body.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
android:id="@+id/body"
44
android:layout_width="match_parent"
55
android:layout_height="match_parent"
6-
android:layout_below="@id/rowHeader"
7-
android:layout_toEndOf="@id/colHeader">
6+
android:layout_below="@id/topHeader"
7+
android:layout_toEndOf="@id/startHeader">
88

99
<ScrollView
1010
android:id="@+id/scroll"

DataTable/src/main/res/layout/data_table_column_header.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:id="@+id/colHeader"
3+
android:id="@+id/startHeader"
44
android:layout_width="match_parent"
55
android:layout_height="match_parent"
66
android:layout_below="@id/corner">

DataTable/src/main/res/layout/data_table_row_header.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:id="@+id/rowHeader"
3+
android:id="@+id/topHeader"
44
android:layout_width="match_parent"
55
android:layout_height="wrap_content"
66
android:layout_toEndOf="@id/corner">

app/src/main/java/com/isolpro/datatablelibrary/MainActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ protected void onCreate(Bundle savedInstanceState) {
2424
adapter = new ItemsDataTableAdapter(this);
2525

2626
dataTable.setCornerViewBackgroundColor(getResources().getColor(R.color.white_10));
27-
dataTable.setRowHeaderBackgroundColor(getResources().getColor(R.color.white_10));
28-
dataTable.setColumnHeaderBackgroundColor(getResources().getColor(R.color.white_10));
27+
dataTable.setTopHeaderBackgroundColor(getResources().getColor(R.color.white_10));
28+
dataTable.setStartHeaderBackgroundColor(getResources().getColor(R.color.white_10));
2929

3030
dataTable.setOnBodyRowClickedListener(tableRow -> Log.e("onClicked----: ", (String) tableRow.getTag()));
3131

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

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -10,50 +10,4 @@
1010
android:layout_width="match_parent"
1111
android:layout_height="match_parent" />
1212

13-
</RelativeLayout>
14-
15-
<!--<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"-->
16-
<!-- xmlns:tools="http://schemas.android.com/tools"-->
17-
<!-- android:layout_width="match_parent"-->
18-
<!-- android:layout_height="match_parent"-->
19-
<!-- tools:context=".MainActivity">-->
20-
21-
<!-- <LinearLayout-->
22-
<!-- android:layout_width="match_parent"-->
23-
<!-- android:layout_height="match_parent"-->
24-
<!-- android:orientation="horizontal">-->
25-
26-
<!-- <LinearLayout-->
27-
<!-- android:layout_width="wrap_content"-->
28-
<!-- android:layout_height="match_parent"-->
29-
<!-- android:orientation="vertical">-->
30-
31-
<!-- <include-->
32-
<!-- android:id="@+id/layoutCorner"-->
33-
<!-- layout="@layout/temp_corner" />-->
34-
35-
<!-- <include-->
36-
<!-- android:id="@+id/layoutColHeader"-->
37-
<!-- layout="@layout/temp_col_header" />-->
38-
39-
<!-- </LinearLayout>-->
40-
41-
<!-- <LinearLayout-->
42-
<!-- android:layout_width="0dp"-->
43-
<!-- android:layout_height="match_parent"-->
44-
<!-- android:layout_weight="1"-->
45-
<!-- android:orientation="vertical">-->
46-
47-
<!-- <include-->
48-
<!-- android:id="@+id/layoutRowHeader"-->
49-
<!-- layout="@layout/temp_row_header" />-->
50-
51-
<!-- <include-->
52-
<!-- android:id="@+id/layoutBody"-->
53-
<!-- layout="@layout/temp_body" />-->
54-
55-
<!-- </LinearLayout>-->
56-
57-
<!-- </LinearLayout>-->
58-
59-
<!--</RelativeLayout>-->
13+
</RelativeLayout>

0 commit comments

Comments
 (0)