Skip to content

Commit f7785c9

Browse files
committed
Sample app model ids has been changed to be prepared for sorting process.
1 parent 1a4649f commit f7785c9

File tree

6 files changed

+33
-27
lines changed

6 files changed

+33
-27
lines changed

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ android {
1010
versionCode 1
1111
versionName "1.0"
1212
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13+
vectorDrawables.useSupportLibrary = true
1314
}
1415
buildTypes {
1516
release {

app/src/main/java/com/evrencoskun/tableviewsample/MainFragment.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ private TableView createTableView() {
7171

7272
// Set adapter
7373
m_iTableViewAdapter = new TableViewAdapter(getContext());
74-
//m_iTableViewAdapter = new MDTableViewAdapter(getContext());
7574
tableView.setAdapter(m_iTableViewAdapter);
7675

7776
// Set layout params
@@ -113,7 +112,7 @@ private void loadData() {
113112
private List<RowHeader> getRowHeaderList() {
114113
List<RowHeader> list = new ArrayList<>();
115114
for (int i = 0; i < ROW_SIZE; i++) {
116-
RowHeader header = new RowHeader(i, "row " + i);
115+
RowHeader header = new RowHeader(String.valueOf(i), "row " + i);
117116
list.add(header);
118117
}
119118

@@ -128,7 +127,7 @@ private List<ColumnHeader> getColumnHeaderList() {
128127
if (i % 6 == 2) {
129128
strTitle = "large column " + i;
130129
}
131-
ColumnHeader header = new ColumnHeader(i, strTitle);
130+
ColumnHeader header = new ColumnHeader(String.valueOf(i), strTitle);
132131
list.add(header);
133132
}
134133

@@ -144,7 +143,8 @@ private List<ColumnHeader> getRandomColumnHeaderList() {
144143
if (nRandom % 4 == 0 || nRandom % 3 == 0 || nRandom == i) {
145144
strTitle = "large column " + i;
146145
}
147-
ColumnHeader header = new ColumnHeader(i, strTitle);
146+
147+
ColumnHeader header = new ColumnHeader(String.valueOf(i), strTitle);
148148
list.add(header);
149149
}
150150

@@ -160,7 +160,9 @@ private List<List<Cell>> getCellList() {
160160
if (j % 4 == 0 && i % 5 == 0) {
161161
strText = "large cell " + j + " " + i + ".";
162162
}
163-
Cell cell = new Cell(j, strText);
163+
String strID = j + "-" + i;
164+
165+
Cell cell = new Cell(strID, strText);
164166
cellList.add(cell);
165167
}
166168
list.add(cellList);
@@ -180,7 +182,10 @@ private List<List<Cell>> getRandomCellList() {
180182
if (nRandom % 2 == 0 || nRandom % 5 == 0 || nRandom == j) {
181183
strText = "large cell " + j + " " + i + getRandomString() + ".";
182184
}
183-
Cell cell = new Cell(j, strText);
185+
186+
String strID = j + "-" + i;
187+
188+
Cell cell = new Cell(strID, strText);
184189
cellList.add(cell);
185190
}
186191
}

app/src/main/java/com/evrencoskun/tableviewsample/tableview/model/Cell.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@
66

77
public class Cell {
88

9-
private long m_nId;
10-
private String m_nData;
9+
private String m_strId;
10+
private String m_strData;
1111

12-
public Cell(long p_nId) {
13-
this(p_nId, "");
12+
public Cell(String p_strId) {
13+
this.m_strId = p_strId;
14+
this.m_strData = "";
1415
}
1516

16-
public Cell(long p_nId, String p_strData) {
17-
this.m_nId = p_nId;
18-
this.m_nData = p_strData;
17+
public Cell(String p_strId, String p_strData) {
18+
this.m_strId = p_strId;
19+
this.m_strData = p_strData;
1920
}
2021

21-
public long getId() {
22-
return m_nId;
22+
public String getId() {
23+
return m_strId;
2324
}
2425

2526
public String getData() {
26-
return m_nData;
27+
return m_strData;
2728
}
2829

2930
public void setData(String p_strData) {
30-
m_nData = p_strData;
31+
m_strData = p_strData;
3132
}
32-
3333
}
3434

app/src/main/java/com/evrencoskun/tableviewsample/tableview/model/ColumnHeader.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
public class ColumnHeader extends Cell {
88

9-
public ColumnHeader(int p_nId) {
10-
super(p_nId);
9+
public ColumnHeader(String p_strId) {
10+
super(p_strId);
1111
}
1212

13-
public ColumnHeader(int p_nId, String p_strData) {
14-
super(p_nId, p_strData);
13+
public ColumnHeader(String p_strId, String p_strData) {
14+
super(p_strId, p_strData);
1515
}
1616
}
1717

app/src/main/java/com/evrencoskun/tableviewsample/tableview/model/RowHeader.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
public class RowHeader extends Cell {
88

9-
public RowHeader(int p_nId) {
10-
super(p_nId);
9+
public RowHeader(String p_strId) {
10+
super(p_strId);
1111
}
1212

13-
public RowHeader(int p_nId, String p_strData) {
14-
super(p_nId, p_strData);
13+
public RowHeader(String p_strId, String p_strData) {
14+
super(p_strId, p_strData);
1515
}
1616
}

tableview/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ publish {
3838
userOrg = 'evrencoskun'//user name of bintray.com
3939
groupId = 'com.evrencoskun.library'//jcenter's url
4040
artifactId = 'tableview'//project name
41-
publishVersion = '0.8.2'//version code
41+
publishVersion = '0.8.3'//version code
4242
desc = 'TableView is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells.'
4343
website = 'https://github.com/evrencoskun/TableView'//website
4444
}

0 commit comments

Comments
 (0)