mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-26 10:35:50 +01:00
Some initial fixes found by static analysis #92
This commit is contained in:
parent
929831e4f0
commit
567f27b0f4
@ -7,7 +7,6 @@ import android.os.Build;
|
||||
import android.os.Build.VERSION;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -27,7 +26,7 @@ public class GBApplication extends Application {
|
||||
private static final String TAG = "GBApplication";
|
||||
private static GBApplication context;
|
||||
private static ActivityDatabaseHandler mActivityDatabaseHandler;
|
||||
private static Lock dbLock = new ReentrantLock();
|
||||
private static final Lock dbLock = new ReentrantLock();
|
||||
|
||||
public GBApplication() {
|
||||
context = this;
|
||||
|
@ -50,14 +50,14 @@ public class ControlCenter extends Activity {
|
||||
public static final String ACTION_REFRESH_DEVICELIST
|
||||
= "nodomain.freeyourgadget.gadgetbridge.controlcenter.action.set_version";
|
||||
|
||||
TextView hintTextView;
|
||||
ListView deviceListView;
|
||||
GBDeviceAdapter mGBDeviceAdapter;
|
||||
private TextView hintTextView;
|
||||
private ListView deviceListView;
|
||||
private GBDeviceAdapter mGBDeviceAdapter;
|
||||
private GBDevice selectedDevice = null;
|
||||
|
||||
final List<GBDevice> deviceList = new ArrayList<>();
|
||||
private final List<GBDevice> deviceList = new ArrayList<>();
|
||||
|
||||
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
||||
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
|
@ -132,7 +132,7 @@ public class ChartsActivity extends FragmentActivity {
|
||||
* A {@link FragmentStatePagerAdapter} that returns a fragment corresponding to
|
||||
* one of the sections/tabs/pages.
|
||||
*/
|
||||
public class SectionsPagerAdapter extends FragmentStatePagerAdapter {
|
||||
public static class SectionsPagerAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
public SectionsPagerAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
|
@ -169,8 +169,7 @@ public class ActivityDatabaseHandler extends SQLiteOpenHelper implements DBHandl
|
||||
final String where = "(provider=" + provider.getID() + " and timestamp>=" + timestamp_from + " and timestamp<=" + timestamp_to + getWhereClauseFor(activityTypes, provider) + ")";
|
||||
final String order = "timestamp";
|
||||
try (SQLiteDatabase db = this.getReadableDatabase()) {
|
||||
Cursor cursor = db.query(TABLE_GBACTIVITYSAMPLES, null, where, null, null, null, order);
|
||||
|
||||
try (Cursor cursor = db.query(TABLE_GBACTIVITYSAMPLES, null, where, null, null, null, order)) {
|
||||
if (cursor.moveToFirst()) {
|
||||
do {
|
||||
GBActivitySample sample = new GBActivitySample(
|
||||
@ -183,6 +182,7 @@ public class ActivityDatabaseHandler extends SQLiteOpenHelper implements DBHandl
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return samples;
|
||||
}
|
||||
|
@ -17,8 +17,6 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/alarm_time_picker"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:timePickerMode="clock"
|
||||
android:layout_weight="1" />
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user