Better tables visibility

Plural and not plural entries lines have different background.
This commit is contained in:
Przemek Grondek 2014-08-01 09:32:38 +02:00
parent bcf550f667
commit 5ea924f149
4 changed files with 19 additions and 5 deletions
app/src/main

View file

@ -155,15 +155,23 @@ public class EntriesFragment extends Fragment implements AsyncDatabaseConnector.
public void onMatrixReturn(List<List<String>> rows) {
// Now we get Rows
if(rows!=null) {
int background;
for (int i = 0; i < rows.size(); i++) {
List<String> elements = rows.get(i);
TableRow newRow = new TableRow(getActivity());
if( i%2 == 0 ){ // Two backgrounds for lines for better visibility
background=R.drawable.entries_element_1;
} else {
background=R.drawable.entries_element_2;
}
for (int j = 0; j < elements.size(); j++) { // elements.size can be the same as in header so maybe some one number or not
TextView textView = new TextView(getActivity());
textView.setText(elements.get(j));
textView.setLayoutParams(layoutParams);
textView.setPadding(ENTRIES_PADDING_LEFT, ENTRIES_PADDING_TOP, ENTRIES_PADDING_RIGHT, ENTRIES_PADDING_BOTTOM);
textView.setBackgroundResource(R.drawable.background_element);
textView.setBackgroundResource(background);
newRow.addView(textView);
}
entriesTable.addView(newRow);

View file

@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!--<solid android:color="#0fff"/>-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/entries_background_color_1"/>
<stroke android:width="1dp" android:color="@color/border"/>
</shape>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/entries_background_color_2"/>
<stroke android:width="1dp" android:color="@color/border"/>
</shape>

View file

@ -2,4 +2,6 @@
<resources>
<color name="border">@android:color/tab_indicator_text</color>
<color name="header_background">@android:color/holo_orange_light</color>
<color name="entries_background_color_1">@android:color/background_light</color>
<color name="entries_background_color_2">#ffcccccc</color>
</resources>