mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-25 16:15:55 +01:00
Make alternate row color honor set theme
This commit is contained in:
parent
78cd8e55b7
commit
19ac94e138
@ -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();
|
||||
|
@ -8,4 +8,5 @@
|
||||
<attr name="chart_light_sleep" format="color" />
|
||||
<attr name="chart_activity" format="color" />
|
||||
<attr name="chart_not_worn" format="color" />
|
||||
<attr name="alternate_row_background" format="color" />
|
||||
</resources>
|
@ -32,4 +32,7 @@
|
||||
<color name="chart_not_worn_light" type="color">#545254</color>
|
||||
<color name="chart_not_worn_dark" type="color">#d8d9d8</color>
|
||||
|
||||
<color name="alternate_row_background_light">#1AFF3D00</color>
|
||||
<color name="alternate_row_background_dark">#1AFF3D00</color>
|
||||
|
||||
</resources>
|
@ -16,6 +16,8 @@
|
||||
<item name="chart_light_sleep">@color/chart_light_sleep_light</item>
|
||||
<item name="chart_activity">@color/chart_activity_light</item>
|
||||
<item name="chart_not_worn">@color/chart_not_worn_light</item>
|
||||
|
||||
<item name="alternate_row_background">@color/alternate_row_background_light</item>
|
||||
</style>
|
||||
|
||||
<style name="GadgetbridgeTheme.NoActionBar">
|
||||
@ -40,6 +42,7 @@
|
||||
<item name="chart_light_sleep">@color/chart_light_sleep_dark</item>
|
||||
<item name="chart_activity">@color/chart_activity_dark</item>
|
||||
<item name="chart_not_worn">@color/chart_not_worn_dark</item>
|
||||
<item name="alternate_row_background">@color/alternate_row_background_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="ButtonDark" parent="Widget.AppCompat.Button.Colored">
|
||||
@ -60,4 +63,5 @@
|
||||
<item tools:targetApi="21" name="android:navigationBarColor">@color/primarydark_dark</item>
|
||||
<item name="android:windowBackground">@drawable/splash</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user