diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ActivitySummaryDetail.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ActivitySummaryDetail.java index 719fcad41..1ab55be35 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ActivitySummaryDetail.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ActivitySummaryDetail.java @@ -18,10 +18,12 @@ package nodomain.freeyourgadget.gadgetbridge.activities; import android.annotation.SuppressLint; +import android.content.Context; import android.content.Intent; -import android.graphics.Color; +import android.content.res.Resources; import android.graphics.Typeface; import android.os.Bundle; +import android.util.TypedValue; import android.view.Gravity; import android.view.MenuItem; import android.view.View; @@ -63,6 +65,7 @@ public class ActivitySummaryDetail extends AbstractGBActivity { private JSONObject groupData = setGroups(); private boolean show_raw_data = false; BaseActivitySummary currentItem = null; + private int alternateColor; @SuppressLint("ClickableViewAccessibility") @Override @@ -75,6 +78,7 @@ public class ActivitySummaryDetail extends AbstractGBActivity { final int position = intent.getIntExtra("position",0); final ActivitySummaryItems items = new ActivitySummaryItems(this, mGBDevice, filter); final RelativeLayout layout = findViewById(R.id.activity_summary_detail_relative_layout); + alternateColor = getAlternateColor(this); final Animation animFadeRight; final Animation animFadeLeft; @@ -247,7 +251,7 @@ public class ActivitySummaryDetail extends AbstractGBActivity { } } TableRow field_row = new TableRow(ActivitySummaryDetail.this); - if (i % 2 == 0) field_row.setBackgroundColor(Color.rgb(237,237,237)); + if (i % 2 == 0) field_row.setBackgroundColor(alternateColor); TextView name_field = new TextView(ActivitySummaryDetail.this); TextView value_field = new TextView(ActivitySummaryDetail.this); @@ -344,6 +348,12 @@ public class ActivitySummaryDetail extends AbstractGBActivity { } return list; } + public static int getAlternateColor(Context context) { + TypedValue typedValue = new TypedValue(); + Resources.Theme theme = context.getTheme(); + theme.resolveAttribute(R.attr.alternate_row_background, typedValue, true); + return typedValue.data; + } private String getStringResourceByName(String aString) { String packageName = getPackageName(); diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index de46d3cdb..c0e856b5a 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -8,4 +8,5 @@ + \ 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 c73916a5f..e91acb947 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -32,4 +32,7 @@ #545254 #d8d9d8 + #1AFF3D00 + #1AFF3D00 + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index c56e0e950..fd20bdf8e 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -16,6 +16,8 @@ @color/chart_light_sleep_light @color/chart_activity_light @color/chart_not_worn_light + + @color/alternate_row_background_light +