diff --git a/app/src/main/java/info/nerull7/mysqlbrowser/EntriesFragment.java b/app/src/main/java/info/nerull7/mysqlbrowser/EntriesFragment.java index 6d10075..e262af7 100644 --- a/app/src/main/java/info/nerull7/mysqlbrowser/EntriesFragment.java +++ b/app/src/main/java/info/nerull7/mysqlbrowser/EntriesFragment.java @@ -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); diff --git a/app/src/main/res/drawable/background_element.xml b/app/src/main/res/drawable/entries_element_1.xml similarity index 69% rename from app/src/main/res/drawable/background_element.xml rename to app/src/main/res/drawable/entries_element_1.xml index a682ad2..4149979 100644 --- a/app/src/main/res/drawable/background_element.xml +++ b/app/src/main/res/drawable/entries_element_1.xml @@ -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> \ No newline at end of file diff --git a/app/src/main/res/drawable/entries_element_2.xml b/app/src/main/res/drawable/entries_element_2.xml new file mode 100644 index 0000000..0bd0f94 --- /dev/null +++ b/app/src/main/res/drawable/entries_element_2.xml @@ -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> \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 86784b1..bf9163e 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -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> \ No newline at end of file