Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

public class SpreadsheetActivity extends AppCompatActivity {

private static final int NUM_COLUMNS = 10;
private static final int NUM_ROWS = 30;
private static int NUM_COLUMNS = 10;
private static int NUM_ROWS = 30;

private TableLayout columns;
private TableLayout rows;
Expand All @@ -37,6 +37,8 @@ public void onCreate(Bundle savedInstanceState) {
setupScrollers();

populateTables();

rePopulateExistingTables();
}

private void setupActionBar() {
Expand Down Expand Up @@ -71,6 +73,30 @@ private void setupScrollers() {
verticalScroller.scrollTo(0, top);
});
}

/**
* reset the existing Tables
*/

private void rePopulateExistingTables() {

NUM_COLUMNS = 5;
NUM_ROWS = 4;

// reset if views are already set
if (columns.getChildCount()>0) {
columns.removeAllViews();
}
if (rows.getChildCount()>0) {
rows.removeAllViews();
}
if (content.getChildCount()>0) {
content.removeAllViews();
}

populateTables();

}

/**
* Fills "Column" and "Row" headers, and "Content" table with inflated cell views
Expand Down