Show 0kb/s if non-zero small transfer

This commit is contained in:
CactiChameleon9 2024-08-31 17:39:20 +01:00
parent a99d8c8f14
commit 579597aa89

View File

@ -99,7 +99,7 @@ public class TrafficService extends Service {
ittSettings.setComponent(new ComponentName("com.android.settings", CMP)); ittSettings.setComponent(new ComponentName("com.android.settings", CMP));
PendingIntent pitSettings = PendingIntent.getActivity(getApplicationContext(), 0, ittSettings, PendingIntent.FLAG_IMMUTABLE); PendingIntent pitSettings = PendingIntent.getActivity(getApplicationContext(), 0, ittSettings, PendingIntent.FLAG_IMMUTABLE);
notBuilder = new NotificationCompat.Builder(getApplicationContext(), CHANNEL_ID); notBuilder = new NotificationCompat.Builder(getApplicationContext(), CHANNEL_ID);
notBuilder.setSmallIcon(R.drawable.wkb000); notBuilder.setSmallIcon(R.drawable.empty);
notBuilder.setContentIntent(pitSettings); notBuilder.setContentIntent(pitSettings);
notBuilder.setOngoing(true); notBuilder.setOngoing(true);
notBuilder.setWhen(0); notBuilder.setWhen(0);
@ -296,10 +296,12 @@ public class TrafficService extends Service {
lngPrevious = lngCurrent; lngPrevious = lngCurrent;
try { try {
if (lngSpeed == 0) {
if (lngSpeed < 1024) {
TrafficService.notBuilder.setSmallIcon(R.drawable.empty); TrafficService.notBuilder.setSmallIcon(R.drawable.empty);
updateIcon(R.drawable.empty); updateIcon(R.drawable.empty);
} else if (lngSpeed < 1024) {
TrafficService.notBuilder.setSmallIcon(R.drawable.wkb000);
updateIcon(R.drawable.wkb000);
} else if (lngSpeed < 1048576L) { } else if (lngSpeed < 1048576L) {
TrafficService.notBuilder.setSmallIcon(R.drawable.wkb000 + (int) (lngSpeed / 1024L)); TrafficService.notBuilder.setSmallIcon(R.drawable.wkb000 + (int) (lngSpeed / 1024L));