Cleanups to keep the diff smaller

This commit is contained in:
Arjan Schrijver 2024-04-04 21:19:48 +02:00
parent 27fc33d126
commit 996f157b05
3 changed files with 9 additions and 12 deletions

View File

@ -8533,7 +8533,7 @@
<issue <issue
id="StaticFieldLeak" id="StaticFieldLeak"
message="This `AsyncTask` class should be static or leaks might occur (nodomain.freeyourgadget.gadgetbridge.activities.DevicesFragment.RefreshTask)" message="This `AsyncTask` class should be static or leaks might occur (nodomain.freeyourgadget.gadgetbridge.activities.ControlCenterv2.RefreshTask)"
errorLine1=" public class RefreshTask extends DBAccess {" errorLine1=" public class RefreshTask extends DBAccess {"
errorLine2=" ~~~~~~~~~~~"> errorLine2=" ~~~~~~~~~~~">
<location <location

View File

@ -94,7 +94,8 @@ import nodomain.freeyourgadget.gadgetbridge.util.GBChangeLog;
import nodomain.freeyourgadget.gadgetbridge.util.Prefs; import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
//TODO: extend AbstractGBActivity, but it requires actionbar that is not available //TODO: extend AbstractGBActivity, but it requires actionbar that is not available
public class ControlCenterv2 extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, GBActivity { public class ControlCenterv2 extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener, GBActivity {
private static final Logger LOG = LoggerFactory.getLogger(ControlCenterv2.class); private static final Logger LOG = LoggerFactory.getLogger(ControlCenterv2.class);
public static final int MENU_REFRESH_CODE = 1; public static final int MENU_REFRESH_CODE = 1;
public static final String ACTION_REQUEST_PERMISSIONS public static final String ACTION_REQUEST_PERMISSIONS
@ -124,20 +125,19 @@ public class ControlCenterv2 extends AppCompatActivity implements NavigationView
case GBApplication.ACTION_QUIT: case GBApplication.ACTION_QUIT:
finish(); finish();
break; break;
case DeviceService.ACTION_REALTIME_SAMPLES:
handleRealtimeSample(intent.getSerializableExtra(DeviceService.EXTRA_REALTIME_SAMPLE));
break;
case ACTION_REQUEST_PERMISSIONS: case ACTION_REQUEST_PERMISSIONS:
checkAndRequestPermissions(); checkAndRequestPermissions();
break; break;
case ACTION_REQUEST_LOCATION_PERMISSIONS: case ACTION_REQUEST_LOCATION_PERMISSIONS:
checkAndRequestLocationPermissions(); checkAndRequestLocationPermissions();
break; break;
case DeviceService.ACTION_REALTIME_SAMPLES:
handleRealtimeSample(intent.getSerializableExtra(DeviceService.EXTRA_REALTIME_SAMPLE));
break;
} }
} }
}; };
private boolean pesterWithPermissions = true; private boolean pesterWithPermissions = true;
private ActivitySample currentHRSample; private ActivitySample currentHRSample;
public ActivitySample getCurrentHRSample() { public ActivitySample getCurrentHRSample() {
@ -158,8 +158,7 @@ public class ControlCenterv2 extends AppCompatActivity implements NavigationView
} }
@Override @Override
protected void onCreate(Bundle savedInstanceState) protected void onCreate(Bundle savedInstanceState) {
{
AbstractGBActivity.init(this, AbstractGBActivity.NO_ACTIONBAR); AbstractGBActivity.init(this, AbstractGBActivity.NO_ACTIONBAR);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
@ -213,9 +212,9 @@ public class ControlCenterv2 extends AppCompatActivity implements NavigationView
filterLocal.addAction(GBApplication.ACTION_LANGUAGE_CHANGE); filterLocal.addAction(GBApplication.ACTION_LANGUAGE_CHANGE);
filterLocal.addAction(GBApplication.ACTION_THEME_CHANGE); filterLocal.addAction(GBApplication.ACTION_THEME_CHANGE);
filterLocal.addAction(GBApplication.ACTION_QUIT); filterLocal.addAction(GBApplication.ACTION_QUIT);
filterLocal.addAction(DeviceService.ACTION_REALTIME_SAMPLES);
filterLocal.addAction(ACTION_REQUEST_PERMISSIONS); filterLocal.addAction(ACTION_REQUEST_PERMISSIONS);
filterLocal.addAction(ACTION_REQUEST_LOCATION_PERMISSIONS); filterLocal.addAction(ACTION_REQUEST_LOCATION_PERMISSIONS);
filterLocal.addAction(DeviceService.ACTION_REALTIME_SAMPLES);
LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver, filterLocal); LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver, filterLocal);
/* /*

View File

@ -64,9 +64,7 @@ public abstract class AbstractDashboardWidget extends Fragment {
protected abstract void fillData(); protected abstract void fillData();
/** /**
* @param width Bitmap width in pixels this.timeFrom = timeFrom; * @param width Bitmap width in pixels
this.timeTo = timeTo;
* @param barWidth Gauge bar width in pixels * @param barWidth Gauge bar width in pixels
* @param filledColor Color of the filled part of the gauge * @param filledColor Color of the filled part of the gauge
* @param filledFactor Factor between 0 and 1 that determines the amount of the gauge that should be filled * @param filledFactor Factor between 0 and 1 that determines the amount of the gauge that should be filled