1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2025-02-24 15:21:19 +00:00

Visual improvements

This commit is contained in:
M66B 2015-12-10 07:56:08 +01:00
parent f0e79abcbd
commit ba9fa0947e

View file

@ -318,7 +318,7 @@ public class SinkholeService extends VpnService {
canvas.drawColor(Color.TRANSPARENT); canvas.drawColor(Color.TRANSPARENT);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SinkholeService.this); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SinkholeService.this);
float base = Integer.parseInt(prefs.getString("stats_base", "5")) * 1024f; float base = Integer.parseInt(prefs.getString("stats_base", "5")) * 1000f;
// Determine max // Determine max
long xmax = 0; long xmax = 0;
@ -339,7 +339,7 @@ public class SinkholeService extends VpnService {
Path ptx = new Path(); Path ptx = new Path();
Path prx = new Path(); Path prx = new Path();
for (int i = 0; i < gtx.size(); i++) { for (int i = 0; i < gtx.size(); i++) {
float x = width * (xmax - gt.get(i)) / 1000f / 100f; float x = width - width * (xmax - gt.get(i)) / 1000f / 100f;
float ytx = height - height * gtx.get(i) / ymax; float ytx = height - height * gtx.get(i) / ymax;
float yrx = height - height * grx.get(i) / ymax; float yrx = height - height * grx.get(i) / ymax;
if (i == 0) { if (i == 0) {
@ -354,7 +354,7 @@ public class SinkholeService extends VpnService {
// Build paint // Build paint
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setStyle(Paint.Style.STROKE); paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(Util.dips2pixels(3, SinkholeService.this)); paint.setStrokeWidth(Util.dips2pixels(2, SinkholeService.this));
// Draw paths // Draw paths
paint.setColor(Color.MAGENTA); paint.setColor(Color.MAGENTA);
@ -362,8 +362,8 @@ public class SinkholeService extends VpnService {
paint.setColor(Color.BLUE); paint.setColor(Color.BLUE);
canvas.drawPath(prx, paint); canvas.drawPath(prx, paint);
// Draw 1 KiB line // Draw base line
paint.setStrokeWidth(0); paint.setStrokeWidth(Util.dips2pixels(1, SinkholeService.this));
paint.setColor(Color.GRAY); paint.setColor(Color.GRAY);
float y = height - height * base / ymax; float y = height - height * base / ymax;
canvas.drawLine(0, y, width, y, paint); canvas.drawLine(0, y, width, y, paint);