Skip to content

Commit

Permalink
Sample app model ids has been changed to be prepared for sorting proc…
Browse files Browse the repository at this point in the history
…ess.
  • Loading branch information
evrencoskun committed Nov 26, 2017
1 parent 1a4649f commit f7785c9
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 27 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ android {
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ private TableView createTableView() {

// Set adapter
m_iTableViewAdapter = new TableViewAdapter(getContext());
//m_iTableViewAdapter = new MDTableViewAdapter(getContext());
tableView.setAdapter(m_iTableViewAdapter);

// Set layout params
Expand Down Expand Up @@ -113,7 +112,7 @@ private void loadData() {
private List<RowHeader> getRowHeaderList() {
List<RowHeader> list = new ArrayList<>();
for (int i = 0; i < ROW_SIZE; i++) {
RowHeader header = new RowHeader(i, "row " + i);
RowHeader header = new RowHeader(String.valueOf(i), "row " + i);
list.add(header);
}

Expand All @@ -128,7 +127,7 @@ private List<ColumnHeader> getColumnHeaderList() {
if (i % 6 == 2) {
strTitle = "large column " + i;
}
ColumnHeader header = new ColumnHeader(i, strTitle);
ColumnHeader header = new ColumnHeader(String.valueOf(i), strTitle);
list.add(header);
}

Expand All @@ -144,7 +143,8 @@ private List<ColumnHeader> getRandomColumnHeaderList() {
if (nRandom % 4 == 0 || nRandom % 3 == 0 || nRandom == i) {
strTitle = "large column " + i;
}
ColumnHeader header = new ColumnHeader(i, strTitle);

ColumnHeader header = new ColumnHeader(String.valueOf(i), strTitle);
list.add(header);
}

Expand All @@ -160,7 +160,9 @@ private List<List<Cell>> getCellList() {
if (j % 4 == 0 && i % 5 == 0) {
strText = "large cell " + j + " " + i + ".";
}
Cell cell = new Cell(j, strText);
String strID = j + "-" + i;

Cell cell = new Cell(strID, strText);
cellList.add(cell);
}
list.add(cellList);
Expand All @@ -180,7 +182,10 @@ private List<List<Cell>> getRandomCellList() {
if (nRandom % 2 == 0 || nRandom % 5 == 0 || nRandom == j) {
strText = "large cell " + j + " " + i + getRandomString() + ".";
}
Cell cell = new Cell(j, strText);

String strID = j + "-" + i;

Cell cell = new Cell(strID, strText);
cellList.add(cell);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@

public class Cell {

private long m_nId;
private String m_nData;
private String m_strId;
private String m_strData;

public Cell(long p_nId) {
this(p_nId, "");
public Cell(String p_strId) {
this.m_strId = p_strId;
this.m_strData = "";
}

public Cell(long p_nId, String p_strData) {
this.m_nId = p_nId;
this.m_nData = p_strData;
public Cell(String p_strId, String p_strData) {
this.m_strId = p_strId;
this.m_strData = p_strData;
}

public long getId() {
return m_nId;
public String getId() {
return m_strId;
}

public String getData() {
return m_nData;
return m_strData;
}

public void setData(String p_strData) {
m_nData = p_strData;
m_strData = p_strData;
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

public class ColumnHeader extends Cell {

public ColumnHeader(int p_nId) {
super(p_nId);
public ColumnHeader(String p_strId) {
super(p_strId);
}

public ColumnHeader(int p_nId, String p_strData) {
super(p_nId, p_strData);
public ColumnHeader(String p_strId, String p_strData) {
super(p_strId, p_strData);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

public class RowHeader extends Cell {

public RowHeader(int p_nId) {
super(p_nId);
public RowHeader(String p_strId) {
super(p_strId);
}

public RowHeader(int p_nId, String p_strData) {
super(p_nId, p_strData);
public RowHeader(String p_strId, String p_strData) {
super(p_strId, p_strData);
}
}
2 changes: 1 addition & 1 deletion tableview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ publish {
userOrg = 'evrencoskun'//user name of bintray.com
groupId = 'com.evrencoskun.library'//jcenter's url
artifactId = 'tableview'//project name
publishVersion = '0.8.2'//version code
publishVersion = '0.8.3'//version code
desc = 'TableView is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells.'
website = 'https://github.com/evrencoskun/TableView'//website
}

0 comments on commit f7785c9

Please sign in to comment.