From 8e66f863d08fc5553479fef9e16278b12b11bba0 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 31 Jan 2016 09:41:09 +0100 Subject: [PATCH] Fixed theming --- .../java/eu/faircode/netguard/AccessAdapter.java | 16 ++++++++-------- .../eu/faircode/netguard/SinkholeService.java | 8 +++++--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/eu/faircode/netguard/AccessAdapter.java b/app/src/main/java/eu/faircode/netguard/AccessAdapter.java index e21c19c6..cb3051df 100644 --- a/app/src/main/java/eu/faircode/netguard/AccessAdapter.java +++ b/app/src/main/java/eu/faircode/netguard/AccessAdapter.java @@ -43,8 +43,8 @@ public class AccessAdapter extends CursorAdapter { private int colBlock; private int colorText; - private int colorPrimary; - private int colorAccent; + private int colorOn; + private int colorOff; public AccessAdapter(Context context, Cursor cursor) { super(context, cursor, 0); @@ -62,10 +62,10 @@ public class AccessAdapter extends CursorAdapter { } TypedValue tv = new TypedValue(); - context.getTheme().resolveAttribute(R.attr.colorPrimary, tv, true); - colorPrimary = tv.data; - context.getTheme().resolveAttribute(R.attr.colorAccent, tv, true); - colorAccent = tv.data; + context.getTheme().resolveAttribute(R.attr.colorOn, tv, true); + colorOn = tv.data; + context.getTheme().resolveAttribute(R.attr.colorOff, tv, true); + colorOff = tv.data; } @Override @@ -98,8 +98,8 @@ public class AccessAdapter extends CursorAdapter { if (allowed < 0) tvDest.setTextColor(colorText); else if (allowed > 0) - tvDest.setTextColor(colorPrimary); + tvDest.setTextColor(colorOn); else - tvDest.setTextColor(colorAccent); + tvDest.setTextColor(colorOff); } } diff --git a/app/src/main/java/eu/faircode/netguard/SinkholeService.java b/app/src/main/java/eu/faircode/netguard/SinkholeService.java index ed12f3e0..3689e1dc 100644 --- a/app/src/main/java/eu/faircode/netguard/SinkholeService.java +++ b/app/src/main/java/eu/faircode/netguard/SinkholeService.java @@ -1505,9 +1505,11 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS TypedValue tv = new TypedValue(); getTheme().resolveAttribute(R.attr.colorPrimary, tv, true); - int colorPrimary = tv.data; - getTheme().resolveAttribute(R.attr.colorAccent, tv, true); int colorAccent = tv.data; + getTheme().resolveAttribute(R.attr.colorOn, tv, true); + int colorOn = tv.data; + getTheme().resolveAttribute(R.attr.colorOff, tv, true); + int colorOff = tv.data; NotificationCompat.Builder builder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_cloud_upload_white_24dp) @@ -1548,7 +1550,7 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS if (allowed >= 0) { pos = sb.indexOf(daddr); sp = new SpannableString(sb); - ForegroundColorSpan fgsp = new ForegroundColorSpan(allowed > 0 ? colorPrimary : colorAccent); + ForegroundColorSpan fgsp = new ForegroundColorSpan(allowed > 0 ? colorOn : colorOff); sp.setSpan(fgsp, pos, pos + daddr.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } notification.addLine(sp);