mirror of https://github.com/M66B/NetGuard.git
Fixed theming
This commit is contained in:
parent
f090b48a84
commit
8e66f863d0
|
@ -43,8 +43,8 @@ public class AccessAdapter extends CursorAdapter {
|
||||||
private int colBlock;
|
private int colBlock;
|
||||||
|
|
||||||
private int colorText;
|
private int colorText;
|
||||||
private int colorPrimary;
|
private int colorOn;
|
||||||
private int colorAccent;
|
private int colorOff;
|
||||||
|
|
||||||
public AccessAdapter(Context context, Cursor cursor) {
|
public AccessAdapter(Context context, Cursor cursor) {
|
||||||
super(context, cursor, 0);
|
super(context, cursor, 0);
|
||||||
|
@ -62,10 +62,10 @@ public class AccessAdapter extends CursorAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
TypedValue tv = new TypedValue();
|
TypedValue tv = new TypedValue();
|
||||||
context.getTheme().resolveAttribute(R.attr.colorPrimary, tv, true);
|
context.getTheme().resolveAttribute(R.attr.colorOn, tv, true);
|
||||||
colorPrimary = tv.data;
|
colorOn = tv.data;
|
||||||
context.getTheme().resolveAttribute(R.attr.colorAccent, tv, true);
|
context.getTheme().resolveAttribute(R.attr.colorOff, tv, true);
|
||||||
colorAccent = tv.data;
|
colorOff = tv.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -98,8 +98,8 @@ public class AccessAdapter extends CursorAdapter {
|
||||||
if (allowed < 0)
|
if (allowed < 0)
|
||||||
tvDest.setTextColor(colorText);
|
tvDest.setTextColor(colorText);
|
||||||
else if (allowed > 0)
|
else if (allowed > 0)
|
||||||
tvDest.setTextColor(colorPrimary);
|
tvDest.setTextColor(colorOn);
|
||||||
else
|
else
|
||||||
tvDest.setTextColor(colorAccent);
|
tvDest.setTextColor(colorOff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1505,9 +1505,11 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
|
||||||
|
|
||||||
TypedValue tv = new TypedValue();
|
TypedValue tv = new TypedValue();
|
||||||
getTheme().resolveAttribute(R.attr.colorPrimary, tv, true);
|
getTheme().resolveAttribute(R.attr.colorPrimary, tv, true);
|
||||||
int colorPrimary = tv.data;
|
|
||||||
getTheme().resolveAttribute(R.attr.colorAccent, tv, true);
|
|
||||||
int colorAccent = tv.data;
|
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)
|
NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
|
||||||
.setSmallIcon(R.drawable.ic_cloud_upload_white_24dp)
|
.setSmallIcon(R.drawable.ic_cloud_upload_white_24dp)
|
||||||
|
@ -1548,7 +1550,7 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
|
||||||
if (allowed >= 0) {
|
if (allowed >= 0) {
|
||||||
pos = sb.indexOf(daddr);
|
pos = sb.indexOf(daddr);
|
||||||
sp = new SpannableString(sb);
|
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);
|
sp.setSpan(fgsp, pos, pos + daddr.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
}
|
}
|
||||||
notification.addLine(sp);
|
notification.addLine(sp);
|
||||||
|
|
Loading…
Reference in New Issue