mirror of
https://github.com/M66B/NetGuard.git
synced 2024-12-30 20:05:04 +00:00
Color coded network speed
This commit is contained in:
parent
f36f7fc130
commit
4004979cb0
4 changed files with 48 additions and 10 deletions
|
@ -9,7 +9,7 @@ model {
|
|||
applicationId = "eu.faircode.netguard"
|
||||
minSdkVersion.apiLevel = 21
|
||||
targetSdkVersion.apiLevel = 23
|
||||
versionCode = 2015120904
|
||||
versionCode = 2015120905
|
||||
versionName = "0.55"
|
||||
archivesBaseName = "NetGuard-v$versionName-$versionCode"
|
||||
}
|
||||
|
|
|
@ -371,12 +371,15 @@ public class SinkholeService extends VpnService {
|
|||
// Update remote view
|
||||
RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.traffic);
|
||||
remoteViews.setImageViewBitmap(R.id.ivTraffic, bitmap);
|
||||
if (txsec < 1024 && rxsec < 1024)
|
||||
remoteViews.setTextViewText(R.id.tvTraffic, String.format("▲ %.0f ▼ %.0f B/sec", txsec, rxsec));
|
||||
else if (txsec < 1024 * 1024 && rxsec < 1024 * 1024)
|
||||
remoteViews.setTextViewText(R.id.tvTraffic, String.format("▲ %.1f ▼ %.1f KiB/sec", txsec / 1024, rxsec / 1024));
|
||||
if (txsec < 1000 * 1000)
|
||||
remoteViews.setTextViewText(R.id.tvTx, getString(R.string.msg_kbsec, txsec / 1000));
|
||||
else
|
||||
remoteViews.setTextViewText(R.id.tvTraffic, String.format("▲ %.1f ▼ %.1f MiB/sec", txsec / 1024 / 1024, rxsec / 1024 / 1024));
|
||||
remoteViews.setTextViewText(R.id.tvTx, getString(R.string.msg_mbsec, txsec / 1000 / 1000));
|
||||
|
||||
if (rxsec < 1000 * 1000)
|
||||
remoteViews.setTextViewText(R.id.tvRx, getString(R.string.msg_kbsec, rxsec / 1000));
|
||||
else
|
||||
remoteViews.setTextViewText(R.id.tvRx, getString(R.string.msg_mbsec, rxsec / 1000 / 1000));
|
||||
|
||||
// Show notification
|
||||
Intent main = new Intent(SinkholeService.this, ActivityMain.class);
|
||||
|
|
|
@ -12,11 +12,44 @@
|
|||
android:layout_alignParentTop="true"
|
||||
android:scaleType="fitXY" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTraffic"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.EventContent" />
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTx"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Info"
|
||||
android:typeface="monospace" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:alpha="0.5"
|
||||
android:text="▲"
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Info"
|
||||
android:textColor="#ffff00ff" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvRx"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Info"
|
||||
android:typeface="monospace" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:alpha="0.5"
|
||||
android:text="▼"
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Info"
|
||||
android:textColor="#ff0000ff" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -65,6 +65,8 @@ Since NetGuard has no internet permission, you know your internet traffic is not
|
|||
<string name="msg_terms">By donating you agree to the <a href="http://www.netguard.me/#terms">terms & conditions</a></string>
|
||||
<string name="msg_dimming">If you cannot press OK in the next dialog, another (screen dimming) application is likely manipulating the screen.</string>
|
||||
<string name="msg_traffic" translatable="false">%1$.1f/%2$.1f KiB since %3$s</string>
|
||||
<string name="msg_kbsec" translatable="false">%7.3f KB/s</string>
|
||||
<string name="msg_mbsec" translatable="false">%7.3f MB/s</string>
|
||||
|
||||
<string name="title_all">All</string>
|
||||
<string name="title_screen_wifi">Allow Wi-Fi when screen is on</string>
|
||||
|
|
Loading…
Reference in a new issue