Fit network graph to available space

This commit is contained in:
M66B 2015-12-09 18:38:35 +01:00
parent ae7c807bb6
commit 3864d2e569
3 changed files with 8 additions and 10 deletions

View File

@ -286,7 +286,7 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
SinkholeService.reload("other", "setting changed", this);
} else if ("show_stats".equals(name))
SinkholeService.reload(null, "setting changed", this);
;
else if ("stats_base".equals(name))
getPreferenceScreen().findPreference(name).setTitle(getString(R.string.setting_stats_base, prefs.getString(name, "5")));

View File

@ -210,10 +210,6 @@ public class SinkholeService extends VpnService {
startDebug(vpn);
if (prev != null)
stopVPN(prev);
// Restart stats
stopStats();
startStats();
break;
case stop:
@ -316,8 +312,9 @@ public class SinkholeService extends VpnService {
rx = rtx;
// Create bitmap
int height = Util.dips2pixels(96 - 2 * 4, SinkholeService.this);
int width = Util.dips2pixels(96 * 5, SinkholeService.this);
int height = Util.dips2pixels(96, SinkholeService.this);
int width = getResources().getDisplayMetrics().widthPixels;
Log.i(TAG, "h=" + height + " w=" + width);
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
// Create canvas

View File

@ -6,10 +6,11 @@
<ImageView
android:id="@+id/ivTraffic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />
android:layout_alignParentTop="true"
android:scaleType="fitXY" />
<TextView
android:id="@+id/tvTraffic"